| version 1.4, 2003/12/19 16:08:01 | version 1.11, 2007/01/10 18:02:21 | 
| Line 1 | Line 1 | 
 |  | /*      $Id$    */ | 
 |  |  | 
 | /* | /* | 
 | * Copyright (c) 2003 NONAKA Kimihiro | * Copyright (c) 2003 NONAKA Kimihiro | 
 | * All rights reserved. | * All rights reserved. | 
| Line 10 | Line 12 | 
 | * 2. Redistributions in binary form must reproduce the above copyright | * 2. Redistributions in binary form must reproduce the above copyright | 
 | *    notice, this list of conditions and the following disclaimer in the | *    notice, this list of conditions and the following disclaimer in the | 
 | *    documentation and/or other materials provided with the distribution. | *    documentation and/or other materials provided with the distribution. | 
 | * 3. The name of the author may not be used to endorse or promote products |  | 
 | *    derived from this software without specific prior written permission. |  | 
 | * | * | 
 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | 
 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 
| Line 28 | Line 28 | 
 | #ifndef NP2_X11_TOOLKIT_H__ | #ifndef NP2_X11_TOOLKIT_H__ | 
 | #define NP2_X11_TOOLKIT_H__ | #define NP2_X11_TOOLKIT_H__ | 
 |  |  | 
 | #if !defined(USE_GTK) && !defined(USE_QT) && !defined(USE_SDL) |  | 
 | #error undefined USE_GTK and USE_QT and USE_SDL!!! |  | 
 | #endif |  | 
 |  |  | 
 | typedef struct { | typedef struct { | 
 | const char*     (*get_toolkit)(void); | const char*     (*get_toolkit)(void); | 
 | BOOL            (*arginit)(int* argc, char*** argv); | BOOL            (*arginit)(int* argc, char*** argv); | 
| Line 42  typedef struct { | Line 38  typedef struct { | 
 | void            (*widget_quit)(void); | void            (*widget_quit)(void); | 
 | void            (*event_process)(void); | void            (*event_process)(void); | 
 | void            (*set_window_title)(const char* str); | void            (*set_window_title)(const char* str); | 
 |  | void            (*messagebox)(const char *title, const char *msg); | 
 | } gui_toolkit_t; | } gui_toolkit_t; | 
 |  |  | 
| #if defined(USE_GTK) && !defined(USE_QT) && !defined(USE_SDL) | void toolkit_msgbox(const char *title, const char *msg); | 
|  |  | 
|  | #if (USE_GTK2 + USE_SDL) > 1 | 
|  |  | 
|  | extern gui_toolkit_t* toolkitp; | 
|  |  | 
|  | void toolkit_initialize(void); | 
|  | #define toolkit_terminate()             (*toolkitp->terminate)() | 
|  | #define toolkit_arginit(argcp, argvp)   (*toolkitp->arginit)(argcp, argvp) | 
|  | #define toolkit_widget_create()         (*toolkitp->widget_create)() | 
|  | #define toolkit_widget_show()           (*toolkitp->widget_show)() | 
|  | #define toolkit_widget_mainloop()       (*toolkitp->widget_mainloop)() | 
|  | #define toolkit_widget_quit()           (*toolkitp->widget_quit)() | 
|  | #define toolkit_event_process()         (*toolkitp->event_process)() | 
|  | #define toolkit_set_window_title(s)     (*toolkitp->set_window_title)(s) | 
|  | #define toolkit_messagebox(t,m)         (*toolkitp->messagebox)(t,m) | 
|  |  | 
|  | #elif USE_GTK2 > 0 | 
 |  |  | 
| #include "gtk/gtk_toolkit.h" | #include "gtk2/gtk_toolkit.h" | 
 |  |  | 
 | #define toolkit_initialize() | #define toolkit_initialize() | 
 | #define toolkit_terminate() | #define toolkit_terminate() | 
| Line 55  typedef struct { | Line 69  typedef struct { | 
 | #define toolkit_widget_show()           gui_gtk_widget_show() | #define toolkit_widget_show()           gui_gtk_widget_show() | 
 | #define toolkit_widget_mainloop()       gui_gtk_widget_mainloop() | #define toolkit_widget_mainloop()       gui_gtk_widget_mainloop() | 
 | #define toolkit_widget_quit()           gui_gtk_widget_quit() | #define toolkit_widget_quit()           gui_gtk_widget_quit() | 
| #define toolkit_event_process() | #define toolkit_event_process()         gui_gtk_event_process() | 
 | #define toolkit_set_window_title(s)     gui_gtk_set_window_title(s) | #define toolkit_set_window_title(s)     gui_gtk_set_window_title(s) | 
 |  | #define toolkit_messagebox(t,m)         gui_gtk_messagebox(t,m) | 
 |  |  | 
| #elif defined(USE_QT) && !defined(USE_GTK) && !defined(USE_SDL) | #elif USE_SDL > 0 | 
|  |  | 
| #include "qt/qttoolkit.h" |  | 
|  |  | 
| #define toolkit_initialize() |  | 
| #define toolkit_terminate()             gui_qt_terminate() |  | 
| #define toolkit_arginit(argcp, argvp)   gui_qt_arginit(argcp, argvp) |  | 
| #define toolkit_widget_create()         gui_qt_widget_create() |  | 
| #define toolkit_widget_show()           gui_qt_widget_show() |  | 
| #define toolkit_widget_mainloop()       gui_qt_widget_mainloop() |  | 
| #define toolkit_widget_quit()           gui_qt_widget_quit() |  | 
| #define toolkit_event_process() |  | 
| #define toolkit_set_window_title(s)     gui_qt_set_window_title(s) |  | 
|  |  | 
| #elif defined(USE_SDL) && !defined(USE_GTK) && !defined(USE_QT) |  | 
 |  |  | 
 | #include "sdl/sdl_toolkit.h" | #include "sdl/sdl_toolkit.h" | 
 |  |  | 
| Line 85  typedef struct { | Line 86  typedef struct { | 
 | #define toolkit_widget_quit()           gui_sdl_widget_quit() | #define toolkit_widget_quit()           gui_sdl_widget_quit() | 
 | #define toolkit_event_process()         gui_sdl_event_process() | #define toolkit_event_process()         gui_sdl_event_process() | 
 | #define toolkit_set_window_title(s)     gui_sdl_set_window_title(s) | #define toolkit_set_window_title(s)     gui_sdl_set_window_title(s) | 
 |  | #define toolkit_messagebox(t,m)         gui_sdl_messagebox(t,m) | 
 |  |  | 
 | #else | #else | 
 |  |  | 
| extern gui_toolkit_t* toolkitp; | #error need to defined USE_GTK2 or USE_SDL !!! | 
|  |  | 
| void toolkit_initialize(void); |  | 
| #define toolkit_terminate()             (*toolkitp->terminate)() |  | 
| #define toolkit_arginit(argcp, argvp)   (*toolkitp->arginit)(argcp, argvp) |  | 
| #define toolkit_widget_create()         (*toolkitp->widget_create)() |  | 
| #define toolkit_widget_show()           (*toolkitp->widget_show)() |  | 
| #define toolkit_widget_mainloop()       (*toolkitp->widget_mainloop)() |  | 
| #define toolkit_widget_quit()           (*toolkitp->widget_quit)() |  | 
| #define toolkit_event_process()         (*toolkitp->event_process)() |  | 
| #define toolkit_set_window_title(s)     (*toolkitp->set_window_title)(s) |  | 
 |  |  | 
 | #endif | #endif | 
 |  |  |