Update the field widths on demand in wxStatusBarGeneric.

This ensures that the value returned from GetFieldRect() is always up to date,
even when this method is called from the user-defined wxEVT_SIZE handler, i.e.
before our own OnSize() could run.

Also remove the now unneeded hack with calling the base class OnSize() from
the statbar sample.

Closes #14268.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71365 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2012-05-05 11:22:09 +00:00
parent 71940de693
commit 8e8d910979
3 changed files with 30 additions and 22 deletions

View File

@@ -91,8 +91,9 @@ protected:
// common part of all ctors
void Init();
// the last known height of the client rect
int m_lastClientHeight;
// the last known size, fields widths must be updated whenever it's out of
// date
wxSize m_lastClientSize;
// the absolute widths of the status bar panes in pixels
wxArrayInt m_widthsAbs;
@@ -106,6 +107,9 @@ protected:
virtual wxSize DoGetBestSize() const;
private:
// Update m_lastClientSize and m_widthsAbs from the current size.
void DoUpdateFieldWidths();
DECLARE_EVENT_TABLE()
DECLARE_DYNAMIC_CLASS_NO_COPY(wxStatusBarGeneric)
};