core/vgui/impl/gtk2/vgui_gtk2_utils.h
Go to the documentation of this file.
00001 // This is core/vgui/impl/gtk2/vgui_gtk2_utils.h
00002 #ifndef vgui_gtk2_utils_h_
00003 #define vgui_gtk2_utils_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007 //:
00008 // \file
00009 // \author Robotics Research Group, University of Oxford
00010 // \date   19-DEC-1999
00011 // \brief  GTK support for menus.
00012 //
00013 //  Contains classes: vgui_gtk2_utils
00014 //
00015 // \verbatim
00016 //  Modifications
00017 //   13-JUL-2000 Marko Bacic, Oxford RRG -- Added support for menu accelerators
00018 //   13-SEP-2002
00019 //   05-JAN-2011 Lianqing Yu -- Add member function translate_key_reverse to
00020 //                              fix the bug that menu accelerator text 
00021 //                              including non-alphabet keys such as F5, Home
00022 //                              are shown incorrectly.
00023 //   05-JAN-2011 Lianqing Yu -- Change GDK_MOD2_MASK to GDK_MOD1_MASK for 
00024 //                              modifier Alt.
00025 // \endverbatim
00026 
00027 
00028 #include <vgui/vgui_event.h>
00029 #include <vgui/vgui_menu.h>
00030 #include <gtk/gtk.h>
00031 
00032 
00033 //: GTK support for menus.
00034 class vgui_gtk2_utils
00035 {
00036  public:
00037   static vgui_button translate_button(int button);
00038   static vgui_key translate_key(GdkEventKey const *gev);
00039   static guint translate_key_reverse(vgui_key key);
00040   static void set_coordinates(vgui_event &e, const gdouble x, const gdouble y);
00041   static void set_modifiers(vgui_event &e, const guint state);
00042   static bool is_modifier(GdkEvent const *gev);
00043 
00044   static void add_submenu(GtkWidget *widget, const vgui_menu& menu);
00045   static void set_menu(GtkWidget *widget, const vgui_menu& menu, bool is_menubar=false);
00046   static GtkAccelGroup *accel_group;
00047 };
00048 
00049 #endif // vgui_gtk2_utils_h_