Add style for manually resizing wxMediaCtrl
Previously, wxMediaCtrl would always automatically resize itself whenever a video was loaded. If a wide video was loaded, this could cause wxMediaCtrl to take up the entire space, hiding any other widget(s) that might exist within the same sizer. Allow avoiding this behavior by adding a new style, wxMC_NO_AUTORESIZE, which disables this automatic resize behavior and allows handling the resize behavior manually.
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,16 @@ 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 must be done manually (if desired) using Layout().
|
||||
It is strongly recommended to use this flag and handle control
|
||||
resizing manually.
|
||||
@endStyleTable
|
||||
|
||||
@library{wxmedia}
|
||||
@category{media}
|
||||
|
||||
|
||||
@@ -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