99 lines
3.4 KiB
C
99 lines
3.4 KiB
C
#ifndef GTK_IMPORTS_H
|
|
#define GTK_IMPORTS_H
|
|
|
|
/*************************************************************************************
|
|
* boiler plate code to initialize Gtk functions etc.
|
|
*************************************************************************************/
|
|
|
|
void loadGtkFunctions(void (*loader)(const char *, void **, void *), void *user_data);
|
|
|
|
/*************************************************************************************
|
|
* Gtk Functions to load from shared library
|
|
*************************************************************************************/
|
|
|
|
#ifdef GTK_DECLARE_FUNCS
|
|
#define EXTERN
|
|
#ifndef NULL
|
|
#define NULL 0
|
|
#endif
|
|
#define DECL(ret, f, arg1) EXTERN ret (*f) arg1 = NULL;
|
|
#else
|
|
#ifdef GTK_LOAD_FUNCS
|
|
#define DECL(ret, f, arg1) loader(#f, (void **) &f, user_data);
|
|
#else
|
|
#define EXTERN extern
|
|
#define DECL(ret, f, arg1) EXTERN ret (*f) arg1;
|
|
#endif
|
|
#endif
|
|
|
|
#ifndef GTK_IMPORTS_TYPES
|
|
#define GTK_IMPORTS_TYPES
|
|
|
|
typedef void GtkWidget;
|
|
typedef void GtkWindow;
|
|
typedef void GtkApplication;
|
|
typedef void GApplication;
|
|
typedef void GObject;
|
|
typedef void *GCallback;
|
|
typedef void *gpointer;
|
|
typedef int gboolean;
|
|
typedef int gint;
|
|
typedef char gchar;
|
|
typedef void GClosure;
|
|
typedef void (*GClosureNotify) (gpointer data, GClosure *closure);
|
|
|
|
typedef enum {
|
|
GTK_WINDOW_TOPLEVEL = 0
|
|
} GtkWindowType;
|
|
|
|
typedef enum {
|
|
G_APPLICATION_FLAGS_NONE = 0,
|
|
G_APPLICATION_DEFAULT_FLAGS = 0,
|
|
G_APPLICATION_IS_SERVICE = 1,
|
|
G_APPLICATION_IS_LAUNCHER = 2,
|
|
G_APPLICATION_HANDLES_OPEN = 4,
|
|
G_APPLICATION_HANDLES_COMMAND_LINE = 8,
|
|
G_APPLICATION_SEND_ENVIRONMENT = 16,
|
|
G_APPLICATION_NON_UNIQUE = 32,
|
|
G_APPLICATION_CAN_OVERRIDE_APP_ID = 64,
|
|
G_APPLICATION_ALLOW_REPLACEMENT = 128,
|
|
G_APPLICATION_REPLACE = 256
|
|
} GApplicationFlags;
|
|
|
|
typedef enum {
|
|
G_CONNECT_DEFAULT = 0,
|
|
G_CONNECT_AFTER = 1,
|
|
G_CONNECT_SWAPPED = 2
|
|
} GConnectFlags;
|
|
|
|
#endif
|
|
|
|
DECL(GtkApplication *, gtk_application_new, (const char *name, GApplicationFlags flags))
|
|
DECL(int, g_application_run, (GApplication* application, int argc, char** argv))
|
|
|
|
DECL(GtkWidget*, gtk_application_window_new, ( GtkApplication* application ))
|
|
DECL(GtkWidget *, gtk_window_new, (GtkWindowType))
|
|
DECL(void, gtk_window_close, (GtkWindow *))
|
|
DECL(void, gtk_widget_show_all, (GtkWindow *window))
|
|
DECL(void, gtk_window_get_size, (GtkWindow *win, int *width, int *height))
|
|
DECL(void, gtk_window_resize, (GtkWindow* window, gint width, gint height))
|
|
DECL(void, gtk_window_set_default_size, (GtkWindow *window, gint width, gint height))
|
|
DECL(void, gtk_window_get_position, (GtkWindow* window, gint* root_x, gint* root_y))
|
|
DECL(void, gtk_window_move, (GtkWindow* window, gint x, gint y))
|
|
|
|
DECL(gboolean, gtk_window_get_decorated, (GtkWindow* window))
|
|
|
|
DECL(void, gtk_window_set_title, (GtkWindow* window, const gchar* title))
|
|
DECL(const gchar*, gtk_window_get_title, (GtkWindow* window))
|
|
|
|
DECL(void, gtk_main, (void))
|
|
DECL(void, gtk_main_quit, (void))
|
|
|
|
DECL(unsigned long, g_signal_connect_data, (GObject *obj, const char *signal, GCallback c_handler, gpointer data, GClosureNotify destroy_data, GConnectFlags connect_flags))
|
|
DECL(void, g_object_unref, (GObject* object))
|
|
|
|
#define g_signal_connect(instance, signal, c_handler, data) \
|
|
g_signal_connect_data(instance, signal, reinterpret_cast<void *>(c_handler), data, NULL, G_CONNECT_DEFAULT)
|
|
|
|
#endif // GTK_IMPORTS_H
|