X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/655719367ac5e131d9642e5783f3ecf64d1a3385..7d0cfe71cf84a7af4ea4f415964767dcb7d1dd66:/src/msw/statbr95.cpp?ds=sidebyside diff --git a/src/msw/statbr95.cpp b/src/msw/statbr95.cpp index 3b203df0b0..ae56a7be84 100644 --- a/src/msw/statbr95.cpp +++ b/src/msw/statbr95.cpp @@ -116,6 +116,7 @@ bool wxStatusBar95::Create(wxWindow *parent, SetFieldsCount(1); SubclassWin(m_hWnd); + InheritAttributes(); SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_MENUBAR)); @@ -176,7 +177,30 @@ void wxStatusBar95::SetStatusText(const wxString& strText, int nField) wxCHECK_RET( (nField >= 0) && (nField < m_nFields), _T("invalid statusbar field index") ); - if ( !StatusBar_SetText(GetHwnd(), nField, strText) ) + // Get field style, if any + int style; + if (m_statusStyles) + { + switch(m_statusStyles[nField]) + { + case wxSB_RAISED: + style = SBT_POPOUT; + break; + case wxSB_FLAT: + style = SBT_NOBORDERS; + break; + case wxSB_NORMAL: + default: + style = 0; + break; + } + } + else + style = 0; + + // Pass both field number and style. MSDN library doesn't mention + // that nField and style have to be 'ORed' + if ( !StatusBar_SetText(GetHwnd(), nField | style, strText) ) { wxLogLastError(wxT("StatusBar_SetText")); } @@ -266,5 +290,39 @@ void wxStatusBar95::DoMoveWindow(int x, int y, int width, int height) } } +void wxStatusBar95::SetStatusStyles(int n, const int styles[]) +{ + wxStatusBarBase::SetStatusStyles(n, styles); + + if (n != m_nFields) + return; + + for (int i = 0; i < n; i++) + { + int style; + switch(styles[i]) + { + case wxSB_RAISED: + style = SBT_POPOUT; + break; + case wxSB_FLAT: + style = SBT_NOBORDERS; + break; + case wxSB_NORMAL: + default: + style = 0; + break; + } + // The SB_SETTEXT message is both used to set the field's text as well as + // the fields' styles. MSDN library doesn't mention + // that nField and style have to be 'ORed' + wxString text = GetStatusText(i); + if (!StatusBar_SetText(GetHwnd(), style | i, text)) + { + wxLogLastError(wxT("StatusBar_SetText")); + } + } +} + #endif // __WIN95__ && wxUSE_NATIVE_STATUSBAR