Override wxWindow::MSWGetCreateWindowCoords() in wxTopLevelWindow.

The old code was messy because it handled both top level and child windows at
wxWindow level when they need quite different treatment. This resulted in
several errors: first, wxWindow versions of WidthDefault and HeightDefault
were used to determine the initial size even of top level windows which was
clearly wrong as it created tiny windows (20*20). Second, CW_USEDEFAULT could
be used for child window for which this shouldn't be done.

Fix this by making MSWGetCreateWindowCoords() virtual and overriding it in
wxTopLevelWindow. This makes the code much simpler and more obviously correct.

Also make MSWGetCreateWindowCoords() void, as nobody was using its return
value anyhow (and the old version also had a bug in it and wrongly returned
true when default size was passed to it).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64101 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2010-04-22 11:21:21 +00:00
parent db890987c6
commit fa5f485828
4 changed files with 90 additions and 74 deletions

View File

@@ -234,15 +234,6 @@ public:
// created yet)
void MSWUpdateStyle(long flagsOld, long exflagsOld);
// translate wxWidgets coords into Windows ones suitable to be passed to
// ::CreateWindow()
//
// returns true if non default coords are returned, false otherwise
bool MSWGetCreateWindowCoords(const wxPoint& pos,
const wxSize& size,
int& x, int& y,
int& w, int& h) const;
// get the HWND to be used as parent of this window with CreateWindow()
virtual WXHWND MSWGetParent() const;
@@ -592,6 +583,13 @@ protected:
// for state as the system will decide for us what needs to be set
void MSWUpdateUIState(int action, int state = 0);
// translate wxWidgets coords into Windows ones suitable to be passed to
// ::CreateWindow(), called from MSWCreate()
virtual void MSWGetCreateWindowCoords(const wxPoint& pos,
const wxSize& size,
int& x, int& y,
int& w, int& h) const;
private:
// common part of all ctors
void Init();