From 7b218dfaf47dc47705f6d6cba9408fa9f9cca70e Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 13 Dec 1998 22:01:50 +0000 Subject: [PATCH] only one of SetSize()s, SetClientSize()s, GetPosition()s &c is virtual now git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1191 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/layout.h | 10 +++------- include/wx/msw/dialog.h | 29 ++++++++++++++--------------- include/wx/msw/frame.h | 11 +++-------- include/wx/msw/window.h | 35 +++++++++++++++++++++++------------ src/common/layout.cpp | 17 ----------------- 5 files changed, 43 insertions(+), 59 deletions(-) diff --git a/include/wx/layout.h b/include/wx/layout.h index 83b610a2ea..04ae4f1401 100644 --- a/include/wx/layout.h +++ b/include/wx/layout.h @@ -231,11 +231,9 @@ class WXDLLEXPORT wxSizer: public wxWindow bool Create(wxWindow *parent, wxSizerBehaviour behav = wxSizerNone); virtual void SetSize(int x, int y, int w, int h, int flags = wxSIZE_AUTO); - // Avoid compiler warning - void SetSize(int w, int h) { wxWindow::SetSize(w, h); } - virtual void Move(int x, int y); virtual void GetSize(int *w, int *h) const; - inline virtual void GetClientSize(int *w, int *h) const { GetSize(w, h); } + + virtual void GetClientSize(int *w, int *h) const { GetSize(w, h); } virtual void GetPosition(int *x, int *y) const; inline void SizerSetSize(int x, int y, int w, int h) @@ -277,9 +275,7 @@ class WXDLLEXPORT wxRowColSizer: public wxSizer ~wxRowColSizer(); bool Create(wxWindow *parent, bool rowOrCol = wxSIZER_ROWS, int rowsOrColSize = 20, wxSizerBehaviour = wxSizerShrink); - void SetSize(int x, int y, int w, int h, int flags = wxSIZE_AUTO); - // Avoid compiler warning - void SetSize(int w, int h) { wxSizer::SetSize(w, h); } + virtual void SetSize(int x, int y, int w, int h, int flags = wxSIZE_AUTO); inline virtual void SetRowOrCol(bool rc) { rowOrCol = rc; } inline virtual bool GetRowOrCol() { return rowOrCol; } diff --git a/include/wx/msw/dialog.h b/include/wx/msw/dialog.h index f883cd4ea8..8ec1b50995 100644 --- a/include/wx/msw/dialog.h +++ b/include/wx/msw/dialog.h @@ -28,7 +28,7 @@ class WXDLLEXPORT wxDialog: public wxPanel bool m_modalShowing; public: - wxDialog(void); + wxDialog(); // Constructor with a modal flag, but no window id - the old convention inline wxDialog(wxWindow *parent, @@ -59,30 +59,29 @@ public: long style = wxDEFAULT_DIALOG_STYLE, const wxString& name = wxDialogNameStr); - ~wxDialog(void); + ~wxDialog(); - virtual bool Destroy(void); + virtual bool Destroy(); - void SetClientSize(int width, int height); + virtual void SetClientSize(int width, int height); - void GetPosition(int *x, int *y) const; - wxPoint GetPosition() const { return wxWindow::GetPosition(); } + virtual void GetPosition(int *x, int *y) const; bool Show(bool show); - bool IsShown(void) const ; + bool IsShown() const ; void Iconize(bool iconize); #if WXWIN_COMPATIBILITY - inline bool Iconized(void) const { return IsIconized(); }; + inline bool Iconized() const { return IsIconized(); }; #endif - virtual bool IsIconized(void) const; - void Fit(void); + virtual bool IsIconized() const; + void Fit(); void SetTitle(const wxString& title); - wxString GetTitle(void) const ; + wxString GetTitle() const ; - bool OnClose(void); + bool OnClose(); void OnCharHook(wxKeyEvent& event); void OnPaint(wxPaintEvent& event); void OnCloseWindow(wxCloseEvent& event); @@ -90,10 +89,10 @@ public: void SetModal(bool flag); virtual void Centre(int direction = wxBOTH); - virtual bool IsModal(void) const { return ((GetWindowStyleFlag() & wxDIALOG_MODAL) == wxDIALOG_MODAL); } + virtual bool IsModal() const { return ((GetWindowStyleFlag() & wxDIALOG_MODAL) == wxDIALOG_MODAL); } // For now, same as Show(TRUE) but returns return code - virtual int ShowModal(void); + virtual int ShowModal(); virtual void EndModal(int retCode); // Standard buttons @@ -109,7 +108,7 @@ public: virtual long MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); virtual bool MSWProcessMessage(WXMSG* pMsg); // virtual bool MSWOnEraseBkgnd(WXHDC pDC); - virtual bool MSWOnClose(void); + virtual bool MSWOnClose(); inline bool IsModalShowing() const { return m_modalShowing ; } virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, WXUINT message, WXWPARAM wParam, WXLPARAM lParam); diff --git a/include/wx/msw/frame.h b/include/wx/msw/frame.h index 28f1464835..b9bfa8580b 100644 --- a/include/wx/msw/frame.h +++ b/include/wx/msw/frame.h @@ -67,16 +67,11 @@ public: 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); - 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 x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); - void ClientToScreen(int *x, int *y) const; - wxPoint ClientToScreen(const wxPoint& pt) const { return wxWindow::ClientToScreen(pt); } + virtual void ClientToScreen(int *x, int *y) const; - void ScreenToClient(int *x, int *y) const; - wxPoint ScreenToClient(const wxPoint& pt) const { return wxWindow::ScreenToClient(pt); } + virtual void ScreenToClient(int *x, int *y) const; virtual bool OnClose(void); diff --git a/include/wx/msw/window.h b/include/wx/msw/window.h index c0b172bb2f..cef7278a85 100644 --- a/include/wx/msw/window.h +++ b/include/wx/msw/window.h @@ -162,39 +162,50 @@ public: // 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); } + 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; - virtual wxPoint GetPosition() const { int x, y; GetPosition(&x, &y); return wxPoint(x, y); } + 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; - virtual wxSize GetClientSize() const { int w, h; GetClientSize(& w, & h); return wxSize(w, h); } + 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); - 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); } + 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); } - virtual void Move(const wxPoint& pt) { SetSize(pt.x, pt.y, -1, -1, wxSIZE_USE_EXISTING); } + void Move(const wxPoint& pt) { SetSize(pt.x, pt.y, -1, -1, wxSIZE_USE_EXISTING); } // Set client size virtual void SetClientSize(int width, int height); - virtual void SetClientSize(const wxSize& sz) { SetClientSize(sz.x, sz.y); } + 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 + 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 + 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 diff --git a/src/common/layout.cpp b/src/common/layout.cpp index 38750acead..517d626892 100644 --- a/src/common/layout.cpp +++ b/src/common/layout.cpp @@ -1304,23 +1304,6 @@ void wxSizer::SetSize(int x, int y, int w, int h, int WXUNUSED(flags)) } } -void wxSizer::Move(int x, int y) -{ - wxLayoutConstraints *constr = GetConstraints(); - if (x != -1) - { - sizerX = x; - if (constr) - constr->left.SetValue(x); - } - if (y != -1) - { - sizerY = y; - if (constr) - constr->top.SetValue(y); - } -} - void wxSizer::GetSize(int *w, int *h) const { *w = sizerWidth;