]> git.sesse.net Git - vlc/commitdiff
skins2: add a function that differentiates dependent and independent layouts.
authorErwan Tulou <erwan10@videolan.org>
Sun, 31 Mar 2013 23:54:55 +0000 (01:54 +0200)
committerErwan Tulou <erwan10@videolan.org>
Mon, 1 Apr 2013 01:15:40 +0000 (03:15 +0200)
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.

modules/gui/skins2/src/generic_layout.cpp
modules/gui/skins2/src/generic_layout.hpp

index 5f5cfa00fc9287627b88fc0fc0465bf96960bb1c..779467b4e67a853e24734e2430acea1ac9e408c8 100644 (file)
@@ -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 )
index a730d19961662f8baa4ece7571251ea9b5d30dbf..fb83d693b01070edffb9b279bb42ad1bb64040f4 100644 (file)
@@ -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;