-bool wxStatusBar95::Create(wxWindow *parent, wxWindowID id, long style)
-{
- SetParent(parent);
-
- if (id == -1)
- m_windowId = NewControlId();
- else
- m_windowId = id;
-
- DWORD wstyle = WS_CHILD | WS_VISIBLE;
- if ( style & wxST_SIZEGRIP )
- wstyle |= SBARS_SIZEGRIP;
-
- m_hWnd = (WXHWND)CreateStatusWindow(wstyle,
- wxT(""),
- (HWND)parent->GetHWND(),
- m_windowId);
- if ( m_hWnd == 0 ) {
- wxLogSysError(wxT("can't create status bar window"));
- return FALSE;
- }
-
- // this doesn't work: display problems (white 1-2 pixel borders...)
- // SubclassWin(m_hWnd);
-
- return TRUE;
+ 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;
+
+ // setting SBARS_SIZEGRIP is perfectly useless: it's always on by default
+ // (at least in the version of comctl32.dll I'm using), and the only way to
+ // turn it off is to use CCS_TOP style - as we position the status bar
+ // manually anyhow (see DoMoveWindow), use CCS_TOP style if wxST_SIZEGRIP
+ // is not given
+ if ( !(style & wxST_SIZEGRIP) )
+ {
+ wstyle |= CCS_TOP;
+ }
+ else
+ {
+#ifndef __WXWINCE__
+ // may be some versions of comctl32.dll do need it - anyhow, it won't
+ // do any harm
+ wstyle |= SBARS_SIZEGRIP;
+#endif
+ }
+
+ m_hWnd = (WXHWND)CreateStatusWindow(wstyle,
+ wxEmptyString,
+ GetHwndOf(parent),
+ m_windowId);
+ if ( m_hWnd == 0 )
+ {
+ wxLogSysError(_("Failed to create a status bar."));
+
+ return false;
+ }
+
+ SetFieldsCount(1);
+ SubclassWin(m_hWnd);
+ InheritAttributes();
+
+ SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_MENUBAR));
+
+ // we must refresh the frame size when the statusbar is created, because
+ // its client area might change
+ wxFrame *frame = wxDynamicCast(GetParent(), wxFrame);
+ if ( frame )
+ {
+ frame->SendSizeEvent();
+ }
+
+ return true;