]>
git.saurik.com Git - wxWidgets.git/blob - samples/menu/menu.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: samples/menu.cpp
3 // Purpose: wxMenu/wxMenuBar sample
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 1999 Vadim Zeitlin
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 // For compilers that support precompilation, includes "wx/wx.h".
21 #include "wx/wxprec.h"
31 #include "wx/msgdlg.h"
33 #include "wx/textctrl.h"
34 #include "wx/textdlg.h"
39 #error "menu sample requires wxUSE_MENUS=1"
44 // ----------------------------------------------------------------------------
46 // ----------------------------------------------------------------------------
48 // Define a new application
49 class MyApp
: public wxApp
56 class MyFrame
: public wxFrame
63 void LogMenuEvent(const wxCommandEvent
& event
);
66 void OnQuit(wxCommandEvent
& event
);
67 void OnClearLog(wxCommandEvent
& event
);
69 void OnAbout(wxCommandEvent
& event
);
71 void OnDummy(wxCommandEvent
& event
);
73 void OnAppendMenuItem(wxCommandEvent
& event
);
74 void OnAppendSubMenu(wxCommandEvent
& event
);
75 void OnDeleteMenuItem(wxCommandEvent
& event
);
76 void OnInsertMenuItem(wxCommandEvent
& event
);
77 void OnCheckMenuItem(wxCommandEvent
& event
);
78 void OnEnableMenuItem(wxCommandEvent
& event
);
79 void OnGetLabelMenuItem(wxCommandEvent
& event
);
80 void OnSetLabelMenuItem(wxCommandEvent
& event
);
81 void OnGetMenuItemInfo(wxCommandEvent
& event
);
83 void OnAppendMenu(wxCommandEvent
& event
);
84 void OnInsertMenu(wxCommandEvent
& event
);
85 void OnDeleteMenu(wxCommandEvent
& event
);
86 void OnToggleMenu(wxCommandEvent
& event
);
87 void OnEnableMenu(wxCommandEvent
& event
);
88 void OnGetLabelMenu(wxCommandEvent
& event
);
89 void OnSetLabelMenu(wxCommandEvent
& event
);
91 void OnTestNormal(wxCommandEvent
& event
);
92 void OnTestCheck(wxCommandEvent
& event
);
93 void OnTestRadio(wxCommandEvent
& event
);
96 void OnContextMenu(wxContextMenuEvent
& event
)
97 { ShowContextMenu(ScreenToClient(event
.GetPosition())); }
99 void OnRightUp(wxMouseEvent
& event
)
100 { ShowContextMenu(event
.GetPosition()); }
103 void OnMenuOpen(wxMenuEvent
& event
)
104 { LogMenuOpenOrClose(event
, _T("opened")); }
105 void OnMenuClose(wxMenuEvent
& event
)
106 { LogMenuOpenOrClose(event
, _T("closed")); }
108 void OnUpdateCheckMenuItemUI(wxUpdateUIEvent
& event
);
110 void OnSize(wxSizeEvent
& event
);
113 void LogMenuOpenOrClose(const wxMenuEvent
& event
, const wxChar
*what
);
114 void ShowContextMenu(const wxPoint
& pos
);
116 wxMenu
*CreateDummyMenu(wxString
*title
);
118 wxMenuItem
*GetLastMenuItem() const;
120 // the menu previously detached from the menubar (may be NULL)
123 // the count of dummy menus already created
126 // the control used for logging
127 wxTextCtrl
*m_textctrl
;
129 // the previous log target
132 DECLARE_EVENT_TABLE()
135 // A small helper class which intercepts all menu events and logs them
136 class MyEvtHandler
: public wxEvtHandler
139 MyEvtHandler(MyFrame
*frame
) { m_frame
= frame
; }
141 void OnMenuEvent(wxCommandEvent
& event
)
143 m_frame
->LogMenuEvent(event
);
151 DECLARE_EVENT_TABLE()
154 // ----------------------------------------------------------------------------
156 // ----------------------------------------------------------------------------
160 Menu_File_Quit
= 100,
163 Menu_MenuBar_Toggle
= 200,
168 Menu_MenuBar_GetLabel
,
169 Menu_MenuBar_SetLabel
,
171 Menu_Menu_Append
= 300,
181 Menu_Test_Normal
= 400,
187 Menu_Dummy_First
= 500,
193 Menu_Help_About
= 1000,
195 Menu_Popup_ToBeDeleted
= 2000,
196 Menu_Popup_ToBeGreyed
,
197 Menu_Popup_ToBeChecked
,
203 // ----------------------------------------------------------------------------
205 // ----------------------------------------------------------------------------
207 BEGIN_EVENT_TABLE(MyFrame
, wxFrame
)
208 EVT_MENU(Menu_File_Quit
, MyFrame::OnQuit
)
209 EVT_MENU(Menu_File_ClearLog
, MyFrame::OnClearLog
)
211 EVT_MENU(Menu_Help_About
, MyFrame::OnAbout
)
213 EVT_MENU(Menu_MenuBar_Toggle
, MyFrame::OnToggleMenu
)
214 EVT_MENU(Menu_MenuBar_Append
, MyFrame::OnAppendMenu
)
215 EVT_MENU(Menu_MenuBar_Insert
, MyFrame::OnInsertMenu
)
216 EVT_MENU(Menu_MenuBar_Delete
, MyFrame::OnDeleteMenu
)
217 EVT_MENU(Menu_MenuBar_Enable
, MyFrame::OnEnableMenu
)
218 EVT_MENU(Menu_MenuBar_GetLabel
, MyFrame::OnGetLabelMenu
)
219 EVT_MENU(Menu_MenuBar_SetLabel
, MyFrame::OnSetLabelMenu
)
221 EVT_MENU(Menu_Menu_Append
, MyFrame::OnAppendMenuItem
)
222 EVT_MENU(Menu_Menu_AppendSub
, MyFrame::OnAppendSubMenu
)
223 EVT_MENU(Menu_Menu_Insert
, MyFrame::OnInsertMenuItem
)
224 EVT_MENU(Menu_Menu_Delete
, MyFrame::OnDeleteMenuItem
)
225 EVT_MENU(Menu_Menu_Enable
, MyFrame::OnEnableMenuItem
)
226 EVT_MENU(Menu_Menu_Check
, MyFrame::OnCheckMenuItem
)
227 EVT_MENU(Menu_Menu_GetLabel
, MyFrame::OnGetLabelMenuItem
)
228 EVT_MENU(Menu_Menu_SetLabel
, MyFrame::OnSetLabelMenuItem
)
229 EVT_MENU(Menu_Menu_GetInfo
, MyFrame::OnGetMenuItemInfo
)
231 EVT_MENU(Menu_Test_Normal
, MyFrame::OnTestNormal
)
232 EVT_MENU(Menu_Test_Check
, MyFrame::OnTestCheck
)
233 EVT_MENU(Menu_Test_Radio1
, MyFrame::OnTestRadio
)
234 EVT_MENU(Menu_Test_Radio2
, MyFrame::OnTestRadio
)
235 EVT_MENU(Menu_Test_Radio3
, MyFrame::OnTestRadio
)
237 EVT_MENU_RANGE(Menu_Dummy_First
, Menu_Dummy_Last
, MyFrame::OnDummy
)
239 EVT_UPDATE_UI(Menu_Menu_Check
, MyFrame::OnUpdateCheckMenuItemUI
)
242 EVT_CONTEXT_MENU(MyFrame::OnContextMenu
)
244 EVT_RIGHT_UP(MyFrame::OnRightUp
)
247 EVT_MENU_OPEN(MyFrame::OnMenuOpen
)
248 EVT_MENU_CLOSE(MyFrame::OnMenuClose
)
250 EVT_SIZE(MyFrame::OnSize
)
253 BEGIN_EVENT_TABLE(MyEvtHandler
, wxEvtHandler
)
254 EVT_MENU(-1, MyEvtHandler::OnMenuEvent
)
257 // ============================================================================
259 // ============================================================================
261 // ----------------------------------------------------------------------------
263 // ----------------------------------------------------------------------------
267 // The `main program' equivalent, creating the windows and returning the
271 // Create the main frame window
272 MyFrame
* frame
= new MyFrame
;
277 frame
->SetStatusText("Welcome to wxWindows menu sample");
278 #endif // wxUSE_STATUSBAR
285 // ----------------------------------------------------------------------------
287 // ----------------------------------------------------------------------------
289 // Define my frame constructor
291 : wxFrame((wxFrame
*)NULL
, -1, "wxWindows menu sample",
292 wxDefaultPosition
, wxSize(400, 250))
301 #endif // wxUSE_STATUSBAR
303 // create the menubar
304 wxMenu
*fileMenu
= new wxMenu
;
306 wxMenuItem
*item
= new wxMenuItem(fileMenu
, Menu_File_ClearLog
,
307 "Clear &log\tCtrl-L");
308 item
->SetBitmap(copy_xpm
);
309 fileMenu
->Append(item
);
310 fileMenu
->AppendSeparator();
311 fileMenu
->Append(Menu_File_Quit
, "E&xit\tAlt-X", "Quit menu sample");
313 wxMenu
*menubarMenu
= new wxMenu
;
314 menubarMenu
->Append(Menu_MenuBar_Append
, "&Append menu\tCtrl-A",
315 "Append a menu to the menubar");
316 menubarMenu
->Append(Menu_MenuBar_Insert
, "&Insert menu\tCtrl-I",
317 "Insert a menu into the menubar");
318 menubarMenu
->Append(Menu_MenuBar_Delete
, "&Delete menu\tCtrl-D",
319 "Delete the last menu from the menubar");
320 menubarMenu
->Append(Menu_MenuBar_Toggle
, "&Toggle menu\tCtrl-T",
321 "Toggle the first menu in the menubar", TRUE
);
322 menubarMenu
->AppendSeparator();
323 menubarMenu
->Append(Menu_MenuBar_Enable
, "&Enable menu\tCtrl-E",
324 "Enable or disable the last menu", TRUE
);
325 menubarMenu
->AppendSeparator();
326 menubarMenu
->Append(Menu_MenuBar_GetLabel
, "&Get menu label\tCtrl-G",
327 "Get the label of the last menu");
328 menubarMenu
->Append(Menu_MenuBar_SetLabel
, "&Set menu label\tCtrl-S",
329 "Change the label of the last menu");
331 wxMenu
*menuMenu
= new wxMenu
;
332 menuMenu
->Append(Menu_Menu_Append
, "&Append menu item\tAlt-A",
333 "Append a menu item to the last menu");
334 menuMenu
->Append(Menu_Menu_AppendSub
, "&Append sub menu\tAlt-S",
335 "Append a sub menu to the last menu");
336 menuMenu
->Append(Menu_Menu_Insert
, "&Insert menu item\tAlt-I",
337 "Insert a menu item in head of the last menu");
338 menuMenu
->Append(Menu_Menu_Delete
, "&Delete menu item\tAlt-D",
339 "Delete the last menu item from the last menu");
340 menuMenu
->AppendSeparator();
341 menuMenu
->Append(Menu_Menu_Enable
, "&Enable menu item\tAlt-E",
342 "Enable or disable the last menu item", TRUE
);
343 menuMenu
->Append(Menu_Menu_Check
, "&Check menu item\tAlt-C",
344 "Check or uncheck the last menu item", TRUE
);
345 menuMenu
->AppendSeparator();
346 menuMenu
->Append(Menu_Menu_GetLabel
, "&Get menu item label\tAlt-G",
347 "Get the label of the last menu item");
348 menuMenu
->Append(Menu_Menu_SetLabel
, "&Set menu item label\tAlt-S",
349 "Change the label of the last menu item");
350 menuMenu
->AppendSeparator();
351 menuMenu
->Append(Menu_Menu_GetInfo
, "Get menu item in&fo\tAlt-F",
352 "Show the state of the last menu item");
354 wxMenu
*testMenu
= new wxMenu
;
355 testMenu
->Append(Menu_Test_Normal
, "&Normal item");
356 testMenu
->AppendSeparator();
357 testMenu
->AppendCheckItem(Menu_Test_Check
, "&Check item");
358 testMenu
->AppendSeparator();
359 testMenu
->AppendRadioItem(Menu_Test_Radio1
, "Radio item &1");
360 testMenu
->AppendRadioItem(Menu_Test_Radio2
, "Radio item &2");
361 testMenu
->AppendRadioItem(Menu_Test_Radio3
, "Radio item &3");
363 wxMenu
*helpMenu
= new wxMenu
;
364 helpMenu
->Append(Menu_Help_About
, "&About\tF1", "About menu sample");
366 wxMenuBar
* menuBar
= new wxMenuBar( wxMB_DOCKABLE
);
368 menuBar
->Append(fileMenu
, "&File");
369 menuBar
->Append(menubarMenu
, "Menu&bar");
370 menuBar
->Append(menuMenu
, "&Menu");
371 menuBar
->Append(testMenu
, "&Test");
372 menuBar
->Append(helpMenu
, "&Help");
374 // these items should be initially checked
375 menuBar
->Check(Menu_MenuBar_Toggle
, TRUE
);
376 menuBar
->Check(Menu_MenuBar_Enable
, TRUE
);
377 menuBar
->Check(Menu_Menu_Enable
, TRUE
);
378 menuBar
->Check(Menu_Menu_Check
, FALSE
);
380 // associate the menu bar with the frame
383 // intercept all menu events and log them in this custom event handler
384 PushEventHandler(new MyEvtHandler(this));
386 // create the log text window
387 m_textctrl
= new wxTextCtrl(this, -1, _T(""),
388 wxDefaultPosition
, wxDefaultSize
,
390 m_textctrl
->SetEditable(FALSE
);
392 wxLog::SetTimestamp(NULL
);
393 m_logOld
= wxLog::SetActiveTarget(new wxLogTextCtrl(m_textctrl
));
395 wxLogMessage(_T("Brief explanations: the commands or the \"Menu\" menu ")
396 _T("append/insert/delete items to/from the last menu.\n")
397 _T("The commands from \"Menubar\" menu work with the ")
398 _T("menubar itself.\n\n")
399 _T("Right click the band below to test popup menus.\n"));
406 // delete the event handler installed in ctor
407 PopEventHandler(TRUE
);
409 // restore old logger
410 delete wxLog::SetActiveTarget(m_logOld
);
413 wxMenu
*MyFrame::CreateDummyMenu(wxString
*title
)
415 wxMenu
*menu
= new wxMenu
;
416 menu
->Append(Menu_Dummy_First
, "&First item\tCtrl-F1");
417 menu
->AppendSeparator();
418 menu
->Append(Menu_Dummy_Second
, "&Second item\tCtrl-F2", "", TRUE
);
422 title
->Printf(wxT("Dummy menu &%d"), ++m_countDummy
);
428 wxMenuItem
*MyFrame::GetLastMenuItem() const
430 wxMenuBar
*menubar
= GetMenuBar();
431 wxMenu
*menu
= menubar
->GetMenu(menubar
->GetMenuCount() - 1);
433 wxMenuItemList::Node
*node
= menu
->GetMenuItems().GetLast();
436 wxLogWarning(wxT("No last item in the last menu!"));
442 return node
->GetData();
446 void MyFrame::LogMenuEvent(const wxCommandEvent
& event
)
448 int id
= event
.GetId();
449 if ( !GetMenuBar()->FindItem(id
) )
452 wxString msg
= wxString::Format(wxT("Menu command %d"), id
);
453 if ( GetMenuBar()->FindItem(id
)->IsCheckable() )
455 msg
+= wxString::Format(wxT(" (the item is currently %schecked)"),
456 event
.IsChecked() ? "" : "not ");
462 // ----------------------------------------------------------------------------
464 // ----------------------------------------------------------------------------
466 void MyFrame::OnQuit(wxCommandEvent
& WXUNUSED(event
))
471 void MyFrame::OnClearLog(wxCommandEvent
& WXUNUSED(event
))
476 void MyFrame::OnAbout(wxCommandEvent
& WXUNUSED(event
))
478 (void)wxMessageBox("wxWindows menu sample\n© 1999-2001 Vadim Zeitlin",
479 "About wxWindows menu sample",
483 void MyFrame::OnDeleteMenu(wxCommandEvent
& WXUNUSED(event
))
485 wxMenuBar
*mbar
= GetMenuBar();
487 size_t count
= mbar
->GetMenuCount();
490 // don't let delete the first 2 menus
491 wxLogError(wxT("Can't delete any more menus"));
495 delete mbar
->Remove(count
- 1);
499 void MyFrame::OnInsertMenu(wxCommandEvent
& WXUNUSED(event
))
502 wxMenu
*menu
= CreateDummyMenu(&title
);
503 GetMenuBar()->Insert(0, menu
, title
);
506 void MyFrame::OnAppendMenu(wxCommandEvent
& WXUNUSED(event
))
509 wxMenu
*menu
= CreateDummyMenu(&title
);
510 GetMenuBar()->Append(menu
, title
);
513 void MyFrame::OnToggleMenu(wxCommandEvent
& WXUNUSED(event
))
515 wxMenuBar
*mbar
= GetMenuBar();
519 m_menu
= mbar
->Remove(0);
524 mbar
->Insert(0, m_menu
, "&File");
529 void MyFrame::OnEnableMenu(wxCommandEvent
& event
)
531 wxMenuBar
*mbar
= GetMenuBar();
532 size_t count
= mbar
->GetMenuCount();
534 mbar
->EnableTop(count
- 1, event
.IsChecked());
537 void MyFrame::OnGetLabelMenu(wxCommandEvent
& WXUNUSED(event
))
539 wxMenuBar
*mbar
= GetMenuBar();
540 size_t count
= mbar
->GetMenuCount();
542 wxCHECK_RET( count
, _T("no last menu?") );
544 wxLogMessage(wxT("The label of the last menu item is '%s'"),
545 mbar
->GetLabelTop(count
- 1).c_str());
548 void MyFrame::OnSetLabelMenu(wxCommandEvent
& WXUNUSED(event
))
550 wxMenuBar
*mbar
= GetMenuBar();
551 size_t count
= mbar
->GetMenuCount();
553 wxCHECK_RET( count
, _T("no last menu?") );
555 wxString label
= wxGetTextFromUser
557 _T("Enter new label: "),
558 _T("Change last menu text"),
559 mbar
->GetLabelTop(count
- 1),
563 if ( !label
.empty() )
565 mbar
->SetLabelTop(count
- 1, label
);
569 void MyFrame::OnDummy(wxCommandEvent
& event
)
571 wxLogMessage(wxT("Dummy item #%d"), event
.GetId() - Menu_Dummy_First
+ 1);
574 void MyFrame::OnAppendMenuItem(wxCommandEvent
& WXUNUSED(event
))
576 wxMenuBar
*menubar
= GetMenuBar();
577 wxMenu
*menu
= menubar
->GetMenu(menubar
->GetMenuCount() - 1);
579 menu
->AppendSeparator();
580 menu
->Append(Menu_Dummy_Third
, "&Third dummy item\tCtrl-F3",
581 "Checkable item", TRUE
);
584 void MyFrame::OnAppendSubMenu(wxCommandEvent
& WXUNUSED(event
))
586 wxMenuBar
*menubar
= GetMenuBar();
588 wxMenu
*menu
= menubar
->GetMenu(menubar
->GetMenuCount() - 1);
590 menu
->Append(Menu_Dummy_Last
, "&Dummy sub menu",
591 CreateDummyMenu(NULL
), "Dummy sub menu help");
594 void MyFrame::OnDeleteMenuItem(wxCommandEvent
& WXUNUSED(event
))
596 wxMenuBar
*menubar
= GetMenuBar();
597 wxMenu
*menu
= menubar
->GetMenu(menubar
->GetMenuCount() - 1);
599 size_t count
= menu
->GetMenuItemCount();
602 wxLogWarning(wxT("No items to delete!"));
606 menu
->Destroy(menu
->GetMenuItems().Item(count
- 1)->GetData());
610 void MyFrame::OnInsertMenuItem(wxCommandEvent
& WXUNUSED(event
))
612 wxMenuBar
*menubar
= GetMenuBar();
613 wxMenu
*menu
= menubar
->GetMenu(menubar
->GetMenuCount() - 1);
615 menu
->Insert(0, wxMenuItem::New(menu
, Menu_Dummy_Fourth
,
616 "Fourth dummy item\tCtrl-F4"));
617 menu
->Insert(1, wxMenuItem::New(menu
, wxID_SEPARATOR
, ""));
620 void MyFrame::OnEnableMenuItem(wxCommandEvent
& WXUNUSED(event
))
622 wxMenuItem
*item
= GetLastMenuItem();
626 item
->Enable(!item
->IsEnabled());
630 void MyFrame::OnCheckMenuItem(wxCommandEvent
& WXUNUSED(event
))
632 wxMenuItem
*item
= GetLastMenuItem();
637 void MyFrame::OnUpdateCheckMenuItemUI(wxUpdateUIEvent
& event
)
641 wxMenuItem
*item
= GetLastMenuItem();
643 event
.Enable(item
&& item
->IsCheckable());
646 void MyFrame::OnGetLabelMenuItem(wxCommandEvent
& WXUNUSED(event
))
648 wxMenuItem
*item
= GetLastMenuItem();
652 wxLogMessage(wxT("The label of the last menu item is '%s'"),
653 item
->GetLabel().c_str());
657 void MyFrame::OnSetLabelMenuItem(wxCommandEvent
& WXUNUSED(event
))
659 wxMenuItem
*item
= GetLastMenuItem();
663 wxString label
= wxGetTextFromUser
665 _T("Enter new label: "),
666 _T("Change last menu item text"),
671 if ( !label
.empty() )
673 item
->SetText(label
);
678 void MyFrame::OnGetMenuItemInfo(wxCommandEvent
& WXUNUSED(event
))
680 wxMenuItem
*item
= GetLastMenuItem();
685 msg
<< "The item is " << (item
->IsEnabled() ? "enabled"
689 if ( item
->IsCheckable() )
691 msg
<< "It is checkable and " << (item
->IsChecked() ? "" : "un")
696 wxAcceleratorEntry
*accel
= item
->GetAccel();
699 msg
<< "Its accelerator is ";
701 int flags
= accel
->GetFlags();
702 if ( flags
& wxACCEL_ALT
)
704 if ( flags
& wxACCEL_CTRL
)
706 if ( flags
& wxACCEL_SHIFT
)
707 msg
<< wxT("Shift-");
709 int code
= accel
->GetKeyCode();
724 msg
<< wxT('F') << code
- WXK_F1
+ 1;
727 // if there are any other keys wxGetAccelFromString() may return,
728 // we should process them here
731 if ( wxIsalnum(code
) )
738 wxFAIL_MSG( wxT("unknown keyboard accel") );
745 msg
<< "It doesn't have an accelerator";
747 #endif // wxUSE_ACCEL
753 void MyFrame::ShowContextMenu(const wxPoint
& pos
)
755 wxMenu
menu("Test popup");
757 menu
.Append(Menu_Help_About
, "&About");
758 menu
.Append(Menu_Popup_Submenu
, "&Submenu", CreateDummyMenu(NULL
));
759 menu
.Append(Menu_Popup_ToBeDeleted
, "To be &deleted");
760 menu
.Append(Menu_Popup_ToBeChecked
, "To be &checked", "", TRUE
);
761 menu
.Append(Menu_Popup_ToBeGreyed
, "To be &greyed");
762 menu
.AppendSeparator();
763 menu
.Append(Menu_File_Quit
, "E&xit");
765 menu
.Delete(Menu_Popup_ToBeDeleted
);
766 menu
.Check(Menu_Popup_ToBeChecked
, TRUE
);
767 menu
.Enable(Menu_Popup_ToBeGreyed
, FALSE
);
769 PopupMenu(&menu
, pos
.x
, pos
.y
);
771 // test for destroying items in popup menus
772 #if 0 // doesn't work in wxGTK!
773 menu
.Destroy(Menu_Popup_Submenu
);
775 PopupMenu( &menu
, event
.GetX(), event
.GetY() );
779 void MyFrame::OnTestNormal(wxCommandEvent
& event
)
781 wxLogMessage(_T("Normal item selected"));
784 void MyFrame::OnTestCheck(wxCommandEvent
& event
)
786 wxLogMessage(_T("Check item %schecked"),
787 event
.IsChecked() ? _T("") : _T("un"));
790 void MyFrame::OnTestRadio(wxCommandEvent
& event
)
792 wxLogMessage(_T("Radio item %d selected"),
793 event
.GetId() - Menu_Test_Radio1
+ 1);
796 void MyFrame::LogMenuOpenOrClose(const wxMenuEvent
& event
, const wxChar
*what
)
798 wxLogStatus(this, _T("A %smenu has been %s."),
799 event
.IsPopup() ? _T("popup ") : _T(""), what
);
802 void MyFrame::OnSize(wxSizeEvent
& event
)
807 // leave a band below for popup menu testing
808 wxSize size
= GetClientSize();
809 m_textctrl
->SetSize(0, 0, size
.x
, (3*size
.y
)/4);
811 // this is really ugly but we have to do it as we can't just call
812 // event.Skip() because wxFrameBase would make the text control fill the
814 #ifdef __WXUNIVERSAL__
816 #endif // __WXUNIVERSAL__