Merge branch 'mediaplayer_sample'
Add wxMC_NO_AUTORESIZE and use it in mediaplayer sample to fix it layout. See https://github.com/wxWidgets/wxWidgets/pull/2562
This commit is contained in:
@@ -37,6 +37,8 @@
|
||||
#include "wx/control.h"
|
||||
#include "wx/uri.h"
|
||||
|
||||
#define wxMC_NO_AUTORESIZE 0x0001
|
||||
|
||||
// ============================================================================
|
||||
// Declarations
|
||||
// ============================================================================
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define wxMC_NO_AUTORESIZE 0x0001
|
||||
|
||||
/**
|
||||
Describes the current state of the media.
|
||||
|
||||
@@ -225,6 +227,18 @@ public:
|
||||
wxActiveXContainer documentation.
|
||||
|
||||
|
||||
@beginStyleTable
|
||||
@style{wxMC_NO_AUTORESIZE}
|
||||
By default, the control will automatically adjust its size to
|
||||
exactly fit the size of a loaded video as soon as a video is loaded.
|
||||
If this flag is given, the control will not change its size
|
||||
automatically and it must be done manually (if desired) using Layout().
|
||||
It is strongly recommended to use this flag and handle control
|
||||
resizing manually (note that this style is only available in
|
||||
wxWidgets 3.1.6, so it is only possible to do it when using this or
|
||||
later version).
|
||||
@endStyleTable
|
||||
|
||||
@library{wxmedia}
|
||||
@category{media}
|
||||
|
||||
@@ -255,7 +269,8 @@ public:
|
||||
@param size
|
||||
Size to put the control at and to stretch movie to.
|
||||
@param style
|
||||
Optional styles.
|
||||
Optional styles. It is recommended to use ::wxMC_NO_AUTORESIZE,
|
||||
although it is not used by default for compatibility reasons.
|
||||
@param szBackend
|
||||
Name of backend you want to use, leave blank to make wxMediaCtrl figure it out.
|
||||
@param validator
|
||||
@@ -289,7 +304,8 @@ public:
|
||||
@param size
|
||||
Size to put the control at and to stretch movie to.
|
||||
@param style
|
||||
Optional styles.
|
||||
Optional styles. It is recommended to use ::wxMC_NO_AUTORESIZE,
|
||||
although it is not used by default for compatibility reasons.
|
||||
@param szBackend
|
||||
Name of backend you want to use, leave blank to make wxMediaCtrl figure it out.
|
||||
@param validator
|
||||
|
||||
@@ -500,7 +500,7 @@ void wxMediaPlayerApp::MacOpenFiles(const wxArrayString & fileNames )
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxMediaPlayerFrame::wxMediaPlayerFrame(const wxString& title)
|
||||
: wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(600,600))
|
||||
: wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(1366,768))
|
||||
{
|
||||
SetIcon(wxICON(sample));
|
||||
|
||||
@@ -1492,7 +1492,8 @@ wxMediaPlayerNotebookPage::wxMediaPlayerNotebookPage(wxMediaPlayerFrame* parentF
|
||||
|
||||
// Make sure creation was successful
|
||||
bool bOK = m_mediactrl->Create(this, wxID_MEDIACTRL, wxEmptyString,
|
||||
wxDefaultPosition, wxDefaultSize, 0,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
wxMC_NO_AUTORESIZE,
|
||||
// you could specify a macro backend here like
|
||||
// wxMEDIABACKEND_WMP10);
|
||||
// "wxPDFMediaBackend");
|
||||
@@ -1608,14 +1609,14 @@ wxMediaPlayerNotebookPage::wxMediaPlayerNotebookPage(wxMediaPlayerFrame* parentF
|
||||
m_volSlider = new wxSlider(this, wxID_VOLSLIDER, 100, // init
|
||||
0, // start
|
||||
100, // end
|
||||
wxDefaultPosition, wxSize(250,20),
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
wxSL_HORIZONTAL );
|
||||
horsizer3->Add(m_volSlider, 1, wxALL, 5);
|
||||
|
||||
m_pbSlider = new wxSlider(this, wxID_PBSLIDER, 4, // init
|
||||
1, // start
|
||||
16, // end
|
||||
wxDefaultPosition, wxSize(250,20),
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
wxSL_HORIZONTAL );
|
||||
horsizer3->Add(m_pbSlider, 1, wxALL, 5);
|
||||
sizer->Add(horsizer3, 1, wxCENTRE | wxALL, 5);
|
||||
|
||||
@@ -466,6 +466,9 @@ void wxMediaCtrl::DoMoveWindow(int x, int y, int w, int h)
|
||||
|
||||
void wxMediaBackendCommonBase::NotifyMovieSizeChanged()
|
||||
{
|
||||
if ( m_ctrl->HasFlag(wxMC_NO_AUTORESIZE) )
|
||||
return;
|
||||
|
||||
// our best size changed after opening a new file
|
||||
m_ctrl->InvalidateBestSize();
|
||||
m_ctrl->SetSize(m_ctrl->GetSize());
|
||||
|
||||
Reference in New Issue
Block a user