+
+void MyFrame::OnFromPoint(wxCommandEvent& WXUNUSED(event))
+{
+ SetStatusText(_T("Press the mouse anywhere..."));
+
+ CaptureMouse();
+}
+
+void MyFrame::OnFullScreen(wxCommandEvent& event)
+{
+ ShowFullScreen(event.IsChecked());
+}
+
+void MyFrame::OnChangeMode(wxCommandEvent& event)
+{
+ wxDisplay dpy(m_notebook->GetSelection());
+
+ // you wouldn't write this in real code, would you?
+ if ( !dpy.ChangeMode(((MyVideoModeClientData *)
+ wxDynamicCast(event.GetEventObject(), wxChoice)->
+ GetClientObject(event.GetInt()))->mode) )
+ {
+ wxLogError(_T("Changing video mode failed!"));
+ }
+}
+
+void MyFrame::OnResetMode(wxCommandEvent& WXUNUSED(event))
+{
+ wxDisplay dpy(m_notebook->GetSelection());
+
+ dpy.ResetMode();
+}
+
+void MyFrame::OnLeftClick(wxMouseEvent& event)
+{
+ if ( HasCapture() )
+ {
+ // mouse events are in client coords, wxDisplay works in screen ones
+ const wxPoint ptScreen = ClientToScreen(event.GetPosition());
+ int dpy = wxDisplay::GetFromPoint(ptScreen);
+ if ( dpy == wxNOT_FOUND )
+ {
+ wxLogError(_T("Mouse clicked outside of display!?"));
+ }
+
+ wxLogStatus(this, _T("Mouse clicked in display %d (at (%d, %d))"),
+ dpy, ptScreen.x, ptScreen.y);
+
+ ReleaseMouse();
+ }
+}
+
+void MyFrame::OnDisplayChanged(wxDisplayChangedEvent& event)
+{
+ // update the current mode text
+ for ( size_t n = 0; n < m_notebook->GetPageCount(); n++ )
+ {
+ wxStaticText *label = wxDynamicCast(m_notebook->GetPage(n)->
+ FindWindow(Display_CurrentMode),
+ wxStaticText);
+ if ( label )
+ label->SetLabel(VideoModeToText(wxDisplay(n).GetCurrentMode()));
+ }
+
+
+ wxLogStatus(this, _T("Display resolution was changed."));
+
+ event.Skip();
+}
+