From bfc6fde4b1dd5bfd8ae22839ff9a69cf24eb9120 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 22 Feb 1999 11:01:13 +0000 Subject: [PATCH] GetSize() and GetClientSize() changes git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1748 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/generic/laywin.h | 26 +- include/wx/generic/tabg.h | 36 +- include/wx/generic/treectrl.h | 6 +- include/wx/gtk/dialog.h | 116 ++-- include/wx/gtk/frame.h | 151 +++-- include/wx/gtk/mdi.h | 7 +- include/wx/gtk/window.h | 612 ++++++++++------- include/wx/gtk1/dialog.h | 116 ++-- include/wx/gtk1/frame.h | 151 +++-- include/wx/gtk1/mdi.h | 7 +- include/wx/gtk1/window.h | 612 ++++++++++------- include/wx/layout.h | 16 +- include/wx/motif/checkbox.h | 53 +- include/wx/motif/choice.h | 122 ++-- include/wx/motif/combobox.h | 119 ++-- include/wx/motif/dialog.h | 173 +++-- include/wx/motif/frame.h | 294 ++++---- include/wx/motif/gauge.h | 79 +-- include/wx/motif/listbox.h | 152 ++--- include/wx/motif/mdi.h | 211 +++--- include/wx/motif/radiobox.h | 134 ++-- include/wx/motif/slider.h | 140 ++-- include/wx/motif/statbmp.h | 88 ++- include/wx/motif/statbox.h | 77 ++- include/wx/motif/window.h | 1071 +++++++++++++++-------------- include/wx/msw/button.h | 63 +- include/wx/msw/checkbox.h | 124 ++-- include/wx/msw/choice.h | 101 ++- include/wx/msw/frame.h | 19 +- include/wx/msw/gauge95.h | 94 +-- include/wx/msw/gaugemsw.h | 92 +-- include/wx/msw/listbox.h | 155 +++-- include/wx/msw/private.h | 6 +- include/wx/msw/radiobox.h | 221 +++--- include/wx/msw/slider95.h | 162 +++-- include/wx/msw/slidrmsw.h | 162 +++-- include/wx/msw/statbmp.h | 11 +- include/wx/msw/statbox.h | 12 +- include/wx/msw/stattext.h | 10 +- include/wx/msw/textctrl.h | 187 ++--- include/wx/msw/window.h | 1203 +++++++++++++++++---------------- src/common/ftp.cpp | 1 - src/common/layout.cpp | 7 +- src/common/log.cpp | 10 +- src/common/object.cpp | 2 +- src/common/valgen.cpp | 1 + src/gtk/dialog.cpp | 7 +- src/gtk/filedlg.cpp | 23 +- src/gtk/frame.cpp | 9 +- src/gtk/window.cpp | 23 +- src/gtk1/dialog.cpp | 7 +- src/gtk1/filedlg.cpp | 23 +- src/gtk1/frame.cpp | 9 +- src/gtk1/window.cpp | 23 +- src/motif/checkbox.cpp | 2 +- src/motif/choice.cpp | 4 +- src/motif/combobox.cpp | 4 +- src/motif/dialog.cpp | 10 +- src/motif/frame.cpp | 4 +- src/motif/gauge.cpp | 5 - src/motif/listbox.cpp | 4 +- src/motif/mdi.cpp | 20 +- src/motif/radiobox.cpp | 2 +- src/motif/slider.cpp | 2 +- src/motif/statbmp.cpp | 5 - src/motif/statbox.cpp | 4 +- src/msw/button.cpp | 2 +- src/msw/checkbox.cpp | 8 +- src/msw/choice.cpp | 2 +- src/msw/frame.cpp | 32 +- src/msw/gauge95.cpp | 2 +- src/msw/gaugemsw.cpp | 2 +- src/msw/listbox.cpp | 14 +- src/msw/radiobox.cpp | 2 +- src/msw/slider95.cpp | 22 +- src/msw/slidrmsw.cpp | 22 +- src/msw/statbmp.cpp | 2 +- src/msw/statbox.cpp | 2 +- src/msw/stattext.cpp | 2 +- src/msw/textctrl.cpp | 2 +- 80 files changed, 3863 insertions(+), 3655 deletions(-) diff --git a/include/wx/generic/laywin.h b/include/wx/generic/laywin.h index 47182c627c..7a80b50e13 100644 --- a/include/wx/generic/laywin.h +++ b/include/wx/generic/laywin.h @@ -67,22 +67,24 @@ public: m_alignment = wxLAYOUT_TOP; m_orientation = wxLAYOUT_HORIZONTAL; } -// Read by the app - inline void SetRequestedLength(int length) { m_requestedLength = length; } - inline int GetRequestedLength() const { return m_requestedLength; } - inline void SetFlags(int flags) { m_flags = flags; } - inline int GetFlags() const { return m_flags; } + // Read by the app + void SetRequestedLength(int length) { m_requestedLength = length; } + int GetRequestedLength() const { return m_requestedLength; } -// Set by the app - inline void SetSize(const wxSize& size) { m_size = size; } - inline wxSize GetSize() const { return m_size; } + void SetFlags(int flags) { m_flags = flags; } + int GetFlags() const { return m_flags; } + + // Set by the app + void SetSize(const wxSize& size) { m_size = size; } + wxSize GetSize() const { return m_size; } + + void SetOrientation(wxLayoutOrientation orient) { m_orientation = orient; } + wxLayoutOrientation GetOrientation() const { return m_orientation; } - inline void SetOrientation(wxLayoutOrientation orient) { m_orientation = orient; } - inline wxLayoutOrientation GetOrientation() const { return m_orientation; } + void SetAlignment(wxLayoutAlignment align) { m_alignment = align; } + wxLayoutAlignment GetAlignment() const { return m_alignment; } - inline void SetAlignment(wxLayoutAlignment align) { m_alignment = align; } - inline wxLayoutAlignment GetAlignment() const { return m_alignment; } protected: int m_flags; int m_requestedLength; diff --git a/include/wx/generic/tabg.h b/include/wx/generic/tabg.h index b3a02100ee..c636650433 100644 --- a/include/wx/generic/tabg.h +++ b/include/wx/generic/tabg.h @@ -37,30 +37,30 @@ public: ~wxTabControl(void); virtual void OnDraw(wxDC& dc, bool lastInRow); - inline void SetLabel(const wxString& str) { m_controlLabel = str; } - inline wxString GetLabel(void) const { return m_controlLabel; } + void SetLabel(const wxString& str) { m_controlLabel = str; } + wxString GetLabel(void) const { return m_controlLabel; } - inline void SetFont(const wxFont& f) { m_labelFont = f; } - inline wxFont *GetFont(void) const { return (wxFont*) & m_labelFont; } + void SetFont(const wxFont& f) { m_labelFont = f; } + wxFont *GetFont(void) const { return (wxFont*) & m_labelFont; } - inline void SetSelected(bool sel) { m_isSelected = sel; } - inline bool IsSelected(void) const { return m_isSelected; } + void SetSelected(bool sel) { m_isSelected = sel; } + bool IsSelected(void) const { return m_isSelected; } - inline void SetPosition(int x, int y) { m_offsetX = x; m_offsetY = y; } - inline void SetSize(int x, int y) { m_width = x; m_height = y; } + void SetPosition(int x, int y) { m_offsetX = x; m_offsetY = y; } + void SetSize(int x, int y) { m_width = x; m_height = y; } - inline void SetRowPosition(int r) { m_rowPosition = r; } - inline int GetRowPosition() const { return m_rowPosition; } - inline void SetColPosition(int c) { m_colPosition = c; } - inline int GetColPosition() const { return m_colPosition; } + void SetRowPosition(int r) { m_rowPosition = r; } + int GetRowPosition() const { return m_rowPosition; } + void SetColPosition(int c) { m_colPosition = c; } + int GetColPosition() const { return m_colPosition; } - inline int GetX(void) const { return m_offsetX; } - inline int GetY(void) const { return m_offsetY; } - inline int GetWidth(void) const { return m_width; } - inline int GetHeight(void) const { return m_height; } + int GetX(void) const { return m_offsetX; } + int GetY(void) const { return m_offsetY; } + int GetWidth(void) const { return m_width; } + int GetHeight(void) const { return m_height; } - inline int GetId(void) const { return m_id; } - inline void SetId(int i) { m_id = i; } + int GetId(void) const { return m_id; } + void SetId(int i) { m_id = i; } virtual bool HitTest(int x, int y) const ; diff --git a/include/wx/generic/treectrl.h b/include/wx/generic/treectrl.h index 014a048ce5..8bbf086830 100644 --- a/include/wx/generic/treectrl.h +++ b/include/wx/generic/treectrl.h @@ -207,7 +207,7 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT, - const wxValidator &validator = wxDefaultValidator, + const wxValidator &validator = wxDefaultValidator, const wxString& name = wxTreeCtrlNameStr) { Create(parent, id, pos, size, style, validator, name); @@ -219,7 +219,7 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT, - const wxValidator &validator = wxDefaultValidator, + const wxValidator &validator = wxDefaultValidator, const wxString& name = wxTreeCtrlNameStr); // accessors @@ -409,7 +409,7 @@ public: wxTreeItemId HitTest(const wxPoint& point) { int dummy; return HitTest(point, dummy); } wxTreeItemId HitTest(const wxPoint& point, int& flags); - + // start editing the item label: this (temporarily) replaces the item // with a one line edit control. The item will be selected if it hadn't // been before. textCtrlClass parameter allows you to create an edit diff --git a/include/wx/gtk/dialog.h b/include/wx/gtk/dialog.h index 0c7ea69240..002c3e1bed 100644 --- a/include/wx/gtk/dialog.h +++ b/include/wx/gtk/dialog.h @@ -37,70 +37,72 @@ extern const char *wxDialogNameStr; class wxDialog: public wxPanel { - DECLARE_DYNAMIC_CLASS(wxDialog) + DECLARE_DYNAMIC_CLASS(wxDialog) public: - wxDialog(); - wxDialog( wxWindow *parent, wxWindowID id, + wxDialog(); + wxDialog( wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE, const wxString &name = wxDialogNameStr ); - bool Create( wxWindow *parent, wxWindowID id, - const wxString &title, - const wxPoint &pos = wxDefaultPosition, - const wxSize &size = wxDefaultSize, - long style = wxDEFAULT_DIALOG_STYLE, - const wxString &name = wxDialogNameStr ); - ~wxDialog(); - - void SetTitle(const wxString& title); - wxString GetTitle() const; - - void OnApply( wxCommandEvent &event ); - void OnCancel( wxCommandEvent &event ); - void OnOK( wxCommandEvent &event ); - void OnPaint( wxPaintEvent& event ); - void OnSize( wxSizeEvent &event ); - void OnCloseWindow( wxCloseEvent& event ); -/* - void OnCharHook( wxKeyEvent& event ); -*/ - - bool Destroy(); - - virtual void SetSize( int x, int y, int width, int height, - int sizeFlags = wxSIZE_AUTO ); - virtual void SetSize( int width, int height ); - - virtual bool Show( bool show ); - virtual int ShowModal(); - virtual void EndModal( int retCode ); - virtual bool IsModal() const; - void SetModal( bool modal ); - - virtual void InitDialog(void); - - virtual void Centre( int direction = wxHORIZONTAL ); - - virtual void SetIcon( const wxIcon &icon ); - virtual void Iconize( bool WXUNUSED(iconize)) { } - virtual bool IsIconized() const { return FALSE; } - bool Iconized() const { return IsIconized(); } - virtual void Maximize() { } - virtual void Restore() { } - -// implementation - - virtual void GtkOnSize( int x, int y, int width, int height ); - virtual void OnInternalIdle(); - - bool m_modalShowing; - wxString m_title; - wxIcon m_icon; - - DECLARE_EVENT_TABLE() + bool Create( wxWindow *parent, wxWindowID id, + const wxString &title, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = wxDEFAULT_DIALOG_STYLE, + const wxString &name = wxDialogNameStr ); + ~wxDialog(); + + void SetTitle(const wxString& title); + wxString GetTitle() const; + + void OnApply( wxCommandEvent &event ); + void OnCancel( wxCommandEvent &event ); + void OnOK( wxCommandEvent &event ); + void OnPaint( wxPaintEvent& event ); + void OnSize( wxSizeEvent &event ); + void OnCloseWindow( wxCloseEvent& event ); + /* + void OnCharHook( wxKeyEvent& event ); + */ + + bool Destroy(); + + virtual bool Show( bool show ); + virtual int ShowModal(); + virtual void EndModal( int retCode ); + virtual bool IsModal() const; + void SetModal( bool modal ); + + virtual void InitDialog(void); + + virtual void Centre( int direction = wxHORIZONTAL ); + + virtual void SetIcon( const wxIcon &icon ); + virtual void Iconize( bool WXUNUSED(iconize)) { } + virtual bool IsIconized() const { return FALSE; } + bool Iconized() const { return IsIconized(); } + virtual void Maximize() { } + virtual void Restore() { } + + // implementation + + virtual void GtkOnSize( int x, int y, int width, int height ); + virtual void OnInternalIdle(); + + bool m_modalShowing; + wxString m_title; + wxIcon m_icon; + +protected: + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); + +private: + DECLARE_EVENT_TABLE() }; #endif // __GTKDIALOGH__ diff --git a/include/wx/gtk/frame.h b/include/wx/gtk/frame.h index 671e1b783a..fc73faa091 100644 --- a/include/wx/gtk/frame.h +++ b/include/wx/gtk/frame.h @@ -46,82 +46,83 @@ extern const char *wxToolBarNameStr; class wxFrame: public wxWindow { - DECLARE_DYNAMIC_CLASS(wxFrame) -public: +DECLARE_DYNAMIC_CLASS(wxFrame) - wxFrame(); - wxFrame( wxWindow *parent, wxWindowID id, const wxString &title, - const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, const wxString &name = wxFrameNameStr ); - bool Create( wxWindow *parent, wxWindowID id, const wxString &title, - const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, const wxString &name = wxFrameNameStr ); - ~wxFrame(); - bool Destroy(); - - virtual bool Show( bool show ); - virtual void Centre( int direction = wxHORIZONTAL ); - - virtual void GetClientSize( int *width, int *height ) const; - wxSize GetClientSize() const { int w, h; GetClientSize(& w, & h); return wxSize(w, h); } - - virtual void SetClientSize( int width, int height ); - - virtual void SetSize( int x, int y, int width, int height, - int sizeFlags = wxSIZE_AUTO ); - virtual void SetSize( int width, int height ); - - virtual wxStatusBar* CreateStatusBar(int number=1, long style = wxST_SIZEGRIP, wxWindowID id = 0, - const wxString& name = "statusBar"); - virtual wxStatusBar *OnCreateStatusBar( int number, long style, wxWindowID id, - const wxString& name ); - virtual wxStatusBar *GetStatusBar() const; - inline void SetStatusBar(wxStatusBar *statusBar) { m_frameStatusBar = statusBar; } - virtual void SetStatusText( const wxString &text, int number = 0 ); - virtual void SetStatusWidths( int n, const int widths_field[] ); - - virtual wxToolBar* CreateToolBar( long style = wxNO_BORDER|wxTB_HORIZONTAL, wxWindowID id = -1, - const wxString& name = wxToolBarNameStr); - virtual wxToolBar *OnCreateToolBar( long style, wxWindowID id, const wxString& name ); - virtual wxToolBar *GetToolBar() const; - inline void SetToolBar(wxToolBar *toolbar) { m_frameToolBar = toolbar; } - - virtual void SetMenuBar( wxMenuBar *menuBar ); - virtual wxMenuBar *GetMenuBar() const; - - virtual void SetTitle( const wxString &title ); - virtual wxString GetTitle() const { return m_title; } - - virtual void SetIcon( const wxIcon &icon ); - virtual void Iconize( bool WXUNUSED(iconize)) { } - virtual bool IsIconized() const { return FALSE; } - bool Iconized() const { return IsIconized(); } - virtual void Maximize(bool WXUNUSED(maximize)) {} - virtual void Restore() {} - - void OnCloseWindow( wxCloseEvent& event ); - void OnActivate( wxActivateEvent &WXUNUSED(event) ) { } // called from docview.cpp - void OnSize( wxSizeEvent &event ); - - void OnMenuHighlight( wxMenuEvent& event ); - - // implementation - - virtual void GtkOnSize( int x, int y, int width, int height ); - virtual wxPoint GetClientAreaOrigin() const; - void DoMenuUpdates(); - void DoMenuUpdates(wxMenu* menu); - virtual void OnInternalIdle(); - - wxMenuBar *m_frameMenuBar; - wxMenuBar *m_mdiMenuBar; - wxStatusBar *m_frameStatusBar; - wxToolBar *m_frameToolBar; - wxString m_title; - wxIcon m_icon; - int m_miniEdge,m_miniTitle; - - DECLARE_EVENT_TABLE() +public: + wxFrame(); + wxFrame( wxWindow *parent, wxWindowID id, const wxString &title, + const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, const wxString &name = wxFrameNameStr ); + bool Create( wxWindow *parent, wxWindowID id, const wxString &title, + const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, const wxString &name = wxFrameNameStr ); + ~wxFrame(); + bool Destroy(); + + virtual bool Show( bool show ); + virtual void Centre( int direction = wxHORIZONTAL ); + + virtual void GetClientSize( int *width, int *height ) const; + + virtual wxStatusBar* CreateStatusBar(int number=1, long style = wxST_SIZEGRIP, wxWindowID id = 0, + const wxString& name = "statusBar"); + virtual wxStatusBar *OnCreateStatusBar( int number, long style, wxWindowID id, + const wxString& name ); + virtual wxStatusBar *GetStatusBar() const; + inline void SetStatusBar(wxStatusBar *statusBar) { m_frameStatusBar = statusBar; } + virtual void SetStatusText( const wxString &text, int number = 0 ); + virtual void SetStatusWidths( int n, const int widths_field[] ); + + virtual wxToolBar* CreateToolBar( long style = wxNO_BORDER|wxTB_HORIZONTAL, wxWindowID id = -1, + const wxString& name = wxToolBarNameStr); + virtual wxToolBar *OnCreateToolBar( long style, wxWindowID id, const wxString& name ); + virtual wxToolBar *GetToolBar() const; + inline void SetToolBar(wxToolBar *toolbar) { m_frameToolBar = toolbar; } + + virtual void SetMenuBar( wxMenuBar *menuBar ); + virtual wxMenuBar *GetMenuBar() const; + + virtual void SetTitle( const wxString &title ); + virtual wxString GetTitle() const { return m_title; } + + virtual void SetIcon( const wxIcon &icon ); + virtual void Iconize( bool WXUNUSED(iconize)) { } + virtual bool IsIconized() const { return FALSE; } + bool Iconized() const { return IsIconized(); } + virtual void Maximize(bool WXUNUSED(maximize)) {} + virtual void Restore() {} + + void OnCloseWindow( wxCloseEvent& event ); + void OnActivate( wxActivateEvent &WXUNUSED(event) ) { } // called from docview.cpp + void OnSize( wxSizeEvent &event ); + + void OnMenuHighlight( wxMenuEvent& event ); + + // implementation + + virtual void GtkOnSize( int x, int y, int width, int height ); + virtual wxPoint GetClientAreaOrigin() const; + void DoMenuUpdates(); + void DoMenuUpdates(wxMenu* menu); + virtual void OnInternalIdle(); + + wxMenuBar *m_frameMenuBar; + wxMenuBar *m_mdiMenuBar; + wxStatusBar *m_frameStatusBar; + wxToolBar *m_frameToolBar; + wxString m_title; + wxIcon m_icon; + int m_miniEdge,m_miniTitle; + +protected: + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); + + virtual void DoSetClientSize(int width, int height); + +private: + DECLARE_EVENT_TABLE() }; #endif // __GTKFRAMEH__ diff --git a/include/wx/gtk/mdi.h b/include/wx/gtk/mdi.h index cde7a8983d..d49600fa0a 100644 --- a/include/wx/gtk/mdi.h +++ b/include/wx/gtk/mdi.h @@ -131,8 +131,11 @@ class wxMDIChildFrame: public wxFrame virtual void SetStatusWidths( int WXUNUSED(n), int *WXUNUSED(width) ) {} // no size hints - virtual void SetSizeHints( int WXUNUSED(minW), int WXUNUSED(minH), int WXUNUSED(maxW), - int WXUNUSED(maxH), int WXUNUSED(incW) ) {} + virtual void SetSizeHints( int WXUNUSED(minW), int WXUNUSED(minH), + int WXUNUSED(maxW), int WXUNUSED(maxH), + int WXUNUSED(incW) ) + { + } // no toolbar bars virtual wxToolBar* CreateToolBar( long WXUNUSED(style), wxWindowID WXUNUSED(id), diff --git a/include/wx/gtk/window.h b/include/wx/gtk/window.h index b2d326bf5a..8e0eeacfe7 100644 --- a/include/wx/gtk/window.h +++ b/include/wx/gtk/window.h @@ -12,7 +12,7 @@ #define __GTKWINDOWH__ #ifdef __GNUG__ -#pragma interface + #pragma interface #endif #include "wx/defs.h" @@ -36,7 +36,7 @@ extern wxList wxTopLevelWindows; // global function //----------------------------------------------------------------------------- -wxWindow* wxGetActiveWindow(); +extern wxWindow* wxGetActiveWindow(); //----------------------------------------------------------------------------- // classes @@ -49,11 +49,11 @@ class wxClientData; class wxVoidClientData; class wxWindow; #if wxUSE_WX_RESOURCES -class wxResourceTable; -class wxItemResource; + class wxResourceTable; + class wxItemResource; #endif #if wxUSE_DRAG_AND_DROP -class wxDropTarget; + class wxDropTarget; #endif class wxToolTip; @@ -78,15 +78,15 @@ extern const wxPoint wxDefaultPosition; class wxClientData { public: - wxClientData() { } - virtual ~wxClientData() { } + wxClientData() { } + virtual ~wxClientData() { } }; //----------------------------------------------------------------------------- // wxStringClientData //----------------------------------------------------------------------------- -class wxStringClientData: public wxClientData +class wxStringClientData : public wxClientData { public: wxStringClientData() { } @@ -112,336 +112,438 @@ void debug_focus_in( GtkWidget* widget, const char* name, const char* window ); // wxWindow //----------------------------------------------------------------------------- -class wxWindow: public wxEvtHandler +class wxWindow : public wxEvtHandler { - DECLARE_DYNAMIC_CLASS(wxWindow) + DECLARE_DYNAMIC_CLASS(wxWindow) public: - wxWindow(); - wxWindow(wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxPanelNameStr); - bool Create(wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxPanelNameStr); - virtual ~wxWindow(); + // creating the window + // ------------------- + wxWindow(); + wxWindow(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxPanelNameStr); + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxPanelNameStr); + virtual ~wxWindow(); #if wxUSE_WX_RESOURCES - virtual bool LoadFromResource( wxWindow *parent, const wxString& resourceName, - const wxResourceTable *table = (const wxResourceTable *) NULL); - virtual wxControl *CreateItem(const wxItemResource* childResource, const wxItemResource* parentResource, - const wxResourceTable *table = (const wxResourceTable *) NULL); -#endif + virtual bool LoadFromResource(wxWindow *parent, + const wxString& resourceName, + const wxResourceTable *table = (const wxResourceTable *) NULL); + virtual wxControl *CreateItem(const wxItemResource* childResource, + const wxItemResource* parentResource, + const wxResourceTable *table = (const wxResourceTable *) NULL); +#endif // wxUSE_WX_RESOURCES + + // closing the window + // ------------------ + bool Close( bool force = FALSE ); + virtual bool Destroy(); + virtual bool DestroyChildren(); + + bool IsBeingDeleted(); + + // moving/resizing + // --------------- + + // set the window size and/or position + void SetSize( int x, int y, int width, int height, + int sizeFlags = wxSIZE_AUTO ) + { DoSetSize(x, y, width, height, sizeFlags); } + + void SetSize( int width, int height ) + { DoSetSize( -1, -1, width, height, wxSIZE_USE_EXISTING ); } + + void SetSize( const wxSize& size ) + { SetSize( size.x, size.y); } + + void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO) + { DoSetSize(rect.x, rect.y, rect.width, rect.height, sizeFlags); } + + void Move( int x, int y ) + { DoSetSize( x, y, -1, -1, wxSIZE_USE_EXISTING ); } + + void Move(const wxPoint& pt) + { Move(pt.x, pt.y); } + + // client size is the size of area available for subwindows + void SetClientSize( int width, int height ) + { DoSetClientSize(width, height); } + + void SetClientSize( const wxSize& size ) + { DoSetClientSize(size.x, size.y); } + + void SetClientSize(const wxRect& rect) + { SetClientSize( rect.width, rect.height ); } + + // get the window position and/or size + virtual void GetPosition( int *x, int *y ) const; + wxPoint GetPosition() const + { + int w, h; + GetPosition(& w, & h); + + return wxPoint(w, h); + } + + virtual void GetSize( int *width, int *height ) const; + + wxSize GetSize() const + { + int w, h; + GetSize(& w, & h); + return wxSize(w, h); + } + + wxRect GetRect() const + { + int x, y, w, h; + GetPosition(& x, & y); + GetSize(& w, & h); + + return wxRect(x, y, w, h); + } - bool Close( bool force = FALSE ); - virtual bool Destroy(); - virtual bool DestroyChildren(); + virtual void GetClientSize( int *width, int *height ) const; + wxSize GetClientSize() const + { + int w, h; + GetClientSize(& w, & h); + return wxSize(w, h); + } - virtual void PrepareDC( wxDC &dc ); + // position with respect to the the parent window + virtual void Centre( int direction = wxHORIZONTAL ); + void Center(int direction = wxHORIZONTAL) { Centre(direction); } + virtual void Fit(); - virtual void SetSize( int x, int y, int width, int height, - int sizeFlags = wxSIZE_AUTO ); - virtual void SetSize( int width, int height ); + // set min/max size of the window + virtual void SetSizeHints( int minW, int minH, + int maxW = -1, int maxH = -1, + int incW = -1, int incH = -1 ); - virtual void Move( int x, int y ); + // Dialog units translations. Implemented in wincmn.cpp. + // ----------------------------------------------------- - virtual void GetSize( int *width, int *height ) const; - wxSize GetSize() const { int w, h; GetSize(& w, & h); return wxSize(w, h); } + wxPoint ConvertPixelsToDialog( const wxPoint& pt ); + wxPoint ConvertDialogToPixels( const wxPoint& pt ); + wxSize ConvertPixelsToDialog( const wxSize& sz ) + { + wxPoint pt(ConvertPixelsToDialog(wxPoint(sz.x, sz.y))); + + return wxSize(pt.x, pt.y); + } - virtual void SetClientSize( int width, int height ); + wxSize ConvertDialogToPixels( const wxSize& sz ) + { + wxPoint pt(ConvertDialogToPixels(wxPoint(sz.x, sz.y))); - virtual void GetClientSize( int *width, int *height ) const; - wxSize GetClientSize() const { int w, h; GetClientSize(& w, & h); return wxSize(w, h); } + return wxSize(pt.x, pt.y); + } - virtual void GetPosition( int *x, int *y ) const; - wxPoint GetPosition() const { int w, h; GetPosition(& w, & h); return wxPoint(w, h); } + void OnSize( wxSizeEvent &event ); - wxRect GetRect() const - { int x, y, w, h; GetPosition(& x, & y); GetSize(& w, & h); return wxRect(x, y, w, h); } + // window state + // ------------ - virtual void Centre( int direction = wxHORIZONTAL ); - inline void Center(int direction = wxHORIZONTAL) { Centre(direction); } - virtual void Fit(); + virtual bool Show( bool show ); + virtual void Enable( bool enable ); + virtual void MakeModal( bool modal ); + virtual bool IsEnabled() const { return m_isEnabled; } + inline bool Enabled() const { return IsEnabled(); } - virtual void SetSizeHints( int minW, int minH, int maxW = -1, int maxH = -1, int incW = -1, int incH = -1 ); + virtual void SetFocus(); + static wxWindow *FindFocus(); - /* Dialog units translations. Implemented in wincmn.cpp. */ - wxPoint ConvertPixelsToDialog( const wxPoint& pt ); - wxPoint ConvertDialogToPixels( const wxPoint& pt ); - inline wxSize ConvertPixelsToDialog( const wxSize& sz ) - { wxPoint pt(ConvertPixelsToDialog(wxPoint(sz.x, sz.y))); return wxSize(pt.x, pt.y); } - inline wxSize ConvertDialogToPixels( const wxSize& sz ) - { wxPoint pt(ConvertDialogToPixels(wxPoint(sz.x, sz.y))); return wxSize(pt.x, pt.y); } + void SetReturnCode( int retCode ); + int GetReturnCode(); - void OnSize( wxSizeEvent &event ); + // parent/children relations + // ------------------------- - virtual bool Show( bool show ); - virtual void Enable( bool enable ); - virtual void MakeModal( bool modal ); - virtual bool IsEnabled() const { return m_isEnabled; } - inline bool Enabled() const { return IsEnabled(); } + virtual void AddChild( wxWindow *child ); + wxList& GetChildren() { return m_children; } - virtual void SetFocus(); - static wxWindow *FindFocus(); + virtual void RemoveChild( wxWindow *child ); - virtual void AddChild( wxWindow *child ); - wxList& GetChildren() { return m_children; } + wxWindow *GetParent() const + { return m_parent; } + wxWindow *GetGrandParent() const + { return (m_parent ? m_parent->m_parent : (wxWindow*)NULL); } + void SetParent( wxWindow *parent ) + { m_parent = parent; } + virtual wxWindow *ReParent( wxWindow *newParent ); - virtual void RemoveChild( wxWindow *child ); - void SetReturnCode( int retCode ); - int GetReturnCode(); + // event handler stuff + // ------------------- - wxWindow *GetParent() const - { return m_parent; } - wxWindow *GetGrandParent() const - { return (m_parent ? m_parent->m_parent : (wxWindow*)NULL); } - void SetParent( wxWindow *parent ) - { m_parent = parent; } - virtual wxWindow *ReParent( wxWindow *newParent ); + wxEvtHandler *GetEventHandler() const; + void SetEventHandler( wxEvtHandler *handler ); + void PushEventHandler( wxEvtHandler *handler ); + wxEvtHandler *PopEventHandler( bool deleteHandler = FALSE ); - wxEvtHandler *GetEventHandler() const; - void SetEventHandler( wxEvtHandler *handler ); - void PushEventHandler( wxEvtHandler *handler ); - wxEvtHandler *PopEventHandler( bool deleteHandler = FALSE ); + // validators and client data + // -------------------------- - virtual void SetValidator( const wxValidator &validator ); - virtual wxValidator *GetValidator(); + virtual void SetValidator( const wxValidator &validator ); + virtual wxValidator *GetValidator(); - virtual void SetClientObject( wxClientData *data ); - virtual wxClientData *GetClientObject(); + virtual void SetClientObject( wxClientData *data ); + virtual wxClientData *GetClientObject(); - virtual void SetClientData( void *data ); - virtual void *GetClientData(); + virtual void SetClientData( void *data ); + virtual void *GetClientData(); - virtual void SetAcceleratorTable( const wxAcceleratorTable& accel ); - virtual wxAcceleratorTable *GetAcceleratorTable() { return &m_acceleratorTable; } + // accelerators + // ------------ + virtual void SetAcceleratorTable( const wxAcceleratorTable& accel ); + virtual wxAcceleratorTable *GetAcceleratorTable() { return &m_acceleratorTable; } - bool IsBeingDeleted(); + void SetId( wxWindowID id ); + wxWindowID GetId() const; - void SetId( wxWindowID id ); - wxWindowID GetId() const; + void SetCursor( const wxCursor &cursor ); - void SetCursor( const wxCursor &cursor ); + virtual void PrepareDC( wxDC &dc ); - void WarpPointer(int x, int y); + void WarpPointer(int x, int y); #if wxUSE_TOOLTIPS - void SetToolTip( const wxString &tip ); - virtual void SetToolTip( wxToolTip *tip ); - wxToolTip* GetToolTip() const { return m_toolTip; } + void SetToolTip( const wxString &tip ); + virtual void SetToolTip( wxToolTip *tip ); + wxToolTip* GetToolTip() const { return m_toolTip; } #endif // wxUSE_TOOLTIPS - virtual void Refresh( bool eraseBackground = TRUE, const wxRect *rect = (const wxRect *) NULL ); - virtual void Clear(); + virtual void Refresh( bool eraseBackground = TRUE, const wxRect *rect = (const wxRect *) NULL ); + virtual void Clear(); + + virtual wxRegion GetUpdateRegion() const; + virtual bool IsExposed( int x, int y ) const; + virtual bool IsExposed( int x, int y, int w, int h ) const; + virtual bool IsExposed( const wxPoint& pt ) const; + virtual bool IsExposed( const wxRect& rect ) const; + + // colours + // ------- - virtual wxRegion GetUpdateRegion() const; - virtual bool IsExposed( int x, int y ) const; - virtual bool IsExposed( int x, int y, int w, int h ) const; - virtual bool IsExposed( const wxPoint& pt ) const; - virtual bool IsExposed( const wxRect& rect ) const; + virtual wxColour GetBackgroundColour() const; + virtual void SetBackgroundColour( const wxColour &colour ); + virtual wxColour GetForegroundColour() const; + virtual void SetForegroundColour( const wxColour &colour ); - virtual wxColour GetBackgroundColour() const; - virtual void SetBackgroundColour( const wxColour &colour ); - virtual wxColour GetForegroundColour() const; - virtual void SetForegroundColour( const wxColour &colour ); + // fonts + // ----- - virtual int GetCharHeight() const; - virtual int GetCharWidth() const; - virtual void GetTextExtent( const wxString& string, int *x, int *y, - int *descent = (int *) NULL, - int *externalLeading = (int *) NULL, - const wxFont *theFont = (const wxFont *) NULL, bool use16 = FALSE) const; + virtual int GetCharHeight() const; + virtual int GetCharWidth() const; + virtual void GetTextExtent( const wxString& string, int *x, int *y, + int *descent = (int *) NULL, + int *externalLeading = (int *) NULL, + const wxFont *theFont = (const wxFont *) NULL, bool use16 = FALSE) const; - virtual void SetFont( const wxFont &font ); - virtual wxFont& GetFont() { return m_font; } + virtual void SetFont( const wxFont &font ); + virtual wxFont& GetFont() { return m_font; } // For backward compatibility - virtual void SetButtonFont(const wxFont& font) { SetFont(font); } - virtual void SetLabelFont(const wxFont& font) { SetFont(font); } - virtual wxFont& GetLabelFont() { return GetFont(); }; - virtual wxFont& GetButtonFont() { return GetFont(); }; + virtual void SetButtonFont(const wxFont& font) { SetFont(font); } + virtual void SetLabelFont(const wxFont& font) { SetFont(font); } + virtual wxFont& GetLabelFont() { return GetFont(); }; + virtual wxFont& GetButtonFont() { return GetFont(); }; - virtual void SetWindowStyleFlag( long flag ); - virtual long GetWindowStyleFlag() const; + virtual void SetWindowStyleFlag( long flag ); + virtual long GetWindowStyleFlag() const; - virtual void CaptureMouse(); - virtual void ReleaseMouse(); + virtual void CaptureMouse(); + virtual void ReleaseMouse(); - virtual void SetTitle( const wxString &title ); - virtual wxString GetTitle() const; - virtual void SetName( const wxString &name ); - virtual wxString GetName() const; - virtual wxString GetLabel() const; + virtual void SetTitle( const wxString &title ); + virtual wxString GetTitle() const; + virtual void SetName( const wxString &name ); + virtual wxString GetName() const; + virtual wxString GetLabel() const; - void OnSysColourChanged( wxSysColourChangedEvent &WXUNUSED(event) ) { } - void OnKeyDown( wxKeyEvent &event ); + void OnSysColourChanged( wxSysColourChangedEvent &WXUNUSED(event) ) { } + void OnKeyDown( wxKeyEvent &event ); - virtual bool IsShown() const; + virtual bool IsShown() const; - virtual void Raise(); - virtual void Lower(); + virtual void Raise(); + virtual void Lower(); - virtual bool IsRetained(); - virtual wxWindow *FindWindow( long id ); - virtual wxWindow *FindWindow( const wxString& name ); + virtual bool IsRetained(); + virtual wxWindow *FindWindow( long id ); + virtual wxWindow *FindWindow( const wxString& name ); - void AllowDoubleClick( bool WXUNUSED(allow) ) { } - void SetDoubleClick( bool WXUNUSED(allow) ) { } + void AllowDoubleClick( bool WXUNUSED(allow) ) { } + void SetDoubleClick( bool WXUNUSED(allow) ) { } - virtual void ClientToScreen( int *x, int *y ); - virtual void ScreenToClient( int *x, int *y ); + virtual void ClientToScreen( int *x, int *y ); + virtual void ScreenToClient( int *x, int *y ); - virtual bool Validate(); - virtual bool TransferDataToWindow(); - virtual bool TransferDataFromWindow(); - void OnInitDialog( wxInitDialogEvent &event ); - virtual void InitDialog(); + virtual bool Validate(); + virtual bool TransferDataToWindow(); + virtual bool TransferDataFromWindow(); + void OnInitDialog( wxInitDialogEvent &event ); + virtual void InitDialog(); - virtual bool PopupMenu( wxMenu *menu, int x, int y ); + virtual bool PopupMenu( wxMenu *menu, int x, int y ); #if wxUSE_DRAG_AND_DROP - virtual void SetDropTarget( wxDropTarget *dropTarget ); - virtual wxDropTarget *GetDropTarget() const; + virtual void SetDropTarget( wxDropTarget *dropTarget ); + virtual wxDropTarget *GetDropTarget() const; #endif - virtual void SetScrollbar( int orient, int pos, int thumbVisible, - int range, bool refresh = TRUE ); - virtual void SetScrollPos( int orient, int pos, bool refresh = TRUE ); - virtual int GetScrollPos( int orient ) const; - virtual int GetScrollThumb( int orient ) const; - virtual int GetScrollRange( int orient ) const; - virtual void ScrollWindow( int dx, int dy, const wxRect* rect = (wxRect *) NULL ); + virtual void SetScrollbar( int orient, int pos, int thumbVisible, + int range, bool refresh = TRUE ); + virtual void SetScrollPos( int orient, int pos, bool refresh = TRUE ); + virtual int GetScrollPos( int orient ) const; + virtual int GetScrollThumb( int orient ) const; + virtual int GetScrollRange( int orient ) const; + virtual void ScrollWindow( int dx, int dy, const wxRect* rect = (wxRect *) NULL ); - virtual bool AcceptsFocus() const; + virtual bool AcceptsFocus() const; - void UpdateWindowUI(); + void UpdateWindowUI(); - // implementation + // implementation - virtual wxPoint GetClientAreaOrigin() const; - virtual void AdjustForParentClientOrigin( int& x, int& y, int sizeFlags ); + virtual wxPoint GetClientAreaOrigin() const; + virtual void AdjustForParentClientOrigin( int& x, int& y, int sizeFlags ); - bool HasVMT(); + bool HasVMT(); - virtual void OnInternalIdle(); + virtual void OnInternalIdle(); - /* used by all classes in the widget creation process */ + /* used by all classes in the widget creation process */ - void PreCreation( wxWindow *parent, wxWindowID id, const wxPoint &pos, - const wxSize &size, long style, const wxString &name ); - void PostCreation(); + void PreCreation( wxWindow *parent, wxWindowID id, const wxPoint &pos, + const wxSize &size, long style, const wxString &name ); + void PostCreation(); - /* the methods below are required because many native widgets - are composed of several subwidgets and setting a style for - the widget means setting it for all subwidgets as well. - also, it is nor clear, which native widget is the top - widget where (most of) the input goes. even tooltips have - to be applied to all subwidgets. */ + /* the methods below are required because many native widgets + are composed of several subwidgets and setting a style for + the widget means setting it for all subwidgets as well. + also, it is nor clear, which native widget is the top + widget where (most of) the input goes. even tooltips have + to be applied to all subwidgets. */ - virtual GtkWidget* GetConnectWidget(); - virtual bool IsOwnGtkWindow( GdkWindow *window ); - void ConnectWidget( GtkWidget *widget ); + virtual GtkWidget* GetConnectWidget(); + virtual bool IsOwnGtkWindow( GdkWindow *window ); + void ConnectWidget( GtkWidget *widget ); - GtkStyle *GetWidgetStyle(); - void SetWidgetStyle(); - virtual void ApplyWidgetStyle(); + GtkStyle *GetWidgetStyle(); + void SetWidgetStyle(); + virtual void ApplyWidgetStyle(); #if wxUSE_TOOLTIPS - virtual void ApplyToolTip( GtkTooltips *tips, const char *tip ); + virtual void ApplyToolTip( GtkTooltips *tips, const char *tip ); #endif // wxUSE_TOOLTIPS - /* private member variables */ - - wxWindow *m_parent; - wxList m_children; - int m_x,m_y; - int m_width,m_height; - int m_minWidth,m_minHeight; - int m_maxWidth,m_maxHeight; - int m_retCode; - wxEvtHandler *m_eventHandler; - wxValidator *m_windowValidator; + /* private member variables */ + + wxWindow *m_parent; + wxList m_children; + int m_x,m_y; + int m_width,m_height; + int m_minWidth,m_minHeight; + int m_maxWidth,m_maxHeight; + int m_retCode; + wxEvtHandler *m_eventHandler; + wxValidator *m_windowValidator; #if wxUSE_DRAG_AND_DROP - wxDropTarget *m_dropTarget; + wxDropTarget *m_dropTarget; #endif - wxWindowID m_windowId; - wxCursor *m_cursor; - wxFont m_font; - wxColour m_backgroundColour; - wxColour m_foregroundColour; - wxRegion m_updateRegion; - long m_windowStyle; - bool m_isShown; - bool m_isEnabled; - wxString m_windowName; - wxAcceleratorTable m_acceleratorTable; - wxClientData *m_clientObject; - void *m_clientData; + wxWindowID m_windowId; + wxCursor *m_cursor; + wxFont m_font; + wxColour m_backgroundColour; + wxColour m_foregroundColour; + wxRegion m_updateRegion; + long m_windowStyle; + bool m_isShown; + bool m_isEnabled; + wxString m_windowName; + wxAcceleratorTable m_acceleratorTable; + wxClientData *m_clientObject; + void *m_clientData; #if wxUSE_TOOLTIPS - wxToolTip *m_toolTip; + wxToolTip *m_toolTip; #endif // wxUSE_TOOLTIPS - GtkWidget *m_widget; - GtkWidget *m_wxwindow; - GtkAdjustment *m_hAdjust,*m_vAdjust; - float m_oldHorizontalPos; - float m_oldVerticalPos; - bool m_needParent; - bool m_hasScrolling; - bool m_isScrolling; - bool m_hasVMT; - bool m_sizeSet; - bool m_resizing; - GdkGC *m_scrollGC; - GtkStyle *m_widgetStyle; - bool m_isStaticBox; - bool m_acceptsFocus; - - wxInsertChildFunction m_insertCallback; + GtkWidget *m_widget; + GtkWidget *m_wxwindow; + GtkAdjustment *m_hAdjust,*m_vAdjust; + float m_oldHorizontalPos; + float m_oldVerticalPos; + bool m_needParent; + bool m_hasScrolling; + bool m_isScrolling; + bool m_hasVMT; + bool m_sizeSet; + bool m_resizing; + GdkGC *m_scrollGC; + GtkStyle *m_widgetStyle; + bool m_isStaticBox; + bool m_acceptsFocus; + + wxInsertChildFunction m_insertCallback; public: - wxLayoutConstraints *m_constraints; - wxList *m_constraintsInvolvedIn; - wxSizer *m_windowSizer; - wxWindow *m_sizerParent; - bool m_autoLayout; - - wxLayoutConstraints *GetConstraints() const; - void SetConstraints( wxLayoutConstraints *constraints ); - void SetAutoLayout( bool autoLayout ); - bool GetAutoLayout() const; - bool Layout(); - void SetSizer( wxSizer *sizer ); - wxSizer *GetSizer() const; - void SetSizerParent( wxWindow *win ); - wxWindow *GetSizerParent() const; - void UnsetConstraints(wxLayoutConstraints *c); - inline wxList *GetConstraintsInvolvedIn() const ; - void AddConstraintReference(wxWindow *otherWin); - void RemoveConstraintReference(wxWindow *otherWin); - void DeleteRelatedConstraints(); - virtual void ResetConstraints(); - virtual void SetConstraintSizes(bool recurse = TRUE); - virtual bool LayoutPhase1(int *noChanges); - virtual bool LayoutPhase2(int *noChanges); - virtual bool DoPhase(int); - virtual void TransformSizerToActual(int *x, int *y) const ; - virtual void SizerSetSize(int x, int y, int w, int h); - virtual void SizerMove(int x, int y); - virtual void SetSizeConstraint(int x, int y, int w, int h); - virtual void MoveConstraint(int x, int y); - virtual void GetSizeConstraint(int *w, int *h) const ; - virtual void GetClientSizeConstraint(int *w, int *h) const ; - virtual void GetPositionConstraint(int *x, int *y) const ; + wxLayoutConstraints *m_constraints; + wxList *m_constraintsInvolvedIn; + wxSizer *m_windowSizer; + wxWindow *m_sizerParent; + bool m_autoLayout; + + wxLayoutConstraints *GetConstraints() const; + void SetConstraints( wxLayoutConstraints *constraints ); + void SetAutoLayout( bool autoLayout ); + bool GetAutoLayout() const; + bool Layout(); + void SetSizer( wxSizer *sizer ); + wxSizer *GetSizer() const; + void SetSizerParent( wxWindow *win ); + wxWindow *GetSizerParent() const; + void UnsetConstraints(wxLayoutConstraints *c); + inline wxList *GetConstraintsInvolvedIn() const ; + void AddConstraintReference(wxWindow *otherWin); + void RemoveConstraintReference(wxWindow *otherWin); + void DeleteRelatedConstraints(); + virtual void ResetConstraints(); + virtual void SetConstraintSizes(bool recurse = TRUE); + virtual bool LayoutPhase1(int *noChanges); + virtual bool LayoutPhase2(int *noChanges); + virtual bool DoPhase(int); + virtual void TransformSizerToActual(int *x, int *y) const ; + virtual void SizerSetSize(int x, int y, int w, int h); + virtual void SizerMove(int x, int y); + virtual void SetSizeConstraint(int x, int y, int w, int h); + virtual void MoveConstraint(int x, int y); + virtual void GetSizeConstraint(int *w, int *h) const ; + virtual void GetClientSizeConstraint(int *w, int *h) const ; + virtual void GetPositionConstraint(int *x, int *y) const ; + +protected: + // this is the virtual function to be overriden in any derived class which + // wants to change how SetSize() or Move() works - it is called by all + // versions of these functions in the base class + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); + + // same as DoSetSize() for the client size + virtual void DoSetClientSize(int width, int height); private: - DECLARE_EVENT_TABLE() + DECLARE_EVENT_TABLE() }; #endif // __GTKWINDOWH__ diff --git a/include/wx/gtk1/dialog.h b/include/wx/gtk1/dialog.h index 0c7ea69240..002c3e1bed 100644 --- a/include/wx/gtk1/dialog.h +++ b/include/wx/gtk1/dialog.h @@ -37,70 +37,72 @@ extern const char *wxDialogNameStr; class wxDialog: public wxPanel { - DECLARE_DYNAMIC_CLASS(wxDialog) + DECLARE_DYNAMIC_CLASS(wxDialog) public: - wxDialog(); - wxDialog( wxWindow *parent, wxWindowID id, + wxDialog(); + wxDialog( wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE, const wxString &name = wxDialogNameStr ); - bool Create( wxWindow *parent, wxWindowID id, - const wxString &title, - const wxPoint &pos = wxDefaultPosition, - const wxSize &size = wxDefaultSize, - long style = wxDEFAULT_DIALOG_STYLE, - const wxString &name = wxDialogNameStr ); - ~wxDialog(); - - void SetTitle(const wxString& title); - wxString GetTitle() const; - - void OnApply( wxCommandEvent &event ); - void OnCancel( wxCommandEvent &event ); - void OnOK( wxCommandEvent &event ); - void OnPaint( wxPaintEvent& event ); - void OnSize( wxSizeEvent &event ); - void OnCloseWindow( wxCloseEvent& event ); -/* - void OnCharHook( wxKeyEvent& event ); -*/ - - bool Destroy(); - - virtual void SetSize( int x, int y, int width, int height, - int sizeFlags = wxSIZE_AUTO ); - virtual void SetSize( int width, int height ); - - virtual bool Show( bool show ); - virtual int ShowModal(); - virtual void EndModal( int retCode ); - virtual bool IsModal() const; - void SetModal( bool modal ); - - virtual void InitDialog(void); - - virtual void Centre( int direction = wxHORIZONTAL ); - - virtual void SetIcon( const wxIcon &icon ); - virtual void Iconize( bool WXUNUSED(iconize)) { } - virtual bool IsIconized() const { return FALSE; } - bool Iconized() const { return IsIconized(); } - virtual void Maximize() { } - virtual void Restore() { } - -// implementation - - virtual void GtkOnSize( int x, int y, int width, int height ); - virtual void OnInternalIdle(); - - bool m_modalShowing; - wxString m_title; - wxIcon m_icon; - - DECLARE_EVENT_TABLE() + bool Create( wxWindow *parent, wxWindowID id, + const wxString &title, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = wxDEFAULT_DIALOG_STYLE, + const wxString &name = wxDialogNameStr ); + ~wxDialog(); + + void SetTitle(const wxString& title); + wxString GetTitle() const; + + void OnApply( wxCommandEvent &event ); + void OnCancel( wxCommandEvent &event ); + void OnOK( wxCommandEvent &event ); + void OnPaint( wxPaintEvent& event ); + void OnSize( wxSizeEvent &event ); + void OnCloseWindow( wxCloseEvent& event ); + /* + void OnCharHook( wxKeyEvent& event ); + */ + + bool Destroy(); + + virtual bool Show( bool show ); + virtual int ShowModal(); + virtual void EndModal( int retCode ); + virtual bool IsModal() const; + void SetModal( bool modal ); + + virtual void InitDialog(void); + + virtual void Centre( int direction = wxHORIZONTAL ); + + virtual void SetIcon( const wxIcon &icon ); + virtual void Iconize( bool WXUNUSED(iconize)) { } + virtual bool IsIconized() const { return FALSE; } + bool Iconized() const { return IsIconized(); } + virtual void Maximize() { } + virtual void Restore() { } + + // implementation + + virtual void GtkOnSize( int x, int y, int width, int height ); + virtual void OnInternalIdle(); + + bool m_modalShowing; + wxString m_title; + wxIcon m_icon; + +protected: + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); + +private: + DECLARE_EVENT_TABLE() }; #endif // __GTKDIALOGH__ diff --git a/include/wx/gtk1/frame.h b/include/wx/gtk1/frame.h index 671e1b783a..fc73faa091 100644 --- a/include/wx/gtk1/frame.h +++ b/include/wx/gtk1/frame.h @@ -46,82 +46,83 @@ extern const char *wxToolBarNameStr; class wxFrame: public wxWindow { - DECLARE_DYNAMIC_CLASS(wxFrame) -public: +DECLARE_DYNAMIC_CLASS(wxFrame) - wxFrame(); - wxFrame( wxWindow *parent, wxWindowID id, const wxString &title, - const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, const wxString &name = wxFrameNameStr ); - bool Create( wxWindow *parent, wxWindowID id, const wxString &title, - const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, const wxString &name = wxFrameNameStr ); - ~wxFrame(); - bool Destroy(); - - virtual bool Show( bool show ); - virtual void Centre( int direction = wxHORIZONTAL ); - - virtual void GetClientSize( int *width, int *height ) const; - wxSize GetClientSize() const { int w, h; GetClientSize(& w, & h); return wxSize(w, h); } - - virtual void SetClientSize( int width, int height ); - - virtual void SetSize( int x, int y, int width, int height, - int sizeFlags = wxSIZE_AUTO ); - virtual void SetSize( int width, int height ); - - virtual wxStatusBar* CreateStatusBar(int number=1, long style = wxST_SIZEGRIP, wxWindowID id = 0, - const wxString& name = "statusBar"); - virtual wxStatusBar *OnCreateStatusBar( int number, long style, wxWindowID id, - const wxString& name ); - virtual wxStatusBar *GetStatusBar() const; - inline void SetStatusBar(wxStatusBar *statusBar) { m_frameStatusBar = statusBar; } - virtual void SetStatusText( const wxString &text, int number = 0 ); - virtual void SetStatusWidths( int n, const int widths_field[] ); - - virtual wxToolBar* CreateToolBar( long style = wxNO_BORDER|wxTB_HORIZONTAL, wxWindowID id = -1, - const wxString& name = wxToolBarNameStr); - virtual wxToolBar *OnCreateToolBar( long style, wxWindowID id, const wxString& name ); - virtual wxToolBar *GetToolBar() const; - inline void SetToolBar(wxToolBar *toolbar) { m_frameToolBar = toolbar; } - - virtual void SetMenuBar( wxMenuBar *menuBar ); - virtual wxMenuBar *GetMenuBar() const; - - virtual void SetTitle( const wxString &title ); - virtual wxString GetTitle() const { return m_title; } - - virtual void SetIcon( const wxIcon &icon ); - virtual void Iconize( bool WXUNUSED(iconize)) { } - virtual bool IsIconized() const { return FALSE; } - bool Iconized() const { return IsIconized(); } - virtual void Maximize(bool WXUNUSED(maximize)) {} - virtual void Restore() {} - - void OnCloseWindow( wxCloseEvent& event ); - void OnActivate( wxActivateEvent &WXUNUSED(event) ) { } // called from docview.cpp - void OnSize( wxSizeEvent &event ); - - void OnMenuHighlight( wxMenuEvent& event ); - - // implementation - - virtual void GtkOnSize( int x, int y, int width, int height ); - virtual wxPoint GetClientAreaOrigin() const; - void DoMenuUpdates(); - void DoMenuUpdates(wxMenu* menu); - virtual void OnInternalIdle(); - - wxMenuBar *m_frameMenuBar; - wxMenuBar *m_mdiMenuBar; - wxStatusBar *m_frameStatusBar; - wxToolBar *m_frameToolBar; - wxString m_title; - wxIcon m_icon; - int m_miniEdge,m_miniTitle; - - DECLARE_EVENT_TABLE() +public: + wxFrame(); + wxFrame( wxWindow *parent, wxWindowID id, const wxString &title, + const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, const wxString &name = wxFrameNameStr ); + bool Create( wxWindow *parent, wxWindowID id, const wxString &title, + const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, const wxString &name = wxFrameNameStr ); + ~wxFrame(); + bool Destroy(); + + virtual bool Show( bool show ); + virtual void Centre( int direction = wxHORIZONTAL ); + + virtual void GetClientSize( int *width, int *height ) const; + + virtual wxStatusBar* CreateStatusBar(int number=1, long style = wxST_SIZEGRIP, wxWindowID id = 0, + const wxString& name = "statusBar"); + virtual wxStatusBar *OnCreateStatusBar( int number, long style, wxWindowID id, + const wxString& name ); + virtual wxStatusBar *GetStatusBar() const; + inline void SetStatusBar(wxStatusBar *statusBar) { m_frameStatusBar = statusBar; } + virtual void SetStatusText( const wxString &text, int number = 0 ); + virtual void SetStatusWidths( int n, const int widths_field[] ); + + virtual wxToolBar* CreateToolBar( long style = wxNO_BORDER|wxTB_HORIZONTAL, wxWindowID id = -1, + const wxString& name = wxToolBarNameStr); + virtual wxToolBar *OnCreateToolBar( long style, wxWindowID id, const wxString& name ); + virtual wxToolBar *GetToolBar() const; + inline void SetToolBar(wxToolBar *toolbar) { m_frameToolBar = toolbar; } + + virtual void SetMenuBar( wxMenuBar *menuBar ); + virtual wxMenuBar *GetMenuBar() const; + + virtual void SetTitle( const wxString &title ); + virtual wxString GetTitle() const { return m_title; } + + virtual void SetIcon( const wxIcon &icon ); + virtual void Iconize( bool WXUNUSED(iconize)) { } + virtual bool IsIconized() const { return FALSE; } + bool Iconized() const { return IsIconized(); } + virtual void Maximize(bool WXUNUSED(maximize)) {} + virtual void Restore() {} + + void OnCloseWindow( wxCloseEvent& event ); + void OnActivate( wxActivateEvent &WXUNUSED(event) ) { } // called from docview.cpp + void OnSize( wxSizeEvent &event ); + + void OnMenuHighlight( wxMenuEvent& event ); + + // implementation + + virtual void GtkOnSize( int x, int y, int width, int height ); + virtual wxPoint GetClientAreaOrigin() const; + void DoMenuUpdates(); + void DoMenuUpdates(wxMenu* menu); + virtual void OnInternalIdle(); + + wxMenuBar *m_frameMenuBar; + wxMenuBar *m_mdiMenuBar; + wxStatusBar *m_frameStatusBar; + wxToolBar *m_frameToolBar; + wxString m_title; + wxIcon m_icon; + int m_miniEdge,m_miniTitle; + +protected: + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); + + virtual void DoSetClientSize(int width, int height); + +private: + DECLARE_EVENT_TABLE() }; #endif // __GTKFRAMEH__ diff --git a/include/wx/gtk1/mdi.h b/include/wx/gtk1/mdi.h index cde7a8983d..d49600fa0a 100644 --- a/include/wx/gtk1/mdi.h +++ b/include/wx/gtk1/mdi.h @@ -131,8 +131,11 @@ class wxMDIChildFrame: public wxFrame virtual void SetStatusWidths( int WXUNUSED(n), int *WXUNUSED(width) ) {} // no size hints - virtual void SetSizeHints( int WXUNUSED(minW), int WXUNUSED(minH), int WXUNUSED(maxW), - int WXUNUSED(maxH), int WXUNUSED(incW) ) {} + virtual void SetSizeHints( int WXUNUSED(minW), int WXUNUSED(minH), + int WXUNUSED(maxW), int WXUNUSED(maxH), + int WXUNUSED(incW) ) + { + } // no toolbar bars virtual wxToolBar* CreateToolBar( long WXUNUSED(style), wxWindowID WXUNUSED(id), diff --git a/include/wx/gtk1/window.h b/include/wx/gtk1/window.h index b2d326bf5a..8e0eeacfe7 100644 --- a/include/wx/gtk1/window.h +++ b/include/wx/gtk1/window.h @@ -12,7 +12,7 @@ #define __GTKWINDOWH__ #ifdef __GNUG__ -#pragma interface + #pragma interface #endif #include "wx/defs.h" @@ -36,7 +36,7 @@ extern wxList wxTopLevelWindows; // global function //----------------------------------------------------------------------------- -wxWindow* wxGetActiveWindow(); +extern wxWindow* wxGetActiveWindow(); //----------------------------------------------------------------------------- // classes @@ -49,11 +49,11 @@ class wxClientData; class wxVoidClientData; class wxWindow; #if wxUSE_WX_RESOURCES -class wxResourceTable; -class wxItemResource; + class wxResourceTable; + class wxItemResource; #endif #if wxUSE_DRAG_AND_DROP -class wxDropTarget; + class wxDropTarget; #endif class wxToolTip; @@ -78,15 +78,15 @@ extern const wxPoint wxDefaultPosition; class wxClientData { public: - wxClientData() { } - virtual ~wxClientData() { } + wxClientData() { } + virtual ~wxClientData() { } }; //----------------------------------------------------------------------------- // wxStringClientData //----------------------------------------------------------------------------- -class wxStringClientData: public wxClientData +class wxStringClientData : public wxClientData { public: wxStringClientData() { } @@ -112,336 +112,438 @@ void debug_focus_in( GtkWidget* widget, const char* name, const char* window ); // wxWindow //----------------------------------------------------------------------------- -class wxWindow: public wxEvtHandler +class wxWindow : public wxEvtHandler { - DECLARE_DYNAMIC_CLASS(wxWindow) + DECLARE_DYNAMIC_CLASS(wxWindow) public: - wxWindow(); - wxWindow(wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxPanelNameStr); - bool Create(wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxPanelNameStr); - virtual ~wxWindow(); + // creating the window + // ------------------- + wxWindow(); + wxWindow(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxPanelNameStr); + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxPanelNameStr); + virtual ~wxWindow(); #if wxUSE_WX_RESOURCES - virtual bool LoadFromResource( wxWindow *parent, const wxString& resourceName, - const wxResourceTable *table = (const wxResourceTable *) NULL); - virtual wxControl *CreateItem(const wxItemResource* childResource, const wxItemResource* parentResource, - const wxResourceTable *table = (const wxResourceTable *) NULL); -#endif + virtual bool LoadFromResource(wxWindow *parent, + const wxString& resourceName, + const wxResourceTable *table = (const wxResourceTable *) NULL); + virtual wxControl *CreateItem(const wxItemResource* childResource, + const wxItemResource* parentResource, + const wxResourceTable *table = (const wxResourceTable *) NULL); +#endif // wxUSE_WX_RESOURCES + + // closing the window + // ------------------ + bool Close( bool force = FALSE ); + virtual bool Destroy(); + virtual bool DestroyChildren(); + + bool IsBeingDeleted(); + + // moving/resizing + // --------------- + + // set the window size and/or position + void SetSize( int x, int y, int width, int height, + int sizeFlags = wxSIZE_AUTO ) + { DoSetSize(x, y, width, height, sizeFlags); } + + void SetSize( int width, int height ) + { DoSetSize( -1, -1, width, height, wxSIZE_USE_EXISTING ); } + + void SetSize( const wxSize& size ) + { SetSize( size.x, size.y); } + + void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO) + { DoSetSize(rect.x, rect.y, rect.width, rect.height, sizeFlags); } + + void Move( int x, int y ) + { DoSetSize( x, y, -1, -1, wxSIZE_USE_EXISTING ); } + + void Move(const wxPoint& pt) + { Move(pt.x, pt.y); } + + // client size is the size of area available for subwindows + void SetClientSize( int width, int height ) + { DoSetClientSize(width, height); } + + void SetClientSize( const wxSize& size ) + { DoSetClientSize(size.x, size.y); } + + void SetClientSize(const wxRect& rect) + { SetClientSize( rect.width, rect.height ); } + + // get the window position and/or size + virtual void GetPosition( int *x, int *y ) const; + wxPoint GetPosition() const + { + int w, h; + GetPosition(& w, & h); + + return wxPoint(w, h); + } + + virtual void GetSize( int *width, int *height ) const; + + wxSize GetSize() const + { + int w, h; + GetSize(& w, & h); + return wxSize(w, h); + } + + wxRect GetRect() const + { + int x, y, w, h; + GetPosition(& x, & y); + GetSize(& w, & h); + + return wxRect(x, y, w, h); + } - bool Close( bool force = FALSE ); - virtual bool Destroy(); - virtual bool DestroyChildren(); + virtual void GetClientSize( int *width, int *height ) const; + wxSize GetClientSize() const + { + int w, h; + GetClientSize(& w, & h); + return wxSize(w, h); + } - virtual void PrepareDC( wxDC &dc ); + // position with respect to the the parent window + virtual void Centre( int direction = wxHORIZONTAL ); + void Center(int direction = wxHORIZONTAL) { Centre(direction); } + virtual void Fit(); - virtual void SetSize( int x, int y, int width, int height, - int sizeFlags = wxSIZE_AUTO ); - virtual void SetSize( int width, int height ); + // set min/max size of the window + virtual void SetSizeHints( int minW, int minH, + int maxW = -1, int maxH = -1, + int incW = -1, int incH = -1 ); - virtual void Move( int x, int y ); + // Dialog units translations. Implemented in wincmn.cpp. + // ----------------------------------------------------- - virtual void GetSize( int *width, int *height ) const; - wxSize GetSize() const { int w, h; GetSize(& w, & h); return wxSize(w, h); } + wxPoint ConvertPixelsToDialog( const wxPoint& pt ); + wxPoint ConvertDialogToPixels( const wxPoint& pt ); + wxSize ConvertPixelsToDialog( const wxSize& sz ) + { + wxPoint pt(ConvertPixelsToDialog(wxPoint(sz.x, sz.y))); + + return wxSize(pt.x, pt.y); + } - virtual void SetClientSize( int width, int height ); + wxSize ConvertDialogToPixels( const wxSize& sz ) + { + wxPoint pt(ConvertDialogToPixels(wxPoint(sz.x, sz.y))); - virtual void GetClientSize( int *width, int *height ) const; - wxSize GetClientSize() const { int w, h; GetClientSize(& w, & h); return wxSize(w, h); } + return wxSize(pt.x, pt.y); + } - virtual void GetPosition( int *x, int *y ) const; - wxPoint GetPosition() const { int w, h; GetPosition(& w, & h); return wxPoint(w, h); } + void OnSize( wxSizeEvent &event ); - wxRect GetRect() const - { int x, y, w, h; GetPosition(& x, & y); GetSize(& w, & h); return wxRect(x, y, w, h); } + // window state + // ------------ - virtual void Centre( int direction = wxHORIZONTAL ); - inline void Center(int direction = wxHORIZONTAL) { Centre(direction); } - virtual void Fit(); + virtual bool Show( bool show ); + virtual void Enable( bool enable ); + virtual void MakeModal( bool modal ); + virtual bool IsEnabled() const { return m_isEnabled; } + inline bool Enabled() const { return IsEnabled(); } - virtual void SetSizeHints( int minW, int minH, int maxW = -1, int maxH = -1, int incW = -1, int incH = -1 ); + virtual void SetFocus(); + static wxWindow *FindFocus(); - /* Dialog units translations. Implemented in wincmn.cpp. */ - wxPoint ConvertPixelsToDialog( const wxPoint& pt ); - wxPoint ConvertDialogToPixels( const wxPoint& pt ); - inline wxSize ConvertPixelsToDialog( const wxSize& sz ) - { wxPoint pt(ConvertPixelsToDialog(wxPoint(sz.x, sz.y))); return wxSize(pt.x, pt.y); } - inline wxSize ConvertDialogToPixels( const wxSize& sz ) - { wxPoint pt(ConvertDialogToPixels(wxPoint(sz.x, sz.y))); return wxSize(pt.x, pt.y); } + void SetReturnCode( int retCode ); + int GetReturnCode(); - void OnSize( wxSizeEvent &event ); + // parent/children relations + // ------------------------- - virtual bool Show( bool show ); - virtual void Enable( bool enable ); - virtual void MakeModal( bool modal ); - virtual bool IsEnabled() const { return m_isEnabled; } - inline bool Enabled() const { return IsEnabled(); } + virtual void AddChild( wxWindow *child ); + wxList& GetChildren() { return m_children; } - virtual void SetFocus(); - static wxWindow *FindFocus(); + virtual void RemoveChild( wxWindow *child ); - virtual void AddChild( wxWindow *child ); - wxList& GetChildren() { return m_children; } + wxWindow *GetParent() const + { return m_parent; } + wxWindow *GetGrandParent() const + { return (m_parent ? m_parent->m_parent : (wxWindow*)NULL); } + void SetParent( wxWindow *parent ) + { m_parent = parent; } + virtual wxWindow *ReParent( wxWindow *newParent ); - virtual void RemoveChild( wxWindow *child ); - void SetReturnCode( int retCode ); - int GetReturnCode(); + // event handler stuff + // ------------------- - wxWindow *GetParent() const - { return m_parent; } - wxWindow *GetGrandParent() const - { return (m_parent ? m_parent->m_parent : (wxWindow*)NULL); } - void SetParent( wxWindow *parent ) - { m_parent = parent; } - virtual wxWindow *ReParent( wxWindow *newParent ); + wxEvtHandler *GetEventHandler() const; + void SetEventHandler( wxEvtHandler *handler ); + void PushEventHandler( wxEvtHandler *handler ); + wxEvtHandler *PopEventHandler( bool deleteHandler = FALSE ); - wxEvtHandler *GetEventHandler() const; - void SetEventHandler( wxEvtHandler *handler ); - void PushEventHandler( wxEvtHandler *handler ); - wxEvtHandler *PopEventHandler( bool deleteHandler = FALSE ); + // validators and client data + // -------------------------- - virtual void SetValidator( const wxValidator &validator ); - virtual wxValidator *GetValidator(); + virtual void SetValidator( const wxValidator &validator ); + virtual wxValidator *GetValidator(); - virtual void SetClientObject( wxClientData *data ); - virtual wxClientData *GetClientObject(); + virtual void SetClientObject( wxClientData *data ); + virtual wxClientData *GetClientObject(); - virtual void SetClientData( void *data ); - virtual void *GetClientData(); + virtual void SetClientData( void *data ); + virtual void *GetClientData(); - virtual void SetAcceleratorTable( const wxAcceleratorTable& accel ); - virtual wxAcceleratorTable *GetAcceleratorTable() { return &m_acceleratorTable; } + // accelerators + // ------------ + virtual void SetAcceleratorTable( const wxAcceleratorTable& accel ); + virtual wxAcceleratorTable *GetAcceleratorTable() { return &m_acceleratorTable; } - bool IsBeingDeleted(); + void SetId( wxWindowID id ); + wxWindowID GetId() const; - void SetId( wxWindowID id ); - wxWindowID GetId() const; + void SetCursor( const wxCursor &cursor ); - void SetCursor( const wxCursor &cursor ); + virtual void PrepareDC( wxDC &dc ); - void WarpPointer(int x, int y); + void WarpPointer(int x, int y); #if wxUSE_TOOLTIPS - void SetToolTip( const wxString &tip ); - virtual void SetToolTip( wxToolTip *tip ); - wxToolTip* GetToolTip() const { return m_toolTip; } + void SetToolTip( const wxString &tip ); + virtual void SetToolTip( wxToolTip *tip ); + wxToolTip* GetToolTip() const { return m_toolTip; } #endif // wxUSE_TOOLTIPS - virtual void Refresh( bool eraseBackground = TRUE, const wxRect *rect = (const wxRect *) NULL ); - virtual void Clear(); + virtual void Refresh( bool eraseBackground = TRUE, const wxRect *rect = (const wxRect *) NULL ); + virtual void Clear(); + + virtual wxRegion GetUpdateRegion() const; + virtual bool IsExposed( int x, int y ) const; + virtual bool IsExposed( int x, int y, int w, int h ) const; + virtual bool IsExposed( const wxPoint& pt ) const; + virtual bool IsExposed( const wxRect& rect ) const; + + // colours + // ------- - virtual wxRegion GetUpdateRegion() const; - virtual bool IsExposed( int x, int y ) const; - virtual bool IsExposed( int x, int y, int w, int h ) const; - virtual bool IsExposed( const wxPoint& pt ) const; - virtual bool IsExposed( const wxRect& rect ) const; + virtual wxColour GetBackgroundColour() const; + virtual void SetBackgroundColour( const wxColour &colour ); + virtual wxColour GetForegroundColour() const; + virtual void SetForegroundColour( const wxColour &colour ); - virtual wxColour GetBackgroundColour() const; - virtual void SetBackgroundColour( const wxColour &colour ); - virtual wxColour GetForegroundColour() const; - virtual void SetForegroundColour( const wxColour &colour ); + // fonts + // ----- - virtual int GetCharHeight() const; - virtual int GetCharWidth() const; - virtual void GetTextExtent( const wxString& string, int *x, int *y, - int *descent = (int *) NULL, - int *externalLeading = (int *) NULL, - const wxFont *theFont = (const wxFont *) NULL, bool use16 = FALSE) const; + virtual int GetCharHeight() const; + virtual int GetCharWidth() const; + virtual void GetTextExtent( const wxString& string, int *x, int *y, + int *descent = (int *) NULL, + int *externalLeading = (int *) NULL, + const wxFont *theFont = (const wxFont *) NULL, bool use16 = FALSE) const; - virtual void SetFont( const wxFont &font ); - virtual wxFont& GetFont() { return m_font; } + virtual void SetFont( const wxFont &font ); + virtual wxFont& GetFont() { return m_font; } // For backward compatibility - virtual void SetButtonFont(const wxFont& font) { SetFont(font); } - virtual void SetLabelFont(const wxFont& font) { SetFont(font); } - virtual wxFont& GetLabelFont() { return GetFont(); }; - virtual wxFont& GetButtonFont() { return GetFont(); }; + virtual void SetButtonFont(const wxFont& font) { SetFont(font); } + virtual void SetLabelFont(const wxFont& font) { SetFont(font); } + virtual wxFont& GetLabelFont() { return GetFont(); }; + virtual wxFont& GetButtonFont() { return GetFont(); }; - virtual void SetWindowStyleFlag( long flag ); - virtual long GetWindowStyleFlag() const; + virtual void SetWindowStyleFlag( long flag ); + virtual long GetWindowStyleFlag() const; - virtual void CaptureMouse(); - virtual void ReleaseMouse(); + virtual void CaptureMouse(); + virtual void ReleaseMouse(); - virtual void SetTitle( const wxString &title ); - virtual wxString GetTitle() const; - virtual void SetName( const wxString &name ); - virtual wxString GetName() const; - virtual wxString GetLabel() const; + virtual void SetTitle( const wxString &title ); + virtual wxString GetTitle() const; + virtual void SetName( const wxString &name ); + virtual wxString GetName() const; + virtual wxString GetLabel() const; - void OnSysColourChanged( wxSysColourChangedEvent &WXUNUSED(event) ) { } - void OnKeyDown( wxKeyEvent &event ); + void OnSysColourChanged( wxSysColourChangedEvent &WXUNUSED(event) ) { } + void OnKeyDown( wxKeyEvent &event ); - virtual bool IsShown() const; + virtual bool IsShown() const; - virtual void Raise(); - virtual void Lower(); + virtual void Raise(); + virtual void Lower(); - virtual bool IsRetained(); - virtual wxWindow *FindWindow( long id ); - virtual wxWindow *FindWindow( const wxString& name ); + virtual bool IsRetained(); + virtual wxWindow *FindWindow( long id ); + virtual wxWindow *FindWindow( const wxString& name ); - void AllowDoubleClick( bool WXUNUSED(allow) ) { } - void SetDoubleClick( bool WXUNUSED(allow) ) { } + void AllowDoubleClick( bool WXUNUSED(allow) ) { } + void SetDoubleClick( bool WXUNUSED(allow) ) { } - virtual void ClientToScreen( int *x, int *y ); - virtual void ScreenToClient( int *x, int *y ); + virtual void ClientToScreen( int *x, int *y ); + virtual void ScreenToClient( int *x, int *y ); - virtual bool Validate(); - virtual bool TransferDataToWindow(); - virtual bool TransferDataFromWindow(); - void OnInitDialog( wxInitDialogEvent &event ); - virtual void InitDialog(); + virtual bool Validate(); + virtual bool TransferDataToWindow(); + virtual bool TransferDataFromWindow(); + void OnInitDialog( wxInitDialogEvent &event ); + virtual void InitDialog(); - virtual bool PopupMenu( wxMenu *menu, int x, int y ); + virtual bool PopupMenu( wxMenu *menu, int x, int y ); #if wxUSE_DRAG_AND_DROP - virtual void SetDropTarget( wxDropTarget *dropTarget ); - virtual wxDropTarget *GetDropTarget() const; + virtual void SetDropTarget( wxDropTarget *dropTarget ); + virtual wxDropTarget *GetDropTarget() const; #endif - virtual void SetScrollbar( int orient, int pos, int thumbVisible, - int range, bool refresh = TRUE ); - virtual void SetScrollPos( int orient, int pos, bool refresh = TRUE ); - virtual int GetScrollPos( int orient ) const; - virtual int GetScrollThumb( int orient ) const; - virtual int GetScrollRange( int orient ) const; - virtual void ScrollWindow( int dx, int dy, const wxRect* rect = (wxRect *) NULL ); + virtual void SetScrollbar( int orient, int pos, int thumbVisible, + int range, bool refresh = TRUE ); + virtual void SetScrollPos( int orient, int pos, bool refresh = TRUE ); + virtual int GetScrollPos( int orient ) const; + virtual int GetScrollThumb( int orient ) const; + virtual int GetScrollRange( int orient ) const; + virtual void ScrollWindow( int dx, int dy, const wxRect* rect = (wxRect *) NULL ); - virtual bool AcceptsFocus() const; + virtual bool AcceptsFocus() const; - void UpdateWindowUI(); + void UpdateWindowUI(); - // implementation + // implementation - virtual wxPoint GetClientAreaOrigin() const; - virtual void AdjustForParentClientOrigin( int& x, int& y, int sizeFlags ); + virtual wxPoint GetClientAreaOrigin() const; + virtual void AdjustForParentClientOrigin( int& x, int& y, int sizeFlags ); - bool HasVMT(); + bool HasVMT(); - virtual void OnInternalIdle(); + virtual void OnInternalIdle(); - /* used by all classes in the widget creation process */ + /* used by all classes in the widget creation process */ - void PreCreation( wxWindow *parent, wxWindowID id, const wxPoint &pos, - const wxSize &size, long style, const wxString &name ); - void PostCreation(); + void PreCreation( wxWindow *parent, wxWindowID id, const wxPoint &pos, + const wxSize &size, long style, const wxString &name ); + void PostCreation(); - /* the methods below are required because many native widgets - are composed of several subwidgets and setting a style for - the widget means setting it for all subwidgets as well. - also, it is nor clear, which native widget is the top - widget where (most of) the input goes. even tooltips have - to be applied to all subwidgets. */ + /* the methods below are required because many native widgets + are composed of several subwidgets and setting a style for + the widget means setting it for all subwidgets as well. + also, it is nor clear, which native widget is the top + widget where (most of) the input goes. even tooltips have + to be applied to all subwidgets. */ - virtual GtkWidget* GetConnectWidget(); - virtual bool IsOwnGtkWindow( GdkWindow *window ); - void ConnectWidget( GtkWidget *widget ); + virtual GtkWidget* GetConnectWidget(); + virtual bool IsOwnGtkWindow( GdkWindow *window ); + void ConnectWidget( GtkWidget *widget ); - GtkStyle *GetWidgetStyle(); - void SetWidgetStyle(); - virtual void ApplyWidgetStyle(); + GtkStyle *GetWidgetStyle(); + void SetWidgetStyle(); + virtual void ApplyWidgetStyle(); #if wxUSE_TOOLTIPS - virtual void ApplyToolTip( GtkTooltips *tips, const char *tip ); + virtual void ApplyToolTip( GtkTooltips *tips, const char *tip ); #endif // wxUSE_TOOLTIPS - /* private member variables */ - - wxWindow *m_parent; - wxList m_children; - int m_x,m_y; - int m_width,m_height; - int m_minWidth,m_minHeight; - int m_maxWidth,m_maxHeight; - int m_retCode; - wxEvtHandler *m_eventHandler; - wxValidator *m_windowValidator; + /* private member variables */ + + wxWindow *m_parent; + wxList m_children; + int m_x,m_y; + int m_width,m_height; + int m_minWidth,m_minHeight; + int m_maxWidth,m_maxHeight; + int m_retCode; + wxEvtHandler *m_eventHandler; + wxValidator *m_windowValidator; #if wxUSE_DRAG_AND_DROP - wxDropTarget *m_dropTarget; + wxDropTarget *m_dropTarget; #endif - wxWindowID m_windowId; - wxCursor *m_cursor; - wxFont m_font; - wxColour m_backgroundColour; - wxColour m_foregroundColour; - wxRegion m_updateRegion; - long m_windowStyle; - bool m_isShown; - bool m_isEnabled; - wxString m_windowName; - wxAcceleratorTable m_acceleratorTable; - wxClientData *m_clientObject; - void *m_clientData; + wxWindowID m_windowId; + wxCursor *m_cursor; + wxFont m_font; + wxColour m_backgroundColour; + wxColour m_foregroundColour; + wxRegion m_updateRegion; + long m_windowStyle; + bool m_isShown; + bool m_isEnabled; + wxString m_windowName; + wxAcceleratorTable m_acceleratorTable; + wxClientData *m_clientObject; + void *m_clientData; #if wxUSE_TOOLTIPS - wxToolTip *m_toolTip; + wxToolTip *m_toolTip; #endif // wxUSE_TOOLTIPS - GtkWidget *m_widget; - GtkWidget *m_wxwindow; - GtkAdjustment *m_hAdjust,*m_vAdjust; - float m_oldHorizontalPos; - float m_oldVerticalPos; - bool m_needParent; - bool m_hasScrolling; - bool m_isScrolling; - bool m_hasVMT; - bool m_sizeSet; - bool m_resizing; - GdkGC *m_scrollGC; - GtkStyle *m_widgetStyle; - bool m_isStaticBox; - bool m_acceptsFocus; - - wxInsertChildFunction m_insertCallback; + GtkWidget *m_widget; + GtkWidget *m_wxwindow; + GtkAdjustment *m_hAdjust,*m_vAdjust; + float m_oldHorizontalPos; + float m_oldVerticalPos; + bool m_needParent; + bool m_hasScrolling; + bool m_isScrolling; + bool m_hasVMT; + bool m_sizeSet; + bool m_resizing; + GdkGC *m_scrollGC; + GtkStyle *m_widgetStyle; + bool m_isStaticBox; + bool m_acceptsFocus; + + wxInsertChildFunction m_insertCallback; public: - wxLayoutConstraints *m_constraints; - wxList *m_constraintsInvolvedIn; - wxSizer *m_windowSizer; - wxWindow *m_sizerParent; - bool m_autoLayout; - - wxLayoutConstraints *GetConstraints() const; - void SetConstraints( wxLayoutConstraints *constraints ); - void SetAutoLayout( bool autoLayout ); - bool GetAutoLayout() const; - bool Layout(); - void SetSizer( wxSizer *sizer ); - wxSizer *GetSizer() const; - void SetSizerParent( wxWindow *win ); - wxWindow *GetSizerParent() const; - void UnsetConstraints(wxLayoutConstraints *c); - inline wxList *GetConstraintsInvolvedIn() const ; - void AddConstraintReference(wxWindow *otherWin); - void RemoveConstraintReference(wxWindow *otherWin); - void DeleteRelatedConstraints(); - virtual void ResetConstraints(); - virtual void SetConstraintSizes(bool recurse = TRUE); - virtual bool LayoutPhase1(int *noChanges); - virtual bool LayoutPhase2(int *noChanges); - virtual bool DoPhase(int); - virtual void TransformSizerToActual(int *x, int *y) const ; - virtual void SizerSetSize(int x, int y, int w, int h); - virtual void SizerMove(int x, int y); - virtual void SetSizeConstraint(int x, int y, int w, int h); - virtual void MoveConstraint(int x, int y); - virtual void GetSizeConstraint(int *w, int *h) const ; - virtual void GetClientSizeConstraint(int *w, int *h) const ; - virtual void GetPositionConstraint(int *x, int *y) const ; + wxLayoutConstraints *m_constraints; + wxList *m_constraintsInvolvedIn; + wxSizer *m_windowSizer; + wxWindow *m_sizerParent; + bool m_autoLayout; + + wxLayoutConstraints *GetConstraints() const; + void SetConstraints( wxLayoutConstraints *constraints ); + void SetAutoLayout( bool autoLayout ); + bool GetAutoLayout() const; + bool Layout(); + void SetSizer( wxSizer *sizer ); + wxSizer *GetSizer() const; + void SetSizerParent( wxWindow *win ); + wxWindow *GetSizerParent() const; + void UnsetConstraints(wxLayoutConstraints *c); + inline wxList *GetConstraintsInvolvedIn() const ; + void AddConstraintReference(wxWindow *otherWin); + void RemoveConstraintReference(wxWindow *otherWin); + void DeleteRelatedConstraints(); + virtual void ResetConstraints(); + virtual void SetConstraintSizes(bool recurse = TRUE); + virtual bool LayoutPhase1(int *noChanges); + virtual bool LayoutPhase2(int *noChanges); + virtual bool DoPhase(int); + virtual void TransformSizerToActual(int *x, int *y) const ; + virtual void SizerSetSize(int x, int y, int w, int h); + virtual void SizerMove(int x, int y); + virtual void SetSizeConstraint(int x, int y, int w, int h); + virtual void MoveConstraint(int x, int y); + virtual void GetSizeConstraint(int *w, int *h) const ; + virtual void GetClientSizeConstraint(int *w, int *h) const ; + virtual void GetPositionConstraint(int *x, int *y) const ; + +protected: + // this is the virtual function to be overriden in any derived class which + // wants to change how SetSize() or Move() works - it is called by all + // versions of these functions in the base class + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); + + // same as DoSetSize() for the client size + virtual void DoSetClientSize(int width, int height); private: - DECLARE_EVENT_TABLE() + DECLARE_EVENT_TABLE() }; #endif // __GTKWINDOWH__ diff --git a/include/wx/layout.h b/include/wx/layout.h index 7a52593c04..960ad90716 100644 --- a/include/wx/layout.h +++ b/include/wx/layout.h @@ -232,21 +232,11 @@ public: bool Create(wxWindow *parent, wxSizerBehaviour behav = wxSizerNone); - virtual void SetSize(int x, int y, int w, int h, int flags = wxSIZE_AUTO); - virtual void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO) - { wxWindow::SetSize(rect.x, rect.y, rect.width, rect.height, sizeFlags); } - virtual void SetSize(const wxSize& size) - { wxWindow::SetSize(size.x, size.y); } - virtual void SetSize(int width, int height) { SetSize(-1, -1, width, height, wxSIZE_USE_EXISTING); } - virtual void GetSize(int *w, int *h) const; - wxSize GetSize() const { return wxWindow::GetSize(); } virtual void GetClientSize(int *w, int *h) const { GetSize(w, h); } - wxSize GetClientSize() const { return wxWindow::GetClientSize(); } virtual void GetPosition(int *x, int *y) const; - wxPoint GetPosition() const { return wxWindow::GetPosition(); } void SizerSetSize(int x, int y, int w, int h) { SetSize(x, y, w, h); } void SizerMove(int x, int y) { Move(x, y); } @@ -263,6 +253,11 @@ public: virtual bool LayoutPhase1(int *); virtual bool LayoutPhase2(int *); + +protected: + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); }; #define wxSIZER_ROWS TRUE @@ -287,7 +282,6 @@ public: bool Create(wxWindow *parent, bool rowOrCol = wxSIZER_ROWS, int rowsOrColSize = 20, wxSizerBehaviour = wxSizerShrink); - virtual void SetSize(int x, int y, int w, int h, int flags = wxSIZE_AUTO); virtual void SetRowOrCol(bool rc) { rowOrCol = rc; } virtual bool GetRowOrCol() { return rowOrCol; } diff --git a/include/wx/motif/checkbox.h b/include/wx/motif/checkbox.h index ec6bd6ccea..e6ca1a43ae 100644 --- a/include/wx/motif/checkbox.h +++ b/include/wx/motif/checkbox.h @@ -54,39 +54,38 @@ class WXDLLEXPORT wxCheckBox: public wxControl class WXDLLEXPORT wxBitmapCheckBox: public wxCheckBox { - DECLARE_DYNAMIC_CLASS(wxBitmapCheckBox) + DECLARE_DYNAMIC_CLASS(wxBitmapCheckBox) - public: - int checkWidth ; - int checkHeight ; +public: + int checkWidth; + int checkHeight; - inline wxBitmapCheckBox() { checkWidth = -1; checkHeight = -1; } - inline wxBitmapCheckBox(wxWindow *parent, wxWindowID id, const wxBitmap *label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxCheckBoxNameStr) - { - Create(parent, id, label, pos, size, style, validator, name); - } + inline wxBitmapCheckBox() { checkWidth = -1; checkHeight = -1; } + inline wxBitmapCheckBox(wxWindow *parent, wxWindowID id, const wxBitmap *label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxCheckBoxNameStr) + { + Create(parent, id, label, pos, size, style, validator, name); + } - bool Create(wxWindow *parent, wxWindowID id, const wxBitmap *bitmap, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxCheckBoxNameStr); + bool Create(wxWindow *parent, wxWindowID id, const wxBitmap *bitmap, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxCheckBoxNameStr); - virtual void SetValue(bool); - virtual bool GetValue() const ; + virtual void SetValue(bool value); + virtual bool GetValue() const; - virtual void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); - virtual void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO) - { wxWindow::SetSize(rect, sizeFlags); } - virtual void SetSize(const wxSize& size) { wxWindow::SetSize(size); } - virtual void SetSize(int width, int height) { SetSize(-1, -1, width, height, wxSIZE_USE_EXISTING); } + virtual void SetLabel(const wxBitmap& bitmap); + virtual void SetLabel(const wxString& label) { wxControl::SetLabel(label); }; - virtual void SetLabel(const wxBitmap& bitmap); - virtual void SetLabel(const wxString& label) { wxControl::SetLabel(label); }; +protected: + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); }; #endif // _WX_CHECKBOX_H_ diff --git a/include/wx/motif/choice.h b/include/wx/motif/choice.h index 17702e03cb..18f80ca5bd 100644 --- a/include/wx/motif/choice.h +++ b/include/wx/motif/choice.h @@ -23,70 +23,68 @@ WXDLLEXPORT_DATA(extern const char*) wxChoiceNameStr; // Choice item class WXDLLEXPORT wxChoice: public wxControl { - DECLARE_DYNAMIC_CLASS(wxChoice) - - public: - wxChoice(); - ~wxChoice(); - - inline wxChoice(wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxChoiceNameStr) - { - Create(parent, id, pos, size, n, choices, style, validator, name); - } - - bool Create(wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxChoiceNameStr); - - virtual void Append(const wxString& item); - virtual void Delete(int n); - virtual void Clear(); - virtual int GetSelection() const ; - virtual void SetSelection(int n); - virtual int FindString(const wxString& s) const; - virtual wxString GetString(int n) const ; - - virtual void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); - virtual void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO) - { wxWindow::SetSize(rect, sizeFlags); } - virtual void SetSize(const wxSize& size) { wxWindow::SetSize(size); } - virtual void SetSize(int width, int height) { SetSize(-1, -1, width, height, wxSIZE_USE_EXISTING); } - - virtual wxString GetStringSelection() const ; - virtual bool SetStringSelection(const wxString& sel); - - virtual inline int Number() const { return m_noStrings; } - virtual void Command(wxCommandEvent& event); - - virtual void SetColumns(int n = 1 ); - virtual int GetColumns() const ; - - void SetFocus(); - -// Implementation - virtual void ChangeFont(bool keepOriginalSize = TRUE); - virtual void ChangeBackgroundColour(); - virtual void ChangeForegroundColour(); - WXWidget GetTopWidget() const { return m_formWidget; } - WXWidget GetMainWidget() const { return m_buttonWidget; } + DECLARE_DYNAMIC_CLASS(wxChoice) + +public: + wxChoice(); + ~wxChoice(); + + wxChoice(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxChoiceNameStr) + { + Create(parent, id, pos, size, n, choices, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxChoiceNameStr); + + virtual void Append(const wxString& item); + virtual void Delete(int n); + virtual void Clear(); + virtual int GetSelection() const ; + virtual void SetSelection(int n); + virtual int FindString(const wxString& s) const; + virtual wxString GetString(int n) const ; + + virtual wxString GetStringSelection() const ; + virtual bool SetStringSelection(const wxString& sel); + + virtual int Number() const { return m_noStrings; } + virtual void Command(wxCommandEvent& event); + + virtual void SetColumns(int n = 1 ); + virtual int GetColumns() const ; + + void SetFocus(); + + // Implementation + virtual void ChangeFont(bool keepOriginalSize = TRUE); + virtual void ChangeBackgroundColour(); + virtual void ChangeForegroundColour(); + WXWidget GetTopWidget() const { return m_formWidget; } + WXWidget GetMainWidget() const { return m_buttonWidget; } protected: - int m_noStrings; - WXWidget m_menuWidget; - WXWidget m_buttonWidget; - WXWidget* m_widgetList ; - WXWidget m_formWidget; - wxStringList m_stringList; + int m_noStrings; + WXWidget m_menuWidget; + WXWidget m_buttonWidget; + WXWidget* m_widgetList ; + WXWidget m_formWidget; + wxStringList m_stringList; + + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); }; #endif diff --git a/include/wx/motif/combobox.h b/include/wx/motif/combobox.h index 7568d28b79..4df7da5137 100644 --- a/include/wx/motif/combobox.h +++ b/include/wx/motif/combobox.h @@ -24,74 +24,73 @@ WXDLLEXPORT_DATA(extern const char*) wxEmptyString; // Combobox item class WXDLLEXPORT wxComboBox: public wxChoice { - DECLARE_DYNAMIC_CLASS(wxComboBox) + DECLARE_DYNAMIC_CLASS(wxComboBox) - public: - inline wxComboBox() {} - ~wxComboBox(); +public: + inline wxComboBox() {} + ~wxComboBox(); - inline wxComboBox(wxWindow *parent, wxWindowID id, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxComboBoxNameStr) - { - Create(parent, id, value, pos, size, n, choices, style, validator, name); - } + inline wxComboBox(wxWindow *parent, wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr) + { + Create(parent, id, value, pos, size, n, choices, style, validator, name); + } - bool Create(wxWindow *parent, wxWindowID id, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxComboBoxNameStr); + bool Create(wxWindow *parent, wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr); - virtual void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); - virtual void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO) - { wxWindow::SetSize(rect, sizeFlags); } - virtual void SetSize(const wxSize& size) { wxWindow::SetSize(size); } - virtual void SetSize(int width, int height) { SetSize(-1, -1, width, height, wxSIZE_USE_EXISTING); } + // List functions + virtual void Append(const wxString& item); + virtual void Delete(int n); + virtual void Clear(); + virtual int GetSelection() const ; + virtual void SetSelection(int n); + virtual int FindString(const wxString& s) const; + virtual wxString GetString(int n) const ; + virtual wxString GetStringSelection() const ; + virtual bool SetStringSelection(const wxString& sel); + virtual inline int Number() const { return m_noStrings; } - // List functions - virtual void Append(const wxString& item); - virtual void Delete(int n); - virtual void Clear(); - virtual int GetSelection() const ; - virtual void SetSelection(int n); - virtual int FindString(const wxString& s) const; - virtual wxString GetString(int n) const ; - virtual wxString GetStringSelection() const ; - virtual bool SetStringSelection(const wxString& sel); - virtual inline int Number() const { return m_noStrings; } + // Text field functions + virtual wxString GetValue() const ; + virtual void SetValue(const wxString& value); - // Text field functions - virtual wxString GetValue() const ; - virtual void SetValue(const wxString& value); + // Clipboard operations + virtual void Copy(); + virtual void Cut(); + virtual void Paste(); + virtual void SetInsertionPoint(long pos); + virtual void SetInsertionPointEnd(); + virtual long GetInsertionPoint() const ; + virtual long GetLastPosition() const ; + virtual void Replace(long from, long to, const wxString& value); + virtual void Remove(long from, long to); + virtual void SetSelection(long from, long to); + virtual void SetEditable(bool editable); - // Clipboard operations - virtual void Copy(); - virtual void Cut(); - virtual void Paste(); - virtual void SetInsertionPoint(long pos); - virtual void SetInsertionPointEnd(); - virtual long GetInsertionPoint() const ; - virtual long GetLastPosition() const ; - virtual void Replace(long from, long to, const wxString& value); - virtual void Remove(long from, long to); - virtual void SetSelection(long from, long to); - virtual void SetEditable(bool editable); + // Implementation + virtual void ChangeFont(bool keepOriginalSize = TRUE); + virtual void ChangeBackgroundColour(); + virtual void ChangeForegroundColour(); + WXWidget GetTopWidget() const { return m_mainWidget; } + WXWidget GetMainWidget() const { return m_mainWidget; } -// Implementation - virtual void ChangeFont(bool keepOriginalSize = TRUE); - virtual void ChangeBackgroundColour(); - virtual void ChangeForegroundColour(); - WXWidget GetTopWidget() const { return m_mainWidget; } - WXWidget GetMainWidget() const { return m_mainWidget; } +protected: + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); }; #endif diff --git a/include/wx/motif/dialog.h b/include/wx/motif/dialog.h index ca8290e082..2fde3e3060 100644 --- a/include/wx/motif/dialog.h +++ b/include/wx/motif/dialog.h @@ -21,99 +21,98 @@ WXDLLEXPORT_DATA(extern const char*) wxDialogNameStr; // Dialog boxes -class WXDLLEXPORT wxDialog: public wxPanel +class WXDLLEXPORT wxDialog : public wxPanel { - DECLARE_DYNAMIC_CLASS(wxDialog) +DECLARE_DYNAMIC_CLASS(wxDialog) + public: + wxDialog(); + + // Constructor with a modal flag, but no window id - the old convention + wxDialog(wxWindow *parent, + const wxString& title, bool modal, + int x = -1, int y= -1, int width = 500, int height = 500, + long style = wxDEFAULT_DIALOG_STYLE, + const wxString& name = wxDialogNameStr) + { + long modalStyle = modal ? wxDIALOG_MODAL : wxDIALOG_MODELESS ; + Create(parent, -1, title, wxPoint(x, y), wxSize(width, height), style|modalStyle, name); + } + + // Constructor with no modal flag - the new convention. + wxDialog(wxWindow *parent, wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_DIALOG_STYLE, + const wxString& name = wxDialogNameStr) + { + Create(parent, id, title, pos, size, style, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxString& title, // bool modal = FALSE, // TODO make this a window style? + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_DIALOG_STYLE, + const wxString& name = wxDialogNameStr); + + ~wxDialog(); + + virtual bool Destroy(); + + bool Show(bool show); + void Iconize(bool iconize); + void Raise(); + void Lower(); + + virtual bool IsIconized() const; + void Fit(); + + void SetTitle(const wxString& title); + wxString GetTitle() const ; + + // bool OnClose(); + void OnCharHook(wxKeyEvent& event); + void OnCloseWindow(wxCloseEvent& event); + + void SetModal(bool flag); + + virtual void Centre(int direction = wxBOTH); + virtual bool IsModal() const { return ((GetWindowStyleFlag() & wxDIALOG_MODAL) == wxDIALOG_MODAL); } + + virtual int ShowModal(); + virtual void EndModal(int retCode); + + // Standard buttons + void OnOK(wxCommandEvent& event); + void OnApply(wxCommandEvent& event); + void OnCancel(wxCommandEvent& event); + + // Responds to colour changes + void OnSysColourChanged(wxSysColourChangedEvent& event); + + // Implementation + virtual void ChangeFont(bool keepOriginalSize = TRUE); + virtual void ChangeBackgroundColour(); + virtual void ChangeForegroundColour(); + inline WXWidget GetTopWidget() const { return m_mainWidget; } + inline WXWidget GetClientWidget() const { return m_mainWidget; } - wxDialog(); - - // Constructor with a modal flag, but no window id - the old convention - inline wxDialog(wxWindow *parent, - const wxString& title, bool modal, - int x = -1, int y= -1, int width = 500, int height = 500, - long style = wxDEFAULT_DIALOG_STYLE, - const wxString& name = wxDialogNameStr) - { - long modalStyle = modal ? wxDIALOG_MODAL : wxDIALOG_MODELESS ; - Create(parent, -1, title, wxPoint(x, y), wxSize(width, height), style|modalStyle, name); - } - - // Constructor with no modal flag - the new convention. - inline wxDialog(wxWindow *parent, wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_DIALOG_STYLE, - const wxString& name = wxDialogNameStr) - { - Create(parent, id, title, pos, size, style, name); - } - - bool Create(wxWindow *parent, wxWindowID id, - const wxString& title, // bool modal = FALSE, // TODO make this a window style? - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_DIALOG_STYLE, - const wxString& name = wxDialogNameStr); - - ~wxDialog(); - - virtual bool Destroy(); - void SetClientSize(int width, int height); - void SetClientSize(const wxSize& size) { wxWindow::SetClientSize(size); } - - void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); - virtual void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO) - { wxWindow::SetSize(rect, sizeFlags); } - virtual void SetSize(const wxSize& size) { wxWindow::SetSize(size); } - virtual void SetSize(int width, int height) { SetSize(-1, -1, width, height, wxSIZE_USE_EXISTING); } - - bool Show(bool show); - void Iconize(bool iconize); - void Raise(); - void Lower(); - - virtual bool IsIconized() const; - void Fit(); - - void SetTitle(const wxString& title); - wxString GetTitle() const ; - -// bool OnClose(); - void OnCharHook(wxKeyEvent& event); - void OnCloseWindow(wxCloseEvent& event); - - void SetModal(bool flag); - - virtual void Centre(int direction = wxBOTH); - virtual bool IsModal() const { return ((GetWindowStyleFlag() & wxDIALOG_MODAL) == wxDIALOG_MODAL); } - - virtual int ShowModal(); - virtual void EndModal(int retCode); - - // Standard buttons - void OnOK(wxCommandEvent& event); - void OnApply(wxCommandEvent& event); - void OnCancel(wxCommandEvent& event); - - // Responds to colour changes - void OnSysColourChanged(wxSysColourChangedEvent& event); - -// Implementation - virtual void ChangeFont(bool keepOriginalSize = TRUE); - virtual void ChangeBackgroundColour(); - virtual void ChangeForegroundColour(); - inline WXWidget GetTopWidget() const { return m_mainWidget; } - inline WXWidget GetClientWidget() const { return m_mainWidget; } +public: + //// Motif-specific + bool m_modalShowing; + wxString m_dialogTitle; +protected: + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); -public: - //// Motif-specific - bool m_modalShowing; - wxString m_dialogTitle; + virtual void DoSetClientSize(int width, int height); -DECLARE_EVENT_TABLE() +private: + DECLARE_EVENT_TABLE() }; #endif diff --git a/include/wx/motif/frame.h b/include/wx/motif/frame.h index bd2a51a950..9326616bb9 100644 --- a/include/wx/motif/frame.h +++ b/include/wx/motif/frame.h @@ -26,185 +26,179 @@ WXDLLEXPORT_DATA(extern const char*) wxToolBarNameStr; class WXDLLEXPORT wxMenuBar; class WXDLLEXPORT wxStatusBar; -class WXDLLEXPORT wxFrame: public wxWindow { - - DECLARE_DYNAMIC_CLASS(wxFrame) +class WXDLLEXPORT wxFrame : public wxWindow +{ +DECLARE_DYNAMIC_CLASS(wxFrame) public: - wxFrame(); - inline wxFrame(wxWindow *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr) - { - Create(parent, id, title, pos, size, style, name); - } - - ~wxFrame(); - - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr); - - virtual bool Destroy(); - - void SetClientSize(int width, int height); - void SetClientSize(const wxSize& size) { wxWindow::SetClientSize(size); } - - void GetClientSize(int *width, int *height) const; - wxSize GetClientSize() const { return wxWindow::GetClientSize(); } - - void GetSize(int *width, int *height) const ; - wxSize GetSize() const { return wxWindow::GetSize(); } - - void GetPosition(int *x, int *y) const ; - wxPoint GetPosition() const { return wxWindow::GetPosition(); } - - void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); - virtual void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO) - { wxWindow::SetSize(rect, sizeFlags); } - virtual void SetSize(const wxSize& size) { wxWindow::SetSize(size); } - virtual void SetSize(int width, int height) { SetSize(-1, -1, width, height, wxSIZE_USE_EXISTING); } - - void ClientToScreen(int *x, int *y) const; - wxPoint ClientToScreen(const wxPoint& pt) const { return wxWindow::ClientToScreen(pt); } - - void ScreenToClient(int *x, int *y) const; - wxPoint ScreenToClient(const wxPoint& pt) const { return wxWindow::ScreenToClient(pt); } - - void OnSize(wxSizeEvent& event); - void OnMenuHighlight(wxMenuEvent& event); - void OnActivate(wxActivateEvent& event); - void OnIdle(wxIdleEvent& event); - void OnCloseWindow(wxCloseEvent& event); - - bool Show(bool show); - - // Set menu bar - void SetMenuBar(wxMenuBar *menu_bar); - virtual wxMenuBar *GetMenuBar() const ; - - // Set title - void SetTitle(const wxString& title); - inline wxString GetTitle() const { return m_title; } - - void Centre(int direction = wxBOTH); - - // Call this to simulate a menu command - virtual void Command(int id); - virtual void ProcessCommand(int id); - - // Set icon - virtual void SetIcon(const wxIcon& icon); - - // Create status line - virtual wxStatusBar* CreateStatusBar(int number=1, long style = wxST_SIZEGRIP, wxWindowID id = 0, - const wxString& name = "statusBar"); - inline wxStatusBar *GetStatusBar() const { return m_frameStatusBar; } - virtual void PositionStatusBar(); - virtual wxStatusBar *OnCreateStatusBar(int number, long style, wxWindowID id, - const wxString& name); - - // Create toolbar + wxFrame(); + wxFrame(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxFrameNameStr) + { + Create(parent, id, title, pos, size, style, name); + } + + ~wxFrame(); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxFrameNameStr); + + virtual bool Destroy(); + + void SetClientSize(int width, int height); + void GetClientSize(int *width, int *height) const; + void GetSize(int *width, int *height) const ; + void GetPosition(int *x, int *y) const ; + + void ClientToScreen(int *x, int *y) const; + wxPoint ClientToScreen(const wxPoint& pt) const { return wxWindow::ClientToScreen(pt); } + + void ScreenToClient(int *x, int *y) const; + wxPoint ScreenToClient(const wxPoint& pt) const { return wxWindow::ScreenToClient(pt); } + + void OnSize(wxSizeEvent& event); + void OnMenuHighlight(wxMenuEvent& event); + void OnActivate(wxActivateEvent& event); + void OnIdle(wxIdleEvent& event); + void OnCloseWindow(wxCloseEvent& event); + + bool Show(bool show); + + // Set menu bar + void SetMenuBar(wxMenuBar *menu_bar); + virtual wxMenuBar *GetMenuBar() const ; + + // Set title + void SetTitle(const wxString& title); + wxString GetTitle() const { return m_title; } + + void Centre(int direction = wxBOTH); + + // Call this to simulate a menu command + virtual void Command(int id); + virtual void ProcessCommand(int id); + + // Set icon + virtual void SetIcon(const wxIcon& icon); + + // Create status line + virtual wxStatusBar* CreateStatusBar(int number=1, long style = wxST_SIZEGRIP, wxWindowID id = 0, + const wxString& name = "statusBar"); + wxStatusBar *GetStatusBar() const { return m_frameStatusBar; } + virtual void PositionStatusBar(); + virtual wxStatusBar *OnCreateStatusBar(int number, long style, wxWindowID id, + const wxString& name); + + // Create toolbar #if wxUSE_TOOLBAR - virtual wxToolBar* CreateToolBar(long style = wxNO_BORDER|wxTB_HORIZONTAL, wxWindowID id = -1, const wxString& name = wxToolBarNameStr); - virtual wxToolBar *OnCreateToolBar(long style, wxWindowID id, const wxString& name); - // If made known to the frame, the frame will manage it automatically. - virtual void SetToolBar(wxToolBar *toolbar) ; - virtual wxToolBar *GetToolBar() const ; - virtual void PositionToolBar(); + virtual wxToolBar* CreateToolBar(long style = wxNO_BORDER|wxTB_HORIZONTAL, wxWindowID id = -1, const wxString& name = wxToolBarNameStr); + virtual wxToolBar *OnCreateToolBar(long style, wxWindowID id, const wxString& name); + // If made known to the frame, the frame will manage it automatically. + virtual void SetToolBar(wxToolBar *toolbar) ; + virtual wxToolBar *GetToolBar() const ; + virtual void PositionToolBar(); #endif // wxUSE_TOOLBAR - // Set status line text - virtual void SetStatusText(const wxString& text, int number = 0); + // Set status line text + virtual void SetStatusText(const wxString& text, int number = 0); - // Set status line widths - virtual void SetStatusWidths(int n, const int widths_field[]); + // Set status line widths + virtual void SetStatusWidths(int n, const int widths_field[]); - // Hint to tell framework which status bar to use - // TODO: should this go into a wxFrameworkSettings class perhaps? - static void UseNativeStatusBar(bool useNative) { m_useNativeStatusBar = useNative; }; - static bool UsesNativeStatusBar() { return m_useNativeStatusBar; }; + // Hint to tell framework which status bar to use + // TODO: should this go into a wxFrameworkSettings class perhaps? + static void UseNativeStatusBar(bool useNative) { m_useNativeStatusBar = useNative; }; + static bool UsesNativeStatusBar() { return m_useNativeStatusBar; }; - // Fit frame around subwindows - virtual void Fit(); + // Fit frame around subwindows + virtual void Fit(); - // Iconize - virtual void Iconize(bool iconize); + // Iconize + virtual void Iconize(bool iconize); - virtual bool IsIconized() const ; + virtual bool IsIconized() const ; - // Compatibility - inline bool Iconized() const { return IsIconized(); } + // Compatibility + bool Iconized() const { return IsIconized(); } - // Is the frame maximized? Returns FALSE under Motif (but TRUE for - // wxMDIChildFrame due to the tabbed implementation). - virtual bool IsMaximized(void) const ; + // Is the frame maximized? Returns FALSE under Motif (but TRUE for + // wxMDIChildFrame due to the tabbed implementation). + virtual bool IsMaximized(void) const ; - virtual void Maximize(bool maximize); + virtual void Maximize(bool maximize); - // Responds to colour changes - void OnSysColourChanged(wxSysColourChangedEvent& event); + // Responds to colour changes + void OnSysColourChanged(wxSysColourChangedEvent& event); - // Query app for menu item updates (called from OnIdle) - void DoMenuUpdates(); - void DoMenuUpdates(wxMenu* menu); + // Query app for menu item updates (called from OnIdle) + void DoMenuUpdates(); + void DoMenuUpdates(wxMenu* menu); - // Checks if there is a toolbar, and returns the first free client position - virtual wxPoint GetClientAreaOrigin() const; + // Checks if there is a toolbar, and returns the first free client position + virtual wxPoint GetClientAreaOrigin() const; - virtual void Raise(); - virtual void Lower(); + virtual void Raise(); + virtual void Lower(); - virtual void CaptureMouse(); - virtual void ReleaseMouse(); + virtual void CaptureMouse(); + virtual void ReleaseMouse(); -// Implementation - virtual void ChangeFont(bool keepOriginalSize = TRUE); - virtual void ChangeBackgroundColour(); - virtual void ChangeForegroundColour(); - WXWidget GetMenuBarWidget() const ; - inline WXWidget GetShellWidget() const { return m_frameShell; } - inline WXWidget GetWorkAreaWidget() const { return m_workArea; } - inline WXWidget GetClientAreaWidget() const { return m_clientArea; } - inline WXWidget GetTopWidget() const { return m_frameShell; } - inline WXWidget GetMainWindowWidget() const { return m_frameWidget; } + // Implementation + virtual void ChangeFont(bool keepOriginalSize = TRUE); + virtual void ChangeBackgroundColour(); + virtual void ChangeForegroundColour(); + WXWidget GetMenuBarWidget() const ; + WXWidget GetShellWidget() const { return m_frameShell; } + WXWidget GetWorkAreaWidget() const { return m_workArea; } + WXWidget GetClientAreaWidget() const { return m_clientArea; } + WXWidget GetTopWidget() const { return m_frameShell; } + WXWidget GetMainWindowWidget() const { return m_frameWidget; } - // The widget that can have children on it - WXWidget GetClientWidget() const; - bool GetVisibleStatus() const { return m_visibleStatus; } + // The widget that can have children on it + WXWidget GetClientWidget() const; + bool GetVisibleStatus() const { return m_visibleStatus; } - bool PreResize(); + bool PreResize(); protected: - wxMenuBar * m_frameMenuBar; - wxStatusBar * m_frameStatusBar; - wxIcon m_icon; - bool m_iconized; - static bool m_useNativeStatusBar; + wxMenuBar * m_frameMenuBar; + wxStatusBar * m_frameStatusBar; + wxIcon m_icon; + bool m_iconized; + static bool m_useNativeStatusBar; #if wxUSE_TOOLBAR - wxToolBar * m_frameToolBar ; + wxToolBar * m_frameToolBar ; #endif // wxUSE_TOOLBAR - //// Motif-specific + //// Motif-specific + + WXWidget m_frameShell; + WXWidget m_frameWidget; + WXWidget m_workArea; + WXWidget m_clientArea; + // WXWidget m_menuBarWidget; + bool m_visibleStatus; + wxString m_title; + + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); - WXWidget m_frameShell; - WXWidget m_frameWidget; - WXWidget m_workArea; - WXWidget m_clientArea; -// WXWidget m_menuBarWidget; - bool m_visibleStatus; - wxString m_title; + virtual void DoSetClientSize(int width, int height); - DECLARE_EVENT_TABLE() +private: + DECLARE_EVENT_TABLE() }; #endif diff --git a/include/wx/motif/gauge.h b/include/wx/motif/gauge.h index 81413b0488..201b6e5488 100644 --- a/include/wx/motif/gauge.h +++ b/include/wx/motif/gauge.h @@ -21,57 +21,52 @@ WXDLLEXPORT_DATA(extern const char*) wxGaugeNameStr; // Group box -class WXDLLEXPORT wxGauge: public wxControl +class WXDLLEXPORT wxGauge : public wxControl { - DECLARE_DYNAMIC_CLASS(wxGauge) - public: - inline wxGauge() { m_rangeMax = 0; m_gaugePos = 0; } + DECLARE_DYNAMIC_CLASS(wxGauge) - inline wxGauge(wxWindow *parent, wxWindowID id, - int range, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxGA_HORIZONTAL, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxGaugeNameStr) - { - Create(parent, id, range, pos, size, style, validator, name); - } +public: + inline wxGauge() { m_rangeMax = 0; m_gaugePos = 0; } - bool Create(wxWindow *parent, wxWindowID id, - int range, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxGA_HORIZONTAL, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxGaugeNameStr); + inline wxGauge(wxWindow *parent, wxWindowID id, + int range, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxGA_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxGaugeNameStr) + { + Create(parent, id, range, pos, size, style, validator, name); + } - void SetShadowWidth(int w); - void SetBezelFace(int w); - void SetRange(int r); - void SetValue(int pos); + bool Create(wxWindow *parent, wxWindowID id, + int range, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxGA_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxGaugeNameStr); - int GetShadowWidth() const ; - int GetBezelFace() const ; - int GetRange() const ; - int GetValue() const ; + void SetShadowWidth(int w); + void SetBezelFace(int w); + void SetRange(int r); + void SetValue(int pos); - void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); - virtual void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO) - { wxWindow::SetSize(rect, sizeFlags); } - virtual void SetSize(const wxSize& size) { wxWindow::SetSize(size); } - virtual void SetSize(int width, int height) { SetSize(-1, -1, width, height, wxSIZE_USE_EXISTING); } + int GetShadowWidth() const ; + int GetBezelFace() const ; + int GetRange() const ; + int GetValue() const ; - virtual void Command(wxCommandEvent& WXUNUSED(event)) {} ; + virtual void Command(wxCommandEvent& WXUNUSED(event)) {} ; -// Implementation - virtual void ChangeFont(bool keepOriginalSize = TRUE); - virtual void ChangeBackgroundColour(); - virtual void ChangeForegroundColour(); + // Implementation + virtual void ChangeFont(bool keepOriginalSize = TRUE); + virtual void ChangeBackgroundColour(); + virtual void ChangeForegroundColour(); - protected: - int m_rangeMax; - int m_gaugePos; +protected: + int m_rangeMax; + int m_gaugePos; }; #endif diff --git a/include/wx/motif/listbox.h b/include/wx/motif/listbox.h index 5d3d61ca42..ea5c008089 100644 --- a/include/wx/motif/listbox.h +++ b/include/wx/motif/listbox.h @@ -28,86 +28,84 @@ WXDLLEXPORT_DATA(extern const char*) wxEmptyString; // List box item class WXDLLEXPORT wxListBox: public wxControl { - DECLARE_DYNAMIC_CLASS(wxListBox) - public: - - wxListBox(); - inline wxListBox(wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr): - m_clientDataList(wxKEY_INTEGER) - { - Create(parent, id, pos, size, n, choices, style, validator, name); - } - - bool Create(wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr); - - ~wxListBox(); - - virtual void Append(const wxString& item); - virtual void Append(const wxString& item, char *clientData); - virtual void Set(int n, const wxString* choices, char **clientData = NULL); - virtual int FindString(const wxString& s) const ; - virtual void Clear(); - virtual void SetSelection(int n, bool select = TRUE); - - virtual void Deselect(int n); - - // For single choice list item only - virtual int GetSelection() const ; - virtual void Delete(int n); - virtual char *GetClientData(int n) const ; - virtual void *GetClientData() { return wxWindow::GetClientData(); } - virtual void SetClientData(int n, char *clientData); - virtual void SetClientData( void *data ) { wxWindow::SetClientData(data); } - virtual void SetString(int n, const wxString& s); - - // For single or multiple choice list item - virtual int GetSelections(wxArrayInt& aSelections) const; - virtual bool Selected(int n) const ; - virtual wxString GetString(int n) const ; - - virtual void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); - virtual void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO) - { wxWindow::SetSize(rect, sizeFlags); } - virtual void SetSize(const wxSize& size) { wxWindow::SetSize(size); } - virtual void SetSize(int width, int height) { SetSize(-1, -1, width, height, wxSIZE_USE_EXISTING); } - - // Set the specified item at the first visible item - // or scroll to max range. - virtual void SetFirstItem(int n) ; - virtual void SetFirstItem(const wxString& s) ; - - virtual void InsertItems(int nItems, const wxString items[], int pos); - - virtual wxString GetStringSelection() const ; - virtual bool SetStringSelection(const wxString& s, bool flag = TRUE); - virtual int Number() const ; - - void Command(wxCommandEvent& event); - -// Implementation - virtual void ChangeFont(bool keepOriginalSize = TRUE); - virtual void ChangeBackgroundColour(); - virtual void ChangeForegroundColour(); - WXWidget GetTopWidget() const; +DECLARE_DYNAMIC_CLASS(wxListBox) + +public: + wxListBox(); + wxListBox(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr): + m_clientDataList(wxKEY_INTEGER) + { + Create(parent, id, pos, size, n, choices, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr); + + ~wxListBox(); + + virtual void Append(const wxString& item); + virtual void Append(const wxString& item, char *clientData); + virtual void Set(int n, const wxString* choices, char **clientData = NULL); + virtual int FindString(const wxString& s) const ; + virtual void Clear(); + virtual void SetSelection(int n, bool select = TRUE); + + virtual void Deselect(int n); + + // For single choice list item only + virtual int GetSelection() const ; + virtual void Delete(int n); + virtual char *GetClientData(int n) const ; + virtual void *GetClientData() { return wxWindow::GetClientData(); } + virtual void SetClientData(int n, char *clientData); + virtual void SetClientData( void *data ) { wxWindow::SetClientData(data); } + virtual void SetString(int n, const wxString& s); + + // For single or multiple choice list item + virtual int GetSelections(wxArrayInt& aSelections) const; + virtual bool Selected(int n) const ; + virtual wxString GetString(int n) const ; + + // Set the specified item at the first visible item + // or scroll to max range. + virtual void SetFirstItem(int n) ; + virtual void SetFirstItem(const wxString& s) ; + + virtual void InsertItems(int nItems, const wxString items[], int pos); + + virtual wxString GetStringSelection() const ; + virtual bool SetStringSelection(const wxString& s, bool flag = TRUE); + virtual int Number() const ; + + void Command(wxCommandEvent& event); + + // Implementation + virtual void ChangeFont(bool keepOriginalSize = TRUE); + virtual void ChangeBackgroundColour(); + virtual void ChangeForegroundColour(); + WXWidget GetTopWidget() const; protected: - int m_noItems; - int m_selected; + int m_noItems; + int m_selected; - // List mapping positions->client data - wxList m_clientDataList; + // List mapping positions->client data + wxList m_clientDataList; + + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); }; #endif diff --git a/include/wx/motif/mdi.h b/include/wx/motif/mdi.h index 7abbbe9ca9..26376b2c61 100644 --- a/include/wx/motif/mdi.h +++ b/include/wx/motif/mdi.h @@ -117,91 +117,83 @@ DECLARE_EVENT_TABLE() class WXDLLEXPORT wxMDIChildFrame: public wxFrame { DECLARE_DYNAMIC_CLASS(wxMDIChildFrame) -public: - - wxMDIChildFrame(); - inline wxMDIChildFrame(wxMDIParentFrame *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr) - { - Create(parent, id, title, pos, size, style, name); - } - - ~wxMDIChildFrame(); - - bool Create(wxMDIParentFrame *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr); - - // Set menu bar - void SetMenuBar(wxMenuBar *menu_bar); - void SetTitle(const wxString& title); - - void SetClientSize(int width, int height); - void SetClientSize(const wxSize& size) { wxWindow::SetClientSize(size); } - - void GetClientSize(int *width, int *height) const; - wxSize GetClientSize() const { return wxWindow::GetClientSize(); } - void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); - virtual void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO) - { wxWindow::SetSize(rect, sizeFlags); } - virtual void SetSize(const wxSize& size) { wxWindow::SetSize(size); } - virtual void SetSize(int width, int height) { SetSize(-1, -1, width, height, wxSIZE_USE_EXISTING); } - - void GetSize(int *width, int *height) const; - wxSize GetSize() const { return wxWindow::GetSize(); } - - void GetPosition(int *x, int *y) const ; - wxPoint GetPosition() const { return wxWindow::GetPosition(); } - - // Set icon - virtual void SetIcon(const wxIcon& icon); - - // Override wxFrame operations - void CaptureMouse(); - void ReleaseMouse(); - void Raise(); - void Lower(void); - void SetSizeHints(int minW = -1, int minH = -1, int maxW = -1, int maxH = -1, int incW = -1, int incH = -1); - - // MDI operations - virtual void Maximize(); - virtual void Maximize(bool WXUNUSED(maximize)) { }; - inline void Minimize() { Iconize(TRUE); }; - virtual void Iconize(bool iconize); - virtual void Restore(); - virtual void Activate(); - virtual bool IsIconized() const ; - - // Is the frame maximized? Returns TRUE for - // wxMDIChildFrame due to the tabbed implementation. - virtual bool IsMaximized(void) const ; - - bool Show(bool show); - - inline WXWidget GetMainWidget() const { return m_mainWidget; }; - inline WXWidget GetTopWidget() const { return m_mainWidget; }; - inline WXWidget GetClientWidget() const { return m_mainWidget; }; - -/* - virtual void OnRaise(); - virtual void OnLower(); -*/ - - inline void SetMDIParentFrame(wxMDIParentFrame* parentFrame) { m_mdiParentFrame = parentFrame; } - inline wxMDIParentFrame* GetMDIParentFrame() const { return m_mdiParentFrame; } +public: + wxMDIChildFrame(); + wxMDIChildFrame(wxMDIParentFrame *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxFrameNameStr) + { + Create(parent, id, title, pos, size, style, name); + } + + ~wxMDIChildFrame(); + + bool Create(wxMDIParentFrame *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxFrameNameStr); + + // Set menu bar + void SetMenuBar(wxMenuBar *menu_bar); + void SetTitle(const wxString& title); + + void SetClientSize(int width, int height); + void GetClientSize(int *width, int *height); + void GetSize(int *width, int *height) const; + void GetPosition(int *x, int *y) const ; + + // Set icon + virtual void SetIcon(const wxIcon& icon); + + // Override wxFrame operations + void CaptureMouse(); + void ReleaseMouse(); + void Raise(); + void Lower(void); + void SetSizeHints(int minW = -1, int minH = -1, int maxW = -1, int maxH = -1, int incW = -1, int incH = -1); + + // MDI operations + virtual void Maximize(); + virtual void Maximize(bool WXUNUSED(maximize)) { }; + inline void Minimize() { Iconize(TRUE); }; + virtual void Iconize(bool iconize); + virtual void Restore(); + virtual void Activate(); + virtual bool IsIconized() const ; + + // Is the frame maximized? Returns TRUE for + // wxMDIChildFrame due to the tabbed implementation. + virtual bool IsMaximized(void) const ; + + bool Show(bool show); + + WXWidget GetMainWidget() const { return m_mainWidget; }; + WXWidget GetTopWidget() const { return m_mainWidget; }; + WXWidget GetClientWidget() const { return m_mainWidget; }; + + /* + virtual void OnRaise(); + virtual void OnLower(); + */ + + void SetMDIParentFrame(wxMDIParentFrame* parentFrame) { m_mdiParentFrame = parentFrame; } + wxMDIParentFrame* GetMDIParentFrame() const { return m_mdiParentFrame; } protected: - wxMDIParentFrame* m_mdiParentFrame; + wxMDIParentFrame* m_mdiParentFrame; + + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); + virtual void DoSetClientSize(int width, int height); }; /* The client window is a child of the parent MDI frame, and itself @@ -213,47 +205,38 @@ protected: class WXDLLEXPORT wxMDIClientWindow: public wxNotebook { - DECLARE_DYNAMIC_CLASS(wxMDIClientWindow) - public: - - wxMDIClientWindow() ; - inline wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0) - { - CreateClient(parent, style); - } +DECLARE_DYNAMIC_CLASS(wxMDIClientWindow) - ~wxMDIClientWindow(); - - void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); - void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO) - { wxWindow::SetSize(rect, sizeFlags); } - void SetSize(const wxSize& size) { wxWindow::SetSize(size); } - virtual void SetSize(int width, int height) { SetSize(-1, -1, width, height, wxSIZE_USE_EXISTING); } - - void SetClientSize(int width, int height); - void SetClientSize(const wxSize& size) { wxWindow::SetClientSize(size); } - - void GetClientSize(int *width, int *height) const; - wxSize GetClientSize() const { return wxWindow::GetClientSize(); } +public: + wxMDIClientWindow() ; + wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0) + { + CreateClient(parent, style); + } - void GetSize(int *width, int *height) const ; - wxSize GetSize() const { return wxWindow::GetSize(); } + ~wxMDIClientWindow(); - void GetPosition(int *x, int *y) const ; - wxPoint GetPosition() const { return wxWindow::GetPosition(); } + void GetClientSize(int *width, int *height) const; + void GetSize(int *width, int *height) const ; + void GetPosition(int *x, int *y) const ; - // Note: this is virtual, to allow overridden behaviour. - virtual bool CreateClient(wxMDIParentFrame *parent, long style = wxVSCROLL | wxHSCROLL); + // Note: this is virtual, to allow overridden behaviour. + virtual bool CreateClient(wxMDIParentFrame *parent, long style = wxVSCROLL | wxHSCROLL); - // Explicitly call default scroll behaviour - void OnScroll(wxScrollEvent& event); + // Explicitly call default scroll behaviour + void OnScroll(wxScrollEvent& event); - // Implementation - void OnPageChanged(wxNotebookEvent& event); + // Implementation + void OnPageChanged(wxNotebookEvent& event); protected: + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); + virtual void DoSetClientSize(int width, int height); -DECLARE_EVENT_TABLE() +private: + DECLARE_EVENT_TABLE() }; #endif diff --git a/include/wx/motif/radiobox.h b/include/wx/motif/radiobox.h index 6d536f7a97..8ef4be358a 100644 --- a/include/wx/motif/radiobox.h +++ b/include/wx/motif/radiobox.h @@ -23,77 +23,77 @@ WXDLLEXPORT_DATA(extern const char*) wxRadioBoxNameStr; // List box item class WXDLLEXPORT wxBitmap ; -class WXDLLEXPORT wxRadioBox: public wxControl +class WXDLLEXPORT wxRadioBox : public wxControl { - DECLARE_DYNAMIC_CLASS(wxRadioBox) +DECLARE_DYNAMIC_CLASS(wxRadioBox) + public: - wxRadioBox(); - - inline wxRadioBox(wxWindow *parent, wxWindowID id, const wxString& title, - const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, - int majorDim = 0, long style = wxRA_HORIZONTAL, - const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr) - { - Create(parent, id, title, pos, size, n, choices, majorDim, style, val, name); - } - - ~wxRadioBox(); - - bool Create(wxWindow *parent, wxWindowID id, const wxString& title, - const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, - int majorDim = 0, long style = wxRA_HORIZONTAL, - const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr); - - int FindString(const wxString& s) const; - void SetSelection(int N); - int GetSelection() const; - wxString GetString(int N) const; - void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); - void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO) - { wxWindow::SetSize(rect, sizeFlags); } - void SetSize(const wxSize& size) { wxWindow::SetSize(size); } - virtual void SetSize(int width, int height) { SetSize(-1, -1, width, height, wxSIZE_USE_EXISTING); } - - void SetLabel(const wxString& label) { wxControl::SetLabel(label); }; - void SetLabel(int item, const wxString& label) ; - wxString GetLabel(int item) const; - wxString GetLabel() const { return wxControl::GetLabel(); }; - void Enable(bool enable); - void Enable(int item, bool enable); - void Show(int item, bool show) ; - bool Show(bool show) ; - - virtual wxString GetStringSelection() const; - virtual bool SetStringSelection(const wxString& s); - inline virtual int Number() const { return m_noItems; } ; - void Command(wxCommandEvent& event); - - inline int GetNumberOfRowsOrCols() const { return m_noRowsOrCols; } - inline void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; } - -// Implementation - virtual void ChangeFont(bool keepOriginalSize = TRUE); - virtual void ChangeBackgroundColour(); - virtual void ChangeForegroundColour(); - WXWidget GetTopWidget() const { return m_formWidget; } - WXWidget GetLabelWidget() const { return m_labelWidget; } - WXWidget GetFrameWidget() const { return m_frameWidget; } - inline WXWidget* GetRadioButtons() const { return m_radioButtons; } - inline void SetSel(int i) { m_selectedButton = i; } + wxRadioBox(); + + wxRadioBox(wxWindow *parent, wxWindowID id, const wxString& title, + const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + int majorDim = 0, long style = wxRA_HORIZONTAL, + const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr) + { + Create(parent, id, title, pos, size, n, choices, majorDim, style, val, name); + } + + ~wxRadioBox(); + + bool Create(wxWindow *parent, wxWindowID id, const wxString& title, + const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + int majorDim = 0, long style = wxRA_HORIZONTAL, + const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr); + + int FindString(const wxString& s) const; + void SetSelection(int N); + int GetSelection() const; + wxString GetString(int N) const; + + void SetLabel(const wxString& label) { wxControl::SetLabel(label); }; + void SetLabel(int item, const wxString& label) ; + wxString GetLabel(int item) const; + wxString GetLabel() const { return wxControl::GetLabel(); }; + void Enable(bool enable); + void Enable(int item, bool enable); + void Show(int item, bool show) ; + bool Show(bool show) ; + + virtual wxString GetStringSelection() const; + virtual bool SetStringSelection(const wxString& s); + virtual int Number() const { return m_noItems; } ; + void Command(wxCommandEvent& event); + + int GetNumberOfRowsOrCols() const { return m_noRowsOrCols; } + void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; } + + // Implementation + virtual void ChangeFont(bool keepOriginalSize = TRUE); + virtual void ChangeBackgroundColour(); + virtual void ChangeForegroundColour(); + WXWidget GetTopWidget() const { return m_formWidget; } + WXWidget GetLabelWidget() const { return m_labelWidget; } + WXWidget GetFrameWidget() const { return m_frameWidget; } + inline WXWidget* GetRadioButtons() const { return m_radioButtons; } + inline void SetSel(int i) { m_selectedButton = i; } protected: - int m_majorDim ; - int m_noItems; - int m_noRowsOrCols; - int m_selectedButton; - - WXWidget m_formWidget; - WXWidget m_labelWidget; - WXWidget m_frameWidget; - WXWidget* m_radioButtons; - wxString* m_radioButtonLabels; + int m_majorDim ; + int m_noItems; + int m_noRowsOrCols; + int m_selectedButton; + + WXWidget m_formWidget; + WXWidget m_labelWidget; + WXWidget m_frameWidget; + WXWidget* m_radioButtons; + wxString* m_radioButtonLabels; + + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); }; #endif diff --git a/include/wx/motif/slider.h b/include/wx/motif/slider.h index 5d1bacf51a..fd9e5b3c28 100644 --- a/include/wx/motif/slider.h +++ b/include/wx/motif/slider.h @@ -23,78 +23,78 @@ WXDLLEXPORT_DATA(extern const char*) wxSliderNameStr; // Slider class WXDLLEXPORT wxSlider: public wxControl { - DECLARE_DYNAMIC_CLASS(wxSlider) +DECLARE_DYNAMIC_CLASS(wxSlider) public: - wxSlider(); - - inline wxSlider(wxWindow *parent, wxWindowID id, - int value, int minValue, int maxValue, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSL_HORIZONTAL, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxSliderNameStr) - { - Create(parent, id, value, minValue, maxValue, pos, size, style, validator, name); - } - - ~wxSlider(); - - bool Create(wxWindow *parent, wxWindowID id, - int value, int minValue, int maxValue, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSL_HORIZONTAL, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxSliderNameStr); - - virtual int GetValue() const ; - virtual void SetValue(int); - void GetSize(int *x, int *y) const ; - wxSize GetSize() const { return wxWindow::GetSize(); } - - void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); - void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO) - { wxWindow::SetSize(rect, sizeFlags); } - void SetSize(const wxSize& size) { wxWindow::SetSize(size); } - virtual void SetSize(int width, int height) { SetSize(-1, -1, width, height, wxSIZE_USE_EXISTING); } - - void SetRange(int minValue, int maxValue); - - inline int GetMin() const { return m_rangeMin; } - inline int GetMax() const { return m_rangeMax; } - - // For trackbars only - void SetTickFreq(int n, int pos); - inline int GetTickFreq() const { return m_tickFreq; } - void SetPageSize(int pageSize); - int GetPageSize() const ; - void ClearSel() ; - void ClearTicks() ; - void SetLineSize(int lineSize); - int GetLineSize() const ; - int GetSelEnd() const ; - int GetSelStart() const ; - void SetSelection(int minPos, int maxPos); - void SetThumbLength(int len) ; - int GetThumbLength() const ; - void SetTick(int tickPos) ; - - void Command(wxCommandEvent& event); - -// Implementation - virtual void ChangeFont(bool keepOriginalSize = TRUE); - virtual void ChangeBackgroundColour(); - virtual void ChangeForegroundColour(); - - protected: - int m_rangeMin; - int m_rangeMax; - int m_pageSize; - int m_lineSize; - int m_tickFreq; -DECLARE_EVENT_TABLE() + wxSlider(); + + wxSlider(wxWindow *parent, wxWindowID id, + int value, int minValue, int maxValue, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSL_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxSliderNameStr) + { + Create(parent, id, value, minValue, maxValue, pos, size, style, validator, name); + } + + ~wxSlider(); + + bool Create(wxWindow *parent, wxWindowID id, + int value, int minValue, int maxValue, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSL_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxSliderNameStr); + + virtual int GetValue() const ; + virtual void SetValue(int); + + void GetSize(int *x, int *y) const ; + + void SetRange(int minValue, int maxValue); + + inline int GetMin() const { return m_rangeMin; } + inline int GetMax() const { return m_rangeMax; } + + // For trackbars only + void SetTickFreq(int n, int pos); + inline int GetTickFreq() const { return m_tickFreq; } + void SetPageSize(int pageSize); + int GetPageSize() const ; + void ClearSel() ; + void ClearTicks() ; + void SetLineSize(int lineSize); + int GetLineSize() const ; + int GetSelEnd() const ; + int GetSelStart() const ; + void SetSelection(int minPos, int maxPos); + void SetThumbLength(int len) ; + int GetThumbLength() const ; + void SetTick(int tickPos) ; + + void Command(wxCommandEvent& event); + + // Implementation + virtual void ChangeFont(bool keepOriginalSize = TRUE); + virtual void ChangeBackgroundColour(); + virtual void ChangeForegroundColour(); + +protected: + int m_rangeMin; + int m_rangeMax; + int m_pageSize; + int m_lineSize; + int m_tickFreq; + + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); + +private: + DECLARE_EVENT_TABLE() }; #endif diff --git a/include/wx/motif/statbmp.h b/include/wx/motif/statbmp.h index 3da85fba6f..24688066d9 100644 --- a/include/wx/motif/statbmp.h +++ b/include/wx/motif/statbmp.h @@ -20,54 +20,48 @@ WXDLLEXPORT_DATA(extern const char*) wxStaticBitmapNameStr; -class WXDLLEXPORT wxStaticBitmap: public wxControl +class WXDLLEXPORT wxStaticBitmap : public wxControl { - DECLARE_DYNAMIC_CLASS(wxStaticBitmap) - public: - inline wxStaticBitmap() { } - ~wxStaticBitmap(); - - inline wxStaticBitmap(wxWindow *parent, wxWindowID id, - const wxBitmap& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxStaticBitmapNameStr) - { - Create(parent, id, label, pos, size, style, name); - } - - bool Create(wxWindow *parent, wxWindowID id, - const wxBitmap& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxStaticBitmapNameStr); - - virtual void SetBitmap(const wxBitmap& bitmap); - - virtual void Command(wxCommandEvent& WXUNUSED(event)) {}; - virtual void ProcessCommand(wxCommandEvent& WXUNUSED(event)) {}; - - void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); - void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO) - { wxWindow::SetSize(rect, sizeFlags); } - void SetSize(const wxSize& size) { wxWindow::SetSize(size); } - virtual void SetSize(int width, int height) { SetSize(-1, -1, width, height, wxSIZE_USE_EXISTING); } - - inline wxBitmap& GetBitmap() const { return (wxBitmap&) m_messageBitmap; } - - // overriden base class virtuals - virtual bool AcceptsFocus() const { return FALSE; } - -// Implementation - virtual void ChangeFont(bool keepOriginalSize = TRUE); - virtual void ChangeBackgroundColour(); - virtual void ChangeForegroundColour(); - - protected: - wxBitmap m_messageBitmap; - +DECLARE_DYNAMIC_CLASS(wxStaticBitmap) + +public: + wxStaticBitmap() { } + ~wxStaticBitmap(); + + wxStaticBitmap(wxWindow *parent, wxWindowID id, + const wxBitmap& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxStaticBitmapNameStr) + { + Create(parent, id, label, pos, size, style, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxBitmap& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxStaticBitmapNameStr); + + virtual void SetBitmap(const wxBitmap& bitmap); + + virtual void Command(wxCommandEvent& WXUNUSED(event)) {}; + virtual void ProcessCommand(wxCommandEvent& WXUNUSED(event)) {}; + + wxBitmap& GetBitmap() const { return (wxBitmap&) m_messageBitmap; } + + // overriden base class virtuals + virtual bool AcceptsFocus() const { return FALSE; } + + // Implementation + virtual void ChangeFont(bool keepOriginalSize = TRUE); + virtual void ChangeBackgroundColour(); + virtual void ChangeForegroundColour(); + +protected: + wxBitmap m_messageBitmap; }; #endif diff --git a/include/wx/motif/statbox.h b/include/wx/motif/statbox.h index 5ebf48dd4e..48059b5318 100644 --- a/include/wx/motif/statbox.h +++ b/include/wx/motif/statbox.h @@ -23,53 +23,52 @@ WXDLLEXPORT_DATA(extern const char*) wxStaticBoxNameStr; // Group box class WXDLLEXPORT wxStaticBox: public wxControl { - DECLARE_DYNAMIC_CLASS(wxStaticBox) +DECLARE_DYNAMIC_CLASS(wxStaticBox) - public: - wxStaticBox(); - inline wxStaticBox(wxWindow *parent, wxWindowID id, - const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxStaticBoxNameStr) - { - Create(parent, id, label, pos, size, style, name); - } - ~wxStaticBox(); +public: + wxStaticBox(); + wxStaticBox(wxWindow *parent, wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxStaticBoxNameStr) + { + Create(parent, id, label, pos, size, style, name); + } + ~wxStaticBox(); - bool Create(wxWindow *parent, wxWindowID id, - const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxStaticBoxNameStr); + bool Create(wxWindow *parent, wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxStaticBoxNameStr); - virtual void Command(wxCommandEvent& WXUNUSED(event)) {}; - virtual void ProcessCommand(wxCommandEvent& WXUNUSED(event)) {}; + virtual void Command(wxCommandEvent& WXUNUSED(event)) {}; + virtual void ProcessCommand(wxCommandEvent& WXUNUSED(event)) {}; - void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); - void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO) - { wxWindow::SetSize(rect, sizeFlags); } - void SetSize(const wxSize& size) { wxWindow::SetSize(size); } - virtual void SetSize(int width, int height) { SetSize(-1, -1, width, height, wxSIZE_USE_EXISTING); } + void SetLabel(const wxString& label); + wxString GetLabel() const; - void SetLabel(const wxString& label); - wxString GetLabel() const; + // Implementation + virtual void ChangeFont(bool keepOriginalSize = TRUE); + virtual void ChangeBackgroundColour(); + virtual void ChangeForegroundColour(); + WXWidget GetTopWidget() const { return m_formWidget; } + WXWidget GetLabelWidget() const { return m_labelWidget; } -// Implementation - virtual void ChangeFont(bool keepOriginalSize = TRUE); - virtual void ChangeBackgroundColour(); - virtual void ChangeForegroundColour(); - WXWidget GetTopWidget() const { return m_formWidget; } - WXWidget GetLabelWidget() const { return m_labelWidget; } +protected: + // Motif-specific + WXWidget m_formWidget; + WXWidget m_labelWidget; -DECLARE_EVENT_TABLE() + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); -protected: - // Motif-specific - WXWidget m_formWidget; - WXWidget m_labelWidget; +private: + DECLARE_EVENT_TABLE() }; #endif diff --git a/include/wx/motif/window.h b/include/wx/motif/window.h index 81c51482c0..c5bc74b719 100644 --- a/include/wx/motif/window.h +++ b/include/wx/motif/window.h @@ -109,561 +109,614 @@ private: wxString m_data; }; -class WXDLLEXPORT wxWindow: public wxEvtHandler +class WXDLLEXPORT wxWindow : public wxEvtHandler { - DECLARE_ABSTRACT_CLASS(wxWindow) + DECLARE_ABSTRACT_CLASS(wxWindow) - friend class WXDLLEXPORT wxDC; - friend class WXDLLEXPORT wxWindowDC; + friend class WXDLLEXPORT wxDC; + friend class WXDLLEXPORT wxWindowDC; public: - wxWindow(); - inline wxWindow(wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxPanelNameStr) - { - m_children = new wxList; - Create(parent, id, pos, size, style, name); - } - - virtual ~wxWindow(); - - bool Create(wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxPanelNameStr); - - // Fit the window around the items - virtual void Fit(); - - // Show or hide the window - virtual bool Show(bool show); - - // Is the window shown? - virtual bool IsShown() const; - - // Raise the window to the top of the Z order - virtual void Raise(); - - // Lower the window to the bottom of the Z order - virtual void Lower(); - - // Is the window enabled? - virtual bool IsEnabled() const; - - // For compatibility - inline bool Enabled() const { return IsEnabled(); } - - // Dialog support: override these and call - // base class members to add functionality - // that can't be done using validators. - - // Transfer values to controls. If returns FALSE, - // it's an application error (pops up a dialog) - virtual bool TransferDataToWindow(); - - // Transfer values from controls. If returns FALSE, - // transfer failed: don't quit - virtual bool TransferDataFromWindow(); - - // Validate controls. If returns FALSE, - // validation failed: don't quit - virtual bool Validate(); - - // Return code for dialogs - inline void SetReturnCode(int retCode); - inline int GetReturnCode(); - - // Set the cursor - virtual void SetCursor(const wxCursor& cursor); - inline virtual wxCursor *GetCursor() const { return (wxCursor *)& m_windowCursor; }; - - // Get the window with the focus - static wxWindow *FindFocus(); - - // Get character size - virtual int GetCharHeight() const; - virtual int GetCharWidth() const; - - // Get overall window size - virtual void GetSize(int *width, int *height) const; - virtual wxSize GetSize() const { int w, h; GetSize(& w, & h); return wxSize(w, h); } - virtual wxRect GetRect() const { int w, h; int x, y; GetPosition(& x, & y); GetSize(& w, & h); return wxRect(x, y, w, h); } - - // Get window position, relative to parent (or screen if no parent) - virtual void GetPosition(int *x, int *y) const; - virtual wxPoint GetPosition() const { int x, y; GetPosition(&x, &y); return wxPoint(x, y); } - - // Get client (application-useable) size - virtual void GetClientSize(int *width, int *height) const; - virtual wxSize GetClientSize() const { int w, h; GetClientSize(& w, & h); return wxSize(w, h); } - - // Set overall size and position - virtual void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); - virtual void SetSize(int width, int height) { SetSize(-1, -1, width, height, wxSIZE_USE_EXISTING); } - virtual void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO) - { SetSize(rect.x, rect.y, rect.width, rect.height, sizeFlags); } - virtual void SetSize(const wxSize& size) { SetSize(-1, -1, size.x, size.y, wxSIZE_USE_EXISTING); } - - virtual void Move(int x, int y) { SetSize(x, y, -1, -1, wxSIZE_USE_EXISTING); } - virtual void Move(const wxPoint& pt) { SetSize(pt.x, pt.y, -1, -1, wxSIZE_USE_EXISTING); } - - // Set client size - virtual void SetClientSize(int width, int size); - virtual void SetClientSize(const wxSize& sz) { SetClientSize(sz.x, sz.y); } - - // Convert client to screen coordinates - virtual void ClientToScreen(int *x, int *y) const; - virtual wxPoint ClientToScreen(const wxPoint& pt) const + wxWindow(); + wxWindow(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxPanelNameStr) + { + m_children = new wxList; + Create(parent, id, pos, size, style, name); + } + + virtual ~wxWindow(); + + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxPanelNameStr); + + // Fit the window around the items + virtual void Fit(); + + // Show or hide the window + virtual bool Show(bool show); + + // Is the window shown? + virtual bool IsShown() const; + + // Raise the window to the top of the Z order + virtual void Raise(); + + // Lower the window to the bottom of the Z order + virtual void Lower(); + + // Is the window enabled? + virtual bool IsEnabled() const; + + // For compatibility + bool Enabled() const { return IsEnabled(); } + + // Dialog support: override these and call + // base class members to add functionality + // that can't be done using validators. + + // Transfer values to controls. If returns FALSE, + // it's an application error (pops up a dialog) + virtual bool TransferDataToWindow(); + + // Transfer values from controls. If returns FALSE, + // transfer failed: don't quit + virtual bool TransferDataFromWindow(); + + // Validate controls. If returns FALSE, + // validation failed: don't quit + virtual bool Validate(); + + // Return code for dialogs + inline void SetReturnCode(int retCode); + inline int GetReturnCode(); + + // Set the cursor + virtual void SetCursor(const wxCursor& cursor); + virtual wxCursor *GetCursor() const { return (wxCursor *)& m_windowCursor; }; + + // Get the window with the focus + static wxWindow *FindFocus(); + + // Get character size + virtual int GetCharHeight() const; + virtual int GetCharWidth() const; + + // moving/resizing + // --------------- + + // set the window size and/or position + void SetSize( int x, int y, int width, int height, + int sizeFlags = wxSIZE_AUTO ) + { DoSetSize(x, y, width, height, sizeFlags); } + + void SetSize( int width, int height ) + { DoSetSize( -1, -1, width, height, wxSIZE_USE_EXISTING ); } + + void SetSize( const wxSize& size ) + { SetSize( size.x, size.y); } + + void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO) + { DoSetSize(rect.x, rect.y, rect.width, rect.height, sizeFlags); } + + void Move( int x, int y ) + { DoSetSize( x, y, -1, -1, wxSIZE_USE_EXISTING ); } + + void Move(const wxPoint& pt) + { Move(pt.x, pt.y); } + + // client size is the size of area available for subwindows + void SetClientSize( int width, int height ) + { DoSetClientSize(width, height); } + + void SetClientSize( const wxSize& size ) + { DoSetClientSize(size.x, size.y); } + + void SetClientSize(const wxRect& rect) + { SetClientSize( rect.width, rect.height ); } + + // get the window position and/or size + virtual void GetPosition( int *x, int *y ) const; + wxPoint GetPosition() const + { + int w, h; + GetPosition(& w, & h); + + return wxPoint(w, h); + } + + virtual void GetSize( int *width, int *height ) const; + + wxSize GetSize() const + { + int w, h; + GetSize(& w, & h); + return wxSize(w, h); + } + + wxRect GetRect() const + { + int x, y, w, h; + GetPosition(& x, & y); + GetSize(& w, & h); + + return wxRect(x, y, w, h); + } + + virtual void GetClientSize( int *width, int *height ) const; + wxSize GetClientSize() const + { + int w, h; + GetClientSize(& w, & h); + return wxSize(w, h); + } + + // Convert client to screen coordinates + virtual void ClientToScreen(int *x, int *y) const; + virtual wxPoint ClientToScreen(const wxPoint& pt) const { int x = pt.x; int y = pt.y; ClientToScreen(& x, & y); return wxPoint(x, y); } - // Convert screen to client coordinates - virtual void ScreenToClient(int *x, int *y) const; - virtual wxPoint ScreenToClient(const wxPoint& pt) const + // Convert screen to client coordinates + virtual void ScreenToClient(int *x, int *y) const; + virtual wxPoint ScreenToClient(const wxPoint& pt) const { int x = pt.x; int y = pt.y; ScreenToClient(& x, & y); return wxPoint(x, y); } - // Set the focus to this window - virtual void SetFocus(); + // Set the focus to this window + virtual void SetFocus(); - // Capture/release mouse - virtual void CaptureMouse(); - virtual void ReleaseMouse(); + // Capture/release mouse + virtual void CaptureMouse(); + virtual void ReleaseMouse(); - // Enable or disable the window - virtual void Enable(bool enable); + // Enable or disable the window + virtual void Enable(bool enable); #if wxUSE_DRAG_AND_DROP - // Associate a drop target with this window (if the window already had a drop - // target, it's deleted!) and return the current drop target (may be NULL). - void SetDropTarget(wxDropTarget *pDropTarget); - wxDropTarget *GetDropTarget() const { return m_pDropTarget; } + // Associate a drop target with this window (if the window already had a drop + // target, it's deleted!) and return the current drop target (may be NULL). + void SetDropTarget(wxDropTarget *pDropTarget); + wxDropTarget *GetDropTarget() const { return m_pDropTarget; } #endif - // Accept files for dragging - virtual void DragAcceptFiles(bool accept); + // Accept files for dragging + virtual void DragAcceptFiles(bool accept); - // tooltips + // tooltips // create a tooltip with this text - void SetToolTip(const wxString& tip); + void SetToolTip(const wxString& tip); - // TODO + // TODO #if wxUSE_TOOLTIPS // pointer may be NULL to remove the tooltip - void SetToolTip(wxToolTip *tooltip); + void SetToolTip(wxToolTip *tooltip); // get the current tooltip (may return NULL if none) - wxToolTip* GetToolTip() const { return m_tooltip; } + wxToolTip* GetToolTip() const { return m_tooltip; } #endif - // Update region access - virtual wxRegion& GetUpdateRegion() const; - virtual bool IsExposed(int x, int y, int w, int h) const; - virtual bool IsExposed(const wxPoint& pt) const; - virtual bool IsExposed(const wxRect& rect) const; - - // Set/get the window title - virtual inline void SetTitle(const wxString& WXUNUSED(title)) {}; - inline virtual wxString GetTitle() const { return wxString(""); }; - // Most windows have the concept of a label; for frames, this is the - // title; for items, this is the label or button text. - inline virtual wxString GetLabel() const { return GetTitle(); } - - // Set/get the window name (used for resource setting in X) - inline virtual wxString GetName() const; - inline virtual void SetName(const wxString& name); - - // Centre the window - virtual void Centre(int direction) ; - inline void Center(int direction = wxHORIZONTAL) { Centre(direction); } - - // Popup a menu - virtual bool PopupMenu(wxMenu *menu, int x, int y); - - // Send the window a refresh event - virtual void Refresh(bool eraseBack = TRUE, const wxRect *rect = NULL); - - // New functions that will replace the above. - virtual void SetScrollbar(int orient, int pos, int thumbVisible, - int range, bool refresh = TRUE); - - // Helper functions for Motif - void CreateScrollbar(int orientation); - void DestroyScrollbar(int orientation); - - virtual void SetScrollPos(int orient, int pos, bool refresh = TRUE); - virtual int GetScrollPos(int orient) const; - virtual int GetScrollRange(int orient) const; - virtual int GetScrollThumb(int orient) const; - - virtual void ScrollWindow(int dx, int dy, const wxRect *rect = NULL); - - // Caret manipulation - virtual void CreateCaret(int w, int h); - virtual void CreateCaret(const wxBitmap *bitmap); - virtual void DestroyCaret(); - virtual void ShowCaret(bool show); - virtual void SetCaretPos(int x, int y); - virtual void GetCaretPos(int *x, int *y) const; - - // Tell window how much it can be sized - virtual void SetSizeHints(int minW = -1, int minH = -1, int maxW = -1, int maxH = -1, int incW = -1, int incH = -1); - - // Set/get the window's identifier - inline int GetId() const; - inline void SetId(int id); - - virtual void SetAcceleratorTable(const wxAcceleratorTable& accel); - inline virtual wxAcceleratorTable& GetAcceleratorTable() const { return (wxAcceleratorTable&) m_acceleratorTable; } - - // Make the window modal (all other windows unresponsive) - virtual void MakeModal(bool modal); - - // Get the private handle (platform-dependent) - inline void *GetHandle() const; - - // Set/get the window's relatives - inline wxWindow *GetParent() const; - inline void SetParent(wxWindow *p) ; - inline wxWindow *GetGrandParent() const; - inline wxList& GetChildren() const; - // Reparents this window to have the new parent. - virtual bool Reparent(wxWindow* parent); - - // Set/get the window's font - virtual void SetFont(const wxFont& f); - inline virtual wxFont& GetFont() const; - - // Set/get the window's validator - void SetValidator(const wxValidator& validator); - inline wxValidator *GetValidator() const; - - virtual void SetClientObject( wxClientData *data ); - virtual wxClientData *GetClientObject(); - - virtual void SetClientData( void *data ); - virtual void *GetClientData(); - - // Set/get the window's style - inline void SetWindowStyleFlag(long flag); - inline long GetWindowStyleFlag() const; - - // Handle a control command - virtual void OnCommand(wxWindow& win, wxCommandEvent& event); - - // Set/get event handler - inline void SetEventHandler(wxEvtHandler *handler); - inline wxEvtHandler *GetEventHandler() const; - - // Push/pop event handler (i.e. allow a chain of event handlers - // be searched) - void PushEventHandler(wxEvtHandler *handler) ; - wxEvtHandler *PopEventHandler(bool deleteHandler = FALSE) ; - - // Close the window by calling OnClose, posting a deletion - virtual bool Close(bool force = FALSE); - - // Destroy the window (delayed, if a managed window) - virtual bool Destroy() ; - - // Mode for telling default OnSize members to - // call Layout(), if not using Sizers, just top-down constraints - inline void SetAutoLayout(bool a); - inline bool GetAutoLayout() const; - - // Set/get constraints - inline wxLayoutConstraints *GetConstraints() const; - void SetConstraints(wxLayoutConstraints *c); - - // Set/get window background colour - virtual void SetBackgroundColour(const wxColour& col); - inline virtual wxColour GetBackgroundColour() const; - - // Set/get window foreground colour - virtual void SetForegroundColour(const wxColour& col); - inline virtual wxColour GetForegroundColour() const; - - // Get the default button, if there is one - inline virtual wxButton *GetDefaultItem() const; - inline virtual void SetDefaultItem(wxButton *but); - - // Override to define new behaviour for default action (e.g. double clicking - // on a listbox) - virtual void OnDefaultAction(wxControl *initiatingItem); - - // Resource loading + // Update region access + virtual wxRegion& GetUpdateRegion() const; + virtual bool IsExposed(int x, int y, int w, int h) const; + virtual bool IsExposed(const wxPoint& pt) const; + virtual bool IsExposed(const wxRect& rect) const; + + // Set/get the window title + virtual void SetTitle(const wxString& WXUNUSED(title)) {}; + virtual wxString GetTitle() const { return wxString(""); }; + // Most windows have the concept of a label; for frames, this is the + // title; for items, this is the label or button text. + virtual wxString GetLabel() const { return GetTitle(); } + + // Set/get the window name (used for resource setting in X) + virtual wxString GetName() const; + virtual void SetName(const wxString& name); + + // Centre the window + virtual void Centre(int direction) ; + void Center(int direction = wxHORIZONTAL) { Centre(direction); } + + // Popup a menu + virtual bool PopupMenu(wxMenu *menu, int x, int y); + + // Send the window a refresh event + virtual void Refresh(bool eraseBack = TRUE, const wxRect *rect = NULL); + + // New functions that will replace the above. + virtual void SetScrollbar(int orient, int pos, int thumbVisible, + int range, bool refresh = TRUE); + + // Helper functions for Motif + void CreateScrollbar(int orientation); + void DestroyScrollbar(int orientation); + + virtual void SetScrollPos(int orient, int pos, bool refresh = TRUE); + virtual int GetScrollPos(int orient) const; + virtual int GetScrollRange(int orient) const; + virtual int GetScrollThumb(int orient) const; + + virtual void ScrollWindow(int dx, int dy, const wxRect *rect = NULL); + + // Caret manipulation + virtual void CreateCaret(int w, int h); + virtual void CreateCaret(const wxBitmap *bitmap); + virtual void DestroyCaret(); + virtual void ShowCaret(bool show); + virtual void SetCaretPos(int x, int y); + virtual void GetCaretPos(int *x, int *y) const; + + // Tell window how much it can be sized + virtual void SetSizeHints(int minW = -1, int minH = -1, int maxW = -1, int maxH = -1, int incW = -1, int incH = -1); + + // Set/get the window's identifier + inline int GetId() const; + inline void SetId(int id); + + virtual void SetAcceleratorTable(const wxAcceleratorTable& accel); + virtual wxAcceleratorTable& GetAcceleratorTable() const { return (wxAcceleratorTable&) m_acceleratorTable; } + + // Make the window modal (all other windows unresponsive) + virtual void MakeModal(bool modal); + + // Get the private handle (platform-dependent) + inline void *GetHandle() const; + + // Set/get the window's relatives + inline wxWindow *GetParent() const; + inline void SetParent(wxWindow *p) ; + inline wxWindow *GetGrandParent() const; + inline wxList& GetChildren() const; + // Reparents this window to have the new parent. + virtual bool Reparent(wxWindow* parent); + + // Set/get the window's font + virtual void SetFont(const wxFont& f); + virtual wxFont& GetFont() const; + + // Set/get the window's validator + void SetValidator(const wxValidator& validator); + inline wxValidator *GetValidator() const; + + virtual void SetClientObject( wxClientData *data ); + virtual wxClientData *GetClientObject(); + + virtual void SetClientData( void *data ); + virtual void *GetClientData(); + + // Set/get the window's style + inline void SetWindowStyleFlag(long flag); + inline long GetWindowStyleFlag() const; + + // Handle a control command + virtual void OnCommand(wxWindow& win, wxCommandEvent& event); + + // Set/get event handler + inline void SetEventHandler(wxEvtHandler *handler); + inline wxEvtHandler *GetEventHandler() const; + + // Push/pop event handler (i.e. allow a chain of event handlers + // be searched) + void PushEventHandler(wxEvtHandler *handler) ; + wxEvtHandler *PopEventHandler(bool deleteHandler = FALSE) ; + + // Close the window by calling OnClose, posting a deletion + virtual bool Close(bool force = FALSE); + + // Destroy the window (delayed, if a managed window) + virtual bool Destroy() ; + + // Mode for telling default OnSize members to + // call Layout(), if not using Sizers, just top-down constraints + inline void SetAutoLayout(bool a); + inline bool GetAutoLayout() const; + + // Set/get constraints + inline wxLayoutConstraints *GetConstraints() const; + void SetConstraints(wxLayoutConstraints *c); + + // Set/get window background colour + virtual void SetBackgroundColour(const wxColour& col); + virtual wxColour GetBackgroundColour() const; + + // Set/get window foreground colour + virtual void SetForegroundColour(const wxColour& col); + virtual wxColour GetForegroundColour() const; + + // Get the default button, if there is one + virtual wxButton *GetDefaultItem() const; + virtual void SetDefaultItem(wxButton *but); + + // Override to define new behaviour for default action (e.g. double clicking + // on a listbox) + virtual void OnDefaultAction(wxControl *initiatingItem); + + // Resource loading #if wxUSE_WX_RESOURCES - virtual bool LoadFromResource(wxWindow *parent, const wxString& resourceName, const wxResourceTable *table = NULL); - virtual wxControl *CreateItem(const wxItemResource* childResource, const wxItemResource* parentResource, - const wxResourceTable *table = (const wxResourceTable *) NULL); + virtual bool LoadFromResource(wxWindow *parent, const wxString& resourceName, const wxResourceTable *table = NULL); + virtual wxControl *CreateItem(const wxItemResource* childResource, const wxItemResource* parentResource, + const wxResourceTable *table = (const wxResourceTable *) NULL); #endif - virtual void GetTextExtent(const wxString& string, int *x, int *y, - int *descent = NULL, - int *externalLeading = NULL, - const wxFont *theFont = NULL, bool use16 = FALSE) const; + virtual void GetTextExtent(const wxString& string, int *x, int *y, + int *descent = NULL, + int *externalLeading = NULL, + const wxFont *theFont = NULL, bool use16 = FALSE) const; - // Is the window retained? - inline bool IsRetained() const; + // Is the window retained? + inline bool IsRetained() const; - // Warp the pointer the given position - virtual void WarpPointer(int x_pos, int y_pos) ; + // Warp the pointer the given position + virtual void WarpPointer(int x_pos, int y_pos) ; - // Clear the window - virtual void Clear(); + // Clear the window + virtual void Clear(); - // Find a window by id or name - virtual wxWindow *FindWindow(long id); - virtual wxWindow *FindWindow(const wxString& name); + // Find a window by id or name + virtual wxWindow *FindWindow(long id); + virtual wxWindow *FindWindow(const wxString& name); - // Constraint operations - bool Layout(); - void SetSizer(wxSizer *sizer); // Adds sizer child to this window - inline wxSizer *GetSizer() const ; - inline wxWindow *GetSizerParent() const ; - inline void SetSizerParent(wxWindow *win); + // Constraint operations + bool Layout(); + void SetSizer(wxSizer *sizer); // Adds sizer child to this window + inline wxSizer *GetSizer() const ; + inline wxWindow *GetSizerParent() const ; + inline void SetSizerParent(wxWindow *win); - // Do Update UI processing for controls - void UpdateWindowUI(); + // Do Update UI processing for controls + void UpdateWindowUI(); - void OnEraseBackground(wxEraseEvent& event); - void OnChar(wxKeyEvent& event); - void OnKeyDown(wxKeyEvent& event); - void OnKeyUp(wxKeyEvent& event); - void OnPaint(wxPaintEvent& event); - void OnIdle(wxIdleEvent& event); + void OnEraseBackground(wxEraseEvent& event); + void OnChar(wxKeyEvent& event); + void OnKeyDown(wxKeyEvent& event); + void OnKeyUp(wxKeyEvent& event); + void OnPaint(wxPaintEvent& event); + void OnIdle(wxIdleEvent& event); - // Does this window want to accept keyboard focus? - virtual bool AcceptsFocus() const; + // Does this window want to accept keyboard focus? + virtual bool AcceptsFocus() const; - virtual void PrepareDC( wxDC & WXUNUSED(dc) ) {}; + virtual void PrepareDC( wxDC & WXUNUSED(dc) ) {}; public: - //////////////////////////////////////////////////////////////////////// - //// IMPLEMENTATION - - // For implementation purposes - sometimes decorations make the client area - // smaller - virtual wxPoint GetClientAreaOrigin() const; - - // Makes an adjustment to the window position (for example, a frame that has - // a toolbar that it manages itself). - virtual void AdjustForParentClientOrigin(int& x, int& y, int sizeFlags); - - // Executes the default message - virtual long Default(); - -/* TODO: you may need something like this - // Determine whether 3D effects are wanted - virtual WXDWORD Determine3DEffects(WXDWORD defaultBorderStyle, bool *want3D); -*/ - - virtual void AddChild(wxWindow *child); // Adds reference to the child object - virtual void RemoveChild(wxWindow *child); // Removes reference to child - // (but doesn't delete the child object) - virtual void DestroyChildren(); // Removes and destroys all children - - inline bool IsBeingDeleted() const { return FALSE; } // TODO: Should probably eliminate this - - // Constraint implementation - void UnsetConstraints(wxLayoutConstraints *c); - inline wxList *GetConstraintsInvolvedIn() const ; - // Back-pointer to other windows we're involved with, so if we delete - // this window, we must delete any constraints we're involved with. - void AddConstraintReference(wxWindow *otherWin); - void RemoveConstraintReference(wxWindow *otherWin); - void DeleteRelatedConstraints(); - - virtual void ResetConstraints(); - virtual void SetConstraintSizes(bool recurse = TRUE); - virtual bool LayoutPhase1(int *noChanges); - virtual bool LayoutPhase2(int *noChanges); - virtual bool DoPhase(int); - // Transforms from sizer coordinate space to actual - // parent coordinate space - virtual void TransformSizerToActual(int *x, int *y) const ; - - // Set size with transformation to actual coordinates if nec. - virtual void SizerSetSize(int x, int y, int w, int h); - virtual void SizerMove(int x, int y); - - // Only set/get the size/position of the constraint (if any) - virtual void SetSizeConstraint(int x, int y, int w, int h); - virtual void MoveConstraint(int x, int y); - virtual void GetSizeConstraint(int *w, int *h) const ; - virtual void GetClientSizeConstraint(int *w, int *h) const ; - virtual void GetPositionConstraint(int *x, int *y) const ; - - // Dialog units translations. Implemented in wincmn.cpp. - wxPoint ConvertPixelsToDialog(const wxPoint& pt) ; - wxPoint ConvertDialogToPixels(const wxPoint& pt) ; - inline wxSize ConvertPixelsToDialog(const wxSize& sz) - { wxPoint pt(ConvertPixelsToDialog(wxPoint(sz.x, sz.y))); return wxSize(pt.x, pt.y); } - inline wxSize ConvertDialogToPixels(const wxSize& sz) - { wxPoint pt(ConvertDialogToPixels(wxPoint(sz.x, sz.y))); return wxSize(pt.x, pt.y); } - - wxObject *GetChild(int number) const ; - - // Generates a new id for controls - static int NewControlId(); - - // Responds to colour changes: passes event on to children. - void OnSysColourChanged(wxSysColourChangedEvent& event); - - // Transfers data to any child controls - void OnInitDialog(wxInitDialogEvent& event); - - // Sends an OnInitDialog event, which in turns transfers data to - // to the window via validators. - virtual void InitDialog(); - - /// Motif-specific - - void ClearUpdateRects(); - void CanvasGetSize(int* width, int* height) const; // If have drawing area - void CanvasGetClientSize(int *width, int *height) const; - void CanvasGetPosition(int *x, int *y) const; // If have drawing area - void CanvasSetClientSize(int width, int size); - void CanvasSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); - - // Gives window a chance to do something in response to a size - // message, e.g. arrange status bar, toolbar etc. - virtual bool PreResize() { return TRUE; } - - // Get main widget for this window, e.g. a text widget - virtual WXWidget GetMainWidget() const; - // Get the widget that corresponds to the label (for font setting, label setting etc.) - virtual WXWidget GetLabelWidget() const { return GetMainWidget(); } - // Get the client widget for this window (something we can - // create other windows on) - virtual WXWidget GetClientWidget() const; - // Get the top widget for this window, e.g. the scrolled widget parent - // of a multi-line text widget. Top means, top in the window hierarchy - // that implements this window. - virtual WXWidget GetTopWidget() const; - virtual void SetMainWidget(WXWidget w) { m_mainWidget = w; } - bool CanAddEventHandler() const { return m_canAddEventHandler; } - void SetCanAddEventHandler(bool flag) { m_canAddEventHandler = flag; } - - // Get the underlying X window and display - virtual WXWindow GetXWindow() const; - virtual WXDisplay *GetXDisplay() const; - - virtual WXPixmap GetBackingPixmap() const { return m_backingPixmap; } - inline int GetPixmapWidth() const { return m_pixmapWidth; } - inline int GetPixmapHeight() const { return m_pixmapHeight; } - - // Change properties - virtual void ChangeFont(bool keepOriginalSize = TRUE); // Change to the current font (often overridden) - virtual void DoChangeForegroundColour(WXWidget widget, wxColour& foregroundColour); - virtual void DoChangeBackgroundColour(WXWidget widget, wxColour& backgroundColour, bool changeArmColour = FALSE); - // These to be overridden as needed (may change several widgets) - virtual void ChangeBackgroundColour(); // Change background and foreground colour using current - // background colour setting (Motif generates - // foreground based on background) - virtual void ChangeForegroundColour(); // Change foreground colour using current - // foreground colour setting - - // Adds the widget to the hash table and adds event handlers. - bool AttachWidget (wxWindow* parent, WXWidget mainWidget, - WXWidget formWidget, int x, int y, int width, int height); - bool DetachWidget(WXWidget widget); - - // Generates a paint event - virtual void DoPaint(); - - // How to implement accelerators. If we find a key event, - // translate to wxWindows wxKeyEvent form. Find a widget for the window. - // Now find a wxWindow for the widget. If there isn't one, go up the widget hierarchy - // trying to find one. Once one is found, call ProcessAccelerator for the - // window. If it returns TRUE (processed the event), skip the X event, - // otherwise carry on up the wxWindows window hierarchy calling ProcessAccelerator. - // If all return FALSE, process the X event as normal. - // Eventually we can implement OnCharHook the same way, but concentrate on accelerators - // for now. - // ProcessAccelerator must look at the current accelerator table, and try to find - // what menu id or window (beneath it) has this ID. Then construct an appropriate command - // event and send it. - virtual bool ProcessAccelerator(wxKeyEvent& event); - - //////////////////////////////////////////////////////////////////////// - //// PROTECTED DATA + //////////////////////////////////////////////////////////////////////// + //// IMPLEMENTATION + + // For implementation purposes - sometimes decorations make the client area + // smaller + virtual wxPoint GetClientAreaOrigin() const; + + // Makes an adjustment to the window position (for example, a frame that has + // a toolbar that it manages itself). + virtual void AdjustForParentClientOrigin(int& x, int& y, int sizeFlags); + + // Executes the default message + virtual long Default(); + + /* TODO: you may need something like this + // Determine whether 3D effects are wanted + virtual WXDWORD Determine3DEffects(WXDWORD defaultBorderStyle, bool *want3D); + */ + + virtual void AddChild(wxWindow *child); // Adds reference to the child object + virtual void RemoveChild(wxWindow *child); // Removes reference to child + // (but doesn't delete the child object) + virtual void DestroyChildren(); // Removes and destroys all children + + bool IsBeingDeleted() const { return FALSE; } // TODO: Should probably eliminate this + + // Constraint implementation + void UnsetConstraints(wxLayoutConstraints *c); + inline wxList *GetConstraintsInvolvedIn() const ; + // Back-pointer to other windows we're involved with, so if we delete + // this window, we must delete any constraints we're involved with. + void AddConstraintReference(wxWindow *otherWin); + void RemoveConstraintReference(wxWindow *otherWin); + void DeleteRelatedConstraints(); + + virtual void ResetConstraints(); + virtual void SetConstraintSizes(bool recurse = TRUE); + virtual bool LayoutPhase1(int *noChanges); + virtual bool LayoutPhase2(int *noChanges); + virtual bool DoPhase(int); + // Transforms from sizer coordinate space to actual + // parent coordinate space + virtual void TransformSizerToActual(int *x, int *y) const ; + + // Set size with transformation to actual coordinates if nec. + virtual void SizerSetSize(int x, int y, int w, int h); + virtual void SizerMove(int x, int y); + + // Only set/get the size/position of the constraint (if any) + virtual void SetSizeConstraint(int x, int y, int w, int h); + virtual void MoveConstraint(int x, int y); + virtual void GetSizeConstraint(int *w, int *h) const ; + virtual void GetClientSizeConstraint(int *w, int *h) const ; + virtual void GetPositionConstraint(int *x, int *y) const ; + + // Dialog units translations. Implemented in wincmn.cpp. + wxPoint ConvertPixelsToDialog(const wxPoint& pt) ; + wxPoint ConvertDialogToPixels(const wxPoint& pt) ; + inline wxSize ConvertPixelsToDialog(const wxSize& sz) + { wxPoint pt(ConvertPixelsToDialog(wxPoint(sz.x, sz.y))); return wxSize(pt.x, pt.y); } + inline wxSize ConvertDialogToPixels(const wxSize& sz) + { wxPoint pt(ConvertDialogToPixels(wxPoint(sz.x, sz.y))); return wxSize(pt.x, pt.y); } + + wxObject *GetChild(int number) const ; + + // Generates a new id for controls + static int NewControlId(); + + // Responds to colour changes: passes event on to children. + void OnSysColourChanged(wxSysColourChangedEvent& event); + + // Transfers data to any child controls + void OnInitDialog(wxInitDialogEvent& event); + + // Sends an OnInitDialog event, which in turns transfers data to + // to the window via validators. + virtual void InitDialog(); + + /// Motif-specific + + void ClearUpdateRects(); + void CanvasGetSize(int* width, int* height) const; // If have drawing area + void CanvasGetClientSize(int *width, int *height) const; + void CanvasGetPosition(int *x, int *y) const; // If have drawing area + void CanvasSetClientSize(int width, int size); + void CanvasSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); + + // Gives window a chance to do something in response to a size + // message, e.g. arrange status bar, toolbar etc. + virtual bool PreResize() { return TRUE; } + + // Get main widget for this window, e.g. a text widget + virtual WXWidget GetMainWidget() const; + // Get the widget that corresponds to the label (for font setting, label setting etc.) + virtual WXWidget GetLabelWidget() const { return GetMainWidget(); } + // Get the client widget for this window (something we can + // create other windows on) + virtual WXWidget GetClientWidget() const; + // Get the top widget for this window, e.g. the scrolled widget parent + // of a multi-line text widget. Top means, top in the window hierarchy + // that implements this window. + virtual WXWidget GetTopWidget() const; + virtual void SetMainWidget(WXWidget w) { m_mainWidget = w; } + bool CanAddEventHandler() const { return m_canAddEventHandler; } + void SetCanAddEventHandler(bool flag) { m_canAddEventHandler = flag; } + + // Get the underlying X window and display + virtual WXWindow GetXWindow() const; + virtual WXDisplay *GetXDisplay() const; + + virtual WXPixmap GetBackingPixmap() const { return m_backingPixmap; } + int GetPixmapWidth() const { return m_pixmapWidth; } + int GetPixmapHeight() const { return m_pixmapHeight; } + + // Change properties + virtual void ChangeFont(bool keepOriginalSize = TRUE); // Change to the current font (often overridden) + virtual void DoChangeForegroundColour(WXWidget widget, wxColour& foregroundColour); + virtual void DoChangeBackgroundColour(WXWidget widget, wxColour& backgroundColour, bool changeArmColour = FALSE); + // These to be overridden as needed (may change several widgets) + virtual void ChangeBackgroundColour(); // Change background and foreground colour using current + // background colour setting (Motif generates + // foreground based on background) + virtual void ChangeForegroundColour(); // Change foreground colour using current + // foreground colour setting + + // Adds the widget to the hash table and adds event handlers. + bool AttachWidget (wxWindow* parent, WXWidget mainWidget, + WXWidget formWidget, int x, int y, int width, int height); + bool DetachWidget(WXWidget widget); + + // Generates a paint event + virtual void DoPaint(); + + // How to implement accelerators. If we find a key event, + // translate to wxWindows wxKeyEvent form. Find a widget for the window. + // Now find a wxWindow for the widget. If there isn't one, go up the widget hierarchy + // trying to find one. Once one is found, call ProcessAccelerator for the + // window. If it returns TRUE (processed the event), skip the X event, + // otherwise carry on up the wxWindows window hierarchy calling ProcessAccelerator. + // If all return FALSE, process the X event as normal. + // Eventually we can implement OnCharHook the same way, but concentrate on accelerators + // for now. + // ProcessAccelerator must look at the current accelerator table, and try to find + // what menu id or window (beneath it) has this ID. Then construct an appropriate command + // event and send it. + virtual bool ProcessAccelerator(wxKeyEvent& event); + + //////////////////////////////////////////////////////////////////////// + //// PROTECTED DATA protected: - int m_windowId; - long m_windowStyle; // Store the window's style - wxEvtHandler * m_windowEventHandler; // Usually is 'this' - wxLayoutConstraints * m_constraints; // Constraints for this window - wxList * m_constraintsInvolvedIn; // List of constraints we're involved in - wxSizer * m_windowSizer; // Window's top-level sizer (if any) - wxWindow * m_sizerParent; // Window's parent sizer (if any) - bool m_autoLayout; // Whether to call Layout() in OnSize - wxWindow * m_windowParent; // Each window always knows its parent - wxValidator * m_windowValidator; - int m_minSizeX; - int m_minSizeY; - int m_maxSizeX; - int m_maxSizeY; - - // Caret data - int m_caretWidth; - int m_caretHeight; - bool m_caretEnabled; - bool m_caretShown; - wxFont m_windowFont; // Window's font - wxCursor m_windowCursor; // Window's cursor - wxString m_windowName; // Window name - - wxButton * m_defaultItem; - - wxColour m_backgroundColour ; - wxColour m_foregroundColour ; - wxAcceleratorTable m_acceleratorTable; - wxClientData* m_clientObject; - void* m_clientData; + int m_windowId; + long m_windowStyle; // Store the window's style + wxEvtHandler * m_windowEventHandler; // Usually is 'this' + wxLayoutConstraints * m_constraints; // Constraints for this window + wxList * m_constraintsInvolvedIn; // List of constraints we're involved in + wxSizer * m_windowSizer; // Window's top-level sizer (if any) + wxWindow * m_sizerParent; // Window's parent sizer (if any) + bool m_autoLayout; // Whether to call Layout() in OnSize + wxWindow * m_windowParent; // Each window always knows its parent + wxValidator * m_windowValidator; + int m_minSizeX; + int m_minSizeY; + int m_maxSizeX; + int m_maxSizeY; + + // Caret data + int m_caretWidth; + int m_caretHeight; + bool m_caretEnabled; + bool m_caretShown; + wxFont m_windowFont; // Window's font + wxCursor m_windowCursor; // Window's cursor + wxString m_windowName; // Window name + + wxButton * m_defaultItem; + + wxColour m_backgroundColour ; + wxColour m_foregroundColour ; + wxAcceleratorTable m_acceleratorTable; + wxClientData* m_clientObject; + void* m_clientData; #if wxUSE_DRAG_AND_DROP - wxDropTarget *m_pDropTarget; // the current drop target or NULL + wxDropTarget *m_pDropTarget; // the current drop target or NULL #endif //USE_DRAG_AND_DROP public: - wxRegion m_updateRegion; - wxList * m_children; // Window's children - int m_returnCode; + wxRegion m_updateRegion; + wxList * m_children; // Window's children + int m_returnCode; public: - /// Motif-specific - bool m_needsRefresh; // Do we need to repaint the backing store? - bool m_canAddEventHandler; - bool m_button1Pressed; - bool m_button2Pressed; - bool m_button3Pressed; - // For double-click detection - long m_lastTS; // last timestamp - int m_lastButton; // last pressed button - wxList m_updateRects; // List of wxRects representing damaged region - bool m_isShown; + /// Motif-specific + bool m_needsRefresh; // Do we need to repaint the backing store? + bool m_canAddEventHandler; + bool m_button1Pressed; + bool m_button2Pressed; + bool m_button3Pressed; + // For double-click detection + long m_lastTS; // last timestamp + int m_lastButton; // last pressed button + wxList m_updateRects; // List of wxRects representing damaged region + bool m_isShown; protected: - WXWidget m_mainWidget; - WXWidget m_hScrollBar; - WXWidget m_vScrollBar; - WXWidget m_borderWidget; - WXWidget m_scrolledWindow; - WXWidget m_drawingArea; - bool m_winCaptured; - bool m_hScroll; - bool m_vScroll; - WXPixmap m_backingPixmap; - int m_pixmapWidth; - int m_pixmapHeight; - int m_pixmapOffsetX; - int m_pixmapOffsetY; - int m_scrollPosX; // Store the last scroll pos, - int m_scrollPosY; // since in wxWin the pos isn't - // set automatically by system - -DECLARE_EVENT_TABLE() + WXWidget m_mainWidget; + WXWidget m_hScrollBar; + WXWidget m_vScrollBar; + WXWidget m_borderWidget; + WXWidget m_scrolledWindow; + WXWidget m_drawingArea; + bool m_winCaptured; + bool m_hScroll; + bool m_vScroll; + WXPixmap m_backingPixmap; + int m_pixmapWidth; + int m_pixmapHeight; + int m_pixmapOffsetX; + int m_pixmapOffsetY; + int m_scrollPosX; // Store the last scroll pos, + int m_scrollPosY; // since in wxWin the pos isn't + // set automatically by system + + // this is the virtual function to be overriden in any derived class which + // wants to change how SetSize() or Move() works - it is called by all + // versions of these functions in the base class + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); + + // same as DoSetSize() for the client size + virtual void DoSetClientSize(int width, int height); + +private: + DECLARE_EVENT_TABLE() }; //////////////////////////////////////////////////////////////////////// diff --git a/include/wx/msw/button.h b/include/wx/msw/button.h index 12352beb39..2980e97747 100644 --- a/include/wx/msw/button.h +++ b/include/wx/msw/button.h @@ -22,38 +22,39 @@ WXDLLEXPORT_DATA(extern const char*) wxButtonNameStr; // Pushbutton -class WXDLLEXPORT wxButton: public wxControl +class WXDLLEXPORT wxButton : public wxControl { - DECLARE_DYNAMIC_CLASS(wxButton) - public: - inline wxButton(void) {} - inline wxButton(wxWindow *parent, wxWindowID id, const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxButtonNameStr) - { - Create(parent, id, label, pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, wxWindowID id, const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxButtonNameStr); - - virtual void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); - void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO) - { wxWindow::SetSize(rect, sizeFlags); } - void SetSize(const wxSize& size) { wxWindow::SetSize(size); } - - virtual void SetDefault(void); - virtual void SetLabel(const wxString& label); - virtual wxString GetLabel(void) const ; - virtual void Command(wxCommandEvent& event); - virtual bool MSWCommand(WXUINT param, WXWORD id); - virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, - WXUINT message, WXWPARAM wParam, WXLPARAM lParam); +DECLARE_DYNAMIC_CLASS(wxButton) + +public: + wxButton() { } + wxButton(wxWindow *parent, wxWindowID id, const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxButtonNameStr) + { + Create(parent, id, label, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxButtonNameStr); + + virtual void SetDefault(); + virtual void SetLabel(const wxString& label); + virtual wxString GetLabel() const ; + virtual void Command(wxCommandEvent& event); + virtual bool MSWCommand(WXUINT param, WXWORD id); + virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, + WXUINT message, WXWPARAM wParam, WXLPARAM lParam); + +protected: + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); }; #endif diff --git a/include/wx/msw/checkbox.h b/include/wx/msw/checkbox.h index 1234ccc432..0c0e45f31a 100644 --- a/include/wx/msw/checkbox.h +++ b/include/wx/msw/checkbox.h @@ -22,71 +22,75 @@ WXDLLEXPORT_DATA(extern const char*) wxCheckBoxNameStr; // Checkbox item (single checkbox) class WXDLLEXPORT wxBitmap; -class WXDLLEXPORT wxCheckBox: public wxControl +class WXDLLEXPORT wxCheckBox : public wxControl { - DECLARE_DYNAMIC_CLASS(wxCheckBox) - - public: - inline wxCheckBox(void) { } - inline wxCheckBox(wxWindow *parent, wxWindowID id, const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxCheckBoxNameStr) - { - Create(parent, id, label, pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, wxWindowID id, const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxCheckBoxNameStr); - virtual void SetValue(bool); - virtual bool GetValue(void) const ; - virtual void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); - void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO) - { wxWindow::SetSize(rect, sizeFlags); } - void SetSize(const wxSize& size) { wxWindow::SetSize(size); } - - virtual bool MSWCommand(WXUINT param, WXWORD id); - virtual void SetLabel(const wxString& label); - virtual void Command(wxCommandEvent& event); - virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, - WXUINT message, WXWPARAM wParam, WXLPARAM lParam); +DECLARE_DYNAMIC_CLASS(wxCheckBox) + +public: + wxCheckBox() { } + wxCheckBox(wxWindow *parent, wxWindowID id, const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxCheckBoxNameStr) + { + Create(parent, id, label, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxCheckBoxNameStr); + + virtual void SetValue(bool value); + virtual bool GetValue() const ; + + virtual bool MSWCommand(WXUINT param, WXWORD id); + virtual void SetLabel(const wxString& label); + virtual void Command(wxCommandEvent& event); + virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, + WXUINT message, WXWPARAM wParam, WXLPARAM lParam); + +protected: + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); }; class WXDLLEXPORT wxBitmapCheckBox: public wxCheckBox { - DECLARE_DYNAMIC_CLASS(wxBitmapCheckBox) - - public: - int checkWidth ; - int checkHeight ; - - inline wxBitmapCheckBox(void) { checkWidth = -1; checkHeight = -1; } - inline wxBitmapCheckBox(wxWindow *parent, wxWindowID id, const wxBitmap *label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxCheckBoxNameStr) - { - Create(parent, id, label, pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, wxWindowID id, const wxBitmap *bitmap, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxCheckBoxNameStr); - virtual void SetValue(bool); - virtual bool GetValue(void) const ; - virtual void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); - void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO) - { wxWindow::SetSize(rect, sizeFlags); } - void SetSize(const wxSize& size) { wxWindow::SetSize(size); } - - virtual void SetLabel(const wxBitmap& bitmap); +DECLARE_DYNAMIC_CLASS(wxBitmapCheckBox) + +public: + int checkWidth ; + int checkHeight ; + + wxBitmapCheckBox() { checkWidth = -1; checkHeight = -1; } + wxBitmapCheckBox(wxWindow *parent, wxWindowID id, const wxBitmap *label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxCheckBoxNameStr) + { + Create(parent, id, label, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, const wxBitmap *bitmap, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxCheckBoxNameStr); + + virtual void SetValue(bool value); + virtual bool GetValue() const ; + + virtual void SetLabel(const wxBitmap& bitmap); + +protected: + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); }; #endif // _WX_CHECKBOX_H_ diff --git a/include/wx/msw/choice.h b/include/wx/msw/choice.h index c7518c79b8..54da088afd 100644 --- a/include/wx/msw/choice.h +++ b/include/wx/msw/choice.h @@ -23,60 +23,59 @@ WXDLLEXPORT_DATA(extern const char*) wxChoiceNameStr; // Choice item class WXDLLEXPORT wxChoice: public wxControl { - DECLARE_DYNAMIC_CLASS(wxChoice) - - public: - inline wxChoice(void) { m_noStrings = 0; } - - inline wxChoice(wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxChoiceNameStr) - { - Create(parent, id, pos, size, n, choices, style, validator, name); - } - - bool Create(wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxChoiceNameStr); - - virtual void Append(const wxString& item); - virtual void Delete(int n); - virtual void Clear(void); - virtual int GetSelection(void) const ; - virtual void SetSelection(int n); - virtual int FindString(const wxString& s) const; - virtual wxString GetString(int n) const ; - virtual void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); - void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO) - { wxWindow::SetSize(rect, sizeFlags); } - void SetSize(const wxSize& size) { wxWindow::SetSize(size); } - virtual wxString GetStringSelection(void) const ; - virtual bool SetStringSelection(const wxString& sel); - - virtual inline int Number(void) const { return m_noStrings; } - virtual void Command(wxCommandEvent& event); - - virtual bool MSWCommand(WXUINT param, WXWORD id); - - virtual inline void SetColumns(int WXUNUSED(n) = 1 ) { /* No effect */ } ; - virtual inline int GetColumns(void) const { return 1 ; }; - - virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, - WXUINT message, WXWPARAM wParam, WXLPARAM lParam); - - long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); + DECLARE_DYNAMIC_CLASS(wxChoice) + +public: + wxChoice() { m_noStrings = 0; } + + wxChoice(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxChoiceNameStr) + { + Create(parent, id, pos, size, n, choices, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxChoiceNameStr); + + virtual void Append(const wxString& item); + virtual void Delete(int n); + virtual void Clear(); + virtual int GetSelection() const ; + virtual void SetSelection(int n); + virtual int FindString(const wxString& s) const; + virtual wxString GetString(int n) const ; + virtual wxString GetStringSelection() const ; + virtual bool SetStringSelection(const wxString& sel); + + virtual int Number() const { return m_noStrings; } + virtual void Command(wxCommandEvent& event); + + virtual bool MSWCommand(WXUINT param, WXWORD id); + + virtual void SetColumns(int WXUNUSED(n) = 1 ) { /* No effect */ } + virtual int GetColumns() const { return 1 ; } + + virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, + WXUINT message, WXWPARAM wParam, WXLPARAM lParam); + + long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); protected: - int m_noStrings; + int m_noStrings; + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); }; #endif diff --git a/include/wx/msw/frame.h b/include/wx/msw/frame.h index 5c27215173..ed28cd8448 100644 --- a/include/wx/msw/frame.h +++ b/include/wx/msw/frame.h @@ -56,23 +56,9 @@ public: virtual bool Destroy(); - void SetClientSize(int width, int height); - void SetClientSize(const wxSize& sz) { wxWindow::SetClientSize(sz); } - void GetClientSize(int *width, int *height) const; - wxSize GetClientSize() const { return wxWindow::GetClientSize(); } - void GetSize(int *width, int *height) const ; - wxSize GetSize() const { return wxWindow::GetSize(); } - void GetPosition(int *x, int *y) const ; - wxPoint GetPosition() const { return wxWindow::GetPosition(); } - - virtual void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); - virtual void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO) - { wxWindow::SetSize(rect, sizeFlags); } - virtual void SetSize(const wxSize& size) { wxWindow::SetSize(size); } - virtual void SetSize(int width, int height) { SetSize(-1, -1, width, height, wxSIZE_USE_EXISTING); } virtual void ClientToScreen(int *x, int *y) const; @@ -208,6 +194,11 @@ protected: WXHWND m_hwndToolTip; #endif // tooltips + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); + virtual void DoSetClientSize(int width, int height); + private: DECLARE_EVENT_TABLE() }; diff --git a/include/wx/msw/gauge95.h b/include/wx/msw/gauge95.h index 99635c2669..5346750970 100644 --- a/include/wx/msw/gauge95.h +++ b/include/wx/msw/gauge95.h @@ -21,59 +21,59 @@ WXDLLEXPORT_DATA(extern const char*) wxGaugeNameStr; // Group box -class WXDLLEXPORT wxGauge95: public wxControl +class WXDLLEXPORT wxGauge95 : public wxControl { - DECLARE_DYNAMIC_CLASS(wxGauge95) - public: - inline wxGauge95(void) { m_rangeMax = 0; m_gaugePos = 0; } - - inline wxGauge95(wxWindow *parent, wxWindowID id, - int range, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxGA_HORIZONTAL, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxGaugeNameStr) - { - Create(parent, id, range, pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, wxWindowID id, - int range, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxGA_HORIZONTAL, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxGaugeNameStr); - - void SetShadowWidth(int w); - void SetBezelFace(int w); - void SetRange(int r); - void SetValue(int pos); - - int GetShadowWidth(void) const ; - int GetBezelFace(void) const ; - int GetRange(void) const ; - int GetValue(void) const ; - - void SetForegroundColour(const wxColour& col); - void SetBackgroundColour(const wxColour& col); - - // Backward compatibility + DECLARE_DYNAMIC_CLASS(wxGauge95) + +public: + wxGauge95(void) { m_rangeMax = 0; m_gaugePos = 0; } + + wxGauge95(wxWindow *parent, wxWindowID id, + int range, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxGA_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxGaugeNameStr) + { + Create(parent, id, range, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + int range, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxGA_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxGaugeNameStr); + + void SetShadowWidth(int w); + void SetBezelFace(int w); + void SetRange(int r); + void SetValue(int pos); + + int GetShadowWidth(void) const ; + int GetBezelFace(void) const ; + int GetRange(void) const ; + int GetValue(void) const ; + + void SetForegroundColour(const wxColour& col); + void SetBackgroundColour(const wxColour& col); + + // Backward compatibility #if WXWIN_COMPATIBILITY - inline void SetButtonColour(const wxColour& col) { SetForegroundColour(col); } + void SetButtonColour(const wxColour& col) { SetForegroundColour(col); } #endif - void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); - void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO) - { wxWindow::SetSize(rect, sizeFlags); } - void SetSize(const wxSize& size) { wxWindow::SetSize(size); } + virtual void Command(wxCommandEvent& WXUNUSED(event)) {} ; - virtual void Command(wxCommandEvent& WXUNUSED(event)) {} ; +protected: + int m_rangeMax; + int m_gaugePos; - protected: - int m_rangeMax; - int m_gaugePos; + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); }; #endif diff --git a/include/wx/msw/gaugemsw.h b/include/wx/msw/gaugemsw.h index b21b098c66..45774569ba 100644 --- a/include/wx/msw/gaugemsw.h +++ b/include/wx/msw/gaugemsw.h @@ -23,57 +23,57 @@ WXDLLEXPORT_DATA(extern const char*) wxGaugeNameStr; // Group box class WXDLLEXPORT wxGaugeMSW: public wxControl { - DECLARE_DYNAMIC_CLASS(wxGaugeMSW) - public: - inline wxGaugeMSW(void) { m_rangeMax = 0; m_gaugePos = 0; } - - inline wxGaugeMSW(wxWindow *parent, wxWindowID id, - int range, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxGA_HORIZONTAL, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxGaugeNameStr) - { - Create(parent, id, range, pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, wxWindowID id, - int range, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxGA_HORIZONTAL, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxGaugeNameStr); - - void SetShadowWidth(int w); - void SetBezelFace(int w); - void SetRange(int r); - void SetValue(int pos); - - int GetShadowWidth(void) const ; - int GetBezelFace(void) const ; - int GetRange(void) const ; - int GetValue(void) const ; - - void SetForegroundColour(const wxColour& col); - void SetBackgroundColour(const wxColour& col); - - // Backward compatibility + DECLARE_DYNAMIC_CLASS(wxGaugeMSW) + +public: + wxGaugeMSW(void) { m_rangeMax = 0; m_gaugePos = 0; } + + wxGaugeMSW(wxWindow *parent, wxWindowID id, + int range, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxGA_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxGaugeNameStr) + { + Create(parent, id, range, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + int range, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxGA_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxGaugeNameStr); + + void SetShadowWidth(int w); + void SetBezelFace(int w); + void SetRange(int r); + void SetValue(int pos); + + int GetShadowWidth(void) const ; + int GetBezelFace(void) const ; + int GetRange(void) const ; + int GetValue(void) const ; + + void SetForegroundColour(const wxColour& col); + void SetBackgroundColour(const wxColour& col); + + // Backward compatibility #if WXWIN_COMPATIBILITY - inline void SetButtonColour(const wxColour& col) { SetForegroundColour(col); } + void SetButtonColour(const wxColour& col) { SetForegroundColour(col); } #endif - void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); - void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO) - { wxWindow::SetSize(rect, sizeFlags); } - void SetSize(const wxSize& size) { wxWindow::SetSize(size); } + virtual void Command(wxCommandEvent& WXUNUSED(event)) {} ; - virtual void Command(wxCommandEvent& WXUNUSED(event)) {} ; +protected: + int m_rangeMax; + int m_gaugePos; - protected: - int m_rangeMax; - int m_gaugePos; + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); }; #endif diff --git a/include/wx/msw/listbox.h b/include/wx/msw/listbox.h index f64c4741e2..7afb83a607 100644 --- a/include/wx/msw/listbox.h +++ b/include/wx/msw/listbox.h @@ -40,105 +40,104 @@ class wxArrayInt; WXDLLEXPORT_DATA(extern const char*) wxEmptyString; // List box item -class WXDLLEXPORT wxListBox: public wxControl +class WXDLLEXPORT wxListBox : public wxControl { - DECLARE_DYNAMIC_CLASS(wxListBox) - public: - - wxListBox(void); - inline wxListBox(wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr) - { - Create(parent, id, pos, size, n, choices, style, validator, name); - } - - bool Create(wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr); - - ~wxListBox(); - - bool MSWCommand(WXUINT param, WXWORD id); + DECLARE_DYNAMIC_CLASS(wxListBox) + +public: + wxListBox(); + wxListBox(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr) + { + Create(parent, id, pos, size, n, choices, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr); + + ~wxListBox(); + + bool MSWCommand(WXUINT param, WXWORD id); #if wxUSE_OWNER_DRAWN - bool MSWOnMeasure(WXMEASUREITEMSTRUCT *item); - bool MSWOnDraw(WXDRAWITEMSTRUCT *item); + bool MSWOnMeasure(WXMEASUREITEMSTRUCT *item); + bool MSWOnDraw(WXDRAWITEMSTRUCT *item); - // plug-in for derived classes - virtual wxOwnerDrawn *CreateItem(size_t n); + // plug-in for derived classes + virtual wxOwnerDrawn *CreateItem(size_t n); - // allows to get the item and use SetXXX functions to set it's appearance - wxOwnerDrawn *GetItem(size_t n) const { return m_aItems[n]; } -#endif + // allows to get the item and use SetXXX functions to set it's appearance + wxOwnerDrawn *GetItem(size_t n) const { return m_aItems[n]; } +#endif // wxUSE_OWNER_DRAWN - virtual void Append(const wxString& item); - virtual void Append(const wxString& item, char *clientData); - virtual void Set(int n, const wxString* choices, char **clientData = NULL); - virtual int FindString(const wxString& s) const ; - virtual void Clear(void); - virtual void SetSelection(int n, bool select = TRUE); + virtual void Append(const wxString& item); + virtual void Append(const wxString& item, char *clientData); + virtual void Set(int n, const wxString* choices, char **clientData = NULL); + virtual int FindString(const wxString& s) const ; + virtual void Clear(); + virtual void SetSelection(int n, bool select = TRUE); - virtual void Deselect(int n); + virtual void Deselect(int n); - // For single choice list item only - virtual int GetSelection() const ; - virtual void Delete(int n); - virtual char *GetClientData(int n) const ; - virtual void SetClientData(int n, char *clientData); - virtual void SetString(int n, const wxString& s); + // For single choice list item only + virtual int GetSelection() const ; + virtual void Delete(int n); + virtual char *GetClientData(int n) const ; + virtual void SetClientData(int n, char *clientData); + virtual void SetString(int n, const wxString& s); - // For single or multiple choice list item - virtual int GetSelections(wxArrayInt& aSelections) const; - virtual bool Selected(int n) const ; - virtual wxString GetString(int n) const ; - virtual void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); - void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO) - { wxWindow::SetSize(rect, sizeFlags); } - void SetSize(const wxSize& size) { wxWindow::SetSize(size); } + // For single or multiple choice list item + virtual int GetSelections(wxArrayInt& aSelections) const; + virtual bool Selected(int n) const ; + virtual wxString GetString(int n) const ; - // Set the specified item at the first visible item - // or scroll to max range. - virtual void SetFirstItem(int n) ; - virtual void SetFirstItem(const wxString& s) ; + // Set the specified item at the first visible item + // or scroll to max range. + virtual void SetFirstItem(int n) ; + virtual void SetFirstItem(const wxString& s) ; - virtual void InsertItems(int nItems, const wxString items[], int pos); + virtual void InsertItems(int nItems, const wxString items[], int pos); - virtual wxString GetStringSelection(void) const ; - virtual bool SetStringSelection(const wxString& s, bool flag = TRUE); - virtual int Number(void) const ; + virtual wxString GetStringSelection() const ; + virtual bool SetStringSelection(const wxString& s, bool flag = TRUE); + virtual int Number() const ; - void Command(wxCommandEvent& event); + void Command(wxCommandEvent& event); - // Windows-specific code to set the horizontal extent of - // the listbox, if necessary. If s is non-NULL, it's - // used to calculate the horizontal extent. - // Otherwise, all strings are used. - virtual void SetHorizontalExtent(const wxString& s = wxEmptyString); + // Windows-specific code to set the horizontal extent of + // the listbox, if necessary. If s is non-NULL, it's + // used to calculate the horizontal extent. + // Otherwise, all strings are used. + virtual void SetHorizontalExtent(const wxString& s = wxEmptyString); - virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, - WXUINT message, WXWPARAM wParam, WXLPARAM lParam); + virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, + WXUINT message, WXWPARAM wParam, WXLPARAM lParam); - virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); - virtual void SetupColours(void); + virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); + virtual void SetupColours(); - protected: - int m_noItems; - int m_selected; +protected: + int m_noItems; + int m_selected; #if wxUSE_OWNER_DRAWN - // control items - wxListBoxItemsArray m_aItems; + // control items + wxListBoxItemsArray m_aItems; #endif + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); }; #endif diff --git a/include/wx/msw/private.h b/include/wx/msw/private.h index 4e95ca8b5b..d6ba8ae923 100644 --- a/include/wx/msw/private.h +++ b/include/wx/msw/private.h @@ -84,8 +84,8 @@ typedef signed short int SHORT ; #endif #if wxUSE_PENWIN -WXDLLEXPORT void wxRegisterPenWin(void); -WXDLLEXPORT void wxCleanUpPenWin(void); +WXDLLEXPORT void wxRegisterPenWin(); +WXDLLEXPORT void wxCleanUpPenWin(); WXDLLEXPORT void wxEnablePenAppHooks (bool hook); #endif @@ -106,7 +106,7 @@ VOID WINAPI ibAdjustWindowRect( HWND hWnd, LPRECT lprc ) ; * - NULL any extra child window pointers not created for this item * (e.g. label control that wasn't needed) * - delete any extra child windows in the destructor (e.g. label control) - * - implement GetSize and SetSize + * - implement DoSetSize * - to find panel position if coordinates are (-1, -1), use GetPosition * - call AdvanceCursor after creation, for panel layout mechanism. * diff --git a/include/wx/msw/radiobox.h b/include/wx/msw/radiobox.h index 6d86bed742..9eac38d4cc 100644 --- a/include/wx/msw/radiobox.h +++ b/include/wx/msw/radiobox.h @@ -23,125 +23,120 @@ WXDLLEXPORT_DATA(extern const char*) wxRadioBoxNameStr; // List box item class WXDLLEXPORT wxBitmap ; -class WXDLLEXPORT wxRadioBox: public wxControl +class WXDLLEXPORT wxRadioBox : public wxControl { - DECLARE_DYNAMIC_CLASS(wxRadioBox) + DECLARE_DYNAMIC_CLASS(wxRadioBox) + public: - wxRadioBox(void); + wxRadioBox(); #if WXWIN_COMPATIBILITY - wxRadioBox(wxWindow *parent, wxFunction func, const char *title, - int x = -1, int y = -1, int width = -1, int height = -1, - int n = 0, char **choices = NULL, - int majorDim = 0, long style = wxRA_HORIZONTAL, const char *name = wxRadioBoxNameStr); - -/* - inline wxRadioBox(wxWindow *parent, wxFunction func, const char *title, - int x, int y, int width, int height, - int n, wxBitmap **choices, - int majorDim = 0, long style = wxRA_HORIZONTAL, const char *name = wxRadioBoxNameStr) - { - Create(parent, -1, title, wxPoint(x, y), wxSize(width, height), n, (const wxBitmap **)choices, majorDim, style, - wxDefaultValidator, name); - Callback(func); - } -*/ - -#endif - - inline wxRadioBox(wxWindow *parent, wxWindowID id, const wxString& title, - const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, - int majorDim = 0, long style = wxRA_HORIZONTAL, - const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr) - { - Create(parent, id, title, pos, size, n, choices, majorDim, style, val, name); - } - -/* - wxRadioBox(wxWindow *parent, wxWindowID id, const wxString& title, - const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxBitmap *choices[] = NULL, - int majorDim = 0, long style = wxRA_HORIZONTAL, - const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr) - { - Create(parent, id, title, pos, size, n, choices, majorDim, style, val, name); - } -*/ - - ~wxRadioBox(void); - - bool Create(wxWindow *parent, wxWindowID id, const wxString& title, - const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, - int majorDim = 0, long style = wxRA_HORIZONTAL, - const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr); - -/* - bool Create(wxWindow *parent, wxWindowID id, const wxString& title, - const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxBitmap *choices[] = NULL, - int majorDim = 0, long style = wxRA_HORIZONTAL, - const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr); -*/ - - virtual bool MSWCommand(WXUINT param, WXWORD id); - virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, - WXUINT message, WXWPARAM wParam, WXLPARAM lParam); - - int FindString(const wxString& s) const; - void SetSelection(int N); - int GetSelection(void) const; - wxString GetString(int N) const; - - void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); - void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO) - { wxWindow::SetSize(rect, sizeFlags); } - void SetSize(const wxSize& size) { wxWindow::SetSize(size); } - - void GetSize(int *x, int *y) const; - wxSize GetSize() const { return wxWindow::GetSize(); } - - void GetPosition(int *x, int *y) const; - wxPoint GetPosition() const { return wxWindow::GetPosition(); } - - wxString GetLabel(void) const; - void SetLabel(const wxString& label); - void SetLabel(int item, const wxString& label) ; - void SetLabel(int item, wxBitmap *bitmap) ; - wxString GetLabel(int item) const; - bool Show(bool show); - void SetFocus(void); - void Enable(bool enable); - void Enable(int item, bool enable); - void Show(int item, bool show) ; - inline void SetLabelFont(const wxFont& WXUNUSED(font)) {}; - inline void SetButtonFont(const wxFont& font) { SetFont(font); } - - virtual wxString GetStringSelection(void) const; - virtual bool SetStringSelection(const wxString& s); - inline virtual int Number(void) const { return m_noItems; } ; - void Command(wxCommandEvent& event); - - inline int GetNumberOfRowsOrCols(void) const { return m_noRowsOrCols; } - inline void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; } - - // Implementation - inline WXHWND *GetRadioButtons(void) const { return m_radioButtons; } - bool ContainsHWND(WXHWND hWnd) const ; - - long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); + wxRadioBox(wxWindow *parent, wxFunction func, const char *title, + int x = -1, int y = -1, int width = -1, int height = -1, + int n = 0, char **choices = NULL, + int majorDim = 0, long style = wxRA_HORIZONTAL, const char *name = wxRadioBoxNameStr); + + /* + inline wxRadioBox(wxWindow *parent, wxFunction func, const char *title, + int x, int y, int width, int height, + int n, wxBitmap **choices, + int majorDim = 0, long style = wxRA_HORIZONTAL, const char *name = wxRadioBoxNameStr) + { + Create(parent, -1, title, wxPoint(x, y), wxSize(width, height), n, (const wxBitmap **)choices, majorDim, style, + wxDefaultValidator, name); + Callback(func); + } + */ +#endif // WXWIN_COMPATIBILITY + + wxRadioBox(wxWindow *parent, wxWindowID id, const wxString& title, + const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + int majorDim = 0, long style = wxRA_HORIZONTAL, + const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr) + { + Create(parent, id, title, pos, size, n, choices, majorDim, style, val, name); + } + + /* + wxRadioBox(wxWindow *parent, wxWindowID id, const wxString& title, + const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + int n = 0, const wxBitmap *choices[] = NULL, + int majorDim = 0, long style = wxRA_HORIZONTAL, + const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr) + { + Create(parent, id, title, pos, size, n, choices, majorDim, style, val, name); + } + */ + + ~wxRadioBox(); + + bool Create(wxWindow *parent, wxWindowID id, const wxString& title, + const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + int majorDim = 0, long style = wxRA_HORIZONTAL, + const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr); + + /* + bool Create(wxWindow *parent, wxWindowID id, const wxString& title, + const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + int n = 0, const wxBitmap *choices[] = NULL, + int majorDim = 0, long style = wxRA_HORIZONTAL, + const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr); + */ + + virtual bool MSWCommand(WXUINT param, WXWORD id); + virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, + WXUINT message, WXWPARAM wParam, WXLPARAM lParam); + + int FindString(const wxString& s) const; + void SetSelection(int N); + int GetSelection() const; + wxString GetString(int N) const; + + void GetSize(int *x, int *y) const; + void GetPosition(int *x, int *y) const; + + wxString GetLabel() const; + void SetLabel(const wxString& label); + void SetLabel(int item, const wxString& label) ; + void SetLabel(int item, wxBitmap *bitmap) ; + wxString GetLabel(int item) const; + bool Show(bool show); + void SetFocus(); + void Enable(bool enable); + void Enable(int item, bool enable); + void Show(int item, bool show) ; + void SetLabelFont(const wxFont& WXUNUSED(font)) {}; + void SetButtonFont(const wxFont& font) { SetFont(font); } + + virtual wxString GetStringSelection() const; + virtual bool SetStringSelection(const wxString& s); + virtual int Number() const { return m_noItems; } ; + void Command(wxCommandEvent& event); + + int GetNumberOfRowsOrCols() const { return m_noRowsOrCols; } + void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; } + + // Implementation + WXHWND *GetRadioButtons() const { return m_radioButtons; } + bool ContainsHWND(WXHWND hWnd) const ; + + long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); protected: - WXHWND * m_radioButtons; - int m_majorDim ; - int * m_radioWidth ; // for bitmaps - int * m_radioHeight ; - - int m_noItems; - int m_noRowsOrCols; - int m_selectedButton; - + WXHWND * m_radioButtons; + int m_majorDim ; + int * m_radioWidth ; // for bitmaps + int * m_radioHeight ; + + int m_noItems; + int m_noRowsOrCols; + int m_selectedButton; + + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); }; #endif diff --git a/include/wx/msw/slider95.h b/include/wx/msw/slider95.h index 612c5f5044..a94978d8b1 100644 --- a/include/wx/msw/slider95.h +++ b/include/wx/msw/slider95.h @@ -21,92 +21,88 @@ WXDLLEXPORT_DATA(extern const char*) wxSliderNameStr; // Slider -class WXDLLEXPORT wxSlider95: public wxControl +class WXDLLEXPORT wxSlider95 : public wxControl { - DECLARE_DYNAMIC_CLASS(wxSlider95) + DECLARE_DYNAMIC_CLASS(wxSlider95) public: - wxSlider95(void); - - inline wxSlider95(wxWindow *parent, wxWindowID id, - int value, int minValue, int maxValue, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSL_HORIZONTAL, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxSliderNameStr) - { - Create(parent, id, value, minValue, maxValue, pos, size, style, validator, name); - } - - ~wxSlider95(void); - - bool Create(wxWindow *parent, wxWindowID id, - int value, int minValue, int maxValue, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSL_HORIZONTAL, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxSliderNameStr); - - virtual int GetValue(void) const ; - virtual void SetValue(int); - - void GetSize(int *x, int *y) const ; - wxSize GetSize() const { return wxWindow::GetSize(); } - - void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); - void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO) - { wxWindow::SetSize(rect, sizeFlags); } - void SetSize(const wxSize& size) { wxWindow::SetSize(size); } - - void GetPosition(int *x, int *y) const ; - wxPoint GetPosition() const { return wxWindow::GetPosition(); } - - bool Show(bool show); - - void SetRange(int minValue, int maxValue); - - inline int GetMin(void) const { return m_rangeMin; } - inline int GetMax(void) const { return m_rangeMax; } - - // For trackbars only - void SetTickFreq(int n, int pos); - inline int GetTickFreq(void) const { return m_tickFreq; } - void SetPageSize(int pageSize); - int GetPageSize(void) const ; - void ClearSel(void) ; - void ClearTicks(void) ; - void SetLineSize(int lineSize); - int GetLineSize(void) const ; - int GetSelEnd(void) const ; - int GetSelStart(void) const ; - void SetSelection(int minPos, int maxPos); - void SetThumbLength(int len) ; - int GetThumbLength(void) const ; - void SetTick(int tickPos) ; - - // IMPLEMENTATION - inline WXHWND GetStaticMin() const { return m_staticMin; } - inline WXHWND GetStaticMax() const { return m_staticMax; } - inline WXHWND GetEditValue() const { return m_staticValue; } - virtual bool ContainsHWND(WXHWND hWnd) const; - - void Command(wxCommandEvent& event); - virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, - WXUINT message, WXWPARAM wParam, WXLPARAM lParam); - void MSWOnVScroll(WXWORD wParam, WXWORD pos, WXHWND control); - void MSWOnHScroll(WXWORD wParam, WXWORD pos, WXHWND control); - - protected: - WXHWND m_staticMin; - WXHWND m_staticMax; - WXHWND m_staticValue; - int m_rangeMin; - int m_rangeMax; - int m_pageSize; - int m_lineSize; - int m_tickFreq; + wxSlider95(); + + wxSlider95(wxWindow *parent, wxWindowID id, + int value, int minValue, int maxValue, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSL_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxSliderNameStr) + { + Create(parent, id, value, minValue, maxValue, pos, size, style, validator, name); + } + + ~wxSlider95(); + + bool Create(wxWindow *parent, wxWindowID id, + int value, int minValue, int maxValue, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSL_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxSliderNameStr); + + virtual int GetValue() const ; + virtual void SetValue(int); + + void GetSize(int *x, int *y) const ; + void GetPosition(int *x, int *y) const ; + + bool Show(bool show); + + void SetRange(int minValue, int maxValue); + + int GetMin() const { return m_rangeMin; } + int GetMax() const { return m_rangeMax; } + + // For trackbars only + void SetTickFreq(int n, int pos); + int GetTickFreq() const { return m_tickFreq; } + void SetPageSize(int pageSize); + int GetPageSize() const ; + void ClearSel() ; + void ClearTicks() ; + void SetLineSize(int lineSize); + int GetLineSize() const ; + int GetSelEnd() const ; + int GetSelStart() const ; + void SetSelection(int minPos, int maxPos); + void SetThumbLength(int len) ; + int GetThumbLength() const ; + void SetTick(int tickPos) ; + + // IMPLEMENTATION + WXHWND GetStaticMin() const { return m_staticMin; } + WXHWND GetStaticMax() const { return m_staticMax; } + WXHWND GetEditValue() const { return m_staticValue; } + virtual bool ContainsHWND(WXHWND hWnd) const; + + void Command(wxCommandEvent& event); + virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, + WXUINT message, WXWPARAM wParam, WXLPARAM lParam); + void MSWOnVScroll(WXWORD wParam, WXWORD pos, WXHWND control); + void MSWOnHScroll(WXWORD wParam, WXWORD pos, WXHWND control); + +protected: + WXHWND m_staticMin; + WXHWND m_staticMax; + WXHWND m_staticValue; + int m_rangeMin; + int m_rangeMax; + int m_pageSize; + int m_lineSize; + int m_tickFreq; + + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); }; #endif diff --git a/include/wx/msw/slidrmsw.h b/include/wx/msw/slidrmsw.h index 47a8fb2196..a53b8857ed 100644 --- a/include/wx/msw/slidrmsw.h +++ b/include/wx/msw/slidrmsw.h @@ -21,92 +21,88 @@ WXDLLEXPORT_DATA(extern const char*) wxSliderNameStr; // Slider -class WXDLLEXPORT wxSliderMSW: public wxControl +class WXDLLEXPORT wxSliderMSW : public wxControl { - DECLARE_DYNAMIC_CLASS(wxSliderMSW) + DECLARE_DYNAMIC_CLASS(wxSliderMSW) public: - wxSliderMSW(void); - - inline wxSliderMSW(wxWindow *parent, wxWindowID id, - int value, int minValue, int maxValue, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSL_HORIZONTAL, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxSliderNameStr) - { - Create(parent, id, value, minValue, maxValue, pos, size, style, validator, name); - } - - ~wxSliderMSW(void); - - bool Create(wxWindow *parent, wxWindowID id, - int value, int minValue, int maxValue, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSL_HORIZONTAL, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxSliderNameStr); - - virtual int GetValue(void) const ; - virtual void SetValue(int); - - void GetSize(int *x, int *y) const ; - wxSize GetSize() const { return wxWindow::GetSize(); } - - void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); - void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO) - { wxWindow::SetSize(rect, sizeFlags); } - void SetSize(const wxSize& size) { wxWindow::SetSize(size); } - - void GetPosition(int *x, int *y) const ; - wxPoint GetPosition() const { return wxWindow::GetPosition(); } - - bool Show(bool show); - - void SetRange(int minValue, int maxValue); - - inline int GetMin(void) const { return m_rangeMin; } - inline int GetMax(void) const { return m_rangeMax; } - - // For trackbars only - void SetTickFreq(int n, int pos); - inline int GetTickFreq(void) const { return m_tickFreq; } - void SetPageSize(int pageSize); - int GetPageSize(void) const ; - void ClearSel(void) ; - void ClearTicks(void) ; - void SetLineSize(int lineSize); - int GetLineSize(void) const ; - int GetSelEnd(void) const ; - int GetSelStart(void) const ; - void SetSelection(int minPos, int maxPos); - void SetThumbLength(int len) ; - int GetThumbLength(void) const ; - void SetTick(int tickPos) ; - - // IMPLEMENTATION - inline WXHWND GetStaticMin() const { return m_staticMin; } - inline WXHWND GetStaticMax() const { return m_staticMax; } - inline WXHWND GetEditValue() const { return m_staticValue; } - virtual bool ContainsHWND(WXHWND hWnd) const; - - void Command(wxCommandEvent& event); - virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, - WXUINT message, WXWPARAM wParam, WXLPARAM lParam); - void MSWOnVScroll(WXWORD wParam, WXWORD pos, WXHWND control); - void MSWOnHScroll(WXWORD wParam, WXWORD pos, WXHWND control); - - protected: - WXHWND m_staticMin; - WXHWND m_staticMax; - WXHWND m_staticValue; - int m_rangeMin; - int m_rangeMax; - int m_pageSize; - int m_lineSize; - int m_tickFreq; + wxSliderMSW(); + + wxSliderMSW(wxWindow *parent, wxWindowID id, + int value, int minValue, int maxValue, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSL_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxSliderNameStr) + { + Create(parent, id, value, minValue, maxValue, pos, size, style, validator, name); + } + + ~wxSliderMSW(); + + bool Create(wxWindow *parent, wxWindowID id, + int value, int minValue, int maxValue, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSL_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxSliderNameStr); + + virtual int GetValue() const ; + virtual void SetValue(int); + + void GetSize(int *x, int *y) const ; + void GetPosition(int *x, int *y) const ; + + bool Show(bool show); + + void SetRange(int minValue, int maxValue); + + int GetMin() const { return m_rangeMin; } + int GetMax() const { return m_rangeMax; } + + // For trackbars only + void SetTickFreq(int n, int pos); + int GetTickFreq() const { return m_tickFreq; } + void SetPageSize(int pageSize); + int GetPageSize() const ; + void ClearSel() ; + void ClearTicks() ; + void SetLineSize(int lineSize); + int GetLineSize() const ; + int GetSelEnd() const ; + int GetSelStart() const ; + void SetSelection(int minPos, int maxPos); + void SetThumbLength(int len) ; + int GetThumbLength() const ; + void SetTick(int tickPos) ; + + // IMPLEMENTATION + WXHWND GetStaticMin() const { return m_staticMin; } + WXHWND GetStaticMax() const { return m_staticMax; } + WXHWND GetEditValue() const { return m_staticValue; } + virtual bool ContainsHWND(WXHWND hWnd) const; + + void Command(wxCommandEvent& event); + virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, + WXUINT message, WXWPARAM wParam, WXLPARAM lParam); + void MSWOnVScroll(WXWORD wParam, WXWORD pos, WXHWND control); + void MSWOnHScroll(WXWORD wParam, WXWORD pos, WXHWND control); + +protected: + WXHWND m_staticMin; + WXHWND m_staticMax; + WXHWND m_staticValue; + int m_rangeMin; + int m_rangeMax; + int m_pageSize; + int m_lineSize; + int m_tickFreq; + + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); }; #endif diff --git a/include/wx/msw/statbmp.h b/include/wx/msw/statbmp.h index 2f742bad4c..c5dc0aff89 100644 --- a/include/wx/msw/statbmp.h +++ b/include/wx/msw/statbmp.h @@ -22,7 +22,7 @@ WXDLLEXPORT_DATA(extern const char*) wxStaticBitmapNameStr; class WXDLLEXPORT wxStaticBitmap : public wxControl { -DECLARE_DYNAMIC_CLASS(wxStaticBitmap) + DECLARE_DYNAMIC_CLASS(wxStaticBitmap) public: wxStaticBitmap() { } @@ -49,12 +49,6 @@ public: virtual void Command(wxCommandEvent& WXUNUSED(event)) { } virtual void ProcessCommand(wxCommandEvent& WXUNUSED(event)) { } - void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); - void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO) - { wxWindow::SetSize(rect, sizeFlags); } - void SetSize(const wxSize& size) - { wxWindow::SetSize(size); } - wxBitmap& GetBitmap(void) const { return (wxBitmap&) m_messageBitmap; } // overriden base class virtuals @@ -67,6 +61,9 @@ public: protected: wxBitmap m_messageBitmap; + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); }; #endif diff --git a/include/wx/msw/statbox.h b/include/wx/msw/statbox.h index 5256c41f10..ed02305c74 100644 --- a/include/wx/msw/statbox.h +++ b/include/wx/msw/statbox.h @@ -26,7 +26,7 @@ class WXDLLEXPORT wxStaticBox : public wxControl DECLARE_DYNAMIC_CLASS(wxStaticBox) public: - wxStaticBox() {} + wxStaticBox() { } wxStaticBox(wxWindow *parent, wxWindowID id, const wxString& label, @@ -52,11 +52,6 @@ public: virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); - void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); - void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO) - { wxWindow::SetSize(rect, sizeFlags); } - void SetSize(const wxSize& size) - { wxWindow::SetSize(size); } void SetLabel(const wxString& label); virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, @@ -65,6 +60,11 @@ public: // overriden base class virtuals virtual bool AcceptsFocus() const { return FALSE; } +protected: + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); + private: DECLARE_EVENT_TABLE() }; diff --git a/include/wx/msw/stattext.h b/include/wx/msw/stattext.h index 81595e9939..053651b819 100644 --- a/include/wx/msw/stattext.h +++ b/include/wx/msw/stattext.h @@ -45,11 +45,6 @@ public: const wxString& name = wxStaticTextNameStr); // accessors - void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); - void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO) - { wxWindow::SetSize(rect, sizeFlags); } - void SetSize(const wxSize& size) - { wxWindow::SetSize(size); } void SetLabel(const wxString& label); // operations @@ -63,6 +58,11 @@ public: virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, WXUINT message, WXWPARAM wParam, WXLPARAM lParam); virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); + +protected: + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); }; #endif diff --git a/include/wx/msw/textctrl.h b/include/wx/msw/textctrl.h index 83cedeaffe..1e47cb7547 100644 --- a/include/wx/msw/textctrl.h +++ b/include/wx/msw/textctrl.h @@ -35,7 +35,7 @@ WXDLLEXPORT_DATA(extern const char*) wxTextCtrlNameStr; WXDLLEXPORT_DATA(extern const char*) wxEmptyString; // Single-line text item -class WXDLLEXPORT wxTextCtrl: public wxControl +class WXDLLEXPORT wxTextCtrl : public wxControl // 16-bit Borland 4.0 doesn't seem to allow multiple inheritance with wxWindow and streambuf: // it complains about deriving a huge class from the huge class streambuf. !! @@ -53,121 +53,122 @@ class WXDLLEXPORT wxTextCtrl: public wxControl DECLARE_DYNAMIC_CLASS(wxTextCtrl) public: - // creation - // -------- - wxTextCtrl(); - inline wxTextCtrl(wxWindow *parent, wxWindowID id, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxTextCtrlNameStr) + // creation + // -------- + wxTextCtrl(); + wxTextCtrl(wxWindow *parent, wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxTextCtrlNameStr) #ifndef NO_TEXT_WINDOW_STREAM - :streambuf() + :streambuf() #endif - { - Create(parent, id, value, pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, wxWindowID id, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = wxTE_PROCESS_TAB, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxTextCtrlNameStr); - - // accessors - // --------- - virtual wxString GetValue() const ; - virtual void SetValue(const wxString& value); - - virtual int GetLineLength(long lineNo) const; - virtual wxString GetLineText(long lineNo) const; - virtual int GetNumberOfLines() const; - - // operations - // ---------- - virtual void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); - void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO) - { wxWindow::SetSize(rect, sizeFlags); } - void SetSize(const wxSize& size) { wxWindow::SetSize(size); } - - // Clipboard operations - virtual void Copy(); - virtual void Cut(); - virtual void Paste(); - - virtual void SetInsertionPoint(long pos); - virtual void SetInsertionPointEnd(); - virtual long GetInsertionPoint() const ; - virtual long GetLastPosition() const ; - virtual void Replace(long from, long to, const wxString& value); - virtual void Remove(long from, long to); - virtual void SetSelection(long from, long to); - virtual void SetEditable(bool editable); - - // streambuf implementation + { + Create(parent, id, value, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = wxTE_PROCESS_TAB, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxTextCtrlNameStr); + + // accessors + // --------- + virtual wxString GetValue() const ; + virtual void SetValue(const wxString& value); + + virtual int GetLineLength(long lineNo) const; + virtual wxString GetLineText(long lineNo) const; + virtual int GetNumberOfLines() const; + + // operations + // ---------- + + // Clipboard operations + virtual void Copy(); + virtual void Cut(); + virtual void Paste(); + + virtual void SetInsertionPoint(long pos); + virtual void SetInsertionPointEnd(); + virtual long GetInsertionPoint() const ; + virtual long GetLastPosition() const ; + virtual void Replace(long from, long to, const wxString& value); + virtual void Remove(long from, long to); + virtual void SetSelection(long from, long to); + virtual void SetEditable(bool editable); + + // streambuf implementation #ifndef NO_TEXT_WINDOW_STREAM - int overflow(int i); - int sync(); - int underflow(); + int overflow(int i); + int sync(); + int underflow(); #endif - wxTextCtrl& operator<<(const wxString& s); - wxTextCtrl& operator<<(int i); - wxTextCtrl& operator<<(long i); - wxTextCtrl& operator<<(float f); - wxTextCtrl& operator<<(double d); - wxTextCtrl& operator<<(const char c); + wxTextCtrl& operator<<(const wxString& s); + wxTextCtrl& operator<<(int i); + wxTextCtrl& operator<<(long i); + wxTextCtrl& operator<<(float f); + wxTextCtrl& operator<<(double d); + wxTextCtrl& operator<<(const char c); - virtual bool LoadFile(const wxString& file); - virtual bool SaveFile(const wxString& file); - virtual void WriteText(const wxString& text); - virtual void AppendText(const wxString& text); - virtual void DiscardEdits(); - virtual bool IsModified() const; + virtual bool LoadFile(const wxString& file); + virtual bool SaveFile(const wxString& file); + virtual void WriteText(const wxString& text); + virtual void AppendText(const wxString& text); + virtual void DiscardEdits(); + virtual bool IsModified() const; #if WXWIN_COMPATIBILITY - inline bool Modified() const { return IsModified(); } + inline bool Modified() const { return IsModified(); } #endif - virtual long XYToPosition(long x, long y) const ; - virtual void PositionToXY(long pos, long *x, long *y) const ; - virtual void ShowPosition(long pos); - virtual void Clear(); + virtual long XYToPosition(long x, long y) const ; + virtual void PositionToXY(long pos, long *x, long *y) const ; + virtual void ShowPosition(long pos); + virtual void Clear(); - // callbacks - // --------- - void OnDropFiles(wxDropFilesEvent& event); - void OnChar(wxKeyEvent& event); // Process 'enter' if required - void OnEraseBackground(wxEraseEvent& event); + // callbacks + // --------- + void OnDropFiles(wxDropFilesEvent& event); + void OnChar(wxKeyEvent& event); // Process 'enter' if required + void OnEraseBackground(wxEraseEvent& event); - // Implementation - // -------------- - virtual void Command(wxCommandEvent& event); - virtual bool MSWCommand(WXUINT param, WXWORD id); + // Implementation + // -------------- + virtual void Command(wxCommandEvent& event); + virtual bool MSWCommand(WXUINT param, WXWORD id); #if wxUSE_RICHEDIT - bool IsRich() const { return m_isRich; } - void SetRichEdit(bool isRich) { m_isRich = isRich; } + bool IsRich() const { return m_isRich; } + void SetRichEdit(bool isRich) { m_isRich = isRich; } #endif - virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, - WXUINT message, WXWPARAM wParam, - WXLPARAM lParam); + virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, + WXUINT message, WXWPARAM wParam, + WXLPARAM lParam); - virtual void AdoptAttributesFromHWND(); - virtual void SetupColours(); - virtual long MSWGetDlgCode(); + virtual void AdoptAttributesFromHWND(); + virtual void SetupColours(); + virtual long MSWGetDlgCode(); protected: #if wxUSE_RICHEDIT - bool m_isRich; // Are we using rich text edit to implement this? + bool m_isRich; // Are we using rich text edit to implement this? #endif - wxString m_fileName; + wxString m_fileName; - DECLARE_EVENT_TABLE() + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); + +private: + DECLARE_EVENT_TABLE() }; #endif diff --git a/include/wx/msw/window.h b/include/wx/msw/window.h index 212504c34f..3e2ac99f30 100644 --- a/include/wx/msw/window.h +++ b/include/wx/msw/window.h @@ -121,648 +121,697 @@ private: class WXDLLEXPORT wxWindow : public wxEvtHandler { - DECLARE_ABSTRACT_CLASS(wxWindow) + DECLARE_ABSTRACT_CLASS(wxWindow) - friend class wxDC; - friend class wxPaintDC; + friend class wxDC; + friend class wxPaintDC; public: - wxWindow(); - wxWindow(wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxPanelNameStr) - { - Init(); - Create(parent, id, pos, size, style, name); - } + wxWindow(); + wxWindow(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxPanelNameStr) + { + Init(); + Create(parent, id, pos, size, style, name); + } - virtual ~wxWindow(); - - bool Create(wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxPanelNameStr); - - // Fit the window around the items - virtual void Fit(); - - // Show or hide the window - virtual bool Show(bool show); - - // Is the window shown? - virtual bool IsShown() const; - - // Raise the window to the top of the Z order - virtual void Raise(); - - // Lower the window to the bottom of the Z order - virtual void Lower(); - - // Is the window enabled? - virtual bool IsEnabled() const; - - // For compatibility - inline bool Enabled() const { return IsEnabled(); } - - // Dialog support: override these and call - // base class members to add functionality - // that can't be done using validators. - - // Transfer values to controls. If returns FALSE, - // it's an application error (pops up a dialog) - virtual bool TransferDataToWindow(); - - // Transfer values from controls. If returns FALSE, - // transfer failed: don't quit - virtual bool TransferDataFromWindow(); - - // Validate controls. If returns FALSE, - // validation failed: don't quit - virtual bool Validate(); - - // Return code for dialogs - inline void SetReturnCode(int retCode); - inline int GetReturnCode(); - - // Set the cursor - virtual void SetCursor(const wxCursor& cursor); - inline virtual wxCursor& GetCursor() const { return (wxCursor& ) m_windowCursor; }; - - // Get the window with the focus - static wxWindow *FindFocus(); - - // Get character size - virtual int GetCharHeight() const; - virtual int GetCharWidth() const; - - // Get overall window size - virtual void GetSize(int *width, int *height) const; - wxSize GetSize() const { int w, h; GetSize(& w, & h); return wxSize(w, h); } - - // Get window position, relative to parent (or screen if no parent) - virtual void GetPosition(int *x, int *y) const; - wxPoint GetPosition() const - { int x, y; GetPosition(&x, &y); return wxPoint(x, y); } - - // Get size and position - wxRect GetRect() const - { int x, y, w, h; GetPosition(& x, & y); GetSize(& w, & h); return wxRect(x, y, w, h); } - - // Get client (application-useable) size - virtual void GetClientSize(int *width, int *height) const; - wxSize GetClientSize() const { int w, h; GetClientSize(& w, & h); return wxSize(w, h); } - - // Set overall size and position - // generic function, may be overriden in derived classes - virtual void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); - - void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO) - { SetSize(rect.x, rect.y, rect.width, rect.height, sizeFlags); } - - // set size only - void SetSize(int width, int height) - { SetSize(-1, -1, width, height, wxSIZE_USE_EXISTING); } - void SetSize(const wxSize& size) - { SetSize(-1, -1, size.x, size.y, wxSIZE_USE_EXISTING); } - - // set position only - virtual void Move(int x, int y) { SetSize(x, y, -1, -1, wxSIZE_USE_EXISTING); } - void Move(const wxPoint& pt) { SetSize(pt.x, pt.y, -1, -1, wxSIZE_USE_EXISTING); } + virtual ~wxWindow(); - // Set client size - virtual void SetClientSize(int width, int height); - void SetClientSize(const wxSize& sz) { SetClientSize(sz.x, sz.y); } + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxPanelNameStr); - // Convert client to screen coordinates - virtual void ClientToScreen(int *x, int *y) const; - wxPoint ClientToScreen(const wxPoint& pt) const + // Fit the window around the items + virtual void Fit(); + + // Show or hide the window + virtual bool Show(bool show); + + // Is the window shown? + virtual bool IsShown() const; + + // Raise the window to the top of the Z order + virtual void Raise(); + + // Lower the window to the bottom of the Z order + virtual void Lower(); + + // Is the window enabled? + virtual bool IsEnabled() const; + + // For compatibility + inline bool Enabled() const { return IsEnabled(); } + + // Dialog support: override these and call + // base class members to add functionality + // that can't be done using validators. + + // Transfer values to controls. If returns FALSE, + // it's an application error (pops up a dialog) + virtual bool TransferDataToWindow(); + + // Transfer values from controls. If returns FALSE, + // transfer failed: don't quit + virtual bool TransferDataFromWindow(); + + // Validate controls. If returns FALSE, + // validation failed: don't quit + virtual bool Validate(); + + // Return code for dialogs + inline void SetReturnCode(int retCode); + inline int GetReturnCode(); + + // Set the cursor + virtual void SetCursor(const wxCursor& cursor); + inline virtual wxCursor& GetCursor() const { return (wxCursor& ) m_windowCursor; }; + + // Get the window with the focus + static wxWindow *FindFocus(); + + // Get character size + virtual int GetCharHeight() const; + virtual int GetCharWidth() const; + + // moving/resizing + // --------------- + + // set the window size and/or position + void SetSize( int x, int y, int width, int height, + int sizeFlags = wxSIZE_AUTO ) + { DoSetSize(x, y, width, height, sizeFlags); } + + void SetSize( int width, int height ) + { DoSetSize(-1, -1, width, height, wxSIZE_USE_EXISTING); } + + void SetSize( const wxSize& size ) + { SetSize(size.x, size.y); } + + void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO) + { DoSetSize(rect.x, rect.y, rect.width, rect.height, sizeFlags); } + + void Move( int x, int y ) + { DoSetSize( x, y, -1, -1, wxSIZE_USE_EXISTING ); } + + void Move(const wxPoint& pt) + { Move(pt.x, pt.y); } + + // client size is the size of area available for subwindows + void SetClientSize( int width, int height ) + { DoSetClientSize(width, height); } + + void SetClientSize( const wxSize& size ) + { DoSetClientSize(size.x, size.y); } + + void SetClientSize(const wxRect& rect) + { SetClientSize( rect.width, rect.height ); } + + // get the window position and/or size + virtual void GetPosition( int *x, int *y ) const; + wxPoint GetPosition() const + { + int w, h; + GetPosition(& w, & h); + + return wxPoint(w, h); + } + + virtual void GetSize( int *width, int *height ) const; + + wxSize GetSize() const + { + int w, h; + GetSize(& w, & h); + return wxSize(w, h); + } + + wxRect GetRect() const + { + int x, y, w, h; + GetPosition(& x, & y); + GetSize(& w, & h); + + return wxRect(x, y, w, h); + } + + virtual void GetClientSize( int *width, int *height ) const; + wxSize GetClientSize() const + { + int w, h; + GetClientSize(& w, & h); + return wxSize(w, h); + } + + wxRect GetClientRect() const + { + int w, h; + GetSize(& w, & h); + + return wxRect(0, 0, w, h); + } + + // Convert client to screen coordinates + virtual void ClientToScreen(int *x, int *y) const; + wxPoint ClientToScreen(const wxPoint& pt) const { int x = pt.x; int y = pt.y; ClientToScreen(& x, & y); return wxPoint(x, y); } - // Convert screen to client coordinates - virtual void ScreenToClient(int *x, int *y) const; - wxPoint ScreenToClient(const wxPoint& pt) const + // Convert screen to client coordinates + virtual void ScreenToClient(int *x, int *y) const; + wxPoint ScreenToClient(const wxPoint& pt) const { int x = pt.x; int y = pt.y; ScreenToClient(& x, & y); return wxPoint(x, y); } - // Set the focus to this window - virtual void SetFocus(); + // Set the focus to this window + virtual void SetFocus(); - // Capture/release mouse - virtual void CaptureMouse(); - virtual void ReleaseMouse(); + // Capture/release mouse + virtual void CaptureMouse(); + virtual void ReleaseMouse(); - // Enable or disable the window - virtual void Enable(bool enable); + // Enable or disable the window + virtual void Enable(bool enable); #if wxUSE_DRAG_AND_DROP - // Associate a drop target with this window (if the window already had a drop - // target, it's deleted!) and return the current drop target (may be NULL). - void SetDropTarget(wxDropTarget *pDropTarget); - wxDropTarget *GetDropTarget() const { return m_pDropTarget; } + // Associate a drop target with this window (if the window already had a drop + // target, it's deleted!) and return the current drop target (may be NULL). + void SetDropTarget(wxDropTarget *pDropTarget); + wxDropTarget *GetDropTarget() const { return m_pDropTarget; } #endif #if wxUSE_TOOLTIPS - // tooltips + // tooltips // create a tooltip with this text - void SetToolTip(const wxString &tip); + void SetToolTip(const wxString &tip); // pointer may be NULL to remove the tooltip - void SetToolTip(wxToolTip *tooltip); + void SetToolTip(wxToolTip *tooltip); // get the current tooltip (may return NULL if none) - wxToolTip* GetToolTip() const { return m_tooltip; } + wxToolTip* GetToolTip() const { return m_tooltip; } #endif // wxUSE_TOOLTIPS - // Accept files for dragging - virtual void DragAcceptFiles(bool accept); + // Accept files for dragging + virtual void DragAcceptFiles(bool accept); - // Update region access - virtual wxRegion GetUpdateRegion() const; - virtual bool IsExposed(int x, int y, int w, int h) const; - virtual bool IsExposed(const wxPoint& pt) const; - virtual bool IsExposed(const wxRect& rect) const; + // Update region access + virtual wxRegion GetUpdateRegion() const; + virtual bool IsExposed(int x, int y, int w, int h) const; + virtual bool IsExposed(const wxPoint& pt) const; + virtual bool IsExposed(const wxRect& rect) const; - // Set/get the window title - virtual inline void SetTitle(const wxString& WXUNUSED(title)) {}; - inline virtual wxString GetTitle() const { return wxString(""); }; - // Most windows have the concept of a label; for frames, this is the - // title; for items, this is the label or button text. - inline virtual wxString GetLabel() const { return GetTitle(); } + // Set/get the window title + virtual inline void SetTitle(const wxString& WXUNUSED(title)) {}; + inline virtual wxString GetTitle() const { return wxString(""); }; + // Most windows have the concept of a label; for frames, this is the + // title; for items, this is the label or button text. + inline virtual wxString GetLabel() const { return GetTitle(); } - // Set/get the window name (used for resource setting in X) - inline virtual wxString GetName() const; - inline virtual void SetName(const wxString& name); + // Set/get the window name (used for resource setting in X) + inline virtual wxString GetName() const; + inline virtual void SetName(const wxString& name); - // Centre the window - virtual void Centre(int direction) ; - inline void Center(int direction = wxHORIZONTAL) { Centre(direction); } + // Centre the window + virtual void Centre(int direction) ; + inline void Center(int direction = wxHORIZONTAL) { Centre(direction); } - // Popup a menu - virtual bool PopupMenu(wxMenu *menu, int x, int y); + // Popup a menu + virtual bool PopupMenu(wxMenu *menu, int x, int y); - // Send the window a refresh event - virtual void Refresh(bool eraseBack = TRUE, const wxRect *rect = NULL); + // Send the window a refresh event + virtual void Refresh(bool eraseBack = TRUE, const wxRect *rect = NULL); #if WXWIN_COMPATIBILITY - // Set/get scroll attributes - virtual void SetScrollRange(int orient, int range, bool refresh = TRUE); - virtual void SetScrollPage(int orient, int page, bool refresh = TRUE); - virtual int OldGetScrollRange(int orient) const; - virtual int GetScrollPage(int orient) const; + // Set/get scroll attributes + virtual void SetScrollRange(int orient, int range, bool refresh = TRUE); + virtual void SetScrollPage(int orient, int page, bool refresh = TRUE); + virtual int OldGetScrollRange(int orient) const; + virtual int GetScrollPage(int orient) const; #endif - // New functions that will replace the above. - virtual void SetScrollbar(int orient, int pos, int thumbVisible, - int range, bool refresh = TRUE); - - virtual void SetScrollPos(int orient, int pos, bool refresh = TRUE); - virtual int GetScrollPos(int orient) const; - virtual int GetScrollRange(int orient) const; - virtual int GetScrollThumb(int orient) const; - - virtual void ScrollWindow(int dx, int dy, const wxRect *rect = NULL); - - // Caret manipulation - virtual void CreateCaret(int w, int h); - virtual void CreateCaret(const wxBitmap *bitmap); - virtual void DestroyCaret(); - virtual void ShowCaret(bool show); - virtual void SetCaretPos(int x, int y); - virtual void GetCaretPos(int *x, int *y) const; - - // Tell window how much it can be sized - virtual void SetSizeHints(int minW = -1, int minH = -1, int maxW = -1, int maxH = -1, int incW = -1, int incH = -1); - - // Set/get the window's identifier - inline int GetId() const; - inline void SetId(int id); - - // Make the window modal (all other windows unresponsive) - virtual void MakeModal(bool modal); - - // Get the private handle (platform-dependent) - inline void *GetHandle() const; - - // Set/get the window's relatives - inline wxWindow *GetParent() const; - inline void SetParent(wxWindow *p) ; - inline wxWindow *GetGrandParent() const; - inline wxList& GetChildren() const; - // Set this window to be the child of 'parent'. - // Returns FALSE it's not possible (some systems - // won't allow it) - virtual bool Reparent(wxWindow *parent); - - // Set/get the window's font - virtual void SetFont(const wxFont& f); - inline virtual wxFont& GetFont() const; - - // Set/get the window's validator - void SetValidator(const wxValidator& validator); - inline wxValidator *GetValidator() const; - - // Set/get the window's style - inline void SetWindowStyleFlag(long flag); - inline long GetWindowStyleFlag() const; - - // Set/get double-clickability - // TODO: we probably wish to get rid of this, and - // always allow double clicks. - inline void SetDoubleClick(bool flag); - inline bool GetDoubleClick() const; - inline void AllowDoubleClick(bool value) { SetDoubleClick(value); } - - // Handle a control command - virtual void OnCommand(wxWindow& win, wxCommandEvent& event); - - // Set/get event handler - inline void SetEventHandler(wxEvtHandler *handler); - inline wxEvtHandler *GetEventHandler() const; - - // Push/pop event handler (i.e. allow a chain of event handlers - // be searched) - void PushEventHandler(wxEvtHandler *handler) ; - wxEvtHandler *PopEventHandler(bool deleteHandler = FALSE) ; - - // Close the window by calling OnClose, posting a deletion - virtual bool Close(bool force = FALSE); - - // Destroy the window (delayed, if a managed window) - virtual bool Destroy() ; - - // Mode for telling default OnSize members to - // call Layout(), if not using Sizers, just top-down constraints - inline void SetAutoLayout(bool a); - inline bool GetAutoLayout() const; - - // Set/get constraints - inline wxLayoutConstraints *GetConstraints() const; - void SetConstraints(wxLayoutConstraints *c); - - // Set/get window background colour - inline virtual void SetBackgroundColour(const wxColour& col); - inline virtual wxColour GetBackgroundColour() const; - - // Set/get window foreground colour - inline virtual void SetForegroundColour(const wxColour& col); - inline virtual wxColour GetForegroundColour() const; - - // For backward compatibility - inline virtual void SetButtonFont(const wxFont& font) { SetFont(font); } - inline virtual void SetLabelFont(const wxFont& font) { SetFont(font); } - inline virtual wxFont& GetLabelFont() const { return GetFont(); }; - inline virtual wxFont& GetButtonFont() const { return GetFont(); }; - - // Get the default button, if there is one - inline virtual wxButton *GetDefaultItem() const; - inline virtual void SetDefaultItem(wxButton *but); - - virtual void SetAcceleratorTable(const wxAcceleratorTable& accel); - inline virtual wxAcceleratorTable& GetAcceleratorTable() const { return (wxAcceleratorTable&) m_acceleratorTable; } - - // Override to define new behaviour for default action (e.g. double clicking - // on a listbox) - virtual void OnDefaultAction(wxControl *initiatingItem); - - // Resource loading + // New functions that will replace the above. + virtual void SetScrollbar(int orient, int pos, int thumbVisible, + int range, bool refresh = TRUE); + + virtual void SetScrollPos(int orient, int pos, bool refresh = TRUE); + virtual int GetScrollPos(int orient) const; + virtual int GetScrollRange(int orient) const; + virtual int GetScrollThumb(int orient) const; + + virtual void ScrollWindow(int dx, int dy, const wxRect *rect = NULL); + + // Caret manipulation + virtual void CreateCaret(int w, int h); + virtual void CreateCaret(const wxBitmap *bitmap); + virtual void DestroyCaret(); + virtual void ShowCaret(bool show); + virtual void SetCaretPos(int x, int y); + virtual void GetCaretPos(int *x, int *y) const; + + // Tell window how much it can be sized + virtual void SetSizeHints(int minW = -1, int minH = -1, int maxW = -1, int maxH = -1, int incW = -1, int incH = -1); + + // Set/get the window's identifier + inline int GetId() const; + inline void SetId(int id); + + // Make the window modal (all other windows unresponsive) + virtual void MakeModal(bool modal); + + // Get the private handle (platform-dependent) + inline void *GetHandle() const; + + // Set/get the window's relatives + inline wxWindow *GetParent() const; + inline void SetParent(wxWindow *p) ; + inline wxWindow *GetGrandParent() const; + inline wxList& GetChildren() const; + // Set this window to be the child of 'parent'. + // Returns FALSE it's not possible (some systems + // won't allow it) + virtual bool Reparent(wxWindow *parent); + + // Set/get the window's font + virtual void SetFont(const wxFont& f); + inline virtual wxFont& GetFont() const; + + // Set/get the window's validator + void SetValidator(const wxValidator& validator); + inline wxValidator *GetValidator() const; + + // Set/get the window's style + inline void SetWindowStyleFlag(long flag); + inline long GetWindowStyleFlag() const; + + // Set/get double-clickability + // TODO: we probably wish to get rid of this, and + // always allow double clicks. + inline void SetDoubleClick(bool flag); + inline bool GetDoubleClick() const; + inline void AllowDoubleClick(bool value) { SetDoubleClick(value); } + + // Handle a control command + virtual void OnCommand(wxWindow& win, wxCommandEvent& event); + + // Set/get event handler + inline void SetEventHandler(wxEvtHandler *handler); + inline wxEvtHandler *GetEventHandler() const; + + // Push/pop event handler (i.e. allow a chain of event handlers + // be searched) + void PushEventHandler(wxEvtHandler *handler) ; + wxEvtHandler *PopEventHandler(bool deleteHandler = FALSE) ; + + // Close the window by calling OnClose, posting a deletion + virtual bool Close(bool force = FALSE); + + // Destroy the window (delayed, if a managed window) + virtual bool Destroy() ; + + // Mode for telling default OnSize members to + // call Layout(), if not using Sizers, just top-down constraints + inline void SetAutoLayout(bool a); + inline bool GetAutoLayout() const; + + // Set/get constraints + inline wxLayoutConstraints *GetConstraints() const; + void SetConstraints(wxLayoutConstraints *c); + + // Set/get window background colour + inline virtual void SetBackgroundColour(const wxColour& col); + inline virtual wxColour GetBackgroundColour() const; + + // Set/get window foreground colour + inline virtual void SetForegroundColour(const wxColour& col); + inline virtual wxColour GetForegroundColour() const; + + // For backward compatibility + inline virtual void SetButtonFont(const wxFont& font) { SetFont(font); } + inline virtual void SetLabelFont(const wxFont& font) { SetFont(font); } + inline virtual wxFont& GetLabelFont() const { return GetFont(); }; + inline virtual wxFont& GetButtonFont() const { return GetFont(); }; + + // Get the default button, if there is one + inline virtual wxButton *GetDefaultItem() const; + inline virtual void SetDefaultItem(wxButton *but); + + virtual void SetAcceleratorTable(const wxAcceleratorTable& accel); + inline virtual wxAcceleratorTable& GetAcceleratorTable() const { return (wxAcceleratorTable&) m_acceleratorTable; } + + // Override to define new behaviour for default action (e.g. double clicking + // on a listbox) + virtual void OnDefaultAction(wxControl *initiatingItem); + + // Resource loading #if wxUSE_WX_RESOURCES - virtual bool LoadFromResource(wxWindow *parent, const wxString& resourceName, const wxResourceTable *table = NULL); - virtual wxControl *CreateItem(const wxItemResource* childResource, const wxItemResource* parentResource, const wxResourceTable *table = NULL); + virtual bool LoadFromResource(wxWindow *parent, const wxString& resourceName, const wxResourceTable *table = NULL); + virtual wxControl *CreateItem(const wxItemResource* childResource, const wxItemResource* parentResource, const wxResourceTable *table = NULL); #endif - // Native resource loading - virtual bool LoadNativeDialog(wxWindow* parent, wxWindowID& id); - virtual bool LoadNativeDialog(wxWindow* parent, const wxString& name); - virtual wxWindow* GetWindowChild1(wxWindowID& id); - virtual wxWindow* GetWindowChild(wxWindowID& id); + // Native resource loading + virtual bool LoadNativeDialog(wxWindow* parent, wxWindowID& id); + virtual bool LoadNativeDialog(wxWindow* parent, const wxString& name); + virtual wxWindow* GetWindowChild1(wxWindowID& id); + virtual wxWindow* GetWindowChild(wxWindowID& id); - virtual void GetTextExtent(const wxString& string, int *x, int *y, - int *descent = NULL, - int *externalLeading = NULL, - const wxFont *theFont = NULL, bool use16 = FALSE) const; + virtual void GetTextExtent(const wxString& string, int *x, int *y, + int *descent = NULL, + int *externalLeading = NULL, + const wxFont *theFont = NULL, bool use16 = FALSE) const; - // Is the window retained? - inline bool IsRetained() const; + // Is the window retained? + inline bool IsRetained() const; - // Warp the pointer the given position - virtual void WarpPointer(int x_pos, int y_pos) ; + // Warp the pointer the given position + virtual void WarpPointer(int x_pos, int y_pos) ; - // Clear the window - virtual void Clear(); + // Clear the window + virtual void Clear(); - // Find a window by id or name - virtual wxWindow *FindWindow(long id); - virtual wxWindow *FindWindow(const wxString& name); + // Find a window by id or name + virtual wxWindow *FindWindow(long id); + virtual wxWindow *FindWindow(const wxString& name); - // Constraint operations - bool Layout(); - void SetSizer(wxSizer *sizer); // Adds sizer child to this window - inline wxSizer *GetSizer() const ; - inline wxWindow *GetSizerParent() const ; - inline void SetSizerParent(wxWindow *win); + // Constraint operations + bool Layout(); + void SetSizer(wxSizer *sizer); // Adds sizer child to this window + inline wxSizer *GetSizer() const ; + inline wxWindow *GetSizerParent() const ; + inline void SetSizerParent(wxWindow *win); - // Do Update UI processing for controls - void UpdateWindowUI(); + // Do Update UI processing for controls + void UpdateWindowUI(); - void OnEraseBackground(wxEraseEvent& event); - void OnKeyDown(wxKeyEvent& event); - void OnKeyUp(wxKeyEvent& event); - void OnPaint(wxPaintEvent& event); - void OnChar(wxKeyEvent& event); - void OnIdle(wxIdleEvent& event); + void OnEraseBackground(wxEraseEvent& event); + void OnKeyDown(wxKeyEvent& event); + void OnKeyUp(wxKeyEvent& event); + void OnPaint(wxPaintEvent& event); + void OnChar(wxKeyEvent& event); + void OnIdle(wxIdleEvent& event); - // Does this window want to accept keyboard focus? - virtual bool AcceptsFocus() const; + // Does this window want to accept keyboard focus? + virtual bool AcceptsFocus() const; - virtual void PrepareDC( wxDC& WXUNUSED(dc) ) {}; + virtual void PrepareDC( wxDC& WXUNUSED(dc) ) {}; public: - //////////////////////////////////////////////////////////////////////// - //// IMPLEMENTATION - - // For implementation purposes - sometimes decorations make the client area - // smaller - virtual wxPoint GetClientAreaOrigin() const; - - // Makes an adjustment to the window position (for example, a frame that has - // a toolbar that it manages itself). - virtual void AdjustForParentClientOrigin(int& x, int& y, int sizeFlags); - - // Windows subclassing - void SubclassWin(WXHWND hWnd); - void UnsubclassWin(); - virtual long Default(); - virtual bool MSWCommand(WXUINT param, WXWORD id); - - // returns TRUE if the event was processed - virtual bool MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result); - - virtual wxWindow *FindItem(int id) const; - virtual wxWindow *FindItemByHWND(WXHWND hWnd, bool controlOnly = FALSE) const ; - virtual void PreDelete(WXHDC dc); // Allows system cleanup - // TO DO: how many of these need to be virtual? - virtual WXHWND GetHWND() const ; - virtual void SetHWND(WXHWND hWnd); - - // Make a Windows extended style from the given wxWindows window style - virtual WXDWORD MakeExtendedStyle(long style, bool eliminateBorders = TRUE); - // Determine whether 3D effects are wanted - virtual WXDWORD Determine3DEffects(WXDWORD defaultBorderStyle, bool *want3D); - - virtual void AddChild(wxWindow *child); // Adds reference to the child object - virtual void RemoveChild(wxWindow *child); // Removes reference to child - // (but doesn't delete the child object) - virtual void DestroyChildren(); // Removes and destroys all children - - inline bool IsBeingDeleted(); - - // MSW only: TRUE if this control is part of the main control - virtual bool ContainsHWND(WXHWND WXUNUSED(hWnd)) const { return FALSE; }; - - // Constraint implementation - void UnsetConstraints(wxLayoutConstraints *c); - inline wxList *GetConstraintsInvolvedIn() const ; - // Back-pointer to other windows we're involved with, so if we delete - // this window, we must delete any constraints we're involved with. - void AddConstraintReference(wxWindow *otherWin); - void RemoveConstraintReference(wxWindow *otherWin); - void DeleteRelatedConstraints(); - - virtual void ResetConstraints(); - virtual void SetConstraintSizes(bool recurse = TRUE); - virtual bool LayoutPhase1(int *noChanges); - virtual bool LayoutPhase2(int *noChanges); - virtual bool DoPhase(int); - // Transforms from sizer coordinate space to actual - // parent coordinate space - virtual void TransformSizerToActual(int *x, int *y) const ; - - // Set size with transformation to actual coordinates if nec. - virtual void SizerSetSize(int x, int y, int w, int h); - virtual void SizerMove(int x, int y); - - // Only set/get the size/position of the constraint (if any) - virtual void SetSizeConstraint(int x, int y, int w, int h); - virtual void MoveConstraint(int x, int y); - virtual void GetSizeConstraint(int *w, int *h) const ; - virtual void GetClientSizeConstraint(int *w, int *h) const ; - virtual void GetPositionConstraint(int *x, int *y) const ; - - // Dialog units translations. Implemented in wincmn.cpp. - wxPoint ConvertPixelsToDialog(const wxPoint& pt) ; - wxPoint ConvertDialogToPixels(const wxPoint& pt) ; - inline wxSize ConvertPixelsToDialog(const wxSize& sz) - { wxPoint pt(ConvertPixelsToDialog(wxPoint(sz.x, sz.y))); return wxSize(pt.x, pt.y); } - inline wxSize ConvertDialogToPixels(const wxSize& sz) - { wxPoint pt(ConvertDialogToPixels(wxPoint(sz.x, sz.y))); return wxSize(pt.x, pt.y); } - - wxObject *GetChild(int number) const ; - - void MSWCreate(int id, wxWindow *parent, const char *wclass, wxWindow *wx_win, const char *title, - int x, int y, int width, int height, - WXDWORD style, const char *dialog_template = NULL, - WXDWORD exendedStyle = 0); - - // Actually defined in wx_canvs.cc since requires wxCanvas declaration - virtual void MSWDeviceToLogical(float *x, float *y) const ; - - // Create an appropriate wxWindow from a HWND - virtual wxWindow* CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd); - - // Make sure the window style reflects the HWND style (roughly) - virtual void AdoptAttributesFromHWND(); - - // Setup background and foreground colours correctly - virtual void SetupColours(); - - // Saves the last message information before calling base version - virtual bool ProcessEvent(wxEvent& event); - - // Handlers - virtual void MSWOnCreate(WXLPCREATESTRUCT cs); - virtual bool MSWOnPaint(); - virtual WXHICON MSWOnQueryDragIcon() { return 0; } - virtual void MSWOnSize(int x, int y, WXUINT flag); - virtual void MSWOnWindowPosChanging(void *lpPos); - virtual void MSWOnHScroll(WXWORD nSBCode, WXWORD pos, WXHWND control); - virtual void MSWOnVScroll(WXWORD nSBCode, WXWORD pos, WXHWND control); - virtual bool MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control); - virtual long MSWOnSysCommand(WXWPARAM wParam, WXLPARAM lParam); - virtual long MSWOnNotify(WXWPARAM wParam, WXLPARAM lParam); - virtual WXHBRUSH MSWOnCtlColor(WXHDC dc, WXHWND pWnd, WXUINT nCtlColor, - WXUINT message, WXWPARAM wParam, WXLPARAM lParam); - virtual bool MSWOnColorChange(WXHWND hWnd, WXUINT message, WXWPARAM wParam, WXLPARAM lParam); - virtual long MSWOnPaletteChanged(WXHWND hWndPalChange); - virtual long MSWOnQueryNewPalette(); - virtual bool MSWOnEraseBkgnd(WXHDC pDC); - virtual void MSWOnMenuHighlight(WXWORD item, WXWORD flags, WXHMENU sysmenu); - virtual void MSWOnInitMenuPopup(WXHMENU menu, int pos, bool isSystem); - virtual bool MSWOnClose(); - // Return TRUE to end session, FALSE to veto end session. - virtual bool MSWOnQueryEndSession(long logOff); - virtual bool MSWOnEndSession(bool endSession, long logOff); - virtual bool MSWOnDestroy(); - virtual bool MSWOnSetFocus(WXHWND wnd); - virtual bool MSWOnKillFocus(WXHWND wnd); - virtual void MSWOnDropFiles(WXWPARAM wParam); - virtual bool MSWOnInitDialog(WXHWND hWndFocus); - virtual void MSWOnShow(bool show, int status); - - // TODO: rationalise these functions into 1 or 2 which take the - // event type as argument. - virtual void MSWOnLButtonDown(int x, int y, WXUINT flags); - virtual void MSWOnLButtonUp(int x, int y, WXUINT flags); - virtual void MSWOnLButtonDClick(int x, int y, WXUINT flags); - - virtual void MSWOnMButtonDown(int x, int y, WXUINT flags); - virtual void MSWOnMButtonUp(int x, int y, WXUINT flags); - virtual void MSWOnMButtonDClick(int x, int y, WXUINT flags); - - virtual void MSWOnRButtonDown(int x, int y, WXUINT flags); - virtual void MSWOnRButtonUp(int x, int y, WXUINT flags); - virtual void MSWOnRButtonDClick(int x, int y, WXUINT flags); - - virtual void MSWOnMouseMove(int x, int y, WXUINT flags); - virtual void MSWOnMouseEnter(int x, int y, WXUINT flags); - virtual void MSWOnMouseLeave(int x, int y, WXUINT flags); - - // These return TRUE if an event handler was found, FALSE otherwise (not processed) - virtual bool MSWOnChar(WXWORD wParam, WXLPARAM lParam, bool isASCII = FALSE); - virtual bool MSWOnKeyDown(WXWORD wParam, WXLPARAM lParam, bool isASCII = FALSE); - virtual bool MSWOnKeyUp(WXWORD wParam, WXLPARAM lParam, bool isASCII = FALSE); - - virtual bool MSWOnActivate(int flag, bool minimized, WXHWND activate); - virtual long MSWOnMDIActivate(long flag, WXHWND activate, WXHWND deactivate); - - virtual bool MSWOnDrawItem(int id, WXDRAWITEMSTRUCT *item); - virtual bool MSWOnMeasureItem(int id, WXMEASUREITEMSTRUCT *item); - - virtual void MSWOnJoyDown(int joystick, int x, int y, WXUINT flags); - virtual void MSWOnJoyUp(int joystick, int x, int y, WXUINT flags); - virtual void MSWOnJoyMove(int joystick, int x, int y, WXUINT flags); - virtual void MSWOnJoyZMove(int joystick, int z, WXUINT flags); - - virtual long MSWGetDlgCode(); - - // Window procedure - virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); - - // Calls an appropriate default window procedure - virtual long MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); - virtual bool MSWProcessMessage(WXMSG* pMsg); - virtual bool MSWTranslateMessage(WXMSG* pMsg); - virtual void MSWDestroyWindow(); - - // Detach "Window" menu from menu bar so it doesn't get deleted - void MSWDetachWindowMenu(); - - inline WXFARPROC MSWGetOldWndProc() const; - inline void MSWSetOldWndProc(WXFARPROC proc); - - // Define for each class of dialog and control - virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, - WXUINT message, WXWPARAM wParam, WXLPARAM lParam); - - inline void SetShowing(bool show); - inline bool IsUserEnabled() const; - inline bool GetUseCtl3D() const ; - inline bool GetTransparentBackground() const ; - - // Responds to colour changes: passes event on to children. - void OnSysColourChanged(wxSysColourChangedEvent& event); - - // Transfers data to any child controls - void OnInitDialog(wxInitDialogEvent& event); - - // Sends an OnInitDialog event, which in turns transfers data to - // to the window via validators. - virtual void InitDialog(); - - //////////////////////////////////////////////////////////////////////// - //// PROTECTED DATA + //////////////////////////////////////////////////////////////////////// + //// IMPLEMENTATION + + // For implementation purposes - sometimes decorations make the client area + // smaller + virtual wxPoint GetClientAreaOrigin() const; + + // Makes an adjustment to the window position (for example, a frame that has + // a toolbar that it manages itself). + virtual void AdjustForParentClientOrigin(int& x, int& y, int sizeFlags); + + // Windows subclassing + void SubclassWin(WXHWND hWnd); + void UnsubclassWin(); + virtual long Default(); + virtual bool MSWCommand(WXUINT param, WXWORD id); + + // returns TRUE if the event was processed + virtual bool MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result); + + virtual wxWindow *FindItem(int id) const; + virtual wxWindow *FindItemByHWND(WXHWND hWnd, bool controlOnly = FALSE) const ; + virtual void PreDelete(WXHDC dc); // Allows system cleanup + // TO DO: how many of these need to be virtual? + virtual WXHWND GetHWND() const ; + virtual void SetHWND(WXHWND hWnd); + + // Make a Windows extended style from the given wxWindows window style + virtual WXDWORD MakeExtendedStyle(long style, bool eliminateBorders = TRUE); + // Determine whether 3D effects are wanted + virtual WXDWORD Determine3DEffects(WXDWORD defaultBorderStyle, bool *want3D); + + virtual void AddChild(wxWindow *child); // Adds reference to the child object + virtual void RemoveChild(wxWindow *child); // Removes reference to child + // (but doesn't delete the child object) + virtual void DestroyChildren(); // Removes and destroys all children + + inline bool IsBeingDeleted(); + + // MSW only: TRUE if this control is part of the main control + virtual bool ContainsHWND(WXHWND WXUNUSED(hWnd)) const { return FALSE; }; + + // Constraint implementation + void UnsetConstraints(wxLayoutConstraints *c); + inline wxList *GetConstraintsInvolvedIn() const ; + // Back-pointer to other windows we're involved with, so if we delete + // this window, we must delete any constraints we're involved with. + void AddConstraintReference(wxWindow *otherWin); + void RemoveConstraintReference(wxWindow *otherWin); + void DeleteRelatedConstraints(); + + virtual void ResetConstraints(); + virtual void SetConstraintSizes(bool recurse = TRUE); + virtual bool LayoutPhase1(int *noChanges); + virtual bool LayoutPhase2(int *noChanges); + virtual bool DoPhase(int); + // Transforms from sizer coordinate space to actual + // parent coordinate space + virtual void TransformSizerToActual(int *x, int *y) const ; + + // Set size with transformation to actual coordinates if nec. + virtual void SizerSetSize(int x, int y, int w, int h); + virtual void SizerMove(int x, int y); + + // Only set/get the size/position of the constraint (if any) + virtual void SetSizeConstraint(int x, int y, int w, int h); + virtual void MoveConstraint(int x, int y); + virtual void GetSizeConstraint(int *w, int *h) const ; + virtual void GetClientSizeConstraint(int *w, int *h) const ; + virtual void GetPositionConstraint(int *x, int *y) const ; + + // Dialog units translations. Implemented in wincmn.cpp. + wxPoint ConvertPixelsToDialog(const wxPoint& pt) ; + wxPoint ConvertDialogToPixels(const wxPoint& pt) ; + inline wxSize ConvertPixelsToDialog(const wxSize& sz) + { wxPoint pt(ConvertPixelsToDialog(wxPoint(sz.x, sz.y))); return wxSize(pt.x, pt.y); } + inline wxSize ConvertDialogToPixels(const wxSize& sz) + { wxPoint pt(ConvertDialogToPixels(wxPoint(sz.x, sz.y))); return wxSize(pt.x, pt.y); } + + wxObject *GetChild(int number) const ; + + void MSWCreate(int id, wxWindow *parent, const char *wclass, wxWindow *wx_win, const char *title, + int x, int y, int width, int height, + WXDWORD style, const char *dialog_template = NULL, + WXDWORD exendedStyle = 0); + + // Actually defined in wx_canvs.cc since requires wxCanvas declaration + virtual void MSWDeviceToLogical(float *x, float *y) const ; + + // Create an appropriate wxWindow from a HWND + virtual wxWindow* CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd); + + // Make sure the window style reflects the HWND style (roughly) + virtual void AdoptAttributesFromHWND(); + + // Setup background and foreground colours correctly + virtual void SetupColours(); + + // Saves the last message information before calling base version + virtual bool ProcessEvent(wxEvent& event); + + // Handlers + virtual void MSWOnCreate(WXLPCREATESTRUCT cs); + virtual bool MSWOnPaint(); + virtual WXHICON MSWOnQueryDragIcon() { return 0; } + virtual void MSWOnSize(int x, int y, WXUINT flag); + virtual void MSWOnWindowPosChanging(void *lpPos); + virtual void MSWOnHScroll(WXWORD nSBCode, WXWORD pos, WXHWND control); + virtual void MSWOnVScroll(WXWORD nSBCode, WXWORD pos, WXHWND control); + virtual bool MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control); + virtual long MSWOnSysCommand(WXWPARAM wParam, WXLPARAM lParam); + virtual long MSWOnNotify(WXWPARAM wParam, WXLPARAM lParam); + virtual WXHBRUSH MSWOnCtlColor(WXHDC dc, WXHWND pWnd, WXUINT nCtlColor, + WXUINT message, WXWPARAM wParam, WXLPARAM lParam); + virtual bool MSWOnColorChange(WXHWND hWnd, WXUINT message, WXWPARAM wParam, WXLPARAM lParam); + virtual long MSWOnPaletteChanged(WXHWND hWndPalChange); + virtual long MSWOnQueryNewPalette(); + virtual bool MSWOnEraseBkgnd(WXHDC pDC); + virtual void MSWOnMenuHighlight(WXWORD item, WXWORD flags, WXHMENU sysmenu); + virtual void MSWOnInitMenuPopup(WXHMENU menu, int pos, bool isSystem); + virtual bool MSWOnClose(); + // Return TRUE to end session, FALSE to veto end session. + virtual bool MSWOnQueryEndSession(long logOff); + virtual bool MSWOnEndSession(bool endSession, long logOff); + virtual bool MSWOnDestroy(); + virtual bool MSWOnSetFocus(WXHWND wnd); + virtual bool MSWOnKillFocus(WXHWND wnd); + virtual void MSWOnDropFiles(WXWPARAM wParam); + virtual bool MSWOnInitDialog(WXHWND hWndFocus); + virtual void MSWOnShow(bool show, int status); + + // TODO: rationalise these functions into 1 or 2 which take the + // event type as argument. + virtual void MSWOnLButtonDown(int x, int y, WXUINT flags); + virtual void MSWOnLButtonUp(int x, int y, WXUINT flags); + virtual void MSWOnLButtonDClick(int x, int y, WXUINT flags); + + virtual void MSWOnMButtonDown(int x, int y, WXUINT flags); + virtual void MSWOnMButtonUp(int x, int y, WXUINT flags); + virtual void MSWOnMButtonDClick(int x, int y, WXUINT flags); + + virtual void MSWOnRButtonDown(int x, int y, WXUINT flags); + virtual void MSWOnRButtonUp(int x, int y, WXUINT flags); + virtual void MSWOnRButtonDClick(int x, int y, WXUINT flags); + + virtual void MSWOnMouseMove(int x, int y, WXUINT flags); + virtual void MSWOnMouseEnter(int x, int y, WXUINT flags); + virtual void MSWOnMouseLeave(int x, int y, WXUINT flags); + + // These return TRUE if an event handler was found, FALSE otherwise (not processed) + virtual bool MSWOnChar(WXWORD wParam, WXLPARAM lParam, bool isASCII = FALSE); + virtual bool MSWOnKeyDown(WXWORD wParam, WXLPARAM lParam, bool isASCII = FALSE); + virtual bool MSWOnKeyUp(WXWORD wParam, WXLPARAM lParam, bool isASCII = FALSE); + + virtual bool MSWOnActivate(int flag, bool minimized, WXHWND activate); + virtual long MSWOnMDIActivate(long flag, WXHWND activate, WXHWND deactivate); + + virtual bool MSWOnDrawItem(int id, WXDRAWITEMSTRUCT *item); + virtual bool MSWOnMeasureItem(int id, WXMEASUREITEMSTRUCT *item); + + virtual void MSWOnJoyDown(int joystick, int x, int y, WXUINT flags); + virtual void MSWOnJoyUp(int joystick, int x, int y, WXUINT flags); + virtual void MSWOnJoyMove(int joystick, int x, int y, WXUINT flags); + virtual void MSWOnJoyZMove(int joystick, int z, WXUINT flags); + + virtual long MSWGetDlgCode(); + + // Window procedure + virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); + + // Calls an appropriate default window procedure + virtual long MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); + virtual bool MSWProcessMessage(WXMSG* pMsg); + virtual bool MSWTranslateMessage(WXMSG* pMsg); + virtual void MSWDestroyWindow(); + + // Detach "Window" menu from menu bar so it doesn't get deleted + void MSWDetachWindowMenu(); + + inline WXFARPROC MSWGetOldWndProc() const; + inline void MSWSetOldWndProc(WXFARPROC proc); + + // Define for each class of dialog and control + virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, + WXUINT message, WXWPARAM wParam, WXLPARAM lParam); + + inline void SetShowing(bool show); + inline bool IsUserEnabled() const; + inline bool GetUseCtl3D() const ; + inline bool GetTransparentBackground() const ; + + // Responds to colour changes: passes event on to children. + void OnSysColourChanged(wxSysColourChangedEvent& event); + + // Transfers data to any child controls + void OnInitDialog(wxInitDialogEvent& event); + + // Sends an OnInitDialog event, which in turns transfers data to + // to the window via validators. + virtual void InitDialog(); + + //////////////////////////////////////////////////////////////////////// + //// PROTECTED DATA protected: - wxAcceleratorTable m_acceleratorTable; - int m_windowId; - long m_windowStyle; // Store the window's style - wxEvtHandler * m_windowEventHandler; // Usually is 'this' - wxLayoutConstraints * m_constraints; // Constraints for this window - wxList * m_constraintsInvolvedIn; // List of constraints we're involved in - wxSizer * m_windowSizer; // Window's top-level sizer (if any) - wxWindow * m_sizerParent; // Window's parent sizer (if any) - bool m_autoLayout; // Whether to call Layout() in OnSize - wxWindow * m_windowParent; // Each window always knows its parent - wxValidator * m_windowValidator; - // Old window proc, for subclassed controls - WXFARPROC m_oldWndProc; - bool m_useCtl3D; // Using CTL3D for this control - - bool m_inOnSize; // Protection against OnSize reentry + wxAcceleratorTable m_acceleratorTable; + int m_windowId; + long m_windowStyle; // Store the window's style + wxEvtHandler * m_windowEventHandler; // Usually is 'this' + wxLayoutConstraints * m_constraints; // Constraints for this window + wxList * m_constraintsInvolvedIn; // List of constraints we're involved in + wxSizer * m_windowSizer; // Window's top-level sizer (if any) + wxWindow * m_sizerParent; // Window's parent sizer (if any) + bool m_autoLayout; // Whether to call Layout() in OnSize + wxWindow * m_windowParent; // Each window always knows its parent + wxValidator * m_windowValidator; + // Old window proc, for subclassed controls + WXFARPROC m_oldWndProc; + bool m_useCtl3D; // Using CTL3D for this control + + bool m_inOnSize; // Protection against OnSize reentry #ifndef _WX_WIN32__ - // Pointer to global memory, for EDIT controls that need - // special treatment to reduce USER area consumption. - WXHGLOBAL m_globalHandle; + // Pointer to global memory, for EDIT controls that need + // special treatment to reduce USER area consumption. + WXHGLOBAL m_globalHandle; #endif - bool m_winEnabled; - int m_minSizeX; - int m_minSizeY; - int m_maxSizeX; - int m_maxSizeY; - - // Caret data - int m_caretWidth; - int m_caretHeight; - bool m_caretEnabled; - bool m_caretShown; - wxFont m_windowFont; // Window's font - bool m_isShown; - bool m_doubleClickAllowed ; - wxCursor m_windowCursor; // Window's cursor - bool m_winCaptured; - wxString m_windowName; // Window name + bool m_winEnabled; + int m_minSizeX; + int m_minSizeY; + int m_maxSizeX; + int m_maxSizeY; + + // Caret data + int m_caretWidth; + int m_caretHeight; + bool m_caretEnabled; + bool m_caretShown; + wxFont m_windowFont; // Window's font + bool m_isShown; + bool m_doubleClickAllowed ; + wxCursor m_windowCursor; // Window's cursor + bool m_winCaptured; + wxString m_windowName; // Window name #if wxUSE_EXTENDED_STATICS - wxList m_staticItems; + wxList m_staticItems; #endif - wxButton * m_defaultItem; - wxColour m_backgroundColour ; - wxColour m_foregroundColour ; - bool m_backgroundTransparent; + wxButton * m_defaultItem; + wxColour m_backgroundColour ; + wxColour m_foregroundColour ; + bool m_backgroundTransparent; - int m_xThumbSize; - int m_yThumbSize; + int m_xThumbSize; + int m_yThumbSize; - float m_lastXPos; - float m_lastYPos; - int m_lastEvent; + float m_lastXPos; + float m_lastYPos; + int m_lastEvent; - bool m_mouseInWindow; + bool m_mouseInWindow; #if wxUSE_DRAG_AND_DROP - wxDropTarget *m_pDropTarget; // the current drop target or NULL + wxDropTarget *m_pDropTarget; // the current drop target or NULL #endif //USE_DRAG_AND_DROP public: - WXHWND m_hWnd; // MS Windows window handle - WXUINT m_lastMsg; - WXWPARAM m_lastWParam; - WXLPARAM m_lastLParam; - - wxRegion m_updateRegion; -/* - wxRect m_updateRect; // Bounding box for screen damage area + WXHWND m_hWnd; // MS Windows window handle + WXUINT m_lastMsg; + WXWPARAM m_lastWParam; + WXLPARAM m_lastLParam; + + wxRegion m_updateRegion; + /* + wxRect m_updateRect; // Bounding box for screen damage area #ifdef __WIN32__ - WXHRGN m_updateRgn; // NT allows access to the rectangle list +WXHRGN m_updateRgn; // NT allows access to the rectangle list #endif -*/ - -// WXHANDLE m_acceleratorTable; - WXHMENU m_hMenu; // Menu, if any - wxList * m_children; // Window's children - int m_returnCode; - bool m_isBeingDeleted; // Fudge because can't access parent - // when being deleted + */ + + // WXHANDLE m_acceleratorTable; + WXHMENU m_hMenu; // Menu, if any + wxList * m_children; // Window's children + int m_returnCode; + bool m_isBeingDeleted; // Fudge because can't access parent + // when being deleted + + // this is the virtual function to be overriden in any derived class which + // wants to change how SetSize() or Move() works - it is called by all + // versions of these functions in the base class + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); + + // same as DoSetSize() for the client size + virtual void DoSetClientSize(int width, int height); private: // common part of all ctors diff --git a/src/common/ftp.cpp b/src/common/ftp.cpp index 505a923011..28aad19f7f 100644 --- a/src/common/ftp.cpp +++ b/src/common/ftp.cpp @@ -328,7 +328,6 @@ bool wxFTP::Abort(void) wxInputStream *wxFTP::GetInputStream(const wxString& path) { wxString tmp_str; - size_t calc_size; if (!SendCommand("TYPE I", '2')) return NULL; diff --git a/src/common/layout.cpp b/src/common/layout.cpp index b98de42ee5..e8f22391a6 100644 --- a/src/common/layout.cpp +++ b/src/common/layout.cpp @@ -1273,7 +1273,7 @@ void wxSizer::RemoveSizerChild(wxWindow *child) GetChildren().DeleteObject(child); } -void wxSizer::SetSize(int x, int y, int w, int h, int WXUNUSED(flags)) +void wxSizer::DoSetSize(int x, int y, int w, int h, int WXUNUSED(flags)) { wxLayoutConstraints *constr = GetConstraints(); if (x != -1) @@ -1500,11 +1500,6 @@ wxRowColSizer::~wxRowColSizer() { } -void wxRowColSizer::SetSize(int x, int y, int w, int h, int flags) -{ - wxSizer::SetSize(x, y, w, h, flags); -} - bool wxRowColSizer::LayoutPhase1(int *noChanges) { *noChanges = 0; diff --git a/src/common/log.cpp b/src/common/log.cpp index 25016cd325..c1e68f3467 100644 --- a/src/common/log.cpp +++ b/src/common/log.cpp @@ -994,10 +994,10 @@ void wxOnAssert(const char *szFile, int nLine, const char *szMsg) // make life easier for people using VC++ IDE: clicking on the message will // take us immediately to the place of the failed assert #ifdef __VISUALC__ - sprintf(szBuf, _("%s(%d): assert failed"), szFile, nLine); + sprintf(szBuf, "%s(%d): assert failed", szFile, nLine); #else // !VC++ // make the error message more clear for all the others - sprintf(szBuf, _("Assert failed in file %s at line %d"), szFile, nLine); + sprintf(szBuf, "Assert failed in file %s at line %d", szFile, nLine); #endif // VC/!VC if ( szMsg != NULL ) { @@ -1015,9 +1015,9 @@ void wxOnAssert(const char *szFile, int nLine, const char *szMsg) #if wxUSE_NOGUI Trap(); #else - strcat(szBuf, _("\nDo you want to stop the program?" - "\nYou can also choose [Cancel] to suppress " - "further warnings.")); + strcat(szBuf, "\nDo you want to stop the program?" + "\nYou can also choose [Cancel] to suppress " + "further warnings."); switch ( wxMessageBox(szBuf, _("Debug"), wxYES_NO | wxCANCEL | wxICON_STOP ) ) { diff --git a/src/common/object.cpp b/src/common/object.cpp index acebb41729..734a4d5085 100644 --- a/src/common/object.cpp +++ b/src/common/object.cpp @@ -320,7 +320,7 @@ void wxObject::LoadObject( wxObjectInputStream& stream ) m_serialObj->LoadObject(stream); } -#endif +#endif // wxUSE_SERIAL /* * wxObject: cloning of objects diff --git a/src/common/valgen.cpp b/src/common/valgen.cpp index 8dbc461079..091c2b9db4 100644 --- a/src/common/valgen.cpp +++ b/src/common/valgen.cpp @@ -24,6 +24,7 @@ #include "wx/utils.h" #include "wx/intl.h" #include "wx/wx.h" +#include "wx/dynarray.h" #endif #ifndef __WIN16__ diff --git a/src/gtk/dialog.cpp b/src/gtk/dialog.cpp index 2c7594587c..5b4719e6fc 100644 --- a/src/gtk/dialog.cpp +++ b/src/gtk/dialog.cpp @@ -290,7 +290,7 @@ void wxDialog::OnSize( wxSizeEvent &WXUNUSED(event) ) } } -void wxDialog::SetSize( int x, int y, int width, int height, int sizeFlags ) +void wxDialog::DoSetSize( int x, int y, int width, int height, int sizeFlags ) { wxASSERT_MSG( (m_widget != NULL), "invalid dialog" ); wxASSERT_MSG( (m_wxwindow != NULL), "invalid dialog" ); @@ -350,11 +350,6 @@ void wxDialog::SetSize( int x, int y, int width, int height, int sizeFlags ) m_resizing = FALSE; } -void wxDialog::SetSize( int width, int height ) -{ - SetSize( -1, -1, width, height, wxSIZE_USE_EXISTING ); -} - void wxDialog::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height ) { // due to a bug in gtk, x,y are always 0 diff --git a/src/gtk/filedlg.cpp b/src/gtk/filedlg.cpp index fce41fad7e..a6be245b23 100644 --- a/src/gtk/filedlg.cpp +++ b/src/gtk/filedlg.cpp @@ -46,11 +46,11 @@ void gtk_filedialog_ok_callback( GtkWidget *WXUNUSED(widget), wxFileDialog *dial { int style = dialog->GetStyle(); - if ((style&wxSAVE)&&(style&wxOVERWRITE_PROMPT)) - { - char *filename = gtk_file_selection_get_filename( - GTK_FILE_SELECTION(dialog->m_widget) ); + GtkFileSelection *filedlg = GTK_FILE_SELECTION(dialog->m_widget); + char *filename = gtk_file_selection_get_filename(filedlg); + if ( (style & wxSAVE) && ( style & wxOVERWRITE_PROMPT ) ) + { if (wxFileExists( filename )) { wxString msg; @@ -61,10 +61,19 @@ void gtk_filedialog_ok_callback( GtkWidget *WXUNUSED(widget), wxFileDialog *dial return; } } + else if ( (style & wxOPEN) && ( style & wxFILE_MUST_EXIST) ) + { + if ( !wxFileExists( filename ) ) + { + wxMessageBox(_("Please choose an existing file."), _("Error"), wxOK); + + return; + } + } - dialog->SetPath( gtk_file_selection_get_filename( GTK_FILE_SELECTION(dialog->m_widget) ) ); + dialog->SetPath( filename ); - wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED,wxID_OK); + wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK); event.SetEventObject( dialog ); dialog->GetEventHandler()->ProcessEvent( event ); } @@ -76,7 +85,7 @@ void gtk_filedialog_ok_callback( GtkWidget *WXUNUSED(widget), wxFileDialog *dial static void gtk_filedialog_cancel_callback( GtkWidget *WXUNUSED(w), wxFileDialog *dialog ) { - wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED,wxID_CANCEL); + wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL); event.SetEventObject( dialog ); dialog->GetEventHandler()->ProcessEvent( event ); } diff --git a/src/gtk/frame.cpp b/src/gtk/frame.cpp index 77cce846da..9b422b1b2d 100644 --- a/src/gtk/frame.cpp +++ b/src/gtk/frame.cpp @@ -249,7 +249,7 @@ wxPoint wxFrame::GetClientAreaOrigin() const return pt; } -void wxFrame::SetSize( int x, int y, int width, int height, int sizeFlags ) +void wxFrame::DoSetSize( int x, int y, int width, int height, int sizeFlags ) { wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); @@ -312,11 +312,6 @@ void wxFrame::SetSize( int x, int y, int width, int height, int sizeFlags ) m_resizing = FALSE; } -void wxFrame::SetSize( int width, int height ) -{ - SetSize( -1, -1, width, height, wxSIZE_USE_EXISTING ); -} - void wxFrame::Centre( int direction ) { wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); @@ -353,7 +348,7 @@ void wxFrame::GetClientSize( int *width, int *height ) const } } -void wxFrame::SetClientSize( int width, int height ) +void wxFrame::DoSetClientSize( int width, int height ) { wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 212d1a5f9b..91c07fb36d 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -9,7 +9,7 @@ #ifdef __GNUG__ -#pragma implementation "window.h" + #pragma implementation "window.h" #endif #include "wx/defs.h" @@ -21,12 +21,15 @@ #include "wx/utils.h" #include "wx/dialog.h" #include "wx/msgdlg.h" + #if wxUSE_DRAG_AND_DROP -#include "wx/dnd.h" + #include "wx/dnd.h" #endif + #if wxUSE_TOOLTIPS -#include "wx/tooltip.h" + #include "wx/tooltip.h" #endif + #include "wx/menu.h" #include "wx/statusbr.h" #include "wx/intl.h" @@ -1798,7 +1801,7 @@ void wxWindow::AdjustForParentClientOrigin( int& x, int& y, int sizeFlags ) } } -void wxWindow::SetSize( int x, int y, int width, int height, int sizeFlags ) +void wxWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags ) { wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxASSERT_MSG( (m_parent != NULL), "wxWindow::SetSize requires parent.\n" ); @@ -1883,16 +1886,6 @@ void wxWindow::OnInternalIdle() UpdateWindowUI(); } -void wxWindow::SetSize( int width, int height ) -{ - SetSize( -1, -1, width, height, wxSIZE_USE_EXISTING ); -} - -void wxWindow::Move( int x, int y ) -{ - SetSize( x, y, -1, -1, wxSIZE_USE_EXISTING ); -} - void wxWindow::GetSize( int *width, int *height ) const { wxCHECK_RET( (m_widget != NULL), "invalid window" ); @@ -1901,7 +1894,7 @@ void wxWindow::GetSize( int *width, int *height ) const if (height) (*height) = m_height; } -void wxWindow::SetClientSize( int width, int height ) +void wxWindow::DoSetClientSize( int width, int height ) { wxCHECK_RET( (m_widget != NULL), "invalid window" ); diff --git a/src/gtk1/dialog.cpp b/src/gtk1/dialog.cpp index 2c7594587c..5b4719e6fc 100644 --- a/src/gtk1/dialog.cpp +++ b/src/gtk1/dialog.cpp @@ -290,7 +290,7 @@ void wxDialog::OnSize( wxSizeEvent &WXUNUSED(event) ) } } -void wxDialog::SetSize( int x, int y, int width, int height, int sizeFlags ) +void wxDialog::DoSetSize( int x, int y, int width, int height, int sizeFlags ) { wxASSERT_MSG( (m_widget != NULL), "invalid dialog" ); wxASSERT_MSG( (m_wxwindow != NULL), "invalid dialog" ); @@ -350,11 +350,6 @@ void wxDialog::SetSize( int x, int y, int width, int height, int sizeFlags ) m_resizing = FALSE; } -void wxDialog::SetSize( int width, int height ) -{ - SetSize( -1, -1, width, height, wxSIZE_USE_EXISTING ); -} - void wxDialog::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height ) { // due to a bug in gtk, x,y are always 0 diff --git a/src/gtk1/filedlg.cpp b/src/gtk1/filedlg.cpp index fce41fad7e..a6be245b23 100644 --- a/src/gtk1/filedlg.cpp +++ b/src/gtk1/filedlg.cpp @@ -46,11 +46,11 @@ void gtk_filedialog_ok_callback( GtkWidget *WXUNUSED(widget), wxFileDialog *dial { int style = dialog->GetStyle(); - if ((style&wxSAVE)&&(style&wxOVERWRITE_PROMPT)) - { - char *filename = gtk_file_selection_get_filename( - GTK_FILE_SELECTION(dialog->m_widget) ); + GtkFileSelection *filedlg = GTK_FILE_SELECTION(dialog->m_widget); + char *filename = gtk_file_selection_get_filename(filedlg); + if ( (style & wxSAVE) && ( style & wxOVERWRITE_PROMPT ) ) + { if (wxFileExists( filename )) { wxString msg; @@ -61,10 +61,19 @@ void gtk_filedialog_ok_callback( GtkWidget *WXUNUSED(widget), wxFileDialog *dial return; } } + else if ( (style & wxOPEN) && ( style & wxFILE_MUST_EXIST) ) + { + if ( !wxFileExists( filename ) ) + { + wxMessageBox(_("Please choose an existing file."), _("Error"), wxOK); + + return; + } + } - dialog->SetPath( gtk_file_selection_get_filename( GTK_FILE_SELECTION(dialog->m_widget) ) ); + dialog->SetPath( filename ); - wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED,wxID_OK); + wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK); event.SetEventObject( dialog ); dialog->GetEventHandler()->ProcessEvent( event ); } @@ -76,7 +85,7 @@ void gtk_filedialog_ok_callback( GtkWidget *WXUNUSED(widget), wxFileDialog *dial static void gtk_filedialog_cancel_callback( GtkWidget *WXUNUSED(w), wxFileDialog *dialog ) { - wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED,wxID_CANCEL); + wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL); event.SetEventObject( dialog ); dialog->GetEventHandler()->ProcessEvent( event ); } diff --git a/src/gtk1/frame.cpp b/src/gtk1/frame.cpp index 77cce846da..9b422b1b2d 100644 --- a/src/gtk1/frame.cpp +++ b/src/gtk1/frame.cpp @@ -249,7 +249,7 @@ wxPoint wxFrame::GetClientAreaOrigin() const return pt; } -void wxFrame::SetSize( int x, int y, int width, int height, int sizeFlags ) +void wxFrame::DoSetSize( int x, int y, int width, int height, int sizeFlags ) { wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); @@ -312,11 +312,6 @@ void wxFrame::SetSize( int x, int y, int width, int height, int sizeFlags ) m_resizing = FALSE; } -void wxFrame::SetSize( int width, int height ) -{ - SetSize( -1, -1, width, height, wxSIZE_USE_EXISTING ); -} - void wxFrame::Centre( int direction ) { wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); @@ -353,7 +348,7 @@ void wxFrame::GetClientSize( int *width, int *height ) const } } -void wxFrame::SetClientSize( int width, int height ) +void wxFrame::DoSetClientSize( int width, int height ) { wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index 212d1a5f9b..91c07fb36d 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -9,7 +9,7 @@ #ifdef __GNUG__ -#pragma implementation "window.h" + #pragma implementation "window.h" #endif #include "wx/defs.h" @@ -21,12 +21,15 @@ #include "wx/utils.h" #include "wx/dialog.h" #include "wx/msgdlg.h" + #if wxUSE_DRAG_AND_DROP -#include "wx/dnd.h" + #include "wx/dnd.h" #endif + #if wxUSE_TOOLTIPS -#include "wx/tooltip.h" + #include "wx/tooltip.h" #endif + #include "wx/menu.h" #include "wx/statusbr.h" #include "wx/intl.h" @@ -1798,7 +1801,7 @@ void wxWindow::AdjustForParentClientOrigin( int& x, int& y, int sizeFlags ) } } -void wxWindow::SetSize( int x, int y, int width, int height, int sizeFlags ) +void wxWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags ) { wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxASSERT_MSG( (m_parent != NULL), "wxWindow::SetSize requires parent.\n" ); @@ -1883,16 +1886,6 @@ void wxWindow::OnInternalIdle() UpdateWindowUI(); } -void wxWindow::SetSize( int width, int height ) -{ - SetSize( -1, -1, width, height, wxSIZE_USE_EXISTING ); -} - -void wxWindow::Move( int x, int y ) -{ - SetSize( x, y, -1, -1, wxSIZE_USE_EXISTING ); -} - void wxWindow::GetSize( int *width, int *height ) const { wxCHECK_RET( (m_widget != NULL), "invalid window" ); @@ -1901,7 +1894,7 @@ void wxWindow::GetSize( int *width, int *height ) const if (height) (*height) = m_height; } -void wxWindow::SetClientSize( int width, int height ) +void wxWindow::DoSetClientSize( int width, int height ) { wxCHECK_RET( (m_widget != NULL), "invalid window" ); diff --git a/src/motif/checkbox.cpp b/src/motif/checkbox.cpp index 1641f1077c..0a5027d046 100644 --- a/src/motif/checkbox.cpp +++ b/src/motif/checkbox.cpp @@ -123,7 +123,7 @@ void wxBitmapCheckBox::SetLabel(const wxBitmap& bitmap) // TODO } -void wxBitmapCheckBox::SetSize(int x, int y, int width, int height, int sizeFlags) +void wxBitmapCheckBox::DoSetSize(int x, int y, int width, int height, int sizeFlags) { // TODO } diff --git a/src/motif/choice.cpp b/src/motif/choice.cpp index b67015a958..b950c67ef4 100644 --- a/src/motif/choice.cpp +++ b/src/motif/choice.cpp @@ -349,7 +349,7 @@ void wxChoice::SetFocus() XmProcessTraversal(XtParent((Widget)m_mainWidget), XmTRAVERSE_CURRENT); } -void wxChoice::SetSize(int x, int y, int width, int height, int sizeFlags) +void wxChoice::DoSetSize(int x, int y, int width, int height, int sizeFlags) { XtVaSetValues((Widget) m_formWidget, XmNresizePolicy, XmRESIZE_ANY, NULL); bool managed = XtIsManaged((Widget) m_formWidget); @@ -380,7 +380,7 @@ void wxChoice::SetSize(int x, int y, int width, int height, int sizeFlags) XtManageChild ((Widget) m_formWidget); XtVaSetValues((Widget) m_formWidget, XmNresizePolicy, XmRESIZE_NONE, NULL); - wxControl::SetSize (x, y, width, height, sizeFlags); + wxControl::DoSetSize (x, y, width, height, sizeFlags); } wxString wxChoice::GetStringSelection () const diff --git a/src/motif/combobox.cpp b/src/motif/combobox.cpp index 89e9a1dfcd..41a12151e5 100644 --- a/src/motif/combobox.cpp +++ b/src/motif/combobox.cpp @@ -102,10 +102,10 @@ wxComboBox::~wxComboBox() m_mainWidget = (WXWidget) 0; } -void wxComboBox::SetSize(int x, int y, int width, int height, int sizeFlags) +void wxComboBox::DoSetSize(int x, int y, int width, int height, int sizeFlags) { // Necessary so it doesn't call wxChoice::SetSize - wxWindow::SetSize(x, y, width, height, sizeFlags); + wxWindow::DoSetSize(x, y, width, height, sizeFlags); } wxString wxComboBox::GetValue() const diff --git a/src/motif/dialog.cpp b/src/motif/dialog.cpp index e4a5bee773..7dc7f7363f 100644 --- a/src/motif/dialog.cpp +++ b/src/motif/dialog.cpp @@ -335,19 +335,13 @@ XtVaGetValues((Widget) m_mainWidget, XmNiconic, &iconic, NULL); return FALSE; } -void wxDialog::SetSize(int x, int y, int width, int height, int sizeFlags) +void wxDialog::DoSetSize(int x, int y, int width, int height, int sizeFlags) { XtVaSetValues((Widget) m_mainWidget, XmNresizePolicy, XmRESIZE_ANY, NULL); - wxWindow::SetSize(x, y, width, height, sizeFlags); + wxWindow::DoSetSize(x, y, width, height, sizeFlags); XtVaSetValues((Widget) m_mainWidget, XmNresizePolicy, XmRESIZE_NONE, NULL); } -void wxDialog::SetClientSize(int width, int height) -{ - SetSize(-1, -1, width, height); -} - - void wxDialog::SetTitle(const wxString& title) { m_dialogTitle = title; diff --git a/src/motif/frame.cpp b/src/motif/frame.cpp index 02472d6861..264204fb1b 100644 --- a/src/motif/frame.cpp +++ b/src/motif/frame.cpp @@ -412,7 +412,7 @@ void wxFrame::GetClientSize(int *x, int *y) const // Set the client size (i.e. leave the calculation of borders etc. // to wxWindows) -void wxFrame::SetClientSize(int width, int height) +void wxFrame::DoSetClientSize(int width, int height) { // Calculate how large the new main window should be // by finding the difference between the client area and the @@ -480,7 +480,7 @@ void wxFrame::GetPosition(int *x, int *y) const if (y) *y = yy; } -void wxFrame::SetSize(int x, int y, int width, int height, int sizeFlags) +void wxFrame::DoSetSize(int x, int y, int width, int height, int sizeFlags) { if (x > -1) XtVaSetValues((Widget) m_frameShell, XmNx, x, NULL); diff --git a/src/motif/gauge.cpp b/src/motif/gauge.cpp index 73beaae217..5804f0b9b4 100644 --- a/src/motif/gauge.cpp +++ b/src/motif/gauge.cpp @@ -134,11 +134,6 @@ bool wxGauge::Create(wxWindow *parent, wxWindowID id, return TRUE; } -void wxGauge::SetSize(int x, int y, int width, int height, int sizeFlags) -{ - wxControl::SetSize(x, y, width, height, sizeFlags); -} - void wxGauge::SetShadowWidth(int w) { if (w == 0) diff --git a/src/motif/listbox.cpp b/src/motif/listbox.cpp index 8bf42b0cf6..1bead5e8e5 100644 --- a/src/motif/listbox.cpp +++ b/src/motif/listbox.cpp @@ -512,9 +512,9 @@ wxString wxListBox::GetString(int N) const return wxEmptyString; } -void wxListBox::SetSize(int x, int y, int width, int height, int sizeFlags) +void wxListBox::DoSetSize(int x, int y, int width, int height, int sizeFlags) { - wxWindow::SetSize(x, y, width, height, sizeFlags); + wxWindow::DoSetSize(x, y, width, height, sizeFlags); // Check resulting size is correct int tempW, tempH; diff --git a/src/motif/mdi.cpp b/src/motif/mdi.cpp index 00612d8b3c..929e51d3c2 100644 --- a/src/motif/mdi.cpp +++ b/src/motif/mdi.cpp @@ -109,12 +109,6 @@ wxMDIParentFrame::~wxMDIParentFrame() m_clientWindow = NULL; } -// Get size *available for subwindows* i.e. excluding menu bar. -void wxMDIParentFrame::GetClientSize(int *x, int *y) const -{ - wxFrame::GetClientSize(x, y); -} - void wxMDIParentFrame::SetMenuBar(wxMenuBar *menu_bar) { m_frameMenuBar = menu_bar; @@ -438,7 +432,7 @@ void wxMDIChildFrame::OnLower() // to wxWindows) void wxMDIChildFrame::SetClientSize(int width, int height) { - wxWindow::SetClientSize(width, height); + wxWindow::DoSetClientSize(width, height); } void wxMDIChildFrame::GetClientSize(int* width, int* height) const @@ -446,9 +440,9 @@ void wxMDIChildFrame::GetClientSize(int* width, int* height) const wxWindow::GetSize(width, height); } -void wxMDIChildFrame::SetSize(int x, int y, int width, int height, int sizeFlags) +void wxMDIChildFrame::DoSetSize(int x, int y, int width, int height, int sizeFlags) { - wxWindow::SetSize(x, y, width, height, sizeFlags); + wxWindow::DoSetSize(x, y, width, height, sizeFlags); } void wxMDIChildFrame::GetSize(int* width, int* height) const @@ -590,14 +584,14 @@ bool wxMDIClientWindow::CreateClient(wxMDIParentFrame *parent, long style) return FALSE; } -void wxMDIClientWindow::SetSize(int x, int y, int width, int height, int sizeFlags) +void wxMDIClientWindow::DoSetSize(int x, int y, int width, int height, int sizeFlags) { - wxWindow::SetSize(x, y, width, height, sizeFlags); + wxWindow::DoSetSize(x, y, width, height, sizeFlags); } -void wxMDIClientWindow::SetClientSize(int width, int height) +void wxMDIClientWindow::DoSetClientSize(int width, int height) { - wxWindow::SetClientSize(width, height); + wxWindow::DoSetClientSize(width, height); } void wxMDIClientWindow::GetClientSize(int *width, int *height) const diff --git a/src/motif/radiobox.cpp b/src/motif/radiobox.cpp index feb57fe5d4..7fdab898f2 100644 --- a/src/motif/radiobox.cpp +++ b/src/motif/radiobox.cpp @@ -297,7 +297,7 @@ wxString wxRadioBox::GetString(int n) const return m_radioButtonLabels[n]; } -void wxRadioBox::SetSize(int x, int y, int width, int height, int sizeFlags) +void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags) { bool managed = XtIsManaged((Widget) m_formWidget); diff --git a/src/motif/slider.cpp b/src/motif/slider.cpp index 3e47c9a424..ab2b4f6e4a 100644 --- a/src/motif/slider.cpp +++ b/src/motif/slider.cpp @@ -131,7 +131,7 @@ void wxSlider::GetSize(int *width, int *height) const wxControl::GetSize(width, height); } -void wxSlider::SetSize(int x, int y, int width, int height, int sizeFlags) +void wxSlider::DoSetSize(int x, int y, int width, int height, int sizeFlags) { Widget widget = (Widget) m_mainWidget; diff --git a/src/motif/statbmp.cpp b/src/motif/statbmp.cpp index 20d46299d5..ba3ae76b29 100644 --- a/src/motif/statbmp.cpp +++ b/src/motif/statbmp.cpp @@ -82,11 +82,6 @@ wxStaticBitmap::~wxStaticBitmap() SetBitmap(wxNullBitmap); } -void wxStaticBitmap::SetSize(int x, int y, int width, int height, int sizeFlags) -{ - wxControl::SetSize(x, y, width, height, sizeFlags); -} - void wxStaticBitmap::SetBitmap(const wxBitmap& bitmap) { m_messageBitmap = bitmap; diff --git a/src/motif/statbox.cpp b/src/motif/statbox.cpp index 3e590bae1d..c3cda9c6d5 100644 --- a/src/motif/statbox.cpp +++ b/src/motif/statbox.cpp @@ -182,9 +182,9 @@ wxString wxStaticBox::GetLabel() const } } -void wxStaticBox::SetSize(int x, int y, int width, int height, int sizeFlags) +void wxStaticBox::DoSetSize(int x, int y, int width, int height, int sizeFlags) { - wxControl::SetSize (x, y, width, height, sizeFlags); + wxControl::DoSetSize (x, y, width, height, sizeFlags); if (m_labelWidget) { diff --git a/src/msw/button.cpp b/src/msw/button.cpp index 17f82e6e7f..661ddad461 100644 --- a/src/msw/button.cpp +++ b/src/msw/button.cpp @@ -96,7 +96,7 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label, return TRUE; } -void wxButton::SetSize(int x, int y, int width, int height, int sizeFlags) +void wxButton::DoSetSize(int x, int y, int width, int height, int sizeFlags) { int currentX, currentY; GetPosition(¤tX, ¤tY); diff --git a/src/msw/checkbox.cpp b/src/msw/checkbox.cpp index 9308744222..436706ad41 100644 --- a/src/msw/checkbox.cpp +++ b/src/msw/checkbox.cpp @@ -118,7 +118,7 @@ void wxCheckBox::SetLabel(const wxString& label) SetWindowText((HWND)GetHWND(), label); } -void wxCheckBox::SetSize(int x, int y, int width, int height, int sizeFlags) +void wxCheckBox::DoSetSize(int x, int y, int width, int height, int sizeFlags) { int currentX, currentY; GetPosition(¤tX, ¤tY); @@ -174,7 +174,7 @@ void wxCheckBox::SetValue(bool val) #define BST_CHECKED 0x0001 #endif -bool wxCheckBox::GetValue(void) const +bool wxCheckBox::GetValue() const { #ifdef __WIN32__ return (SendMessage((HWND) GetHWND(), BM_GETCHECK, 0, 0) == BST_CHECKED); @@ -275,7 +275,7 @@ void wxBitmapCheckBox::SetLabel(const wxBitmap& bitmap) { } -void wxBitmapCheckBox::SetSize(int x, int y, int width, int height, int sizeFlags) +void wxBitmapCheckBox::DoSetSize(int x, int y, int width, int height, int sizeFlags) { int currentX, currentY; GetPosition(¤tX, ¤tY); @@ -307,7 +307,7 @@ void wxBitmapCheckBox::SetValue(bool val) SendMessage((HWND) GetHWND(), BM_SETCHECK, val, 0); } -bool wxBitmapCheckBox::GetValue(void) const +bool wxBitmapCheckBox::GetValue() const { return ((0x003 & SendMessage((HWND) GetHWND(), BM_GETCHECK, 0, 0)) == 0x003); } diff --git a/src/msw/choice.cpp b/src/msw/choice.cpp index a31cd8a366..a901873db3 100644 --- a/src/msw/choice.cpp +++ b/src/msw/choice.cpp @@ -180,7 +180,7 @@ wxString wxChoice::GetString(int n) const return wxString(wxBuffer); } -void wxChoice::SetSize(int x, int y, int width, int height, int sizeFlags) +void wxChoice::DoSetSize(int x, int y, int width, int height, int sizeFlags) { int currentX, currentY; GetPosition(¤tX, ¤tY); diff --git a/src/msw/frame.cpp b/src/msw/frame.cpp index 368784f459..d98fffe623 100644 --- a/src/msw/frame.cpp +++ b/src/msw/frame.cpp @@ -68,7 +68,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow) bool wxFrame::m_useNativeStatusBar = FALSE; #endif -wxFrame::wxFrame(void) +wxFrame::wxFrame() { m_frameToolBar = NULL ; m_frameMenuBar = NULL; @@ -126,7 +126,7 @@ bool wxFrame::Create(wxWindow *parent, return TRUE; } -wxFrame::~wxFrame(void) +wxFrame::~wxFrame() { m_isBeingDeleted = TRUE; wxTopLevelWindows.DeleteObject(this); @@ -158,7 +158,7 @@ wxFrame::~wxFrame(void) ::BringWindowToTop((HWND) GetParent()->GetHWND()); } -WXHMENU wxFrame::GetWinMenu(void) const +WXHMENU wxFrame::GetWinMenu() const { return m_hMenu; } @@ -186,7 +186,7 @@ void wxFrame::GetClientSize(int *x, int *y) const // Set the client size (i.e. leave the calculation of borders etc. // to wxWindows) -void wxFrame::SetClientSize(int width, int height) +void wxFrame::DoSetClientSize(int width, int height) { HWND hWnd = (HWND) GetHWND(); @@ -244,7 +244,7 @@ void wxFrame::GetPosition(int *x, int *y) const *y = point.y; } -void wxFrame::SetSize(int x, int y, int width, int height, int sizeFlags) +void wxFrame::DoSetSize(int x, int y, int width, int height, int sizeFlags) { int currentX, currentY; int x1 = x; @@ -329,14 +329,14 @@ void wxFrame::Maximize(bool maximize) m_iconized = FALSE; } -bool wxFrame::IsIconized(void) const +bool wxFrame::IsIconized() const { ((wxFrame *)this)->m_iconized = (::IsIconic((HWND) GetHWND()) != 0); return m_iconized; } // Is it maximized? -bool wxFrame::IsMaximized(void) const +bool wxFrame::IsMaximized() const { return (::IsZoomed((HWND) GetHWND()) != 0) ; } @@ -346,7 +346,7 @@ void wxFrame::SetTitle(const wxString& title) SetWindowText((HWND) GetHWND(), (const char *)title); } -wxString wxFrame::GetTitle(void) const +wxString wxFrame::GetTitle() const { GetWindowText((HWND) GetHWND(), wxBuffer, 1000); return wxString(wxBuffer); @@ -427,7 +427,7 @@ void wxFrame::SetStatusWidths(int n, const int widths_field[]) PositionStatusBar(); } -void wxFrame::PositionStatusBar(void) +void wxFrame::PositionStatusBar() { // native status bar positions itself if (m_frameStatusBar @@ -515,7 +515,7 @@ bool wxFrame::LoadAccelerators(const wxString& table) } #endif -void wxFrame::Fit(void) +void wxFrame::Fit() { // Work out max. size wxNode *node = GetChildren().First(); @@ -633,7 +633,7 @@ void wxFrame::MSWCreate(int id, wxWindow *parent, const char *wclass, wxWindow * ::PostMessage((HWND) GetHWND(), WM_SIZE, SIZE_RESTORED, MAKELPARAM(width, height)); } -bool wxFrame::MSWOnPaint(void) +bool wxFrame::MSWOnPaint() { RECT rect; if (GetUpdateRect((HWND) GetHWND(), &rect, FALSE)) @@ -679,7 +679,7 @@ bool wxFrame::MSWOnPaint(void) return 1; } -WXHICON wxFrame::MSWOnQueryDragIcon(void) +WXHICON wxFrame::MSWOnQueryDragIcon() { if (m_icon.Ok() && (m_icon.GetHICON() != 0)) return m_icon.GetHICON(); @@ -738,7 +738,7 @@ void wxFrame::MSWOnSize(int x, int y, WXUINT id) } } -bool wxFrame::MSWOnClose(void) +bool wxFrame::MSWOnClose() { return Close(); } @@ -866,7 +866,7 @@ void wxFrame::OnCloseWindow(wxCloseEvent& event) } // Destroy the window (delayed, if a managed window) -bool wxFrame::Destroy(void) +bool wxFrame::Destroy() { if (!wxPendingDelete.Member(this)) wxPendingDelete.Append(this); @@ -898,7 +898,7 @@ void wxFrame::OnMenuHighlight(wxMenuEvent& event) } } -wxMenuBar *wxFrame::GetMenuBar(void) const +wxMenuBar *wxFrame::GetMenuBar() const { return m_frameMenuBar; } @@ -1011,7 +1011,7 @@ wxToolBar* wxFrame::OnCreateToolBar(long style, wxWindowID id, const wxString& n return new wxToolBar(this, id, wxDefaultPosition, wxDefaultSize, style, name); } -void wxFrame::PositionToolBar(void) +void wxFrame::PositionToolBar() { RECT rect; ::GetClientRect((HWND) GetHWND(), &rect); diff --git a/src/msw/gauge95.cpp b/src/msw/gauge95.cpp index 3f934a58c0..d287e72444 100644 --- a/src/msw/gauge95.cpp +++ b/src/msw/gauge95.cpp @@ -94,7 +94,7 @@ bool wxGauge95::Create(wxWindow *parent, wxWindowID id, return TRUE; } -void wxGauge95::SetSize(int x, int y, int width, int height, int sizeFlags) +void wxGauge95::DoSetSize(int x, int y, int width, int height, int sizeFlags) { int currentX, currentY; GetPosition(¤tX, ¤tY); diff --git a/src/msw/gaugemsw.cpp b/src/msw/gaugemsw.cpp index 515dbe7b5d..c2137dd8c4 100644 --- a/src/msw/gaugemsw.cpp +++ b/src/msw/gaugemsw.cpp @@ -142,7 +142,7 @@ bool wxGaugeMSW::Create(wxWindow *parent, wxWindowID id, return TRUE; } -void wxGaugeMSW::SetSize(int x, int y, int width, int height, int sizeFlags) +void wxGaugeMSW::DoSetSize(int x, int y, int width, int height, int sizeFlags) { int currentX, currentY; GetPosition(¤tX, ¤tY); diff --git a/src/msw/listbox.cpp b/src/msw/listbox.cpp index 9de6a74b3b..46f202afe2 100644 --- a/src/msw/listbox.cpp +++ b/src/msw/listbox.cpp @@ -140,7 +140,7 @@ bool wxListBox::MSWCommand(WXUINT param, WXWORD WXUNUSED(id)) } // Listbox item -wxListBox::wxListBox(void) +wxListBox::wxListBox() { m_noItems = 0; m_selected = 0; @@ -258,7 +258,7 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id, return TRUE; } -wxListBox::~wxListBox(void) +wxListBox::~wxListBox() { #if wxUSE_OWNER_DRAWN size_t uiCount = m_aItems.Count(); @@ -268,7 +268,7 @@ wxListBox::~wxListBox(void) #endif } -void wxListBox::SetupColours(void) +void wxListBox::SetupColours() { SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW)); SetForegroundColour(GetParent()->GetForegroundColour()); @@ -377,7 +377,7 @@ int wxListBox::FindString(const wxString& s) const return pos; } -void wxListBox::Clear(void) +void wxListBox::Clear() { ListBox_ResetContent(hwnd); @@ -474,7 +474,7 @@ wxString wxListBox::GetString(int N) const return wxString(wxBuffer); } -void wxListBox::SetSize(int x, int y, int width, int height, int sizeFlags) +void wxListBox::DoSetSize(int x, int y, int width, int height, int sizeFlags) { int currentX, currentY; GetPosition(¤tX, ¤tY); @@ -640,13 +640,13 @@ void wxListBox::SetString(int N, const wxString& s) #endif //USE_OWNER_DRAWN } -int wxListBox::Number (void) const +int wxListBox::Number () const { return m_noItems; } // For single selection items only -wxString wxListBox::GetStringSelection (void) const +wxString wxListBox::GetStringSelection () const { int sel = GetSelection (); if (sel > -1) diff --git a/src/msw/radiobox.cpp b/src/msw/radiobox.cpp index 934e190a30..66ee17fea5 100644 --- a/src/msw/radiobox.cpp +++ b/src/msw/radiobox.cpp @@ -569,7 +569,7 @@ void wxRadioBox::SetSize(int x, int y, int width, int height, int sizeFlags) #endif // Restored old code. -void wxRadioBox::SetSize(int x, int y, int width, int height, int sizeFlags) +void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags) { int currentX, currentY; GetPosition(¤tX, ¤tY); diff --git a/src/msw/slider95.cpp b/src/msw/slider95.cpp index 6981d0a1b0..d7a322184a 100644 --- a/src/msw/slider95.cpp +++ b/src/msw/slider95.cpp @@ -40,7 +40,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxSlider95, wxControl) #endif // Slider -wxSlider95::wxSlider95(void) +wxSlider95::wxSlider95() { m_staticValue = 0; m_staticMin = 0; @@ -264,7 +264,7 @@ void wxSlider95::MSWOnHScroll(WXWORD wParam, WXWORD pos, WXHWND control) MSWOnVScroll(wParam, pos, control); } -wxSlider95::~wxSlider95(void) +wxSlider95::~wxSlider95() { if (m_staticMin) DestroyWindow((HWND) m_staticMin); @@ -274,7 +274,7 @@ wxSlider95::~wxSlider95(void) DestroyWindow((HWND) m_staticValue); } -int wxSlider95::GetValue(void) const +int wxSlider95::GetValue() const { return ::SendMessage((HWND) GetHWND(), TBM_GETPOS, 0, 0); } @@ -343,7 +343,7 @@ void wxSlider95::GetPosition(int *x, int *y) const *y = point.y; } -void wxSlider95::SetSize(int x, int y, int width, int height, int sizeFlags) +void wxSlider95::DoSetSize(int x, int y, int width, int height, int sizeFlags) { int x1 = x; int y1 = y; @@ -553,17 +553,17 @@ void wxSlider95::SetPageSize(int pageSize) m_pageSize = pageSize; } -int wxSlider95::GetPageSize(void) const +int wxSlider95::GetPageSize() const { return m_pageSize; } -void wxSlider95::ClearSel(void) +void wxSlider95::ClearSel() { ::SendMessage( (HWND) GetHWND(), TBM_CLEARSEL, (WPARAM) TRUE, (LPARAM) 0 ); } -void wxSlider95::ClearTicks(void) +void wxSlider95::ClearTicks() { ::SendMessage( (HWND) GetHWND(), TBM_CLEARTICS, (WPARAM) TRUE, (LPARAM) 0 ); } @@ -574,17 +574,17 @@ void wxSlider95::SetLineSize(int lineSize) ::SendMessage( (HWND) GetHWND(), TBM_SETLINESIZE, (WPARAM) 0, (LPARAM) lineSize ); } -int wxSlider95::GetLineSize(void) const +int wxSlider95::GetLineSize() const { return (int) ::SendMessage( (HWND) GetHWND(), TBM_GETLINESIZE, (WPARAM) 0, (LPARAM) 0 ); } -int wxSlider95::GetSelEnd(void) const +int wxSlider95::GetSelEnd() const { return (int) ::SendMessage( (HWND) GetHWND(), TBM_SETSELEND, (WPARAM) 0, (LPARAM) 0 ); } -int wxSlider95::GetSelStart(void) const +int wxSlider95::GetSelStart() const { return (int) ::SendMessage( (HWND) GetHWND(), TBM_GETSELSTART, (WPARAM) 0, (LPARAM) 0 ); } @@ -599,7 +599,7 @@ void wxSlider95::SetThumbLength(int len) ::SendMessage( (HWND) GetHWND(), TBM_SETTHUMBLENGTH, (WPARAM) len, (LPARAM) 0 ); } -int wxSlider95::GetThumbLength(void) const +int wxSlider95::GetThumbLength() const { return (int) ::SendMessage( (HWND) GetHWND(), TBM_GETTHUMBLENGTH, (WPARAM) 0, (LPARAM) 0 ); } diff --git a/src/msw/slidrmsw.cpp b/src/msw/slidrmsw.cpp index 83d4a14846..26d7488832 100644 --- a/src/msw/slidrmsw.cpp +++ b/src/msw/slidrmsw.cpp @@ -34,7 +34,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxSliderMSW, wxControl) #endif // Slider -wxSliderMSW::wxSliderMSW(void) +wxSliderMSW::wxSliderMSW() { m_staticValue = 0; m_staticMin = 0; @@ -235,7 +235,7 @@ void wxSliderMSW::MSWOnHScroll(WXWORD wParam, WXWORD pos, WXHWND control) MSWOnVScroll(wParam, pos, control); } -wxSliderMSW::~wxSliderMSW(void) +wxSliderMSW::~wxSliderMSW() { if (m_staticMin) DestroyWindow((HWND) m_staticMin); @@ -245,7 +245,7 @@ wxSliderMSW::~wxSliderMSW(void) DestroyWindow((HWND) m_staticValue); } -int wxSliderMSW::GetValue(void) const +int wxSliderMSW::GetValue() const { return ::GetScrollPos((HWND) GetHWND(), SB_CTL); } @@ -314,7 +314,7 @@ void wxSliderMSW::GetPosition(int *x, int *y) const *y = point.y; } -void wxSliderMSW::SetSize(int x, int y, int width, int height, int sizeFlags) +void wxSliderMSW::DoSetSize(int x, int y, int width, int height, int sizeFlags) { int x1 = x; int y1 = y; @@ -501,16 +501,16 @@ void wxSliderMSW::SetPageSize(int pageSize) m_pageSize = pageSize; } -int wxSliderMSW::GetPageSize(void) const +int wxSliderMSW::GetPageSize() const { return m_pageSize; } -void wxSliderMSW::ClearSel(void) +void wxSliderMSW::ClearSel() { } -void wxSliderMSW::ClearTicks(void) +void wxSliderMSW::ClearTicks() { } @@ -519,17 +519,17 @@ void wxSliderMSW::SetLineSize(int lineSize) m_lineSize = lineSize; } -int wxSliderMSW::GetLineSize(void) const +int wxSliderMSW::GetLineSize() const { return m_lineSize; } -int wxSliderMSW::GetSelEnd(void) const +int wxSliderMSW::GetSelEnd() const { return 0; } -int wxSliderMSW::GetSelStart(void) const +int wxSliderMSW::GetSelStart() const { return 0; } @@ -542,7 +542,7 @@ void wxSliderMSW::SetThumbLength(int len) { } -int wxSliderMSW::GetThumbLength(void) const +int wxSliderMSW::GetThumbLength() const { return 0; } diff --git a/src/msw/statbmp.cpp b/src/msw/statbmp.cpp index 89f992643f..980476bfde 100644 --- a/src/msw/statbmp.cpp +++ b/src/msw/statbmp.cpp @@ -90,7 +90,7 @@ bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID id, return TRUE; } -void wxStaticBitmap::SetSize(int x, int y, int width, int height, int sizeFlags) +void wxStaticBitmap::DoSetSize(int x, int y, int width, int height, int sizeFlags) { int currentX, currentY; GetPosition(¤tX, ¤tY); diff --git a/src/msw/statbox.cpp b/src/msw/statbox.cpp index 1121999a22..77e8db8f11 100644 --- a/src/msw/statbox.cpp +++ b/src/msw/statbox.cpp @@ -102,7 +102,7 @@ void wxStaticBox::SetLabel(const wxString& label) SetWindowText((HWND)m_hWnd, (const char *)label); } -void wxStaticBox::SetSize(int x, int y, int width, int height, int sizeFlags) +void wxStaticBox::DoSetSize(int x, int y, int width, int height, int sizeFlags) { int currentX, currentY; GetPosition(¤tX, ¤tY); diff --git a/src/msw/stattext.cpp b/src/msw/stattext.cpp index d5d2268447..c9f7ca1bca 100644 --- a/src/msw/stattext.cpp +++ b/src/msw/stattext.cpp @@ -94,7 +94,7 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID id, return TRUE; } -void wxStaticText::SetSize(int x, int y, int width, int height, int sizeFlags) +void wxStaticText::DoSetSize(int x, int y, int width, int height, int sizeFlags) { int currentX, currentY; GetPosition(¤tX, ¤tY); diff --git a/src/msw/textctrl.cpp b/src/msw/textctrl.cpp index 323bca0c7c..fd62249fe9 100644 --- a/src/msw/textctrl.cpp +++ b/src/msw/textctrl.cpp @@ -311,7 +311,7 @@ void wxTextCtrl::SetValue(const wxString& value) SetWindowText((HWND) GetHWND(), (const char *)value); } -void wxTextCtrl::SetSize(int x, int y, int width, int height, int sizeFlags) +void wxTextCtrl::DoSetSize(int x, int y, int width, int height, int sizeFlags) { int currentX, currentY; GetPosition(¤tX, ¤tY); -- 2.45.2