projects
/
wxWidgets.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
compilation fix after last commit (missing semicolon added)
[wxWidgets.git]
/
samples
/
toolbar
/
toolbar.cpp
diff --git
a/samples/toolbar/toolbar.cpp
b/samples/toolbar/toolbar.cpp
index d32714c31b070b1f9c67692b5a0d3e85aa7b0bda..747a49f1424f9ac70e3c11e81104325c00c18ee1 100644
(file)
--- a/
samples/toolbar/toolbar.cpp
+++ b/
samples/toolbar/toolbar.cpp
@@
-88,7
+88,7
@@
class MyFrame: public wxFrame
{
public:
MyFrame(wxFrame *parent,
{
public:
MyFrame(wxFrame *parent,
- wxWindowID id =
-1
,
+ wxWindowID id =
wxID_ANY
,
const wxString& title = _T("wxToolBar Sample"),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
const wxString& title = _T("wxToolBar Sample"),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
@@
-119,6
+119,7
@@
public:
void OnToolbarStyle(wxCommandEvent& event);
void OnToolLeftClick(wxCommandEvent& event);
void OnToolbarStyle(wxCommandEvent& event);
void OnToolLeftClick(wxCommandEvent& event);
+ void OnToolRightClick(wxCommandEvent& event);
void OnToolEnter(wxCommandEvent& event);
void OnCombo(wxCommandEvent& event);
void OnToolEnter(wxCommandEvent& event);
void OnCombo(wxCommandEvent& event);
@@
-223,11
+224,12
@@
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU_RANGE(IDM_TOOLBAR_SHOW_TEXT, IDM_TOOLBAR_SHOW_BOTH,
MyFrame::OnToolbarStyle)
EVT_MENU_RANGE(IDM_TOOLBAR_SHOW_TEXT, IDM_TOOLBAR_SHOW_BOTH,
MyFrame::OnToolbarStyle)
- EVT_MENU(
-1
, MyFrame::OnToolLeftClick)
+ EVT_MENU(
wxID_ANY
, MyFrame::OnToolLeftClick)
EVT_COMBOBOX(ID_COMBO, MyFrame::OnCombo)
EVT_TOOL_ENTER(ID_TOOLBAR, MyFrame::OnToolEnter)
EVT_COMBOBOX(ID_COMBO, MyFrame::OnCombo)
EVT_TOOL_ENTER(ID_TOOLBAR, MyFrame::OnToolEnter)
+ EVT_TOOL_RCLICKED(wxID_ANY, MyFrame::OnToolRightClick)
EVT_UPDATE_UI(wxID_COPY, MyFrame::OnUpdateCopyAndCut)
EVT_UPDATE_UI(wxID_CUT, MyFrame::OnUpdateCopyAndCut)
EVT_UPDATE_UI(wxID_COPY, MyFrame::OnUpdateCopyAndCut)
EVT_UPDATE_UI(wxID_CUT, MyFrame::OnUpdateCopyAndCut)
@@
-254,7
+256,7
@@
IMPLEMENT_APP(MyApp)
bool MyApp::OnInit()
{
// Create the main frame window
bool MyApp::OnInit()
{
// Create the main frame window
- MyFrame* frame = new MyFrame((wxFrame *) NULL,
-1
,
+ MyFrame* frame = new MyFrame((wxFrame *) NULL,
wxID_ANY
,
_T("wxToolBar Sample"),
#ifdef __WXWINCE__
wxDefaultPosition, wxDefaultSize
_T("wxToolBar Sample"),
#ifdef __WXWINCE__
wxDefaultPosition, wxDefaultSize
@@
-263,15
+265,15
@@
bool MyApp::OnInit()
#endif
);
#endif
);
- frame->Show(
TRUE
);
+ frame->Show(
true
);
-#if
ndef __SMARTPHONE__
+#if
wxUSE_STATUSBAR
frame->SetStatusText(_T("Hello, wxWidgets"));
#endif
SetTopWindow(frame);
frame->SetStatusText(_T("Hello, wxWidgets"));
#endif
SetTopWindow(frame);
- return
TRUE
;
+ return
true
;
}
void MyFrame::RecreateToolbar()
}
void MyFrame::RecreateToolbar()
@@
-279,7
+281,7
@@
void MyFrame::RecreateToolbar()
#ifdef __WXWINCE__
// On Windows CE, we should not delete the
// previous toolbar in case it contains the menubar.
#ifdef __WXWINCE__
// On Windows CE, we should not delete the
// previous toolbar in case it contains the menubar.
- // We'll try to accomodate this usage in due course.
+ // We'll try to accom
m
odate this usage in due course.
wxToolBar* toolBar = CreateToolBar();
#else
// delete and recreate the toolbar
wxToolBar* toolBar = CreateToolBar();
#else
// delete and recreate the toolbar
@@
-343,7
+345,7
@@
void MyFrame::RecreateToolbar()
// adding a combo to a vertical toolbar is not very smart
if ( m_horzToolbar )
{
// adding a combo to a vertical toolbar is not very smart
if ( m_horzToolbar )
{
- wxComboBox *combo = new wxComboBox(toolBar, ID_COMBO, _T(""), wxDefaultPosition, wxSize(200,
-1
) );
+ wxComboBox *combo = new wxComboBox(toolBar, ID_COMBO, _T(""), wxDefaultPosition, wxSize(200,
wxDefaultCoord
) );
combo->Append(_T("This"));
combo->Append(_T("is a"));
combo->Append(_T("combobox"));
combo->Append(_T("This"));
combo->Append(_T("is a"));
combo->Append(_T("combobox"));
@@
-383,13
+385,13
@@
MyFrame::MyFrame(wxFrame* parent,
{
m_tbar = NULL;
{
m_tbar = NULL;
- m_smallToolbar =
TRUE
;
- m_horzToolbar =
TRUE
;
- m_horzText =
FALSE
;
+ m_smallToolbar =
true
;
+ m_horzToolbar =
true
;
+ m_horzText =
false
;
m_rows = 1;
m_nPrint = 1;
m_rows = 1;
m_nPrint = 1;
-#if
ndef __SMARTPHONE__
+#if
wxUSE_STATUSBAR
// Give it a status line
CreateStatusBar();
#endif
// Give it a status line
CreateStatusBar();
#endif
@@
-455,12
+457,12
@@
MyFrame::MyFrame(wxFrame* parent,
// Associate the menu bar with the frame
SetMenuBar(menuBar);
// Associate the menu bar with the frame
SetMenuBar(menuBar);
- menuBar->Check(IDM_TOOLBAR_SHOW_BOTH,
TRUE
);
+ menuBar->Check(IDM_TOOLBAR_SHOW_BOTH,
true
);
// Create the toolbar
RecreateToolbar();
// Create the toolbar
RecreateToolbar();
- m_textWindow = new wxTextCtrl(this,
-1, _T(""), wxPoint(0, 0), wxSize(-1, -1)
, wxTE_MULTILINE);
+ m_textWindow = new wxTextCtrl(this,
wxID_ANY, _T(""), wxPoint(0, 0), wxDefaultSize
, wxTE_MULTILINE);
}
#if USE_GENERIC_TBAR
}
#if USE_GENERIC_TBAR
@@
-483,7
+485,7
@@
void MyFrame::LayoutChildren()
int offset;
if ( m_tbar )
{
int offset;
if ( m_tbar )
{
- m_tbar->SetSize(
-1
, size.y);
+ m_tbar->SetSize(
wxDefaultCoord
, size.y);
m_tbar->Move(0, 0);
offset = m_tbar->GetSize().x;
m_tbar->Move(0, 0);
offset = m_tbar->GetSize().x;
@@
-544,7
+546,7
@@
void MyFrame::OnToggleAnotherToolbar(wxCommandEvent& WXUNUSED(event))
style &= ~wxTB_HORIZONTAL;
style |= wxTB_VERTICAL;
style &= ~wxTB_HORIZONTAL;
style |= wxTB_VERTICAL;
- m_tbar = new wxToolBar(this,
-1
,
+ m_tbar = new wxToolBar(this,
wxID_ANY
,
wxDefaultPosition, wxDefaultSize,
style);
wxDefaultPosition, wxDefaultSize,
style);
@@
-588,7
+590,7
@@
void MyFrame::OnToggleToolbarOrient(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
{
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
{
- Close(
TRUE
);
+ Close(
true
);
}
void MyFrame::OnAbout(wxCommandEvent& event)
}
void MyFrame::OnAbout(wxCommandEvent& event)
@@
-623,6
+625,13
@@
void MyFrame::OnToolLeftClick(wxCommandEvent& event)
}
}
}
}
+void MyFrame::OnToolRightClick(wxCommandEvent& event)
+{
+ m_textWindow->AppendText(
+ wxString::Format(_T("Tool %d right clicked.\n"),
+ (int) event.GetInt()));
+}
+
void MyFrame::OnCombo(wxCommandEvent& event)
{
wxLogStatus(_T("Combobox string '%s' selected"), event.GetString().c_str());
void MyFrame::OnCombo(wxCommandEvent& event)
{
wxLogStatus(_T("Combobox string '%s' selected"), event.GetString().c_str());
@@
-711,7
+720,7
@@
void MyFrame::OnInsertPrint(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnToolEnter(wxCommandEvent& event)
{
void MyFrame::OnToolEnter(wxCommandEvent& event)
{
-#if
ndef __SMARTPHONE__
+#if
wxUSE_STATUSBAR
if (event.GetSelection() > -1)
{
wxString str;
if (event.GetSelection() > -1)
{
wxString str;
@@
-720,7
+729,9
@@
void MyFrame::OnToolEnter(wxCommandEvent& event)
}
else
SetStatusText(_T(""));
}
else
SetStatusText(_T(""));
-#endif
+#else
+ wxUnusedVar(event);
+#endif // wxUSE_STATUSBAR
}
void MyFrame::OnToggleRadioBtn(wxCommandEvent& event)
}
void MyFrame::OnToggleRadioBtn(wxCommandEvent& event)