From 98eb2e84e883b50168b678693704613fe29d89d9 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 21 Mar 2013 22:36:52 +0000 Subject: [PATCH] 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 --- docs/doxygen/overviews/xrc_format.h | 5 +++-- include/wx/statusbr.h | 6 ++---- interface/wx/statusbr.h | 7 +++++-- samples/statbar/statbar.cpp | 16 +++++++++++++++- src/generic/statusbr.cpp | 4 ++-- src/msw/statusbar.cpp | 2 ++ src/xrc/xh_statbar.cpp | 2 ++ 7 files changed, 31 insertions(+), 11 deletions(-) diff --git a/docs/doxygen/overviews/xrc_format.h b/docs/doxygen/overviews/xrc_format.h index 4246a0a..80f0388 100644 --- a/docs/doxygen/overviews/xrc_format.h +++ b/docs/doxygen/overviews/xrc_format.h @@ -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 diff --git a/include/wx/statusbr.h b/include/wx/statusbr.h index 3567ba3..52e134f 100644 --- a/include/wx/statusbr.h +++ b/include/wx/statusbr.h @@ -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 diff --git a/interface/wx/statusbr.h b/interface/wx/statusbr.h index c1eaee3..8070fe0 100644 --- a/interface/wx/statusbr.h +++ b/interface/wx/statusbr.h @@ -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); diff --git a/samples/statbar/statbar.cpp b/samples/statbar/statbar.cpp index 7ea8202..d81ddd4 100644 --- a/samples/statbar/statbar.cpp +++ b/samples/statbar/statbar.cpp @@ -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(); diff --git a/src/generic/statusbr.cpp b/src/generic/statusbr.cpp index 819ccf3..075c96b 100644 --- a/src/generic/statusbr.cpp +++ b/src/generic/statusbr.cpp @@ -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 diff --git a/src/msw/statusbar.cpp b/src/msw/statusbar.cpp index 321df1b..c2767b3 100644 --- a/src/msw/statusbar.cpp +++ b/src/msw/statusbar.cpp @@ -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; diff --git a/src/xrc/xh_statbar.cpp b/src/xrc/xh_statbar.cpp index fbf25f1..c531ee0 100644 --- a/src/xrc/xh_statbar.cpp +++ b/src/xrc/xh_statbar.cpp @@ -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 -- 2.7.4