added status bar fields styles support (patch 988292)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28480 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2004-07-25 16:13:52 +00:00
parent 22dec51f90
commit c2919ab326
14 changed files with 373 additions and 50 deletions

View File

@@ -177,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"));
}
@@ -267,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