]> git.saurik.com Git - wxWidgets.git/blame - samples/toolbar/toolbar.cpp
header files are not executable
[wxWidgets.git] / samples / toolbar / toolbar.cpp
CommitLineData
14d1ccd8 1/////////////////////////////////////////////////////////////////////////////
fc6bbc6d 2// Name: toolbar.cpp
14d1ccd8
JS
3// Purpose: wxToolBar sample
4// Author: Julian Smart
5// Modified by:
6// Created: 04/01/98
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart
ad9bb75f 9// Licence: wxWindows licence
14d1ccd8
JS
10/////////////////////////////////////////////////////////////////////////////
11
ad9bb75f
VZ
12// ============================================================================
13// declarations
14// ============================================================================
15
16// ----------------------------------------------------------------------------
17// headers
18// ----------------------------------------------------------------------------
19
14d1ccd8 20// For compilers that support precompilation, includes "wx/wx.h".
92a19c2e 21#include "wx/wxprec.h"
14d1ccd8
JS
22
23#ifdef __BORLANDC__
ad9bb75f 24 #pragma hdrstop
14d1ccd8
JS
25#endif
26
27#ifndef WX_PRECOMP
5f4d35b8 28 #include "wx/wx.h"
14d1ccd8
JS
29#endif
30
5f4d35b8
WS
31#include "wx/toolbar.h"
32#include "wx/log.h"
33#include "wx/image.h"
5e3b8b93 34#include "wx/filedlg.h"
b529726e
RR
35#include "wx/spinctrl.h"
36#include "wx/srchctrl.h"
8bbe427f 37
f6bcfd97 38// define this to use XPMs everywhere (by default, BMPs are used under Win)
0ed1d09c 39// BMPs use less space, but aren't compiled into the executable on other platforms
f6bcfd97
BP
40#ifdef __WXMSW__
41 #define USE_XPM_BITMAPS 0
42#else
43 #define USE_XPM_BITMAPS 1
44#endif
45
f6bcfd97
BP
46#if USE_XPM_BITMAPS && defined(__WXMSW__) && !wxUSE_XPM_IN_MSW
47 #error You need to enable XPM support to use XPM bitmaps with toolbar!
48#endif // USE_XPM_BITMAPS
49
079b2f6b
JS
50// If this is 1, the sample will test an extra toolbar identical to the
51// main one, but not managed by the frame. This can test subtle differences
52// in the way toolbars are handled, especially on Mac where there is one
53// native, 'installed' toolbar.
54#define USE_UNMANAGED_TOOLBAR 0
55
ad9bb75f
VZ
56// ----------------------------------------------------------------------------
57// resources
58// ----------------------------------------------------------------------------
14d1ccd8 59
5f4d35b8 60#if !defined(__WXMSW__) && !defined(__WXPM__)
ad9bb75f 61 #include "mondrian.xpm"
5f4d35b8
WS
62#endif
63
64#if USE_XPM_BITMAPS
ad9bb75f
VZ
65 #include "bitmaps/new.xpm"
66 #include "bitmaps/open.xpm"
67 #include "bitmaps/save.xpm"
68 #include "bitmaps/copy.xpm"
69 #include "bitmaps/cut.xpm"
5ef2e633 70 #include "bitmaps/preview.xpm" // paste XPM
ad9bb75f 71 #include "bitmaps/print.xpm"
ad9bb75f 72 #include "bitmaps/help.xpm"
f6bcfd97 73#endif // USE_XPM_BITMAPS
ad9bb75f 74
7a976304
VZ
75enum Positions
76{
77 TOOLBAR_LEFT,
78 TOOLBAR_TOP,
79 TOOLBAR_RIGHT,
80 TOOLBAR_BOTTOM
81};
82
ad9bb75f
VZ
83// ----------------------------------------------------------------------------
84// classes
85// ----------------------------------------------------------------------------
86
ef3e6c15
RR
87class MyMiniControl: public wxControl
88{
89public:
90 MyMiniControl( wxWindow *parent ) :
6de67633 91 wxControl( parent, -1, wxDefaultPosition, wxSize(80,22), wxBORDER_SUNKEN, wxDefaultValidator, "MyMiniControl" )
ef3e6c15 92 {
6de67633 93 m_hasFocus = false;
ef3e6c15
RR
94 }
95 void OnPaint(wxPaintEvent &WXUNUSED(event))
96 {
97 wxPaintDC dc(this);
6de67633
RR
98 dc.SetPen( *wxTRANSPARENT_PEN );
99 dc.SetBrush( *wxWHITE_BRUSH );
ef3e6c15
RR
100 wxSize size = GetClientSize();
101 dc.DrawRectangle( 0,0,size.x,size.y );
6de67633
RR
102 if (m_hasFocus)
103 dc.DrawText( "Focussed", 1,1 );
104 }
105 void OnSetFocus(wxFocusEvent &WXUNUSED(event))
106 {
107 m_hasFocus = true;
108 Refresh();
109 }
110 void OnKillFocus(wxFocusEvent &WXUNUSED(event))
111 {
112 m_hasFocus = false;
113 Refresh();
ef3e6c15
RR
114 }
115 virtual wxSize GetBestSize()
116 {
6de67633 117 return wxSize(80,22);
ef3e6c15 118 }
6de67633
RR
119 virtual bool AcceptsFocus()
120 {
121 return true;
122 }
123
124 bool m_hasFocus;
ef3e6c15
RR
125
126private:
127 DECLARE_EVENT_TABLE()
128};
129
130BEGIN_EVENT_TABLE(MyMiniControl, wxControl)
131 EVT_PAINT(MyMiniControl::OnPaint)
6de67633
RR
132 EVT_SET_FOCUS(MyMiniControl::OnSetFocus)
133 EVT_KILL_FOCUS(MyMiniControl::OnKillFocus)
ef3e6c15
RR
134END_EVENT_TABLE()
135
136
137
ad9bb75f 138// Define a new application
5ef2e633 139class MyApp : public wxApp
ad9bb75f
VZ
140{
141public:
142 bool OnInit();
ad9bb75f 143};
47908e25 144
ad9bb75f
VZ
145// Define a new frame
146class MyFrame: public wxFrame
147{
148public:
149 MyFrame(wxFrame *parent,
bc2ec626 150 wxWindowID id = wxID_ANY,
ab1ca7b3 151 const wxString& title = _T("wxToolBar Sample"),
ad9bb75f
VZ
152 const wxPoint& pos = wxDefaultPosition,
153 const wxSize& size = wxDefaultSize,
229de929 154 long style = wxDEFAULT_FRAME_STYLE|wxCLIP_CHILDREN|wxNO_FULL_REPAINT_ON_RESIZE);
14d1ccd8 155
079b2f6b 156 void PopulateToolbar(wxToolBarBase* toolBar);
5ef2e633
VZ
157 void RecreateToolbar();
158
ad9bb75f
VZ
159 void OnQuit(wxCommandEvent& event);
160 void OnAbout(wxCommandEvent& event);
161
f6bcfd97
BP
162 void OnSize(wxSizeEvent& event);
163
ba0abe3c 164 void OnToggleToolbar(wxCommandEvent& event);
f6bcfd97 165 void OnToggleAnotherToolbar(wxCommandEvent& event);
96dc4236 166 void OnToggleHorizontalText(wxCommandEvent& WXUNUSED(event));
f6bcfd97 167
5ef2e633 168 void OnToggleToolbarSize(wxCommandEvent& event);
7a976304 169 void OnChangeOrientation(wxCommandEvent& event);
98066234 170 void OnToggleToolbarRows(wxCommandEvent& event);
6a1b3ead 171 void OnToggleTooltips(wxCommandEvent& event);
8d0a7b56 172 void OnToggleCustomDisabled(wxCommandEvent& event);
5ef2e633 173
ad4ae6ed
VZ
174 void OnEnablePrint(wxCommandEvent& WXUNUSED(event)) { DoEnablePrint(); }
175 void OnDeletePrint(wxCommandEvent& WXUNUSED(event)) { DoDeletePrint(); }
bdc72a22 176 void OnInsertPrint(wxCommandEvent& event);
a1f79c1e 177 void OnChangeToolTip(wxCommandEvent& event);
ad4ae6ed 178 void OnToggleHelp(wxCommandEvent& WXUNUSED(event)) { DoToggleHelp(); }
3bf4189d 179 void OnToggleRadioBtn(wxCommandEvent& event);
ad9bb75f 180
ec483b11 181 void OnToolbarStyle(wxCommandEvent& event);
5e3b8b93 182 void OnToolbarCustomBitmap(wxCommandEvent& event);
ec483b11 183
ad9bb75f 184 void OnToolLeftClick(wxCommandEvent& event);
e052a316 185 void OnToolRightClick(wxCommandEvent& event);
a9a0ceca 186 void OnToolDropdown(wxCommandEvent& event);
ad9bb75f 187
1c383dba
VZ
188 void OnCombo(wxCommandEvent& event);
189
5ef2e633 190 void OnUpdateCopyAndCut(wxUpdateUIEvent& event);
96dc4236 191 void OnUpdateToggleHorzText(wxUpdateUIEvent& event);
3bf4189d
VZ
192 void OnUpdateToggleRadioBtn(wxUpdateUIEvent& event)
193 { event.Enable( m_tbar != NULL ); }
5ef2e633 194
ad9bb75f
VZ
195private:
196 void DoEnablePrint();
97d7bfb8 197 void DoDeletePrint();
ad9bb75f
VZ
198 void DoToggleHelp();
199
f6bcfd97
BP
200 void LayoutChildren();
201
5ef2e633 202 bool m_smallToolbar,
8d0a7b56 203 m_horzText,
6a1b3ead
VZ
204 m_useCustomDisabled,
205 m_showTooltips;
98066234
VZ
206 size_t m_rows; // 1 or 2 only
207
2b5f62a0
VZ
208 // the number of print buttons we have (they're added/removed dynamically)
209 size_t m_nPrint;
210
7a976304
VZ
211 // store toolbar position for future use
212 Positions m_toolbarPosition;
213
f6bcfd97
BP
214 wxTextCtrl *m_textWindow;
215
079b2f6b
JS
216 wxPanel *m_panel;
217 wxToolBar *m_extraToolBar;
218
f6bcfd97 219 wxToolBar *m_tbar;
ad9bb75f 220
5e3b8b93
VZ
221 // the path to the custom bitmap for the test toolbar tool
222 wxString m_pathBmp;
223
ad9bb75f
VZ
224 DECLARE_EVENT_TABLE()
225};
226
227// ----------------------------------------------------------------------------
228// constants
229// ----------------------------------------------------------------------------
230
231const int ID_TOOLBAR = 500;
232
dd46ee66 233static const long TOOLBAR_STYLE = wxTB_FLAT | wxTB_DOCKABLE | wxTB_TEXT;
86f65864 234
ad9bb75f 235enum
14d1ccd8 236{
5ef2e633 237 IDM_TOOLBAR_TOGGLETOOLBARSIZE = 200,
98066234 238 IDM_TOOLBAR_TOGGLETOOLBARROWS,
6a1b3ead 239 IDM_TOOLBAR_TOGGLETOOLTIPS,
8d0a7b56 240 IDM_TOOLBAR_TOGGLECUSTOMDISABLED,
ad9bb75f 241 IDM_TOOLBAR_ENABLEPRINT,
97d7bfb8 242 IDM_TOOLBAR_DELETEPRINT,
bdc72a22 243 IDM_TOOLBAR_INSERTPRINT,
1c383dba 244 IDM_TOOLBAR_TOGGLEHELP,
3bf4189d
VZ
245 IDM_TOOLBAR_TOGGLERADIOBTN1,
246 IDM_TOOLBAR_TOGGLERADIOBTN2,
247 IDM_TOOLBAR_TOGGLERADIOBTN3,
ba0abe3c 248 IDM_TOOLBAR_TOGGLE_TOOLBAR,
96dc4236 249 IDM_TOOLBAR_TOGGLE_HORIZONTAL_TEXT,
f6bcfd97 250 IDM_TOOLBAR_TOGGLE_ANOTHER_TOOLBAR,
a1f79c1e 251 IDM_TOOLBAR_CHANGE_TOOLTIP,
ec483b11
VZ
252 IDM_TOOLBAR_SHOW_TEXT,
253 IDM_TOOLBAR_SHOW_ICONS,
254 IDM_TOOLBAR_SHOW_BOTH,
5e3b8b93 255 IDM_TOOLBAR_CUSTOM_PATH,
7a976304
VZ
256 IDM_TOOLBAR_TOP_ORIENTATION,
257 IDM_TOOLBAR_LEFT_ORIENTATION,
5b2acc3a 258 IDM_TOOLBAR_BOTTOM_ORIENTATION,
7a976304 259 IDM_TOOLBAR_RIGHT_ORIENTATION,
3bf4189d
VZ
260 IDM_TOOLBAR_OTHER_1,
261 IDM_TOOLBAR_OTHER_2,
262 IDM_TOOLBAR_OTHER_3,
263
5b2acc3a
RR
264 ID_COMBO = 1000,
265 ID_SPIN = 1001
ad9bb75f 266};
14d1ccd8 267
ad9bb75f
VZ
268// ----------------------------------------------------------------------------
269// event tables
270// ----------------------------------------------------------------------------
14d1ccd8 271
ad9bb75f
VZ
272// Notice that wxID_HELP will be processed for the 'About' menu and the toolbar
273// help button.
14d1ccd8 274
ad9bb75f 275BEGIN_EVENT_TABLE(MyFrame, wxFrame)
f6bcfd97
BP
276 EVT_SIZE(MyFrame::OnSize)
277
ad9bb75f
VZ
278 EVT_MENU(wxID_EXIT, MyFrame::OnQuit)
279 EVT_MENU(wxID_HELP, MyFrame::OnAbout)
14d1ccd8 280
ba0abe3c 281 EVT_MENU(IDM_TOOLBAR_TOGGLE_TOOLBAR, MyFrame::OnToggleToolbar)
f6bcfd97 282 EVT_MENU(IDM_TOOLBAR_TOGGLE_ANOTHER_TOOLBAR, MyFrame::OnToggleAnotherToolbar)
96dc4236 283 EVT_MENU(IDM_TOOLBAR_TOGGLE_HORIZONTAL_TEXT, MyFrame::OnToggleHorizontalText)
f6bcfd97 284
7a976304 285 EVT_MENU_RANGE(IDM_TOOLBAR_TOP_ORIENTATION, IDM_TOOLBAR_RIGHT_ORIENTATION, MyFrame::OnChangeOrientation)
5ef2e633 286 EVT_MENU(IDM_TOOLBAR_TOGGLETOOLBARSIZE, MyFrame::OnToggleToolbarSize)
98066234 287 EVT_MENU(IDM_TOOLBAR_TOGGLETOOLBARROWS, MyFrame::OnToggleToolbarRows)
6a1b3ead 288 EVT_MENU(IDM_TOOLBAR_TOGGLETOOLTIPS, MyFrame::OnToggleTooltips)
8d0a7b56 289 EVT_MENU(IDM_TOOLBAR_TOGGLECUSTOMDISABLED, MyFrame::OnToggleCustomDisabled)
5ef2e633 290
ad9bb75f 291 EVT_MENU(IDM_TOOLBAR_ENABLEPRINT, MyFrame::OnEnablePrint)
97d7bfb8 292 EVT_MENU(IDM_TOOLBAR_DELETEPRINT, MyFrame::OnDeletePrint)
bdc72a22 293 EVT_MENU(IDM_TOOLBAR_INSERTPRINT, MyFrame::OnInsertPrint)
ad9bb75f 294 EVT_MENU(IDM_TOOLBAR_TOGGLEHELP, MyFrame::OnToggleHelp)
3bf4189d
VZ
295 EVT_MENU_RANGE(IDM_TOOLBAR_TOGGLERADIOBTN1, IDM_TOOLBAR_TOGGLERADIOBTN3,
296 MyFrame::OnToggleRadioBtn)
a1f79c1e 297 EVT_MENU(IDM_TOOLBAR_CHANGE_TOOLTIP, MyFrame::OnChangeToolTip)
14d1ccd8 298
ec483b11
VZ
299 EVT_MENU_RANGE(IDM_TOOLBAR_SHOW_TEXT, IDM_TOOLBAR_SHOW_BOTH,
300 MyFrame::OnToolbarStyle)
301
5e3b8b93
VZ
302 EVT_MENU(IDM_TOOLBAR_CUSTOM_PATH, MyFrame::OnToolbarCustomBitmap)
303
bc2ec626 304 EVT_MENU(wxID_ANY, MyFrame::OnToolLeftClick)
14d1ccd8 305
1c383dba
VZ
306 EVT_COMBOBOX(ID_COMBO, MyFrame::OnCombo)
307
e052a316 308 EVT_TOOL_RCLICKED(wxID_ANY, MyFrame::OnToolRightClick)
5ef2e633 309
a9a0ceca
VZ
310 EVT_TOOL_DROPDOWN(wxID_ANY, MyFrame::OnToolDropdown)
311
5ef2e633
VZ
312 EVT_UPDATE_UI(wxID_COPY, MyFrame::OnUpdateCopyAndCut)
313 EVT_UPDATE_UI(wxID_CUT, MyFrame::OnUpdateCopyAndCut)
96dc4236 314
3bf4189d
VZ
315 EVT_UPDATE_UI_RANGE(IDM_TOOLBAR_TOGGLERADIOBTN1,
316 IDM_TOOLBAR_TOGGLERADIOBTN3,
317 MyFrame::OnUpdateToggleRadioBtn)
96dc4236
VZ
318 EVT_UPDATE_UI(IDM_TOOLBAR_TOGGLE_HORIZONTAL_TEXT,
319 MyFrame::OnUpdateToggleHorzText)
ad9bb75f 320END_EVENT_TABLE()
14d1ccd8 321
ad9bb75f
VZ
322// ============================================================================
323// implementation
324// ============================================================================
14d1ccd8 325
ad9bb75f
VZ
326// ----------------------------------------------------------------------------
327// MyApp
328// ----------------------------------------------------------------------------
14d1ccd8 329
ad9bb75f 330IMPLEMENT_APP(MyApp)
14d1ccd8 331
ad9bb75f
VZ
332// The `main program' equivalent, creating the windows and returning the
333// main frame
334bool MyApp::OnInit()
335{
45e6e6f8
VZ
336 if ( !wxApp::OnInit() )
337 return false;
338
ad9bb75f 339 // Create the main frame window
bc2ec626 340 MyFrame* frame = new MyFrame((wxFrame *) NULL, wxID_ANY,
ab1ca7b3 341 _T("wxToolBar Sample"),
6de67633 342 wxPoint(100, 100), wxSize(550, 500));
14d1ccd8 343
bc2ec626 344 frame->Show(true);
7fb23305 345
8520f137 346#if wxUSE_STATUSBAR
be5a51fb 347 frame->SetStatusText(_T("Hello, wxWidgets"));
0cfc2a92 348#endif
7fb23305 349
5e3b8b93
VZ
350 wxInitAllImageHandlers();
351
7fb23305
VZ
352 SetTopWindow(frame);
353
bc2ec626 354 return true;
14d1ccd8
JS
355}
356
5ef2e633 357void MyFrame::RecreateToolbar()
14d1ccd8 358{
bf95a04f
JS
359#ifdef __WXWINCE__
360 // On Windows CE, we should not delete the
361 // previous toolbar in case it contains the menubar.
34621cc5 362 // We'll try to accommodate this usage in due course.
bf95a04f
JS
363 wxToolBar* toolBar = CreateToolBar();
364#else
5ef2e633 365 // delete and recreate the toolbar
ad4ae6ed 366 wxToolBarBase *toolBar = GetToolBar();
ec483b11
VZ
367 long style = toolBar ? toolBar->GetWindowStyle() : TOOLBAR_STYLE;
368
5ef2e633 369 delete toolBar;
14d1ccd8 370
5ef2e633
VZ
371 SetToolBar(NULL);
372
7a976304
VZ
373 style &= ~(wxTB_HORIZONTAL | wxTB_VERTICAL | wxTB_BOTTOM | wxTB_RIGHT | wxTB_HORZ_LAYOUT);
374 switch( m_toolbarPosition )
375 {
376 case TOOLBAR_LEFT:
377 style |= wxTB_LEFT;
378 break;
379 case TOOLBAR_TOP:
380 style |= wxTB_TOP;
381 break;
382 case TOOLBAR_RIGHT:
383 style |= wxTB_RIGHT;
384 break;
385 case TOOLBAR_BOTTOM:
5b2acc3a 386 style |= wxTB_BOTTOM;
7a976304
VZ
387 break;
388 }
96dc4236 389
6a1b3ead
VZ
390 if ( m_showTooltips )
391 style &= ~wxTB_NO_TOOLTIPS;
392 else
393 style |= wxTB_NO_TOOLTIPS;
394
96dc4236
VZ
395 if ( style & wxTB_TEXT && !(style & wxTB_NOICONS) && m_horzText )
396 style |= wxTB_HORZ_LAYOUT;
5ef2e633
VZ
397
398 toolBar = CreateToolBar(style, ID_TOOLBAR);
bf95a04f 399#endif
5ef2e633 400
079b2f6b
JS
401 PopulateToolbar(toolBar);
402}
403
404void MyFrame::PopulateToolbar(wxToolBarBase* toolBar)
405{
5ef2e633 406 // Set up toolbar
8d0a7b56
VZ
407 enum
408 {
409 Tool_new,
410 Tool_open,
411 Tool_save,
412 Tool_copy,
413 Tool_cut,
414 Tool_paste,
415 Tool_print,
416 Tool_help,
417 Tool_Max
418 };
419
420 wxBitmap toolBarBitmaps[Tool_Max];
5ef2e633 421
f6bcfd97 422#if USE_XPM_BITMAPS
8d0a7b56
VZ
423 #define INIT_TOOL_BMP(bmp) \
424 toolBarBitmaps[Tool_##bmp] = wxBitmap(bmp##_xpm)
f6bcfd97 425#else // !USE_XPM_BITMAPS
8d0a7b56
VZ
426 #define INIT_TOOL_BMP(bmp) \
427 toolBarBitmaps[Tool_##bmp] = wxBITMAP(bmp)
f6bcfd97 428#endif // USE_XPM_BITMAPS/!USE_XPM_BITMAPS
40515a21 429
8d0a7b56
VZ
430 INIT_TOOL_BMP(new);
431 INIT_TOOL_BMP(open);
432 INIT_TOOL_BMP(save);
433 INIT_TOOL_BMP(copy);
434 INIT_TOOL_BMP(cut);
435 INIT_TOOL_BMP(paste);
436 INIT_TOOL_BMP(print);
437 INIT_TOOL_BMP(help);
438
439 int w = toolBarBitmaps[Tool_new].GetWidth(),
440 h = toolBarBitmaps[Tool_new].GetHeight();
441
5ef2e633
VZ
442 if ( !m_smallToolbar )
443 {
8d0a7b56
VZ
444 w *= 2;
445 h *= 2;
446
447 for ( size_t n = Tool_new; n < WXSIZEOF(toolBarBitmaps); n++ )
40515a21
VZ
448 {
449 toolBarBitmaps[n] =
368d59f0 450 wxBitmap(toolBarBitmaps[n].ConvertToImage().Scale(w, h));
40515a21 451 }
5ef2e633 452 }
14d1ccd8 453
6a1b3ead
VZ
454 toolBar->SetToolBitmapSize(wxSize(w, h));
455
e112f019 456 toolBar->AddTool(wxID_NEW, _T("New"),
a9a0ceca 457 toolBarBitmaps[Tool_new], wxNullBitmap, wxITEM_DROPDOWN,
e112f019 458 _T("New file"), _T("This is help for new file tool"));
a9a0ceca
VZ
459
460 wxMenu* menu = new wxMenu;
461 menu->Append(wxID_ANY, _T("&First dummy item"));
462 menu->Append(wxID_ANY, _T("&Second dummy item"));
463 menu->AppendSeparator();
464 menu->Append(wxID_EXIT, _T("Exit"));
465 toolBar->SetDropdownMenu(wxID_NEW, menu);
466
e112f019
VZ
467 toolBar->AddTool(wxID_OPEN, _T("Open"),
468 toolBarBitmaps[Tool_open], wxNullBitmap, wxITEM_NORMAL,
469 _T("Open file"), _T("This is help for open file tool"));
14d1ccd8 470
aae91497 471 // the generic toolbar doesn't really support this
27cc9142 472#if wxUSE_TOOLBAR_NATIVE && !defined(__WXX11__) || defined(__WXUNIVERSAL__)
5ef2e633 473 // adding a combo to a vertical toolbar is not very smart
7a976304 474 if ( !( toolBar->IsVertical() ) )
5ef2e633 475 {
b529726e 476 wxComboBox *combo = new wxComboBox(toolBar, ID_COMBO, wxEmptyString, wxDefaultPosition, wxSize(100,-1) );
2b5f62a0
VZ
477 combo->Append(_T("This"));
478 combo->Append(_T("is a"));
479 combo->Append(_T("combobox"));
480 combo->Append(_T("in a"));
481 combo->Append(_T("toolbar"));
cdb11cb9 482 toolBar->AddControl(combo, _T("Combo Label"));
6bbb8a8d 483
b529726e
RR
484 wxSpinCtrl *spin = new wxSpinCtrl( toolBar, ID_SPIN, wxT("0"), wxDefaultPosition, wxSize(80,wxDefaultCoord), 0, 0, 100 );
485 toolBar->AddControl( spin );
cdb11cb9 486
b529726e
RR
487 wxTextCtrl *text = new wxTextCtrl( toolBar, -1, wxT("text"), wxDefaultPosition, wxSize(80,wxDefaultCoord) );
488 toolBar->AddControl( text );
cdb11cb9 489
b529726e
RR
490 wxSearchCtrl *srch = new wxSearchCtrl( toolBar, -1, wxT("xx"), wxDefaultPosition, wxSize(80,wxDefaultCoord), wxSUNKEN_BORDER );
491 toolBar->AddControl( srch );
ef3e6c15
RR
492
493 toolBar->AddControl( new MyMiniControl( toolBar) );
5ef2e633 494 }
ad4ae6ed 495#endif // toolbars which don't support controls
14d1ccd8 496
8d0a7b56
VZ
497 toolBar->AddTool(wxID_SAVE, _T("Save"), toolBarBitmaps[Tool_save], _T("Toggle button 1"), wxITEM_CHECK);
498 toolBar->AddTool(wxID_COPY, _T("Copy"), toolBarBitmaps[Tool_copy], _T("Toggle button 2"), wxITEM_CHECK);
499 toolBar->AddTool(wxID_CUT, _T("Cut"), toolBarBitmaps[Tool_cut], _T("Toggle/Untoggle help button"));
500 toolBar->AddTool(wxID_PASTE, _T("Paste"), toolBarBitmaps[Tool_paste], _T("Paste"));
501
502 if ( m_useCustomDisabled )
503 {
504 wxBitmap bmpDisabled(w, h);
505 {
506 wxMemoryDC dc;
507 dc.SelectObject(bmpDisabled);
508 dc.DrawBitmap(toolBarBitmaps[Tool_print], 0, 0);
509
510 wxPen pen(*wxRED, 5);
511 dc.SetPen(pen);
512 dc.DrawLine(0, 0, w, h);
513 }
514
515 toolBar->AddTool(wxID_PRINT, _T("Print"), toolBarBitmaps[Tool_print],
516 bmpDisabled);
517 }
518 else
519 {
520 toolBar->AddTool(wxID_PRINT, _T("Print"), toolBarBitmaps[Tool_print],
521 _T("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."));
522 }
523
40515a21 524 toolBar->AddSeparator();
8d0a7b56 525 toolBar->AddTool(wxID_HELP, _T("Help"), toolBarBitmaps[Tool_help], _T("Help button"), wxITEM_CHECK);
13437238 526
5e3b8b93
VZ
527 if ( !m_pathBmp.empty() )
528 {
529 // create a tool with a custom bitmap for testing
530 wxImage img(m_pathBmp);
531 if ( img.Ok() )
532 {
533 if ( img.GetWidth() > w && img.GetHeight() > h )
534 img = img.GetSubImage(wxRect(0, 0, w, h));
535
536 toolBar->AddSeparator();
537 toolBar->AddTool(wxID_ANY, _T("Custom"), img);
538 }
539 }
540
5ef2e633
VZ
541 // after adding the buttons to the toolbar, must call Realize() to reflect
542 // the changes
543 toolBar->Realize();
98066234 544
7a976304 545 toolBar->SetRows(!(toolBar->IsVertical()) ? m_rows : 10 / m_rows);
14d1ccd8
JS
546}
547
ad9bb75f
VZ
548// ----------------------------------------------------------------------------
549// MyFrame
550// ----------------------------------------------------------------------------
13437238
JS
551
552// Define my frame constructor
7fb23305
VZ
553MyFrame::MyFrame(wxFrame* parent,
554 wxWindowID id,
555 const wxString& title,
556 const wxPoint& pos,
557 const wxSize& size,
558 long style)
559 : wxFrame(parent, id, title, pos, size, style)
14d1ccd8 560{
f6bcfd97 561 m_tbar = NULL;
98066234 562
bc2ec626 563 m_smallToolbar = true;
bc2ec626 564 m_horzText = false;
8d0a7b56 565 m_useCustomDisabled = false;
6a1b3ead
VZ
566 m_showTooltips = true;
567
98066234 568 m_rows = 1;
2b5f62a0 569 m_nPrint = 1;
ad9bb75f 570
8520f137 571#if wxUSE_STATUSBAR
ad9bb75f
VZ
572 // Give it a status line
573 CreateStatusBar();
0cfc2a92 574#endif
ad9bb75f
VZ
575
576 // Give it an icon
577 SetIcon(wxICON(mondrian));
578
579 // Make a menubar
580 wxMenu *tbarMenu = new wxMenu;
ba0abe3c 581 tbarMenu->AppendCheckItem(IDM_TOOLBAR_TOGGLE_TOOLBAR,
2b5f62a0
VZ
582 _T("Toggle &toolbar\tCtrl-Z"),
583 _T("Show or hide the toolbar"));
ba0abe3c
VZ
584
585 tbarMenu->AppendCheckItem(IDM_TOOLBAR_TOGGLE_ANOTHER_TOOLBAR,
2b5f62a0
VZ
586 _T("Toggle &another toolbar\tCtrl-A"),
587 _T("Show/hide another test toolbar"));
ba0abe3c 588
96dc4236
VZ
589 tbarMenu->AppendCheckItem(IDM_TOOLBAR_TOGGLE_HORIZONTAL_TEXT,
590 _T("Toggle hori&zontal text\tCtrl-H"),
591 _T("Show text under/alongside the icon"));
592
ba0abe3c 593 tbarMenu->AppendCheckItem(IDM_TOOLBAR_TOGGLETOOLBARSIZE,
2b5f62a0
VZ
594 _T("&Toggle toolbar size\tCtrl-S"),
595 _T("Toggle between big/small toolbar"));
ba0abe3c 596
ba0abe3c 597 tbarMenu->AppendCheckItem(IDM_TOOLBAR_TOGGLETOOLBARROWS,
2b5f62a0
VZ
598 _T("Toggle number of &rows\tCtrl-R"),
599 _T("Toggle number of toolbar rows between 1 and 2"));
5ef2e633 600
6a1b3ead
VZ
601 tbarMenu->AppendCheckItem(IDM_TOOLBAR_TOGGLETOOLTIPS,
602 _T("Show &tooltips\tCtrl-L"),
603 _T("Show tooltips for the toolbar tools"));
604
8d0a7b56
VZ
605 tbarMenu->AppendCheckItem(IDM_TOOLBAR_TOGGLECUSTOMDISABLED,
606 _T("Use c&ustom disabled images\tCtrl-U"),
607 _T("Switch between using system-generated and custom disabled images"));
608
609
7a976304
VZ
610 tbarMenu->AppendSeparator();
611 tbarMenu->AppendRadioItem(IDM_TOOLBAR_TOP_ORIENTATION,
612 _T("Set toolbar at the top of the window"),
613 _T("Set toolbar at the top of the window"));
614 tbarMenu->AppendRadioItem(IDM_TOOLBAR_LEFT_ORIENTATION,
615 _T("Set toolbar at the left of the window"),
616 _T("Set toolbar at the left of the window"));
617 tbarMenu->AppendRadioItem(IDM_TOOLBAR_BOTTOM_ORIENTATION,
5b2acc3a
RR
618 _T("Set toolbar at the bottom of the window"),
619 _T("Set toolbar at the bottom of the window"));
7a976304
VZ
620 tbarMenu->AppendRadioItem(IDM_TOOLBAR_RIGHT_ORIENTATION,
621 _T("Set toolbar at the right edge of the window"),
622 _T("Set toolbar at the right edge of the window"));
5ef2e633
VZ
623 tbarMenu->AppendSeparator();
624
5e3b8b93
VZ
625 tbarMenu->Append(IDM_TOOLBAR_ENABLEPRINT, _T("&Enable print button\tCtrl-E"));
626 tbarMenu->Append(IDM_TOOLBAR_DELETEPRINT, _T("&Delete print button\tCtrl-D"));
627 tbarMenu->Append(IDM_TOOLBAR_INSERTPRINT, _T("&Insert print button\tCtrl-I"));
628 tbarMenu->Append(IDM_TOOLBAR_TOGGLEHELP, _T("Toggle &help button\tCtrl-T"));
a1f79c1e 629 tbarMenu->AppendSeparator();
5e3b8b93
VZ
630 tbarMenu->Append(IDM_TOOLBAR_TOGGLERADIOBTN1, _T("Toggle &1st radio button\tCtrl-1"));
631 tbarMenu->Append(IDM_TOOLBAR_TOGGLERADIOBTN2, _T("Toggle &2nd radio button\tCtrl-2"));
632 tbarMenu->Append(IDM_TOOLBAR_TOGGLERADIOBTN3, _T("Toggle &3rd radio button\tCtrl-3"));
3bf4189d 633 tbarMenu->AppendSeparator();
5e3b8b93 634 tbarMenu->Append(IDM_TOOLBAR_CHANGE_TOOLTIP, _T("Change tool tip"));
ec483b11 635 tbarMenu->AppendSeparator();
f5e6e431
VZ
636 tbarMenu->AppendRadioItem(IDM_TOOLBAR_SHOW_TEXT, _T("Show &text\tCtrl-Alt-T"));
637 tbarMenu->AppendRadioItem(IDM_TOOLBAR_SHOW_ICONS, _T("Show &icons\tCtrl-Alt-I"));
638 tbarMenu->AppendRadioItem(IDM_TOOLBAR_SHOW_BOTH, _T("Show &both\tCtrl-Alt-B"));
5e3b8b93
VZ
639 tbarMenu->AppendSeparator();
640 tbarMenu->Append(IDM_TOOLBAR_CUSTOM_PATH, _T("Custom &bitmap...\tCtrl-B"));
b487a08f 641
ad9bb75f 642 wxMenu *fileMenu = new wxMenu;
2b5f62a0 643 fileMenu->Append(wxID_EXIT, _T("E&xit\tAlt-X"), _T("Quit toolbar sample") );
ad9bb75f 644
ad9bb75f 645 wxMenu *helpMenu = new wxMenu;
2b5f62a0 646 helpMenu->Append(wxID_HELP, _T("&About"), _T("About toolbar sample"));
ad9bb75f
VZ
647
648 wxMenuBar* menuBar = new wxMenuBar( wxMB_DOCKABLE );
649
2b5f62a0
VZ
650 menuBar->Append(fileMenu, _T("&File"));
651 menuBar->Append(tbarMenu, _T("&Toolbar"));
652 menuBar->Append(helpMenu, _T("&Help"));
ad9bb75f
VZ
653
654 // Associate the menu bar with the frame
655 SetMenuBar(menuBar);
656
bc2ec626 657 menuBar->Check(IDM_TOOLBAR_SHOW_BOTH, true);
6a1b3ead 658 menuBar->Check(IDM_TOOLBAR_TOGGLETOOLTIPS, true);
c631abda 659
7a976304
VZ
660 menuBar->Check(IDM_TOOLBAR_TOP_ORIENTATION, true );
661 m_toolbarPosition = TOOLBAR_TOP;
079b2f6b 662
ad9bb75f 663 // Create the toolbar
5ef2e633 664 RecreateToolbar();
949b8e62 665
079b2f6b
JS
666 m_panel = new wxPanel(this, wxID_ANY);
667#if USE_UNMANAGED_TOOLBAR
668 m_extraToolBar = new wxToolBar(m_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTB_TEXT|wxTB_FLAT|wxTB_TOP);
669 PopulateToolbar(m_extraToolBar);
670#else
671 m_extraToolBar = NULL;
672#endif
673
674 m_textWindow = new wxTextCtrl(m_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE);
675
676 wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);
677 m_panel->SetSizer(sizer);
678 if (m_extraToolBar)
679 sizer->Add(m_extraToolBar, 0, wxEXPAND, 0);
6de67633 680 sizer->Add(0,0,6);
079b2f6b 681 sizer->Add(m_textWindow, 1, wxEXPAND, 0);
6de67633
RR
682
683 wxControl *control;
684 control = new wxControl( m_panel, -1, wxPoint(30,20), wxSize(50,50), wxBORDER_SUNKEN );
685 control = new wxControl( m_panel, -1, wxPoint(130,20), wxSize(50,50), wxBORDER_SIMPLE );
686 control = new wxControl( m_panel, -1, wxPoint(230,20), wxSize(50,50), wxBORDER_RAISED );
687 control = new wxControl( m_panel, -1, wxPoint(330,20), wxSize(50,50), wxBORDER_THEME );
688
689 wxScrolledWindow *scrolled;
690 scrolled = new wxScrolledWindow( m_panel, -1, wxPoint(30,120), wxSize(80,80), wxHSCROLL|wxVSCROLL | wxBORDER_SUNKEN );
691 scrolled->SetVirtualSize(400,400);
692 scrolled->SetScrollRate(10,10);
693 scrolled = new wxScrolledWindow( m_panel, -1, wxPoint(130,120), wxSize(80,80), wxHSCROLL|wxVSCROLL | wxBORDER_SIMPLE );
694 scrolled->SetVirtualSize(400,400);
695 scrolled->SetScrollRate(10,10);
696 scrolled = new wxScrolledWindow( m_panel, -1, wxPoint(230,120), wxSize(80,80), wxHSCROLL|wxVSCROLL | wxBORDER_RAISED );
697 scrolled->SetVirtualSize(400,400);
698 scrolled->SetScrollRate(10,10);
5ef2e633 699}
ad9bb75f 700
f6bcfd97
BP
701void MyFrame::LayoutChildren()
702{
703 wxSize size = GetClientSize();
704
705 int offset;
706 if ( m_tbar )
707 {
7a7d2a14 708 m_tbar->SetSize(0, 0, wxDefaultCoord, size.y);
f6bcfd97
BP
709
710 offset = m_tbar->GetSize().x;
711 }
712 else
713 {
714 offset = 0;
715 }
716
079b2f6b 717 m_panel->SetSize(offset, 0, size.x - offset, size.y);
f6bcfd97
BP
718}
719
720void MyFrame::OnSize(wxSizeEvent& event)
721{
722 if ( m_tbar )
723 {
724 LayoutChildren();
725 }
726 else
727 {
728 event.Skip();
729 }
730}
731
ba0abe3c
VZ
732void MyFrame::OnToggleToolbar(wxCommandEvent& WXUNUSED(event))
733{
734 wxToolBar *tbar = GetToolBar();
735
736 if ( !tbar )
737 {
738 RecreateToolbar();
739 }
740 else
741 {
742 delete tbar;
743
744 SetToolBar(NULL);
745 }
746}
747
96dc4236
VZ
748void MyFrame::OnToggleHorizontalText(wxCommandEvent& WXUNUSED(event))
749{
750 m_horzText = !m_horzText;
751
752 RecreateToolbar();
753}
754
f6bcfd97
BP
755void MyFrame::OnToggleAnotherToolbar(wxCommandEvent& WXUNUSED(event))
756{
757 if ( m_tbar )
758 {
759 delete m_tbar;
760 m_tbar = NULL;
761 }
762 else
763 {
8927d6d1
VZ
764 long style = GetToolBar() ? GetToolBar()->GetWindowStyle()
765 : TOOLBAR_STYLE;
ec483b11
VZ
766 style &= ~wxTB_HORIZONTAL;
767 style |= wxTB_VERTICAL;
768
bc2ec626 769 m_tbar = new wxToolBar(this, wxID_ANY,
f6bcfd97 770 wxDefaultPosition, wxDefaultSize,
ec483b11
VZ
771 style);
772
69c14ebe
VZ
773 m_tbar->SetMargins(4, 4);
774
3bf4189d
VZ
775 m_tbar->AddRadioTool(IDM_TOOLBAR_OTHER_1, _T("First"), wxBITMAP(new));
776 m_tbar->AddRadioTool(IDM_TOOLBAR_OTHER_2, _T("Second"), wxBITMAP(open));
777 m_tbar->AddRadioTool(IDM_TOOLBAR_OTHER_3, _T("Third"), wxBITMAP(save));
ec483b11
VZ
778 m_tbar->AddSeparator();
779 m_tbar->AddTool(wxID_HELP, _T("Help"), wxBITMAP(help));
780
f6bcfd97
BP
781 m_tbar->Realize();
782 }
783
784 LayoutChildren();
785}
786
5ef2e633
VZ
787void MyFrame::OnToggleToolbarSize(wxCommandEvent& WXUNUSED(event))
788{
789 m_smallToolbar = !m_smallToolbar;
ad9bb75f 790
5ef2e633 791 RecreateToolbar();
7fb23305
VZ
792}
793
98066234
VZ
794void MyFrame::OnToggleToolbarRows(wxCommandEvent& WXUNUSED(event))
795{
796 // m_rows may be only 1 or 2
797 m_rows = 3 - m_rows;
798
7a976304 799 GetToolBar()->SetRows(!(GetToolBar()->IsVertical()) ? m_rows : 10 / m_rows);
98066234 800
9fb35cf1 801 //RecreateToolbar(); -- this is unneeded
98066234
VZ
802}
803
6a1b3ead
VZ
804void MyFrame::OnToggleTooltips(wxCommandEvent& WXUNUSED(event))
805{
806 m_showTooltips = !m_showTooltips;
807
808 RecreateToolbar();
809}
810
8d0a7b56
VZ
811void MyFrame::OnToggleCustomDisabled(wxCommandEvent& WXUNUSED(event))
812{
813 m_useCustomDisabled = !m_useCustomDisabled;
814
815 RecreateToolbar();
816}
817
7a976304 818void MyFrame::OnChangeOrientation(wxCommandEvent& event)
7fb23305 819{
7a976304
VZ
820 switch( event.GetId() )
821 {
822 case IDM_TOOLBAR_LEFT_ORIENTATION:
823 m_toolbarPosition = TOOLBAR_LEFT;
824 break;
825 case IDM_TOOLBAR_TOP_ORIENTATION:
826 m_toolbarPosition = TOOLBAR_TOP;
827 break;
828 case IDM_TOOLBAR_RIGHT_ORIENTATION:
829 m_toolbarPosition = TOOLBAR_RIGHT;
830 break;
831 case IDM_TOOLBAR_BOTTOM_ORIENTATION:
832 m_toolbarPosition = TOOLBAR_BOTTOM;
833 break;
834 }
5ef2e633 835 RecreateToolbar();
14d1ccd8
JS
836}
837
47908e25 838void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
14d1ccd8 839{
bc2ec626 840 Close(true);
14d1ccd8
JS
841}
842
e08bbf37 843void MyFrame::OnAbout(wxCommandEvent& event)
14d1ccd8 844{
e08bbf37
VZ
845 if ( event.IsChecked() )
846 m_textWindow->WriteText( _T("Help button down now.\n") );
847 else
848 m_textWindow->WriteText( _T("Help button up now.\n") );
849
be5a51fb 850 (void)wxMessageBox(_T("wxWidgets toolbar sample"), _T("About wxToolBar"));
13437238 851}
14d1ccd8 852
13437238
JS
853void MyFrame::OnToolLeftClick(wxCommandEvent& event)
854{
e179bd65
RR
855 wxString str;
856 str.Printf( _T("Clicked on tool %d\n"), event.GetId());
857 m_textWindow->WriteText( str );
ad9bb75f 858
e179bd65
RR
859 if (event.GetId() == wxID_COPY)
860 {
7fb23305 861 DoEnablePrint();
e179bd65 862 }
ad9bb75f 863
e179bd65
RR
864 if (event.GetId() == wxID_CUT)
865 {
7fb23305 866 DoToggleHelp();
e179bd65 867 }
1c4f8f8d 868
97d7bfb8
RR
869 if (event.GetId() == wxID_PRINT)
870 {
871 DoDeletePrint();
872 }
14d1ccd8
JS
873}
874
e052a316
VZ
875void MyFrame::OnToolRightClick(wxCommandEvent& event)
876{
877 m_textWindow->AppendText(
60c474a0
MB
878 wxString::Format(_T("Tool %d right clicked.\n"),
879 (int) event.GetInt()));
e052a316
VZ
880}
881
1c383dba
VZ
882void MyFrame::OnCombo(wxCommandEvent& event)
883{
884 wxLogStatus(_T("Combobox string '%s' selected"), event.GetString().c_str());
885}
886
7fb23305
VZ
887void MyFrame::DoEnablePrint()
888{
2b5f62a0
VZ
889 if ( !m_nPrint )
890 return;
891
ad4ae6ed 892 wxToolBarBase *tb = GetToolBar();
2b5f62a0 893 tb->EnableTool(wxID_PRINT, !tb->GetToolEnabled(wxID_PRINT));
7fb23305
VZ
894}
895
97d7bfb8
RR
896void MyFrame::DoDeletePrint()
897{
2b5f62a0
VZ
898 if ( !m_nPrint )
899 return;
1c4f8f8d 900
2b5f62a0 901 wxToolBarBase *tb = GetToolBar();
97d7bfb8 902 tb->DeleteTool( wxID_PRINT );
2b5f62a0
VZ
903
904 m_nPrint--;
97d7bfb8
RR
905}
906
7fb23305
VZ
907void MyFrame::DoToggleHelp()
908{
ad4ae6ed 909 wxToolBarBase *tb = GetToolBar();
7fb23305
VZ
910 tb->ToggleTool( wxID_HELP, !tb->GetToolState( wxID_HELP ) );
911}
912
5ef2e633
VZ
913void MyFrame::OnUpdateCopyAndCut(wxUpdateUIEvent& event)
914{
96dc4236
VZ
915 event.Enable( m_textWindow->CanCopy() );
916}
917
918void MyFrame::OnUpdateToggleHorzText(wxUpdateUIEvent& event)
919{
920 wxToolBar *tbar = GetToolBar();
921 event.Enable( tbar &&
922 tbar->HasFlag(wxTB_TEXT) &&
923 !tbar->HasFlag(wxTB_NOICONS) );
5ef2e633
VZ
924}
925
a1f79c1e
VZ
926void MyFrame::OnChangeToolTip(wxCommandEvent& WXUNUSED(event))
927{
928 GetToolBar()->SetToolShortHelp(wxID_NEW, _T("New toolbar button"));
929}
930
ec483b11
VZ
931void MyFrame::OnToolbarStyle(wxCommandEvent& event)
932{
933 long style = GetToolBar()->GetWindowStyle();
934 style &= ~(wxTB_NOICONS | wxTB_TEXT);
935
936 switch ( event.GetId() )
937 {
938 case IDM_TOOLBAR_SHOW_TEXT:
939 style |= wxTB_NOICONS | wxTB_TEXT;
940 break;
941
942 case IDM_TOOLBAR_SHOW_ICONS:
943 // nothing to do
944 break;
945
946 case IDM_TOOLBAR_SHOW_BOTH:
947 style |= wxTB_TEXT;
948 }
949
950 GetToolBar()->SetWindowStyle(style);
951}
952
5e3b8b93
VZ
953void MyFrame::OnToolbarCustomBitmap(wxCommandEvent& WXUNUSED(event))
954{
955 m_pathBmp = wxFileSelector(_T("Custom bitmap path"));
956
957 RecreateToolbar();
958}
959
bdc72a22
VZ
960void MyFrame::OnInsertPrint(wxCommandEvent& WXUNUSED(event))
961{
2b5f62a0 962 m_nPrint++;
bdc72a22 963
2b5f62a0
VZ
964 wxToolBarBase *tb = GetToolBar();
965 tb->InsertTool(0, wxID_PRINT, _T("New print"),
966 wxBITMAP(print), wxNullBitmap,
967 wxITEM_NORMAL,
968 _T("Delete this tool"),
969 _T("This button was inserted into the toolbar"));
970
971 // must call Realize() after adding a new button
972 tb->Realize();
bdc72a22
VZ
973}
974
3bf4189d
VZ
975void MyFrame::OnToggleRadioBtn(wxCommandEvent& event)
976{
977 if ( m_tbar )
978 {
979 m_tbar->ToggleTool(IDM_TOOLBAR_OTHER_1 +
980 event.GetId() - IDM_TOOLBAR_TOGGLERADIOBTN1, true);
981 }
982}
a9a0ceca
VZ
983
984void MyFrame::OnToolDropdown(wxCommandEvent& event)
985{
986 wxString str;
987 str.Printf( _T("Dropdown on tool %d\n"), event.GetId());
988 m_textWindow->WriteText( str );
989
990 event.Skip();
991}