Use flat generic status bar by default and add wxSB_SUNKEN.

GTK+ applications don't use sunken status bars since many years, do don't do
it in wxWidgets neither by default any more. Add wxSB_SUNKEN style that can be
explicitly used if the old appearance is desired.

Closes #15009.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73691 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2013-03-21 22:36:52 +00:00
parent 3c2f3a60d1
commit 98eb2e84e8
7 changed files with 31 additions and 11 deletions

View File

@ -1629,8 +1629,9 @@ child and the second one for right/bottom child window.
by wxStatusBar::SetStatusWidths().}
@row3col{styles, @ref overview_xrcformat_type_string,
Comma-separated list of @em fields flags. Each value specifies status bar
fieldd style and can be one of @c wxSB_NORMAL, @c wxSB_FLAT or
@c wxSB_RAISED. See wxStatusBar::SetStatusStyles() for their description.}
fieldd style and can be one of @c wxSB_NORMAL, @c wxSB_FLAT,
@c wxSB_RAISED or, since wxWidgets 2.9.5, @c wxSB_SUNKEN. See
wxStatusBar::SetStatusStyles() for their description.}
@endTable

View File

@ -45,6 +45,7 @@ extern WXDLLIMPEXP_DATA_CORE(const char) wxStatusBarNameStr[];
#define wxSB_NORMAL 0x0000
#define wxSB_FLAT 0x0001
#define wxSB_RAISED 0x0002
#define wxSB_SUNKEN 0x0003
// ----------------------------------------------------------------------------
// wxStatusBarPane: an helper for wxStatusBar
@ -150,10 +151,7 @@ public:
// field styles
// ------------
// Set the field style. Use either wxSB_NORMAL (default) for a standard 3D
// border around a field, wxSB_FLAT for no border around a field, so that it
// appears flat or wxSB_POPOUT to make the field appear raised.
// Setting field styles only works on wxMSW
// Set the field border style to one of wxSB_XXX values.
virtual void SetStatusStyles(int n, const int styles[]);
int GetStatusStyle(int n) const

View File

@ -20,6 +20,7 @@
#define wxSB_NORMAL 0x0000
#define wxSB_FLAT 0x0001
#define wxSB_RAISED 0x0002
#define wxSB_SUNKEN 0x0003
/**
@ -268,10 +269,12 @@ public:
number passed to SetFieldsCount() the last time it was called.
@param styles
Contains an array of @a n integers with the styles for each field.
There are three possible styles:
- @c wxSB_NORMAL (default): The field appears sunken with a standard 3D border.
There are four possible styles:
- @c wxSB_NORMAL (default): The field appears with the default native border.
- @c wxSB_FLAT: No border is painted around the field so that it appears flat.
- @c wxSB_RAISED: A raised 3D border is painted around the field.
- @c wxSB_SUNKEN: A sunken 3D border is painted around the field
(this style is new since wxWidgets 2.9.5).
*/
virtual void SetStatusStyles(int n, const int* styles);

View File

@ -218,6 +218,7 @@ enum
StatusBar_SetPaneStyleNormal,
StatusBar_SetPaneStyleFlat,
StatusBar_SetPaneStyleRaised,
StatusBar_SetPaneStyleSunken,
StatusBar_SetStyleSizeGrip,
StatusBar_SetStyleEllipsizeStart,
@ -256,6 +257,7 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(StatusBar_SetPaneStyleNormal, MyFrame::OnSetPaneStyle)
EVT_MENU(StatusBar_SetPaneStyleFlat, MyFrame::OnSetPaneStyle)
EVT_MENU(StatusBar_SetPaneStyleRaised, MyFrame::OnSetPaneStyle)
EVT_MENU(StatusBar_SetPaneStyleSunken, MyFrame::OnSetPaneStyle)
EVT_MENU(StatusBar_SetStyleSizeGrip, MyFrame::OnSetStyle)
EVT_MENU(StatusBar_SetStyleEllipsizeStart, MyFrame::OnSetStyle)
@ -267,7 +269,7 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
MyFrame::OnUpdateForDefaultStatusbar)
EVT_UPDATE_UI(StatusBar_Toggle, MyFrame::OnUpdateStatusBarToggle)
EVT_UPDATE_UI_RANGE(StatusBar_SetPaneStyleNormal,
StatusBar_SetPaneStyleRaised,
StatusBar_SetPaneStyleSunken,
MyFrame::OnUpdateSetPaneStyle)
EVT_UPDATE_UI_RANGE(StatusBar_SetStyleSizeGrip, StatusBar_SetStyleShowTips,
MyFrame::OnUpdateSetStyle)
@ -396,6 +398,12 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
wxT("&Raised"),
wxT("Sets the style of the first field to raised look")
);
statbarPaneStyleMenu->AppendCheckItem
(
StatusBar_SetPaneStyleSunken,
wxT("&Sunken"),
wxT("Sets the style of the first field to sunken look")
);
statbarMenu->Append(StatusBar_SetPaneStyle, wxT("Field style"),
statbarPaneStyleMenu);
@ -722,6 +730,9 @@ void MyFrame::OnUpdateSetPaneStyle(wxUpdateUIEvent& event)
case StatusBar_SetPaneStyleRaised:
event.Check(m_statbarPaneStyle == wxSB_RAISED);
break;
case StatusBar_SetPaneStyleSunken:
event.Check(m_statbarPaneStyle == wxSB_SUNKEN);
break;
}
}
@ -738,6 +749,9 @@ void MyFrame::OnSetPaneStyle(wxCommandEvent& event)
case StatusBar_SetPaneStyleRaised:
m_statbarPaneStyle = wxSB_RAISED;
break;
case StatusBar_SetPaneStyleSunken:
m_statbarPaneStyle = wxSB_SUNKEN;
break;
}
ApplyPaneStyle();

View File

@ -291,10 +291,10 @@ void wxStatusBarGeneric::DrawField(wxDC& dc, int i, int textHeight)
return; // happens when the status bar is shrunk in a very small area!
int style = m_panes[i].GetStyle();
if (style != wxSB_FLAT)
if (style == wxSB_RAISED || style == wxSB_SUNKEN)
{
// Draw border
// For wxSB_NORMAL: paint a grey background, plus 3-d border (one black rectangle)
// For wxSB_SUNKEN: paint a grey background, plus 3-d border (one black rectangle)
// Inside this, left and top sides (dark grey). Bottom and right (white).
// Reverse it for wxSB_RAISED

View File

@ -275,6 +275,7 @@ void wxStatusBar::DoUpdateStatusText(int nField)
style = SBT_NOBORDERS;
break;
case wxSB_SUNKEN:
case wxSB_NORMAL:
default:
style = 0;
@ -553,6 +554,7 @@ void wxStatusBar::SetStatusStyles(int n, const int styles[])
case wxSB_FLAT:
style = SBT_NOBORDERS;
break;
case wxSB_SUNKEN:
case wxSB_NORMAL:
default:
style = 0;

View File

@ -87,6 +87,8 @@ wxObject *wxStatusBarXmlHandler::DoCreateResource()
style[i] = wxSB_FLAT;
else if (first == wxT("wxSB_RAISED"))
style[i] = wxSB_RAISED;
else if (first == wxT("wxSB_SUNKEN"))
style[i] = wxSB_SUNKEN;
else if (!first.empty())
{
ReportParamError