Back to index

gcompris  8.2.2
gcompris.h
Go to the documentation of this file.
00001 /* gcompris - gcompris.h
00002  *
00003  * Time-stamp: <2006/08/20 10:03:53 bruno>
00004  *
00005  * Copyright (C) 2000,2001,2002 Bruno Coudoin
00006  *
00007  * This program is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 2 of the License, or
00010  * (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00020  */
00021 
00022 #ifndef _MAIN_H_
00023 #define _MAIN_H_
00024 
00025 #ifdef HAVE_CONFIG_H
00026 #  include <config.h>
00027 #endif
00028 
00029 #include <libgnomecanvas/libgnomecanvas.h>
00030 
00031 #include <gtk/gtk.h>
00032 #include <gdk/gdkkeysyms.h>
00033 
00034 #include <glib.h>
00035 #include <libintl.h>
00036 
00037 #include <gmodule.h>
00038 
00039 #include "plugin.h"
00040 #include "gcompris-board.h"
00041 #include "board.h"
00042 #include "board_config.h"
00043 #include "properties.h"
00044 #include "gameutil.h"
00045 #include "gc_net.h"
00046 #include "bonus.h"
00047 #include "timer.h"
00048 #include "score.h"
00049 #include "skin.h"
00050 #include "anim.h"
00051 
00052 #include "profile.h"
00053 #include "gcompris_db.h"
00054 #include "wordlist.h"
00055 #include "gcompris_im.h"
00056 #include "gcompris_alphabeta.h"
00057 
00058 #ifdef USE_CAIRO
00059 #include "gcompris-cairo.h"
00060 #endif
00061 
00062 #ifdef DMALLOC
00063 #include "dmalloc.h"
00064 #endif
00065 
00066 #define BOARDWIDTH  800
00067 #define BOARDHEIGHT 520
00068 #define BARHEIGHT   80
00069 
00070 #define DEFAULT_SKIN "gartoon"
00071 
00072 #define _(String) gettext (String)
00073 #define gettext_noop(String) String
00074 
00075 #ifndef N_
00076 #define N_(String) gettext_noop (String)
00077 #endif
00078 
00079 /*****************************************************************************/
00080 /* Method usefull for boards provided by gcompris */
00081 
00082 void           gc_board_end(void);
00083 
00084 /* Control Bar methods */
00085 void           gc_bar_start (GnomeCanvas *theCanvas);
00086 
00087 GnomeCanvasItem *gc_set_background(GnomeCanvasGroup *parent, gchar *file);
00088 void           gc_bar_set_level (GcomprisBoard *gcomprisBoard);
00089 void           gc_bar_set_repeat_icon (GdkPixbuf *pixmap);
00090 
00091 /* Status bar control */
00092 typedef enum
00093 {
00094   GC_BAR_LEVEL          = 1 << 0,
00095   GC_BAR_OK      = 1 << 1,
00096   GC_BAR_REPEAT         = 1 << 2,
00097   GC_BAR_CONFIG         = 1 << 3,
00098   GC_BAR_ABOUT          = 1 << 4,
00099   GC_BAR_REPEAT_ICON = 1 << 5,
00100   GC_BAR_QUIT    = 1 << 6,
00101 } GComprisBarFlags;
00102 
00103 /* Difficulty filtering */
00104 typedef enum {
00105   GCOMPRIS_FILTER_NONE,
00106   GCOMPRIS_FILTER_EQUAL,
00107   GCOMPRIS_FILTER_UNDER,
00108   GCOMPRIS_FILTER_ABOVE,
00109 } GcomprisFilterType;
00110 
00111 void           gc_bar_set (const GComprisBarFlags flags);
00112 void           gc_bar_hide (gboolean hide);
00113 
00114 /* General */
00115 GnomeCanvas     *gc_get_canvas(void);
00116 GtkWidget     *gc_get_window(void);
00117 void          gc_ignore_next_focus_out(void);
00118 
00119 const gchar   *gc_locale_get(void);
00120 void           gc_locale_set(gchar *locale);
00121 char          *gc_locale_get_user_default(void);
00122 gchar         *gc_locale_get_name(gchar *locale);
00123 
00124 void           gc_cursor_set(guint gdk_cursor_type);
00125 
00126 typedef void     (*ImageSelectorCallBack)     (gchar* image);
00127 void           gc_selector_images_start (GcomprisBoard *gcomprisBoard, 
00128                                            gchar *dataset, 
00129                                            ImageSelectorCallBack imscb);
00130 void           gc_selector_images_stop (void);
00131 
00132 typedef void     (*FileSelectorCallBack)     (gchar *file, gchar *file_type); /* file_type is one string from file_types in the save */
00133 void           gc_selector_file_load (GcomprisBoard *gcomprisBoard, 
00134                                          gchar *rootdir,
00135                                          gchar *file_types, /* A Comma separated text explaining the different file types */
00136                                          FileSelectorCallBack fscb);
00137 void           gc_selector_file_save (GcomprisBoard *gcomprisBoard,
00138                                          gchar *rootdir,
00139                                          gchar *file_types, /* A Comma separated text explaining the different file types */
00140                                          FileSelectorCallBack fscb);
00141 void           gc_selector_file_stop (void);
00142 
00143 gchar         *gc_db_get_filename();
00144 
00145 /* Dialog box */
00146 typedef void     (*DialogBoxCallBack)     ();
00147 void           gc_dialog(gchar *str, DialogBoxCallBack dbcb);
00148 void           gc_dialog_close();
00149 
00150 /* Confirm box */
00151 typedef void     (*ConfirmCallBack)     (gboolean answer);
00152 
00153 void           gc_confirm_box (gchar *title, 
00154                              gchar *question_text,
00155                              gchar *yes_text,
00156                              gchar *no_text,
00157                              ConfirmCallBack iscb);
00158 
00159 void           gc_confirm_box_stop (void);
00160 
00161 /* Use these instead of the gnome_canvas ones for proper fullscreen mousegrab
00162    handling. */
00163 int            gc_canvas_item_grab (GnomeCanvasItem *item, unsigned int event_mask,
00164                                        GdkCursor *cursor, guint32 etime);
00165 void           gc_canvas_item_ungrab (GnomeCanvasItem *item, guint32 etime);
00166 
00167 /* Trace Log */
00168 #define GCOMPRIS_LOG_STATUS_PASSED    "PASSED"
00169 #define GCOMPRIS_LOG_STATUS_FAILED    "FAILED"
00170 #define GCOMPRIS_LOG_STATUS_DRAW      "DRAW"
00171 #define GCOMPRIS_LOG_STATUS_COMPLETED "COMPLETED"
00172 
00173 /* Use it to tell the teacher where the kid failed */
00174 void           gc_log_set_comment (GcomprisBoard *gcomprisBoard, gchar *expected, gchar* got); 
00175 
00176 /* Do not use it if you use the bonus API in your board */
00177 void           gc_log_end (GcomprisBoard *gcomprisBoard, gchar *status);
00178 
00179 /* For menu type activity */
00180 GList         *gc_menu_getlist(gchar *section);
00181 GcomprisBoard   *gc_menu_section_get(gchar *section);
00182 GList           *gc_menu_get_boards();
00183 
00184 /*=========================================================*/
00185 /* Some global definition to keep a constant look and feel */
00186 /* Boards coders are invited to use them                   */
00187 #define COLOR_TITLE         0x0F0FC0FF
00188 #define COLOR_TEXT_BUTTON       0x0F0FC0FF
00189 #define COLOR_CONTENT              0x0D0DFAFF
00190 #define COLOR_SUBTITLE             0xB00400FF
00191 #define COLOR_SHADOW        0x000000FF
00192 
00193 #define FONT_TITLE          "Sans 20"
00194 #define FONT_TITLE_FALLBACK "Sans 12"
00195 #define FONT_SUBTITLE              "Sans 16"
00196 #define FONT_SUBTITLE_FALLBACK     "Sans 12"
00197 #define FONT_CONTENT        "Sans 12"
00198 #define FONT_CONTENT_FALLBACK      "Sans 12"
00199 
00200 #define FONT_BOARD_TINY            "Sans 10"
00201 #define FONT_BOARD_SMALL    "Sans 12"
00202 #define FONT_BOARD_MEDIUM   "Sans 14"
00203 #define FONT_BOARD_BIG             "Sans 16"
00204 #define FONT_BOARD_BIG_BOLD "Sans bold 16"
00205 #define FONT_BOARD_FIXED    "Fixed 12"
00206 #define FONT_BOARD_TITLE    "Sans 20"
00207 #define FONT_BOARD_TITLE_BOLD      "Sans bold 20"
00208 #define FONT_BOARD_HUGE            "Sans 28"
00209 #define FONT_BOARD_HUGE_BOLD       "Sans bold 28"
00210 
00211 /*=========================================================*/
00212 // These are gcompris defined cursors
00213 // cursor defines must be over the last gnome cursor defined in gdkcursors.h
00214 #define GCOMPRIS_FIRST_CUSTOM_CURSOR      1000
00215 #define GCOMPRIS_BIG_RED_ARROW_CURSOR     1001
00216 #define GCOMPRIS_BIRD_CURSOR              1002
00217 #define GCOMPRIS_LINE_CURSOR              1003
00218 #define GCOMPRIS_FILLRECT_CURSOR   1004
00219 #define GCOMPRIS_RECT_CURSOR              1005
00220 #define GCOMPRIS_FILLCIRCLE_CURSOR 1006
00221 #define GCOMPRIS_CIRCLE_CURSOR            1007
00222 #define GCOMPRIS_DEL_CURSOR        1008
00223 #define GCOMPRIS_FILL_CURSOR              1009
00224 #define GCOMPRIS_SELECT_CURSOR            1010
00225 
00226 #define GCOMPRIS_DEFAULT_CURSOR           GCOMPRIS_BIG_RED_ARROW_CURSOR
00227 
00228 #endif