|
|
| version 1.4, 2003/12/19 16:08:01 | version 1.12, 2008/03/13 16:27:39 |
|---|---|
| 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) | /* for toolkit_msgbox() */ |
| #error undefined USE_GTK and USE_QT and USE_SDL!!! | #define TK_MB_OK (1U << 0) |
| #endif | #define TK_MB_CANCEL (1U << 1) |
| #define TK_MB_YES (1U << 2) | |
| typedef struct { | #define TK_MB_NO (1U << 3) |
| const char* (*get_toolkit)(void); | #define TK_MB_OKCANCEL (TK_MB_OK|TK_MB_CANCEL) |
| BOOL (*arginit)(int* argc, char*** argv); | #define TK_MB_YESNO (TK_MB_YES|TK_MB_NO) |
| void (*terminate)(void); | #define TK_MB_BTN_MASK (TK_MB_OK|TK_MB_CANCEL|TK_MB_YESNO) |
| void (*widget_create)(void); | #define TK_MB_ICON_INFO (1U << 16) |
| void (*widget_show)(void); | #define TK_MB_ICON_WARNING (1U << 17) |
| void (*widget_mainloop)(void); | #define TK_MB_ICON_ERROR (1U << 18) |
| void (*widget_quit)(void); | #define TK_MB_ICON_QUESTION (1U << 19) |
| void (*event_process)(void); | #define TK_MB_ICON_MASK (TK_MB_ICON_INFO \ |
| void (*set_window_title)(const char* str); | |TK_MB_ICON_WARNING \ |
| } gui_toolkit_t; | |TK_MB_ICON_ERROR \ |
| |TK_MB_ICON_QUESTION) | |
| #if defined(USE_GTK) && !defined(USE_QT) && !defined(USE_SDL) | |
| #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 54 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_msgbox(t,m,TK_MB_OK|TK_MB_ICON_INFO) | |
| #elif defined(USE_QT) && !defined(USE_GTK) && !defined(USE_SDL) | #define toolkit_msgbox(t,m,f) gui_gtk_msgbox(t,m,f) |
| #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" | |
| #define toolkit_initialize() | |
| #define toolkit_terminate() | |
| #define toolkit_arginit(argcp, argvp) gui_sdl_arginit(argcp, argvp) | |
| #define toolkit_widget_create() gui_sdl_widget_create() | |
| #define toolkit_widget_show() gui_sdl_widget_show() | |
| #define toolkit_widget_mainloop() gui_sdl_widget_mainloop() | |
| #define toolkit_widget_quit() gui_sdl_widget_quit() | |
| #define toolkit_event_process() gui_sdl_event_process() | |
| #define toolkit_set_window_title(s) gui_sdl_set_window_title(s) | |
| #else | |
| 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) | |
| #endif | |
| #endif /* NP2_X11_TOOLKIT_H__ */ | #endif /* NP2_X11_TOOLKIT_H__ */ |