core/vgui/impl/wx/vgui_wx_window.h
Go to the documentation of this file.
00001 // This is core/vgui/impl/wx/vgui_wx_window.h
00002 #ifndef vgui_wx_window_h_
00003 #define vgui_wx_window_h_
00004 //=========================================================================
00005 //:
00006 // \file
00007 // \brief  wxWidgets implementation of vgui_window.
00008 // \author Miguel A. Figueroa-Villanueva (miguelfv)
00009 //
00010 // \verbatim
00011 //  Modifications
00012 //   04/05/2006 - File created. (miguelfv)
00013 // \endverbatim
00014 //=========================================================================
00015 
00016 #include <vgui/vgui_window.h>
00017 class vgui_wx_adaptor;
00018 class vgui_wx_menu;
00019 class vgui_wx_statusbar;
00020 
00021 #include <wx/frame.h>
00022 
00023 //-------------------------------------------------------------------------
00024 //: wxWidgets implementation of vgui_window.
00025 //
00026 // Creates a top-level window in wxWidgets and provides methods for its
00027 // management and customization.
00028 //-------------------------------------------------------------------------
00029 class vgui_wx_window : public vgui_window
00030 {
00031  public:
00032   //: Constructor - create a new window.
00033   vgui_wx_window(int width, int height, const char* title);
00034 
00035   //: Constructor - create a new window with a menubar.
00036   vgui_wx_window(int width,
00037                  int height,
00038                  const vgui_menu& menubar,
00039                  const char* title);
00040 
00041   //: Destructor.
00042   virtual ~vgui_wx_window();
00043 
00044   //: Put the given menu in the menubar (if it exists).
00045   virtual void set_menubar(vgui_menu const&);
00046 
00047   //: If true, activate the statusbar (if it exists).
00048   virtual void set_statusbar(bool);
00049 
00050   //: Set the default adaptor (if it exists) to the given vgui_adaptor.
00051   //  These refer to the default/current adaptor, if that makes
00052   //  sense. It is not a requirement that it should make sense.
00053   virtual void set_adaptor(vgui_adaptor*);
00054 
00055   //: Get the default adaptor (if it exists).
00056   virtual vgui_adaptor* get_adaptor();
00057 
00058   //: Get the status bar (if it exists).
00059   virtual vgui_statusbar* get_statusbar();
00060 
00061   //: Display the window.
00062   virtual void show() { frame_->Show(); }
00063 
00064   //: Hide the window from view.
00065   virtual void hide() { frame_->Hide(); }
00066 
00067   //: Turn the window into an icon.
00068   virtual void iconify() { frame_->Iconize(); }
00069 
00070   //: If true, activate horizontal scrollbar (if it exists).
00071   virtual void enable_hscrollbar(bool);
00072 
00073   //: If true, activate vertical scrollbar (if it exists).
00074   virtual void enable_vscrollbar(bool);
00075 
00076   //: Change window shape to new given width and height.
00077   virtual void reshape(unsigned, unsigned);
00078 
00079   //: Move the window to the new given x,y position.
00080   virtual void reposition(int, int);
00081 
00082   //: Use the given text as the window title (if the window has a title).
00083   virtual void set_title(vcl_string const&);
00084 
00085   //: Set the position of the horizontal scrollbar, returns old position.
00086   virtual int set_hscrollbar(int pos);
00087 
00088   //: Set the position of the vertical scrollbar, returns old position.
00089   virtual int set_vscrollbar(int pos);
00090 
00091  private:
00092   //: Catch all constructor.
00093   void init_window();
00094 
00095   //: The wxWidgets window.
00096   wxFrame* frame_;
00097 
00098   //: vgui_adaptor associated with this window.
00099   vgui_wx_adaptor* adaptor_;
00100 
00101   //: Statusbar that vgui writes to.
00102   vgui_wx_statusbar* statusbar_;
00103 
00104   //: wxMenuBar event handler and menu.
00105   vgui_wx_menu* menu_;
00106 
00107   //: Title of the window.
00108   vcl_string title_;
00109 };
00110 
00111 #endif // vgui_wx_window_h_