[vlc-commits] skins2: add a function that differentiates dependent and independent layouts.
Erwan Tulou
git at videolan.org
Mon Apr 1 03:18:52 CEST 2013
vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Mon Apr 1 01:54:55 2013 +0200| [ac394edb69eb59e141b87870d4cabe403ee92986] | committer: Erwan Tulou
skins2: add a function that differentiates dependent and independent layouts.
In skins2, a window can have multiple layouts with two different goals.
First goal, layouts have the same original size and only differ in the
presentation (different color, ...). If the active layout gets resized,
the user expects the related inactive layouts with the same size to
automatically resize, should they become active.
Second goal, layouts are different in size, e.g a reduced layout and an
expanded layout. In this case, resizing the active layout doesn't mean
resizing the other inactive layouts, since they were not meant to be
similar in size in the first place.
This patch creates a function that will be used to differentiate these
two different use of layouts.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ac394edb69eb59e141b87870d4cabe403ee92986
---
modules/gui/skins2/src/generic_layout.cpp | 4 +++-
modules/gui/skins2/src/generic_layout.hpp | 11 +++++++++++
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/modules/gui/skins2/src/generic_layout.cpp b/modules/gui/skins2/src/generic_layout.cpp
index 5f5cfa0..779467b 100644
--- a/modules/gui/skins2/src/generic_layout.cpp
+++ b/modules/gui/skins2/src/generic_layout.cpp
@@ -37,7 +37,9 @@
GenericLayout::GenericLayout( intf_thread_t *pIntf, int width, int height,
int minWidth, int maxWidth, int minHeight,
int maxHeight ):
- SkinObject( pIntf ), m_pWindow( NULL ), m_rect( 0, 0, width, height ),
+ SkinObject( pIntf ), m_pWindow( NULL ),
+ m_original_width( width ), m_original_height( height ),
+ m_rect( 0, 0, width, height ),
m_minWidth( minWidth ), m_maxWidth( maxWidth ),
m_minHeight( minHeight ), m_maxHeight( maxHeight ), m_pVideoCtrlSet(),
m_visible( false ), m_pVarActive( NULL )
diff --git a/modules/gui/skins2/src/generic_layout.hpp b/modules/gui/skins2/src/generic_layout.hpp
index a730d19..fb83d69 100644
--- a/modules/gui/skins2/src/generic_layout.hpp
+++ b/modules/gui/skins2/src/generic_layout.hpp
@@ -107,6 +107,14 @@ public:
/// Resize the layout
virtual void resize( int width, int height );
+ /// determine whether layouts should be kept the same size
+ virtual bool isTightlyCoupledWith( const GenericLayout& otherLayout ) const
+ {
+ return m_original_width == otherLayout.m_original_width
+ &&
+ m_original_height == otherLayout.m_original_height;
+ }
+
/**
* Add a control in the layout at the given position, and
* the optional given layer
@@ -147,6 +155,9 @@ public:
private:
/// Parent window of the layout
TopWindow *m_pWindow;
+ /// Layout original size
+ const int m_original_width;
+ const int m_original_height;
/// Layout size
SkinsRect m_rect;
int m_minWidth, m_maxWidth;
More information about the vlc-commits
mailing list