+
+void MyFrame::OnFromPoint(wxCommandEvent& WXUNUSED(event))
+{
+#if wxUSE_STATUSBAR
+ SetStatusText(wxT("Press the mouse anywhere..."));
+#endif // wxUSE_STATUSBAR
+
+ CaptureMouse();
+}
+
+void MyFrame::OnFullScreen(wxCommandEvent& event)
+{
+ ShowFullScreen(event.IsChecked());
+}
+
+#if wxUSE_DISPLAY
+
+void MyFrame::OnChangeMode(wxCommandEvent& event)
+{
+ wxDisplay dpy(m_book->GetSelection());
+
+ // you wouldn't write this in real code, would you?
+ if ( !dpy.ChangeMode(((MyVideoModeClientData *)
+ wxDynamicCast(event.GetEventObject(), wxChoice)->
+ GetClientObject(event.GetInt()))->mode) )
+ {
+ wxLogError(wxT("Changing video mode failed!"));
+ }
+}
+
+void MyFrame::OnResetMode(wxCommandEvent& WXUNUSED(event))
+{
+ wxDisplay dpy(m_book->GetSelection());
+
+ dpy.ResetMode();
+}
+
+#endif // wxUSE_DISPLAY
+
+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(wxT("Mouse clicked outside of display!?"));
+ }
+
+ wxLogStatus(this, wxT("Mouse clicked in display %d (at (%d, %d))"),
+ dpy, ptScreen.x, ptScreen.y);
+
+ ReleaseMouse();
+ }
+}
+
+#if wxUSE_DISPLAY
+
+void MyFrame::OnDisplayChanged(wxDisplayChangedEvent& event)
+{
+ // update the current mode text
+ for ( size_t n = 0; n < m_book->GetPageCount(); n++ )
+ {
+ wxStaticText *label = wxDynamicCast(m_book->GetPage(n)->
+ FindWindow(Display_CurrentMode),
+ wxStaticText);
+ if ( label )
+ label->SetLabel(VideoModeToText(wxDisplay(n).GetCurrentMode()));
+ }
+
+
+ wxLogStatus(this, wxT("Display resolution was changed."));
+
+ event.Skip();
+}
+
+#endif // wxUSE_DISPLAY