Go to the documentation of this file.00001
00002 #ifndef vgui_gtk_adaptor_h_
00003 #define vgui_gtk_adaptor_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007
00008
00009
00010
00011
00012
00013 #ifdef __SUNPRO_CC
00014
00015 # include <vcl_string.h>
00016 #endif
00017
00018 #include <vgui/vgui_adaptor.h>
00019 #include <vgui/internals/vgui_adaptor_mixin.h>
00020 #include <vcl_map.h>
00021 #include <gtk/gtk.h>
00022
00023 struct vgui_overlay_helper;
00024 class vgui_gtk_window;
00025
00026
00027 class vgui_gtk_adaptor : public vgui_adaptor, public vgui_adaptor_mixin
00028 {
00029 public:
00030 typedef vgui_adaptor_mixin mixin;
00031
00032 vgui_gtk_adaptor(vgui_gtk_window* win = 0);
00033 ~vgui_gtk_adaptor();
00034
00035
00036 void swap_buffers();
00037 void make_current();
00038 void post_redraw();
00039 void post_overlay_redraw();
00040 void post_timer(float,int);
00041 void post_destroy();
00042
00043 void kill_timer(int);
00044
00045 unsigned get_width() const {return mixin::width;}
00046 unsigned get_height() const {return mixin::height;}
00047 void bind_popups(vgui_modifier m, vgui_button b)
00048 { mixin::popup_modifier = m; mixin::popup_button = b; }
00049 void get_popup_bindings(vgui_modifier &m, vgui_button &b) const
00050 { m = mixin::popup_modifier; b = mixin::popup_button; }
00051
00052 void set_default_popup(vgui_menu);
00053 vgui_menu get_popup();
00054
00055 void draw();
00056 void reshape();
00057
00058
00059 vgui_window* get_window() const;
00060
00061
00062 GtkWidget *get_glarea_widget() { return widget; }
00063
00064 private:
00065
00066 static gint handle(GtkWidget *, GdkEvent *, gpointer);
00067
00068
00069 static gint idle_callback_for_redraw(gpointer data);
00070 static gint idle_callback_for_destroy(gpointer data);
00071
00072
00073 bool redraw_requested;
00074 bool destroy_requested;
00075
00076
00077 GtkWidget *widget;
00078
00079
00080 vgui_gtk_window* win_;
00081
00082
00083 vgui_overlay_helper *ovl_helper;
00084
00085
00086 struct internal_timer{
00087 gint real_id_;
00088 void* callback_ptr_;
00089
00090 internal_timer() : real_id_(0), callback_ptr_(0) { }
00091 internal_timer(gint id, void* p)
00092 : real_id_(id), callback_ptr_(p) { }
00093 };
00094
00095
00096 vcl_map<int, internal_timer> timers_;
00097
00098
00099
00100 static vgui_menu last_popup;
00101
00102
00103 int last_mouse_x, last_mouse_y;
00104 };
00105
00106 #endif // vgui_gtk_adaptor_h_