+
+void MyFrame::OnTestCheck(wxCommandEvent& event)
+{
+ wxLogMessage(_T("Check item %schecked"),
+ event.IsChecked() ? _T("") : _T("un"));
+}
+
+void MyFrame::OnTestRadio(wxCommandEvent& event)
+{
+ wxLogMessage(_T("Radio item %d selected"),
+ event.GetId() - Menu_Test_Radio1 + 1);
+}
+
+#if USE_LOG_WINDOW
+void MyFrame::LogMenuOpenOrClose(const wxMenuEvent& event, const wxChar *what)
+{
+ wxString msg;
+ msg << _T("A ")
+ << ( event.IsPopup() ? _T("popup ") : _T("") )
+ << _T("menu has been ")
+ << what
+ << _T(".");
+
+ wxLogStatus(this, msg.c_str());
+}
+#endif
+
+void MyFrame::OnUpdateSubMenuNormal(wxUpdateUIEvent& event)
+{
+ event.Enable(false);
+}
+
+void MyFrame::OnUpdateSubMenuCheck(wxUpdateUIEvent& event)
+{
+ event.Enable(true);
+ event.Check(true);
+}
+
+void MyFrame::OnUpdateSubMenuRadio(wxUpdateUIEvent& event)
+{
+ int which = (event.GetId() - Menu_SubMenu_Radio1 + 1);
+ if (which == 2)
+ event.Check(true);
+ else
+ event.Check(false);
+}
+
+#if USE_CONTEXT_MENU
+void MyFrame::OnContextMenu(wxContextMenuEvent& event)
+{
+ wxPoint point = event.GetPosition();
+ // If from keyboard
+ if (point.x == -1 && point.y == -1) {
+ wxSize size = GetSize();
+ point.x = size.x / 2;
+ point.y = size.y / 2;
+ } else {
+ point = ScreenToClient(point);
+ }
+ ShowContextMenu(point);
+}
+#endif
+
+void MyFrame::OnSize(wxSizeEvent& WXUNUSED(event))
+{
+#if USE_LOG_WINDOW
+ if ( !m_textctrl )
+ return;
+
+ // leave a band below for popup menu testing
+ wxSize size = GetClientSize();
+ m_textctrl->SetSize(0, 0, size.x, (3*size.y)/4);
+#endif
+
+ // this is really ugly but we have to do it as we can't just call
+ // event.Skip() because wxFrameBase would make the text control fill the
+ // entire frame then
+#ifdef __WXUNIVERSAL__
+ PositionMenuBar();
+#endif // __WXUNIVERSAL__
+}
+