macros.h

00001 #ifndef _MACROS_GLADE_H
00002 #define _MACROS_GLADE_H
00003 
00004 #include <gladeui/glade.h>
00005 #include <uwidgets/UWidgets.h>
00006 #include <usvgwidgets/USVGWidgets.h>
00007 #include <objects/Objects.h>
00008 #include <components/Components.h>
00009 #include <typical/Typical.h>
00010 
00011 using namespace UniWidgets;
00012 
00013 static void gw_set_default(GladeWidget *gw)
00014 {
00015 /* HACK to set default values from catalog
00016 * It isn't set for some reason
00017 * I hope later we will find the problem
00018 */
00019 
00020   GList *l;
00021 
00022   for (l = gw->properties; l && l->data; l = l->next)
00023   {
00024     GladeProperty *prop  = GLADE_PROPERTY(l->data);
00025     glade_widget_property_reset (gw, prop->klass->id);
00026   }
00027 }
00028 
00029 #define GLADE_UVOID_FUNCS(uname, cname)\
00030 extern "C" GType cname##_get_type(); \
00031 extern "C" void cname##_wrap_new(GObject* object);\
00032 \
00033 void cname##_init()\
00034 {\
00035   UObj_Get_Type<uname>();\
00036 }\
00037 \
00038 extern "C" GType gtkmm___custom_object_##cname##_get_type()\
00039 {\
00040   GType type = UObj_Get_Type<uname>();\
00041   return type;\
00042 }\
00043 \
00044 extern "C" void cname##_postcreate(GladeWidgetAdaptor *adaptor, GObject *object, GladeCreateReason reason)\
00045 {\
00046   uwrap<uname>(object);\
00047   if (reason == GLADE_CREATE_USER)\
00048   {\
00049     GladeWidget* gw = glade_widget_get_from_gobject(object);\
00050     gw_set_default(gw);\
00051   }\
00052 }
00053 
00054 #define GLADE_DEFAULT_FUNCS(name, cname)\
00055 extern "C" GType cname##_get_type(); \
00056 extern "C" void cname##_wrap_new(GObject* object);\
00057 \
00058 void cname##_init()\
00059 {\
00060   Obj_Get_Type<name>();\
00061 }\
00062 \
00063 extern "C" GType gtkmm___custom_object_##cname##_get_type()\
00064 {\
00065   GType type = Obj_Get_Type<name>();\
00066   return type;\
00067 }\
00068 \
00069 extern "C" void cname##_postcreate(GladeWidgetAdaptor *adaptor, GObject *object, GladeCreateReason reason)\
00070 {\
00071   uwrap<name>(object);\
00072   if (reason == GLADE_CREATE_USER)\
00073   {\
00074     GladeWidget* gw = glade_widget_get_from_gobject(object);\
00075     gw_set_default(gw);\
00076   }\
00077 }
00078 
00079 #define GLADE_SIMPLEOBJECT_FUNCS(uname, cname)\
00080 extern "C" GType cname##_get_type(); \
00081 extern "C" void cname##_wrap_new(GObject* object);\
00082 \
00083 void cname##_init()\
00084 {\
00085   SimpleObject_Get_Type<uname>();\
00086 }\
00087 \
00088 extern "C" GType gtkmm___custom_object_##cname##_get_type()\
00089 {\
00090   GType type = SimpleObject_Get_Type<uname>();\
00091   return type;\
00092 }\
00093 \
00094 extern "C" void cname##_postcreate(GladeWidgetAdaptor *adaptor, GObject *object, GladeCreateReason reason)\
00095 {\
00096   uwrap<uname>(object);\
00097   if (reason == GLADE_CREATE_USER)\
00098   {\
00099     GladeWidget* gw = glade_widget_get_from_gobject(object);\
00100     gw_set_default(gw);\
00101   }\
00102 }
00103 
00104 #define GLADE_GROUPOBJECT_FUNCS(uname, cname)\
00105 extern "C" GType cname##_get_type(); \
00106 extern "C" void cname##_wrap_new(GObject* object);\
00107 \
00108 void cname##_init()\
00109 {\
00110   GroupObject_Get_Type<uname>();\
00111 }\
00112 \
00113 extern "C" GType gtkmm___custom_object_##cname##_get_type()\
00114 {\
00115   GType type = GroupObject_Get_Type<uname>();\
00116   return type;\
00117 }\
00118 \
00119 extern "C" void cname##_postcreate(GladeWidgetAdaptor *adaptor, GObject *object, GladeCreateReason reason)\
00120 {\
00121   uwrap<uname>(object);\
00122   if (reason == GLADE_CREATE_USER)\
00123   {\
00124     GladeWidget* gw = glade_widget_get_from_gobject(object);\
00125     gw_set_default(gw);\
00126   }\
00127 }
00128 
00129 #endif

Документация по UniWidgets. Последние изменения: Fri Oct 10 09:57:49 2014. Создано системой  doxygen 1.5.9