new default theme for wxAuiNotebook
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43146 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -94,6 +94,9 @@ class MyFrame : public wxFrame
|
||||
ID_NotebookAllowTabSplit,
|
||||
ID_NotebookWindowList,
|
||||
ID_NotebookScrollButtons,
|
||||
ID_NotebookTabFixedWidth,
|
||||
ID_NotebookArtGloss,
|
||||
ID_NotebookArtSimple,
|
||||
ID_FirstPerspective = ID_CreatePerspective+1000
|
||||
};
|
||||
|
||||
@@ -155,6 +158,7 @@ private:
|
||||
wxArrayString m_perspectives;
|
||||
wxMenu* m_perspectives_menu;
|
||||
long m_notebook_style;
|
||||
long m_notebook_theme;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
@@ -575,6 +579,7 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||
EVT_MENU(ID_NoVenetianFade, MyFrame::OnManagerFlag)
|
||||
EVT_MENU(ID_TransparentDrag, MyFrame::OnManagerFlag)
|
||||
EVT_MENU(ID_AllowActivePane, MyFrame::OnManagerFlag)
|
||||
EVT_MENU(ID_NotebookTabFixedWidth, MyFrame::OnNotebookFlag)
|
||||
EVT_MENU(ID_NotebookNoCloseButton, MyFrame::OnNotebookFlag)
|
||||
EVT_MENU(ID_NotebookCloseButton, MyFrame::OnNotebookFlag)
|
||||
EVT_MENU(ID_NotebookCloseButtonAll, MyFrame::OnNotebookFlag)
|
||||
@@ -584,6 +589,8 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||
EVT_MENU(ID_NotebookAllowTabSplit, MyFrame::OnNotebookFlag)
|
||||
EVT_MENU(ID_NotebookScrollButtons, MyFrame::OnNotebookFlag)
|
||||
EVT_MENU(ID_NotebookWindowList, MyFrame::OnNotebookFlag)
|
||||
EVT_MENU(ID_NotebookArtGloss, MyFrame::OnNotebookFlag)
|
||||
EVT_MENU(ID_NotebookArtSimple, MyFrame::OnNotebookFlag)
|
||||
EVT_MENU(ID_NoGradient, MyFrame::OnGradient)
|
||||
EVT_MENU(ID_VerticalGradient, MyFrame::OnGradient)
|
||||
EVT_MENU(ID_HorizontalGradient, MyFrame::OnGradient)
|
||||
@@ -596,6 +603,7 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||
EVT_MENU(ID_NotebookContent, MyFrame::OnChangeContentPane)
|
||||
EVT_MENU(wxID_EXIT, MyFrame::OnExit)
|
||||
EVT_MENU(wxID_ABOUT, MyFrame::OnAbout)
|
||||
EVT_UPDATE_UI(ID_NotebookTabFixedWidth, MyFrame::OnUpdateUI)
|
||||
EVT_UPDATE_UI(ID_NotebookNoCloseButton, MyFrame::OnUpdateUI)
|
||||
EVT_UPDATE_UI(ID_NotebookCloseButton, MyFrame::OnUpdateUI)
|
||||
EVT_UPDATE_UI(ID_NotebookCloseButtonAll, MyFrame::OnUpdateUI)
|
||||
@@ -640,7 +648,8 @@ MyFrame::MyFrame(wxWindow* parent,
|
||||
|
||||
// set up default notebook style
|
||||
m_notebook_style = wxAUI_NB_DEFAULT_STYLE | wxAUI_NB_TAB_EXTERNAL_MOVE | wxNO_BORDER;
|
||||
|
||||
m_notebook_theme = 0;
|
||||
|
||||
// create menu
|
||||
wxMenuBar* mb = new wxMenuBar;
|
||||
|
||||
@@ -681,6 +690,9 @@ MyFrame::MyFrame(wxWindow* parent,
|
||||
options_menu->Append(ID_Settings, _("Settings Pane"));
|
||||
|
||||
wxMenu* notebook_menu = new wxMenu;
|
||||
notebook_menu->AppendRadioItem(ID_NotebookArtGloss, _("Glossy Theme (Default)"));
|
||||
notebook_menu->AppendRadioItem(ID_NotebookArtSimple, _("Simple Theme"));
|
||||
notebook_menu->AppendSeparator();
|
||||
notebook_menu->AppendRadioItem(ID_NotebookNoCloseButton, _("No Close Button"));
|
||||
notebook_menu->AppendRadioItem(ID_NotebookCloseButton, _("Close Button at Right"));
|
||||
notebook_menu->AppendRadioItem(ID_NotebookCloseButtonAll, _("Close Button on All Tabs"));
|
||||
@@ -691,6 +703,7 @@ MyFrame::MyFrame(wxWindow* parent,
|
||||
notebook_menu->AppendCheckItem(ID_NotebookAllowTabSplit, _("Allow Notebook Split"));
|
||||
notebook_menu->AppendCheckItem(ID_NotebookScrollButtons, _("Scroll Buttons Visible"));
|
||||
notebook_menu->AppendCheckItem(ID_NotebookWindowList, _("Window List Button Visible"));
|
||||
notebook_menu->AppendCheckItem(ID_NotebookTabFixedWidth, _("Fixed-width Tabs"));
|
||||
|
||||
m_perspectives_menu = new wxMenu;
|
||||
m_perspectives_menu->Append(ID_CreatePerspective, _("Create Perspective"));
|
||||
@@ -1069,19 +1082,35 @@ void MyFrame::OnNotebookFlag(wxCommandEvent& event)
|
||||
{
|
||||
m_notebook_style ^= wxAUI_NB_SCROLL_BUTTONS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
else if (id == ID_NotebookTabFixedWidth)
|
||||
{
|
||||
m_notebook_style ^= wxAUI_NB_TAB_FIXED_WIDTH;
|
||||
}
|
||||
|
||||
|
||||
size_t i, count;
|
||||
wxAuiPaneInfoArray& all_panes = m_mgr.GetAllPanes();
|
||||
for (i = 0, count = all_panes.GetCount(); i < count; ++i)
|
||||
{
|
||||
wxAuiPaneInfo& pane = all_panes.Item(i);
|
||||
|
||||
if (pane.window->IsKindOf(CLASSINFO(wxAuiNotebook)))
|
||||
{
|
||||
pane.window->SetWindowStyleFlag(m_notebook_style);
|
||||
pane.window->Refresh();
|
||||
wxAuiNotebook* nb = (wxAuiNotebook*)pane.window;
|
||||
|
||||
if (id == ID_NotebookArtGloss)
|
||||
{
|
||||
nb->SetArtProvider(new wxAuiDefaultTabArt);
|
||||
m_notebook_theme = 0;
|
||||
}
|
||||
else if (id == ID_NotebookArtSimple)
|
||||
{
|
||||
nb->SetArtProvider(new wxAuiSimpleTabArt);
|
||||
m_notebook_theme = 1;
|
||||
}
|
||||
|
||||
|
||||
nb->SetWindowStyleFlag(m_notebook_style);
|
||||
nb->Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1158,6 +1187,16 @@ void MyFrame::OnUpdateUI(wxUpdateUIEvent& event)
|
||||
case ID_NotebookWindowList:
|
||||
event.Check((m_notebook_style & wxAUI_NB_WINDOWLIST_BUTTON) != 0);
|
||||
break;
|
||||
case ID_NotebookTabFixedWidth:
|
||||
event.Check((m_notebook_style & wxAUI_NB_TAB_FIXED_WIDTH) != 0);
|
||||
break;
|
||||
case ID_NotebookArtGloss:
|
||||
event.Check(m_notebook_style == 0);
|
||||
break;
|
||||
case ID_NotebookArtSimple:
|
||||
event.Check(m_notebook_style == 1);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1409,7 +1448,7 @@ wxAuiNotebook* MyFrame::CreateNotebook()
|
||||
wxSize(430,200),
|
||||
m_notebook_style);
|
||||
|
||||
ctrl->AddPage(CreateHTMLCtrl(ctrl), wxT("Welcome"));
|
||||
ctrl->AddPage(CreateHTMLCtrl(ctrl), wxT("Welcome to wxAUI"));
|
||||
|
||||
wxPanel *panel = new wxPanel( ctrl, wxID_ANY );
|
||||
wxFlexGridSizer *flex = new wxFlexGridSizer( 2 );
|
||||
@@ -1446,7 +1485,7 @@ wxAuiNotebook* MyFrame::CreateNotebook()
|
||||
wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , wxT("wxTextCtrl 6") );
|
||||
|
||||
ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, wxT("Some more text"),
|
||||
wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , wxT("wxTextCtrl 7") );
|
||||
wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , wxT("wxTextCtrl 7 (longer title)") );
|
||||
|
||||
ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, wxT("Some more text"),
|
||||
wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , wxT("wxTextCtrl 8") );
|
||||
|
Reference in New Issue
Block a user