Merge branch 'display-unique-modes' of https://github.com/MaartenBent/wxWidgets
Return unique modes from wxDisplay::GetModes() and minor improvements to the display sample. See https://github.com/wxWidgets/wxWidgets/pull/1659
This commit is contained in:
@@ -35,7 +35,7 @@ if(WXGTK2)
|
|||||||
endif()
|
endif()
|
||||||
wx_add_sample(dialogs ${SAMPLE_DIALOGS_SRC} DATA tips.txt)
|
wx_add_sample(dialogs ${SAMPLE_DIALOGS_SRC} DATA tips.txt)
|
||||||
wx_add_sample(dialup nettest.cpp LIBRARIES net DEPENDS wxUSE_DIALUP_MANAGER)
|
wx_add_sample(dialup nettest.cpp LIBRARIES net DEPENDS wxUSE_DIALUP_MANAGER)
|
||||||
wx_add_sample(display DEPENDS wxUSE_DISPLAY)
|
wx_add_sample(display)
|
||||||
wx_add_sample(dnd dnd.cpp RES dnd.rc DATA wxwin.png DEPENDS wxUSE_DRAG_AND_DROP)
|
wx_add_sample(dnd dnd.cpp RES dnd.rc DATA wxwin.png DEPENDS wxUSE_DRAG_AND_DROP)
|
||||||
wx_add_sample(docview docview.cpp doc.cpp view.cpp docview.h doc.h view.h
|
wx_add_sample(docview docview.cpp doc.cpp view.cpp docview.h doc.h view.h
|
||||||
RES docview.rc LIBRARIES aui DEPENDS wxUSE_DOC_VIEW_ARCHITECTURE)
|
RES docview.rc LIBRARIES aui DEPENDS wxUSE_DOC_VIEW_ARCHITECTURE)
|
||||||
|
@@ -96,6 +96,7 @@ private:
|
|||||||
wxDECLARE_EVENT_TABLE();
|
wxDECLARE_EVENT_TABLE();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if wxUSE_DISPLAY
|
||||||
// Client data class for the choice control containing the video modes
|
// Client data class for the choice control containing the video modes
|
||||||
class MyVideoModeClientData : public wxClientData
|
class MyVideoModeClientData : public wxClientData
|
||||||
{
|
{
|
||||||
@@ -104,6 +105,7 @@ public:
|
|||||||
|
|
||||||
const wxVideoMode mode;
|
const wxVideoMode mode;
|
||||||
};
|
};
|
||||||
|
#endif // wxUSE_DISPLAY
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// constants
|
// constants
|
||||||
@@ -299,7 +301,7 @@ void MyFrame::PopuplateWithDisplayInfo()
|
|||||||
|
|
||||||
// add it to another sizer to have borders around it and button below
|
// add it to another sizer to have borders around it and button below
|
||||||
wxSizer *sizerTop = new wxBoxSizer(wxVERTICAL);
|
wxSizer *sizerTop = new wxBoxSizer(wxVERTICAL);
|
||||||
sizerTop->Add(sizer, 1, wxALL | wxEXPAND, 10);
|
sizerTop->Add(sizer, wxSizerFlags(1).Expand().DoubleBorder());
|
||||||
|
|
||||||
#if wxUSE_DISPLAY
|
#if wxUSE_DISPLAY
|
||||||
wxChoice *choiceModes = new wxChoice(page, Display_ChangeMode);
|
wxChoice *choiceModes = new wxChoice(page, Display_ChangeMode);
|
||||||
@@ -312,16 +314,18 @@ void MyFrame::PopuplateWithDisplayInfo()
|
|||||||
choiceModes->Append(VideoModeToText(mode),
|
choiceModes->Append(VideoModeToText(mode),
|
||||||
new MyVideoModeClientData(mode));
|
new MyVideoModeClientData(mode));
|
||||||
}
|
}
|
||||||
|
const wxString currentMode = VideoModeToText(display.GetCurrentMode());
|
||||||
|
choiceModes->SetStringSelection(currentMode);
|
||||||
|
|
||||||
sizer->Add(new wxStaticText(page, wxID_ANY, "&Modes: "));
|
sizer->Add(new wxStaticText(page, wxID_ANY, "&Modes: "),
|
||||||
sizer->Add(choiceModes, 0, wxEXPAND);
|
wxSizerFlags().CentreVertical());
|
||||||
|
sizer->Add(choiceModes, wxSizerFlags().Expand());
|
||||||
|
|
||||||
sizer->Add(new wxStaticText(page, wxID_ANY, "Current: "));
|
sizer->Add(new wxStaticText(page, wxID_ANY, "Current: "));
|
||||||
sizer->Add(new wxStaticText(page, Display_CurrentMode,
|
sizer->Add(new wxStaticText(page, Display_CurrentMode, currentMode));
|
||||||
VideoModeToText(display.GetCurrentMode())));
|
|
||||||
|
|
||||||
sizerTop->Add(new wxButton(page, Display_ResetMode, "&Reset mode"),
|
sizerTop->Add(new wxButton(page, Display_ResetMode, "&Reset mode"),
|
||||||
0, wxALL | wxCENTRE, 5);
|
wxSizerFlags().Centre().Border());
|
||||||
#endif // wxUSE_DISPLAY
|
#endif // wxUSE_DISPLAY
|
||||||
|
|
||||||
page->SetSizer(sizerTop);
|
page->SetSizer(sizerTop);
|
||||||
@@ -331,6 +335,7 @@ void MyFrame::PopuplateWithDisplayInfo()
|
|||||||
}
|
}
|
||||||
|
|
||||||
SetClientSize(m_book->GetBestSize());
|
SetClientSize(m_book->GetBestSize());
|
||||||
|
SetMinSize(GetSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
#if wxUSE_DISPLAY
|
#if wxUSE_DISPLAY
|
||||||
|
@@ -390,6 +390,14 @@ wxArrayVideoModes wxDisplayMSW::GetModes(const wxVideoMode& modeMatch) const
|
|||||||
::EnumDisplaySettings(deviceName, iModeNum, &dm);
|
::EnumDisplaySettings(deviceName, iModeNum, &dm);
|
||||||
iModeNum++ )
|
iModeNum++ )
|
||||||
{
|
{
|
||||||
|
// Only care about the default display output, this prevents duplicate
|
||||||
|
// entries in the modes list.
|
||||||
|
if ( dm.dmFields & DM_DISPLAYFIXEDOUTPUT &&
|
||||||
|
dm.dmDisplayFixedOutput != DMDFO_DEFAULT )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
const wxVideoMode mode = ConvertToVideoMode(dm);
|
const wxVideoMode mode = ConvertToVideoMode(dm);
|
||||||
if ( mode.Matches(modeMatch) )
|
if ( mode.Matches(modeMatch) )
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user