Merge branch 'toolbar-sample-fixes'
Miscellaneous fixes to the toolbar sample. Closes https://github.com/wxWidgets/wxWidgets/pull/84
This commit is contained in:
@@ -481,6 +481,8 @@ void MyFrame::PopulateToolbar(wxToolBarBase* toolBar)
|
|||||||
wxT("Delete this tool. This is a very long tooltip to test whether it does the right thing when the tooltip is more than Windows can cope with."));
|
wxT("Delete this tool. This is a very long tooltip to test whether it does the right thing when the tooltip is more than Windows can cope with."));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_nPrint = 1;
|
||||||
|
|
||||||
// add a stretchable space before the "Help" button to make it
|
// add a stretchable space before the "Help" button to make it
|
||||||
// right-aligned
|
// right-aligned
|
||||||
toolBar->AddStretchableSpace();
|
toolBar->AddStretchableSpace();
|
||||||
@@ -530,7 +532,7 @@ MyFrame::MyFrame(wxFrame* parent,
|
|||||||
m_searchTool = NULL;
|
m_searchTool = NULL;
|
||||||
|
|
||||||
m_rows = 1;
|
m_rows = 1;
|
||||||
m_nPrint = 1;
|
m_nPrint = 0; // set to 1 in PopulateToolbar()
|
||||||
|
|
||||||
#if wxUSE_STATUSBAR
|
#if wxUSE_STATUSBAR
|
||||||
// Give it a status line
|
// Give it a status line
|
||||||
@@ -638,7 +640,8 @@ MyFrame::MyFrame(wxFrame* parent,
|
|||||||
PopulateToolbar(m_extraToolBar);
|
PopulateToolbar(m_extraToolBar);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_textWindow = new wxTextCtrl(m_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE);
|
// Use a read-only text control; Cut tool will not cut selected text anyway.
|
||||||
|
m_textWindow = new wxTextCtrl(m_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY);
|
||||||
|
|
||||||
wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);
|
wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
m_panel->SetSizer(sizer);
|
m_panel->SetSizer(sizer);
|
||||||
@@ -810,9 +813,9 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
|||||||
void MyFrame::OnAbout(wxCommandEvent& event)
|
void MyFrame::OnAbout(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
if ( event.IsChecked() )
|
if ( event.IsChecked() )
|
||||||
m_textWindow->WriteText( wxT("Help button down now.\n") );
|
m_textWindow->AppendText( wxT("Help button down now.\n") );
|
||||||
else
|
else
|
||||||
m_textWindow->WriteText( wxT("Help button up now.\n") );
|
m_textWindow->AppendText( wxT("Help button up now.\n") );
|
||||||
|
|
||||||
(void)wxMessageBox(wxT("wxWidgets toolbar sample"), wxT("About wxToolBar"));
|
(void)wxMessageBox(wxT("wxWidgets toolbar sample"), wxT("About wxToolBar"));
|
||||||
}
|
}
|
||||||
@@ -821,7 +824,7 @@ void MyFrame::OnToolLeftClick(wxCommandEvent& event)
|
|||||||
{
|
{
|
||||||
wxString str;
|
wxString str;
|
||||||
str.Printf( wxT("Clicked on tool %d\n"), event.GetId());
|
str.Printf( wxT("Clicked on tool %d\n"), event.GetId());
|
||||||
m_textWindow->WriteText( str );
|
m_textWindow->AppendText( str );
|
||||||
|
|
||||||
if (event.GetId() == wxID_COPY)
|
if (event.GetId() == wxID_COPY)
|
||||||
{
|
{
|
||||||
@@ -858,6 +861,7 @@ void MyFrame::DoEnablePrint()
|
|||||||
|
|
||||||
wxToolBarBase *tb = GetToolBar();
|
wxToolBarBase *tb = GetToolBar();
|
||||||
tb->EnableTool(wxID_PRINT, !tb->GetToolEnabled(wxID_PRINT));
|
tb->EnableTool(wxID_PRINT, !tb->GetToolEnabled(wxID_PRINT));
|
||||||
|
m_textWindow->AppendText("Print tool state changed.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::DoDeletePrint()
|
void MyFrame::DoDeletePrint()
|
||||||
@@ -867,6 +871,7 @@ void MyFrame::DoDeletePrint()
|
|||||||
|
|
||||||
wxToolBarBase *tb = GetToolBar();
|
wxToolBarBase *tb = GetToolBar();
|
||||||
tb->DeleteTool( wxID_PRINT );
|
tb->DeleteTool( wxID_PRINT );
|
||||||
|
m_textWindow->AppendText("Print tool was deleted.\n");
|
||||||
|
|
||||||
m_nPrint--;
|
m_nPrint--;
|
||||||
}
|
}
|
||||||
@@ -875,6 +880,7 @@ void MyFrame::DoToggleHelp()
|
|||||||
{
|
{
|
||||||
wxToolBarBase *tb = GetToolBar();
|
wxToolBarBase *tb = GetToolBar();
|
||||||
tb->ToggleTool( wxID_HELP, !tb->GetToolState( wxID_HELP ) );
|
tb->ToggleTool( wxID_HELP, !tb->GetToolState( wxID_HELP ) );
|
||||||
|
m_textWindow->AppendText("Help tool was toggled.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnToggleSearch(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnToggleSearch(wxCommandEvent& WXUNUSED(event))
|
||||||
@@ -995,7 +1001,7 @@ void MyFrame::OnToolDropdown(wxCommandEvent& event)
|
|||||||
{
|
{
|
||||||
wxString str;
|
wxString str;
|
||||||
str.Printf( wxT("Dropdown on tool %d\n"), event.GetId());
|
str.Printf( wxT("Dropdown on tool %d\n"), event.GetId());
|
||||||
m_textWindow->WriteText( str );
|
m_textWindow->AppendText( str );
|
||||||
|
|
||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user