core/vgui/impl/gtk2/vgui_gtk2_window.h
Go to the documentation of this file.
00001 // This is core/vgui/impl/gtk2/vgui_gtk2_window.h
00002 #ifndef vgui_gtk2_window_h_
00003 #define vgui_gtk2_window_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    18 Dec 99
00011 // \brief   The GTK implementation of vgui_window.
00012 //
00013 //  Contains classes: vgui_gtk2_window
00014 //
00015 // \verbatim
00016 //  Modifications
00017 //   13-Jul-2000 Marko Bacic, Oxford RRG - Added support for menu shortcuts
00018 //   21-Sep-2000 capes@robots- Changed destructor to actually destroy the widgets
00019 //                             Facilitates the post_destroy() adaptor method.
00020 //   13-Sep-2002 K.Y.McGaul  - Changed to Doxygen style comments.
00021 //   07-Jan-2011 Lianqing Yu - Move member function init() from show() to the
00022 //                             constructors so that client may call show()
00023 //                             multiple times without triggering GTK+ warning
00024 //                             that a child widget (indeed its member box) is
00025 //                             inserted into a GtkBin widget (actually its
00026 //                             member window) that already has a child.
00027 // \endverbatim
00028 
00029 #ifdef __SUNPRO_CC
00030 // <string> breaks if NULL is defined to "(void*)0".
00031 # include <vcl_string.h>
00032 #endif
00033 
00034 #include <vgui/vgui_window.h>
00035 #include <vgui/vgui_menu.h>
00036 
00037 #include <gtk/gtk.h>
00038 
00039 //: The GTK implementation of vgui_window.
00040 //  Provides functions for manipulating a window.
00041 class vgui_gtk2_window : public vgui_window
00042 {
00043  public:
00044 
00045   vgui_gtk2_window(int w, int h, const vgui_menu& menu, const char* title);
00046   vgui_gtk2_window(int w, int h, const char* title);
00047  ~vgui_gtk2_window();
00048 
00049   bool use_menubar;
00050   bool use_statusbar;
00051 
00052   void init();
00053 
00054   void show();
00055   void hide();
00056   void reshape(unsigned, unsigned);
00057   void set_title(vcl_string const &);
00058 
00059   void set_menubar(const vgui_menu &menu);
00060 
00061   //: Returns the current adaptor (OpenGL widget holder).
00062   vgui_adaptor* get_adaptor() { return adaptor; }
00063   void set_adaptor(vgui_adaptor* a) { adaptor=a; }
00064 
00065   vgui_statusbar* get_statusbar() { return statusbar; }
00066   void set_statusbar(bool) {}
00067 
00068   // gtk specific
00069   vgui_adaptor *adaptor;
00070   vgui_statusbar *statusbar;
00071 
00072   GtkWidget *window;
00073   GtkWidget *box;
00074   GtkWidget *menubar;
00075 
00076  private:
00077   // This is a place to store any menu passed in, so that it doesn't go out
00078   // of scope while the popup is on screen.
00079   vgui_menu* last_menubar; // <-- ask fsm about this.
00080 };
00081 
00082 #endif // vgui_gtk2_window_h_