git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36956
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
#include "wx/wx.h"
#endif
#include "wx/wx.h"
#endif
-#if !wxUSE_DISPLAY
- #error "To compile this sample you must build the library with wxUSE_DISPLAY set to 1"
-#endif
-
#include "wx/bookctrl.h"
#include "wx/display.h"
#include "wx/bookctrl.h"
#include "wx/display.h"
void OnLeftClick(wxMouseEvent& event);
void OnLeftClick(wxMouseEvent& event);
void OnDisplayChanged(wxDisplayChangedEvent& event);
void OnDisplayChanged(wxDisplayChangedEvent& event);
// convert video mode to textual description
wxString VideoModeToText(const wxVideoMode& mode);
// convert video mode to textual description
wxString VideoModeToText(const wxVideoMode& mode);
// GUI controls
wxBookCtrl *m_book;
// GUI controls
wxBookCtrl *m_book;
EVT_LEFT_UP(MyFrame::OnLeftClick)
EVT_LEFT_UP(MyFrame::OnLeftClick)
EVT_DISPLAY_CHANGED(MyFrame::OnDisplayChanged)
EVT_DISPLAY_CHANGED(MyFrame::OnDisplayChanged)
END_EVENT_TABLE()
// Create a new application object: this macro will allow wxWidgets to create
END_EVENT_TABLE()
// Create a new application object: this macro will allow wxWidgets to create
// 'Main program' equivalent: the program execution "starts" here
bool MyApp::OnInit()
{
// 'Main program' equivalent: the program execution "starts" here
bool MyApp::OnInit()
{
+#if !wxUSE_DISPLAY
+ wxMessageBox(_("Please recompile wxWidgets and this sample with wxUSE_DISPLAY set to 1."));
+ return false;
+#else
+
#ifdef __WXMSW__
if ( argc == 2 && !wxStricmp(argv[1], _T("/dx")) )
{
#ifdef __WXMSW__
if ( argc == 2 && !wxStricmp(argv[1], _T("/dx")) )
{
// loop and the application will run. If we returned false here, the
// application would exit immediately.
return true;
// loop and the application will run. If we returned false here, the
// application would exit immediately.
return true;
}
// ----------------------------------------------------------------------------
}
// ----------------------------------------------------------------------------
CreateStatusBar();
#endif // wxUSE_STATUSBAR
CreateStatusBar();
#endif // wxUSE_STATUSBAR
// create child controls
wxPanel *panel = new wxPanel(this, wxID_ANY);
// create child controls
wxPanel *panel = new wxPanel(this, wxID_ANY);
panel->SetSizer(sizer);
sizer->Fit(this);
sizer->SetSizeHints(this);
panel->SetSizer(sizer);
sizer->Fit(this);
sizer->SetSizeHints(this);
wxString MyFrame::VideoModeToText(const wxVideoMode& mode)
{
wxString s;
wxString MyFrame::VideoModeToText(const wxVideoMode& mode)
{
wxString s;
void MyFrame::OnChangeMode(wxCommandEvent& event)
{
void MyFrame::OnChangeMode(wxCommandEvent& event)
{
wxDisplay dpy(m_book->GetSelection());
// you wouldn't write this in real code, would you?
wxDisplay dpy(m_book->GetSelection());
// you wouldn't write this in real code, would you?
{
wxLogError(_T("Changing video mode failed!"));
}
{
wxLogError(_T("Changing video mode failed!"));
}
}
void MyFrame::OnResetMode(wxCommandEvent& WXUNUSED(event))
{
}
void MyFrame::OnResetMode(wxCommandEvent& WXUNUSED(event))
{
wxDisplay dpy(m_book->GetSelection());
dpy.ResetMode();
wxDisplay dpy(m_book->GetSelection());
dpy.ResetMode();
}
void MyFrame::OnLeftClick(wxMouseEvent& event)
{
}
void MyFrame::OnLeftClick(wxMouseEvent& event)
{
if ( HasCapture() )
{
// mouse events are in client coords, wxDisplay works in screen ones
if ( HasCapture() )
{
// mouse events are in client coords, wxDisplay works in screen ones
void MyFrame::OnDisplayChanged(wxDisplayChangedEvent& event)
{
// update the current mode text
void MyFrame::OnDisplayChanged(wxDisplayChangedEvent& event)
{
// update the current mode text