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
This commit is contained in:
Vadim Zeitlin 1998-12-13 22:01:50 +00:00
parent de13591805
commit 7b218dfaf4
5 changed files with 43 additions and 59 deletions

View File

@ -231,11 +231,9 @@ class WXDLLEXPORT wxSizer: public wxWindow
bool Create(wxWindow *parent, wxSizerBehaviour behav = wxSizerNone); 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(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; 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; virtual void GetPosition(int *x, int *y) const;
inline void SizerSetSize(int x, int y, int w, int h) inline void SizerSetSize(int x, int y, int w, int h)
@ -277,9 +275,7 @@ class WXDLLEXPORT wxRowColSizer: public wxSizer
~wxRowColSizer(); ~wxRowColSizer();
bool Create(wxWindow *parent, bool rowOrCol = wxSIZER_ROWS, int rowsOrColSize = 20, wxSizerBehaviour = wxSizerShrink); 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); virtual 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); }
inline virtual void SetRowOrCol(bool rc) { rowOrCol = rc; } inline virtual void SetRowOrCol(bool rc) { rowOrCol = rc; }
inline virtual bool GetRowOrCol() { return rowOrCol; } inline virtual bool GetRowOrCol() { return rowOrCol; }

View File

@ -28,7 +28,7 @@ class WXDLLEXPORT wxDialog: public wxPanel
bool m_modalShowing; bool m_modalShowing;
public: public:
wxDialog(void); wxDialog();
// Constructor with a modal flag, but no window id - the old convention // Constructor with a modal flag, but no window id - the old convention
inline wxDialog(wxWindow *parent, inline wxDialog(wxWindow *parent,
@ -59,30 +59,29 @@ public:
long style = wxDEFAULT_DIALOG_STYLE, long style = wxDEFAULT_DIALOG_STYLE,
const wxString& name = wxDialogNameStr); 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; virtual void GetPosition(int *x, int *y) const;
wxPoint GetPosition() const { return wxWindow::GetPosition(); }
bool Show(bool show); bool Show(bool show);
bool IsShown(void) const ; bool IsShown() const ;
void Iconize(bool iconize); void Iconize(bool iconize);
#if WXWIN_COMPATIBILITY #if WXWIN_COMPATIBILITY
inline bool Iconized(void) const { return IsIconized(); }; inline bool Iconized() const { return IsIconized(); };
#endif #endif
virtual bool IsIconized(void) const; virtual bool IsIconized() const;
void Fit(void); void Fit();
void SetTitle(const wxString& title); void SetTitle(const wxString& title);
wxString GetTitle(void) const ; wxString GetTitle() const ;
bool OnClose(void); bool OnClose();
void OnCharHook(wxKeyEvent& event); void OnCharHook(wxKeyEvent& event);
void OnPaint(wxPaintEvent& event); void OnPaint(wxPaintEvent& event);
void OnCloseWindow(wxCloseEvent& event); void OnCloseWindow(wxCloseEvent& event);
@ -90,10 +89,10 @@ public:
void SetModal(bool flag); void SetModal(bool flag);
virtual void Centre(int direction = wxBOTH); 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 // For now, same as Show(TRUE) but returns return code
virtual int ShowModal(void); virtual int ShowModal();
virtual void EndModal(int retCode); virtual void EndModal(int retCode);
// Standard buttons // Standard buttons
@ -109,7 +108,7 @@ public:
virtual long MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); virtual long MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
virtual bool MSWProcessMessage(WXMSG* pMsg); virtual bool MSWProcessMessage(WXMSG* pMsg);
// virtual bool MSWOnEraseBkgnd(WXHDC pDC); // virtual bool MSWOnEraseBkgnd(WXHDC pDC);
virtual bool MSWOnClose(void); virtual bool MSWOnClose();
inline bool IsModalShowing() const { return m_modalShowing ; } inline bool IsModalShowing() const { return m_modalShowing ; }
virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
WXUINT message, WXWPARAM wParam, WXLPARAM lParam); WXUINT message, WXWPARAM wParam, WXLPARAM lParam);

View File

@ -67,16 +67,11 @@ public:
void GetPosition(int *x, int *y) const ; void GetPosition(int *x, int *y) const ;
wxPoint GetPosition() const { return wxWindow::GetPosition(); } wxPoint GetPosition() const { return wxWindow::GetPosition(); }
void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); 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); }
void ClientToScreen(int *x, int *y) const; virtual void ClientToScreen(int *x, int *y) const;
wxPoint ClientToScreen(const wxPoint& pt) const { return wxWindow::ClientToScreen(pt); }
void ScreenToClient(int *x, int *y) const; virtual void ScreenToClient(int *x, int *y) const;
wxPoint ScreenToClient(const wxPoint& pt) const { return wxWindow::ScreenToClient(pt); }
virtual bool OnClose(void); virtual bool OnClose(void);

View File

@ -162,39 +162,50 @@ public:
// Get overall window size // Get overall window size
virtual void GetSize(int *width, int *height) const; virtual void GetSize(int *width, int *height) const;
virtual wxSize GetSize() const { int w, h; GetSize(& w, & h); return wxSize(w, h); } 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) // Get window position, relative to parent (or screen if no parent)
virtual void GetPosition(int *x, int *y) const; 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 // Get client (application-useable) size
virtual void GetClientSize(int *width, int *height) const; 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 // 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 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(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 // Set client size
virtual void SetClientSize(int width, int height); 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 // Convert client to screen coordinates
virtual void ClientToScreen(int *x, int *y) const; 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); } { int x = pt.x; int y = pt.y; ClientToScreen(& x, & y); return wxPoint(x, y); }
// Convert screen to client coordinates // Convert screen to client coordinates
virtual void ScreenToClient(int *x, int *y) const; 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); } { int x = pt.x; int y = pt.y; ScreenToClient(& x, & y); return wxPoint(x, y); }
// Set the focus to this window // Set the focus to this window

View File

@ -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 void wxSizer::GetSize(int *w, int *h) const
{ {
*w = sizerWidth; *w = sizerWidth;