Use wxControl-provided CreateControl() and MSWCreateControl() methods to
create the status bar instead of duplicating their code in its Create().
Also translate wx styles to MSW ones in overridden MSWGetStyle() now.
In addition to making the code smaller and more clear, this fixes the
non-respect of the styles specified at status bar creation (e.g. border),
see #12655.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66227
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
virtual void DoUpdateStatusText(int number);
// override some base class virtuals
virtual void DoUpdateStatusText(int number);
// override some base class virtuals
+ virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const;
virtual wxSize DoGetBestSize() const;
virtual void DoMoveWindow(int x, int y, int width, int height);
#if wxUSE_TOOLTIPS
virtual wxSize DoGetBestSize() const;
virtual void DoMoveWindow(int x, int y, int width, int height);
#if wxUSE_TOOLTIPS
-bool wxStatusBar::Create(wxWindow *parent,
- wxWindowID id,
- long style,
- const wxString& name)
+WXDWORD wxStatusBar::MSWGetStyle(long style, WXDWORD *exstyle) const
- wxCHECK_MSG( parent, false, "status bar must have a parent" );
-
- SetName(name);
- SetWindowStyleFlag(style);
- SetParent(parent);
-
- parent->AddChild(this);
-
- m_windowId = id == wxID_ANY ? NewControlId() : id;
-
- DWORD wstyle = WS_CHILD | WS_VISIBLE;
-
- if ( style & wxCLIP_SIBLINGS )
- wstyle |= WS_CLIPSIBLINGS;
+ WXDWORD msStyle = wxStatusBarBase::MSWGetStyle(style, exstyle);
// wxSTB_SIZEGRIP is part of our default style but it doesn't make sense to
// show size grip if this is the status bar of a non-resizeable TLW so turn
// it off in such case
// wxSTB_SIZEGRIP is part of our default style but it doesn't make sense to
// show size grip if this is the status bar of a non-resizeable TLW so turn
// it off in such case
+ wxWindow * const parent = GetParent();
+ wxCHECK_MSG( parent, msStyle, wxS("Status bar must have a parent") );
if ( parent->IsTopLevel() && !parent->HasFlag(wxRESIZE_BORDER) )
style &= ~wxSTB_SIZEGRIP;
if ( parent->IsTopLevel() && !parent->HasFlag(wxRESIZE_BORDER) )
style &= ~wxSTB_SIZEGRIP;
// is not given
if ( !(style & wxSTB_SIZEGRIP) )
{
// is not given
if ( !(style & wxSTB_SIZEGRIP) )
{
}
else
{
#ifndef __WXWINCE__
// may be some versions of comctl32.dll do need it - anyhow, it won't
// do any harm
}
else
{
#ifndef __WXWINCE__
// may be some versions of comctl32.dll do need it - anyhow, it won't
// do any harm
- wstyle |= SBARS_SIZEGRIP;
+ *exstyle |= SBARS_SIZEGRIP;
- m_hWnd = CreateWindow
- (
- STATUSCLASSNAME,
- wxT(""),
- wstyle,
- 0, 0, 0, 0,
- GetHwndOf(parent),
- (HMENU)wxUIntToPtr(m_windowId.GetValue()),
- wxGetInstance(),
- NULL
- );
- if ( m_hWnd == 0 )
- {
- wxLogSysError(_("Failed to create a status bar."));
+ return msStyle;
+}
+
+bool wxStatusBar::Create(wxWindow *parent,
+ wxWindowID id,
+ long style,
+ const wxString& name)
+{
+ if ( !CreateControl(parent, id, wxDefaultPosition, wxDefaultSize,
+ style, wxDefaultValidator, name) )
+ return false;
+ if ( !MSWCreateControl(STATUSCLASSNAME, wxString(),
+ wxDefaultPosition, wxDefaultSize) )
// cache the DC instance used by DoUpdateStatusText:
// cache the DC instance used by DoUpdateStatusText:
- // NOTE: create the DC before calling InheritAttributes() since
- // it may result in a call to our SetFont()
m_pDC = new wxClientDC(this);
m_pDC = new wxClientDC(this);
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_MENUBAR));
// we must refresh the frame size when the statusbar is created, because
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_MENUBAR));
// we must refresh the frame size when the statusbar is created, because