GTKMainWindowWidget.cpp
Go to the documentation of this file.
1 // ****************************************************************************
2 // Filename: GTKMainWindowWidget.cpp
3 // Author: Florian Hecht
4 // Date: 2009
5 // ****************************************************************************
6 
7 
8 #include "GTKMainWindowWidget.h"
9 #include "GTKMainWindow.h"
10 
12 #include "Image/ByteImage.h"
13 
14 
16 : m_main_window(main_window), m_type(type), m_widget(NULL), m_obj(NULL)
17 {
18 }
19 
21 {
22  if (m_type == eImage)
23  {
24  delete ((IVTImage*)m_widget)->image;
25  ((IVTImage*)m_widget)->image = NULL;
26  }
27 }
28 
30 {
32 
33  if (ec != NULL && m_type == eButton)
34  {
35  ec->ButtonPushed(this);
36  }
37 }
39 {
41 
42  if (ec != NULL && (m_type == eSlider || m_type == eComboBox))
43  {
44  ec->ValueChanged(this, value);
45  }
46 }
48 {
50 
51  if (ec != NULL && m_type == eCheckBox)
52  {
53  ec->ValueChanged(this, (flag ? 1 : 0));
54  }
55 }
56 void CGTKMainWindowWidget::TextChanged(const char *str)
57 {
59 
60  if (ec != NULL && m_type == eTextEdit)
61  {
62  ec->ValueChanged(this, -1);
63  }
64 }
65 
66 
67 static void ivtimage_class_init (IVTImageClass *klass);
68 static void ivtimage_init (IVTImage *ttt);
69 
70 GType ivtimage_get_type(void)
71 {
72  static GType ttt_type = 0;
73 
74  if (!ttt_type)
75  {
76  static const GTypeInfo ttt_info =
77  {
78  sizeof (IVTImageClass),
79  NULL, /* base_init */
80  NULL, /* base_finalize */
81  (GClassInitFunc) ivtimage_class_init,
82  NULL, /* class_finalize */
83  NULL, /* class_data */
84  sizeof (IVTImage),
85  0, /* n_preallocs */
86  (GInstanceInitFunc) ivtimage_init,
87  };
88 
89  ttt_type = g_type_register_static (GTK_TYPE_DRAWING_AREA,
90  "IVTImage",
91  &ttt_info,
92  (GTypeFlags)0);
93  }
94 
95  return ttt_type;
96 }
97 
98 static void ivtimage_class_init (IVTImageClass *klass)
99 {
100 
101 }
102 
103 static void ivtimage_init (IVTImage *ttt)
104 {
105  ttt->pixmap = NULL;
106  ttt->image = NULL;
107  ttt->main_window_widget = NULL;
108 
109  ttt->mouse_down = 0;
110 
111  GTK_WIDGET_SET_FLAGS(ttt, GTK_CAN_FOCUS);
112 }
113 
114 GtkWidget* ivtimage_new ()
115 {
116  return GTK_WIDGET (g_object_new (ivtimage_get_type (), NULL));
117 }
118 
119 
120 #ifdef USE_OPENGL
121 
122 #include "GTKGLContext.h"
123 
124 static void ivtglwidget_class_init (IVTGLWidgetClass *klass);
125 static void ivtglwidget_init (IVTGLWidget *ttt);
126 static void ivtglwidget_destroy (GtkObject *object);
127 
128 static GtkDrawingAreaClass *parent_class = NULL;
129 
130 GType ivtglwidget_get_type(void)
131 {
132  static GType ttt_type = 0;
133 
134  if (!ttt_type)
135  {
136  static const GTypeInfo ttt_info =
137  {
138  sizeof (IVTGLWidgetClass),
139  NULL, /* base_init */
140  NULL, /* base_finalize */
141  (GClassInitFunc) ivtglwidget_class_init,
142  NULL, /* class_finalize */
143  NULL, /* class_data */
144  sizeof (IVTGLWidget),
145  0, /* n_preallocs */
146  (GInstanceInitFunc) ivtglwidget_init,
147  };
148 
149  ttt_type = g_type_register_static (GTK_TYPE_DRAWING_AREA,
150  "IVTGLWidget",
151  &ttt_info,
152  (GTypeFlags)0);
153  }
154 
155  return ttt_type;
156 }
157 
158 static void ivtglwidget_class_init (IVTGLWidgetClass *klass)
159 {
160  GtkObjectClass *object_class;
161 
162  parent_class = (GtkDrawingAreaClass*)g_type_class_peek_parent(klass);
163  object_class = (GtkObjectClass*) klass;
164 
165  object_class->destroy = ivtglwidget_destroy;
166 }
167 
168 static void ivtglwidget_init (IVTGLWidget *ttt)
169 {
170  ttt->glcontext = NULL;
171  ttt->main_window_widget = NULL;
172 
173  GTK_WIDGET_SET_FLAGS(ttt, GTK_CAN_FOCUS);
174 }
175 
176 static void ivtglwidget_destroy(GtkObject *object)
177 {
178  IVTGLWidget *glw;
179 
180  g_return_if_fail (object != NULL);
181  g_return_if_fail (IS_IVTGLWIDGET(object));
182 
183  glw = IVTGLWIDGET(object);
184 
185  if (glw->glcontext)
186  delete glw->glcontext;
187  glw->glcontext = NULL;
188 
189  if (GTK_OBJECT_CLASS (parent_class)->destroy)
190  (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
191 }
192 GtkWidget* ivtglwidget_new ()
193 {
194  IVTGLWidget *glw = (IVTGLWidget*)g_object_new (ivtglwidget_get_type (), NULL);
195 
196  return (GtkWidget*)glw;
197 }
198 
199 #endif /* USE_OPENGL */
200 
201 
struct _IVTImage IVTImage
virtual void ButtonPushed(WIDGET_HANDLE widget)
virtual void ValueChanged(WIDGET_HANDLE widget, int value)
CByteImage * image
GType ivtimage_get_type(void)
GLuint GLuint GLsizei GLenum type
Definition: glext.h:3121
struct _IVTImageClass IVTImageClass
GdkPixmap * pixmap
void ValueChanged(int value)
GtkWidget * ivtimage_new()
GLsizei const GLfloat * value
Definition: glext.h:3538
static void ivtimage_class_init(IVTImageClass *klass)
CGTKMainWindowWidget * main_window_widget
CMainWindowEventInterface * GetEventCallback()
Definition: GTKMainWindow.h:70
void TextChanged(const char *str)
CGTKMainWindowWidget(CGTKMainWindow *main_window, GTKWidgetType type)
CGTKMainWindow * m_main_window
Interface for the event mechanism of GUIs using the GUI toolkit of the IVT.
GTKWidgetType
static void ivtimage_init(IVTImage *ttt)


asr_ivt
Author(s): Allgeyer Tobias, Hutmacher Robin, Kleinert Daniel, Meißner Pascal, Scholz Jonas, Stöckle Patrick
autogenerated on Mon Dec 2 2019 03:47:28