Enable caller to handle GTK events without inheriting from any class. One-one connection. It's better to use template based technology. By GtkEventSource caller is able to handle multiple widgets' events. More...
#include <test_gtk_source.h>
Enable caller to handle GTK events without inheriting from any class. One-one connection. It's better to use template based technology. By GtkEventSource caller is able to handle multiple widgets' events.
Definition at line 40 of file test_gtk_source.h.
enum gtk::GtkEventSource::EventType |
Definition at line 41 of file notepad_gtk_source.h.
00042 { 00043 EVENT_EXPOSE = 0, // signal expose_event 00044 EVENT_VISIBILITY_NOTIFY,// signal visibility_notify_event 00045 EVENT_CONFIG, // signal configure_event 00046 EVENT_BUTTON_PRESS, // signal button_press_event 00047 EVENT_BUTTON_RELEASE, // signal button_release_event 00048 EVENT_MOTION_NOTIFY, // signal motion_notify_event 00049 EVENT_KEY_PRESS, // signal key_press_event 00050 EVENT_KEY_RELEASE, // signal key_release_event 00051 EVENT_DELETE, // signal delete_event 00052 EVENT_MAX, // number of events 00053 };
enum gtk::GtkEventSource::EventType |
Definition at line 45 of file gtk_source.h.
00046 { 00047 EVENT_EXPOSE = 0, 00048 EVENT_CONFIG, 00049 EVENT_BUTTON_PRESS, 00050 EVENT_BUTTON_RELEASE, 00051 EVENT_MOTION_NOTIFY, 00052 EVENT_KEY_PRESS, 00053 EVENT_KEY_RELEASE, 00054 EVENT_DELETE, 00055 EVENT_FD_INPUT, 00056 EVENT_UNDEFINED, 00057 };
enum gtk::GtkEventSource::EventType |
Definition at line 43 of file test_gtk_source.h.
00044 { 00045 EVENT_EXPOSE = 0, 00046 EVENT_CONFIG, 00047 EVENT_BUTTON_PRESS, 00048 EVENT_BUTTON_RELEASE, 00049 EVENT_MOTION_NOTIFY, 00050 EVENT_KEY_PRESS, 00051 EVENT_KEY_RELEASE, 00052 EVENT_DELETE, 00053 EVENT_FD_INPUT, 00054 EVENT_UNDEFINED, 00055 };
gtk::GtkEventSource< T >::GtkEventSource | ( | T * | r | ) | [inline] |
Definition at line 58 of file test_gtk_source.h.
gtk::GtkEventSource< T >::~GtkEventSource | ( | ) | [inline] |
Definition at line 63 of file test_gtk_source.h.
gtk::GtkEventSource< T >::GtkEventSource | ( | T * | r | ) | [inline] |
Definition at line 60 of file gtk_source.h.
gtk::GtkEventSource< T >::~GtkEventSource | ( | ) | [inline] |
Definition at line 66 of file gtk_source.h.
gtk::GtkEventSource< T >::GtkEventSource | ( | T * | r | ) | [inline] |
Definition at line 56 of file notepad_gtk_source.h.
gtk::GtkEventSource< T >::~GtkEventSource | ( | ) | [inline] |
Definition at line 62 of file notepad_gtk_source.h.
void gtk::GtkEventSource< T >::clear | ( | GtkWidget * | widget | ) | [inline] |
Disconnect all connected signal handlers.
Definition at line 71 of file gtk_source.h.
00072 { 00073 for(size_t i = 0; i < handler_ids.size(); ++i) 00074 { 00075 gtk_signal_disconnect(GTK_OBJECT (widget), handler_ids[i]); 00076 } 00077 00078 handler_ids.clear(); 00079 receiver = 0; 00080 memset(&callbacks[0], 0, sizeof(callbacks)); 00081 }
void gtk::GtkEventSource< T >::connect_event_handlers | ( | GtkWidget * | widget | ) | [inline] |
Connect the event handler(slot) with the gtk event(signal).
Definition at line 80 of file notepad_gtk_source.h.
00081 { 00082 // events 00083 gtk_widget_set_events (widget, 00084 GDK_EXPOSURE_MASK | GDK_BUTTON_MOTION_MASK | 00085 GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | 00086 GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_VISIBILITY_NOTIFY_MASK); 00087 00088 // install event handlers. 00089 handler_ids[EVENT_EXPOSE] = 00090 g_signal_connect( GTK_OBJECT(widget), "expose_event", 00091 G_CALLBACK(widget_event_handler), this); 00092 00093 handler_ids[EVENT_VISIBILITY_NOTIFY] = 00094 g_signal_connect( GTK_OBJECT(widget), "visibility_notify_event", 00095 G_CALLBACK(widget_event_handler), this); 00096 00097 handler_ids[EVENT_CONFIG] = 00098 g_signal_connect( GTK_OBJECT(widget), "configure_event", 00099 G_CALLBACK(widget_event_handler), this); 00100 00101 handler_ids[EVENT_BUTTON_PRESS] = 00102 g_signal_connect( GTK_OBJECT(widget), "button_press_event", 00103 G_CALLBACK(widget_event_handler), this); 00104 00105 handler_ids[EVENT_BUTTON_RELEASE] = 00106 g_signal_connect( GTK_OBJECT(widget), "button_release_event", 00107 G_CALLBACK(widget_event_handler), this); 00108 00109 handler_ids[EVENT_MOTION_NOTIFY] = 00110 g_signal_connect( GTK_OBJECT(widget), "motion_notify_event", 00111 G_CALLBACK(widget_event_handler), this); 00112 00113 handler_ids[EVENT_KEY_PRESS] = 00114 g_signal_connect( GTK_OBJECT(widget), "key_press_event", 00115 G_CALLBACK(widget_event_handler), this); 00116 00117 handler_ids[EVENT_KEY_RELEASE] = 00118 g_signal_connect( GTK_OBJECT(widget), "key_release_event", 00119 G_CALLBACK(widget_event_handler), this); 00120 00121 handler_ids[EVENT_DELETE] = 00122 g_signal_connect( GTK_OBJECT(widget), "delete_event", 00123 G_CALLBACK(widget_event_handler), this); 00124 }
void gtk::GtkEventSource< T >::connect_event_handlers | ( | GtkWidget * | widget | ) | [inline] |
Connect the event handler(slot) with the gtk event(signal).
Definition at line 84 of file gtk_source.h.
00085 { 00086 // events 00087 gtk_widget_set_events (widget, 00088 GDK_EXPOSURE_MASK | GDK_BUTTON_MOTION_MASK | 00089 GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | 00090 GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK); 00091 00092 // install event handlers. 00093 handler_ids.push_back( 00094 gtk_signal_connect (GTK_OBJECT (widget), "expose_event", 00095 GTK_SIGNAL_FUNC (widget_event_handler), this)); 00096 00097 handler_ids.push_back( 00098 gtk_signal_connect (GTK_OBJECT (widget), "configure_event", 00099 GTK_SIGNAL_FUNC (widget_event_handler), this)); 00100 00101 handler_ids.push_back( 00102 gtk_signal_connect (GTK_OBJECT (widget), "button_press_event", 00103 GTK_SIGNAL_FUNC (widget_event_handler), this)); 00104 00105 handler_ids.push_back( 00106 gtk_signal_connect (GTK_OBJECT (widget), "button_release_event", 00107 GTK_SIGNAL_FUNC (widget_event_handler), this)); 00108 00109 handler_ids.push_back( 00110 gtk_signal_connect (GTK_OBJECT (widget), "motion_notify_event", 00111 GTK_SIGNAL_FUNC (widget_event_handler), this)); 00112 00113 handler_ids.push_back( 00114 gtk_signal_connect (GTK_OBJECT (widget), "key_press_event", 00115 GTK_SIGNAL_FUNC (widget_event_handler), this)); 00116 00117 handler_ids.push_back( 00118 gtk_signal_connect (GTK_OBJECT (widget), "key_release_event", 00119 GTK_SIGNAL_FUNC (widget_event_handler), this)); 00120 00121 handler_ids.push_back( 00122 gtk_signal_connect (GTK_OBJECT (widget), "delete_event", 00123 GTK_SIGNAL_FUNC (widget_event_handler), this)); 00124 }
void gtk::GtkEventSource< T >::connect_event_handlers | ( | GtkWidget * | widget | ) | [inline] |
Connect the event handler(slot) with the gtk event(signal).
Definition at line 68 of file test_gtk_source.h.
00069 { 00070 // events 00071 gtk_widget_set_events (widget, 00072 GDK_EXPOSURE_MASK | GDK_BUTTON_MOTION_MASK | 00073 GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | 00074 GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK); 00075 00076 // install event handlers 00077 gtk_signal_connect (GTK_OBJECT (widget), "expose_event", 00078 GTK_SIGNAL_FUNC (widget_event_handler), this); 00079 00080 gtk_signal_connect (GTK_OBJECT (widget), "configure_event", 00081 GTK_SIGNAL_FUNC (widget_event_handler), this); 00082 00083 gtk_signal_connect (GTK_OBJECT (widget), "button_press_event", 00084 GTK_SIGNAL_FUNC (widget_event_handler), this); 00085 00086 gtk_signal_connect (GTK_OBJECT (widget), "button_release_event", 00087 GTK_SIGNAL_FUNC (widget_event_handler), this); 00088 00089 gtk_signal_connect (GTK_OBJECT (widget), "motion_notify_event", 00090 GTK_SIGNAL_FUNC (widget_event_handler), this); 00091 00092 gtk_signal_connect (GTK_OBJECT (widget), "key_press_event", 00093 GTK_SIGNAL_FUNC (widget_event_handler), this); 00094 00095 gtk_signal_connect (GTK_OBJECT (widget), "key_release_event", 00096 GTK_SIGNAL_FUNC (widget_event_handler), this); 00097 00098 gtk_signal_connect (GTK_OBJECT (widget), "delete_event", 00099 GTK_SIGNAL_FUNC (widget_event_handler), this); 00100 }
void gtk::GtkEventSource< T >::disconnect_event_handlers | ( | GtkWidget * | widget | ) | [inline] |
Disconnect all connected signal handlers.
Definition at line 67 of file notepad_gtk_source.h.
void gtk::GtkEventSource< T >::set_event_handler | ( | EventType | type, | |
void(T::*)(GdkEvent *event) | func | |||
) | [inline] |
Set event handler of gtk event (from event loop).
Definition at line 128 of file notepad_gtk_source.h.
void gtk::GtkEventSource< T >::set_event_handler | ( | EventType | type, | |
gboolean(T::*)(GtkWidget *widget, GdkEvent *event) | func | |||
) | [inline] |
Set event handler of gtk event (from event loop).
Definition at line 139 of file gtk_source.h.
void gtk::GtkEventSource< T >::set_event_handler | ( | EventType | type, | |
gboolean(T::*)(GtkWidget *widget, GdkEvent *event) | func | |||
) | [inline] |
Set event handler of gtk event (from event loop).
Definition at line 115 of file test_gtk_source.h.
void gtk::GtkEventSource< T >::set_fd_event_watcher | ( | int | fd, | |
gboolean(T::*)(GtkWidget *widget, GdkEvent *event) | func | |||
) | [inline] |
Set event handler of File Descriptor.
Definition at line 127 of file gtk_source.h.
00130 { 00131 gdk_input_add(fd, GDK_INPUT_READ, 00132 (GdkInputFunction)fd_event_handler, 00133 (gpointer)this); 00134 00135 callbacks[EVENT_FD_INPUT] = func; 00136 }
void gtk::GtkEventSource< T >::set_fd_event_watcher | ( | int | fd, | |
gboolean(T::*)(GtkWidget *widget, GdkEvent *event) | func | |||
) | [inline] |
Set event handler of File Descriptor.
Definition at line 103 of file test_gtk_source.h.
00106 { 00107 gdk_input_add(fd, GDK_INPUT_READ, 00108 (GdkInputFunction)fd_event_handler, 00109 (gpointer)this); 00110 00111 callbacks[EVENT_FD_INPUT] = func; 00112 }