Changeset 28bd3a4a6af005742657f8a0ea7fa92a4fef0618
- Timestamp:
- 05/15/06 00:16:59
(2 years ago)
- Author:
- Olivier Teulière <ipkiss@videolan.org>
- git-committer:
- Olivier Teulière <ipkiss@videolan.org> 1147645019 +0000
- git-parent:
[ccf834a51a5ba339dff515333118635aaa3b9047]
- git-author:
- Olivier Teulière <ipkiss@videolan.org> 1147645019 +0000
- Message:
- skins2: new LayoutID.isActive boolean variable
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| rdea9733 |
r28bd3a4 |
|
| 315 | 315 | <title>Layout</title> |
|---|
| 316 | 316 | <para>A layout is one aspect of a window, i.e. a set of controls and anchors. A window can have many layouts, but only one will be visible at any time.</para> |
|---|
| | 317 | <sect4 id="layoutid"> |
|---|
| | 318 | <title>id</title> |
|---|
| | 319 | <para>Name of the layout (it may be used for actions). Two layouts cannot have the same id.</para> |
|---|
| | 320 | <para>Default value: none</para> |
|---|
| | 321 | </sect4> |
|---|
| 317 | 322 | <sect4 id="layoutwidth"> |
|---|
| 318 | 323 | <title>width</title> |
|---|
| … | … | |
| 922 | 927 | </para></listitem> |
|---|
| 923 | 928 | <listitem><para> |
|---|
| 924 | | <emphasis>WindowID.setLayout(LayoutID)</emphasis>: Change the layout of the <link linkend="Window">Window</link> whose <link linkend="windowid">id</link> attribute is 'WindowID', using the <link linkend="Layout">Layout</link> whose <link linkend="attrid">id</link> attribute is 'LayoutID'. |
|---|
| | 929 | <emphasis>WindowID.setLayout(LayoutID)</emphasis>: Change the layout of the <link linkend="Window">Window</link> whose <link linkend="windowid">id</link> attribute is 'WindowID', using the <link linkend="Layout">Layout</link> whose <link linkend="layoutid">id</link> attribute is 'LayoutID'. |
|---|
| 925 | 930 | </para></listitem> |
|---|
| 926 | 931 | </itemizedlist> |
|---|
| … | … | |
| 1024 | 1029 | </para></listitem> |
|---|
| 1025 | 1030 | <listitem><para> |
|---|
| 1026 | | <emphasis>window_name.isVisible</emphasis>: True when the window whose <link linkend="windowid">id</link> is "window_name" is visible, false otherwise. |
|---|
| | 1031 | <emphasis>WindowID.isVisible</emphasis>: True when the window whose <link linkend="windowid">id</link> is "WindowID" is visible, false otherwise. |
|---|
| | 1032 | </para></listitem> |
|---|
| | 1033 | <listitem><para> |
|---|
| | 1034 | <emphasis>LayoutID.isVisible</emphasis>: True when the layout whose <link linkend="layoutid">id</link> is "LayoutID" is the active layout in its window (even if the window is hidden), false otherwise (since VLC 0.8.6). |
|---|
| 1027 | 1035 | </para></listitem> |
|---|
| 1028 | 1036 | </itemizedlist> |
|---|
| red0b72e |
r28bd3a4 |
|
| 402 | 402 | if( pWin ) |
|---|
| 403 | 403 | { |
|---|
| 404 | | // Push the visibility variable on the stack |
|---|
| | 404 | // Push the visibility variable onto the stack |
|---|
| 405 | 405 | varStack.push_back( &pWin->getVisibleVar() ); |
|---|
| 406 | 406 | } |
|---|
| … | … | |
| 408 | 408 | { |
|---|
| 409 | 409 | msg_Err( getIntf(), "unknown window (%s)", windowId.c_str() ); |
|---|
| | 410 | return NULL; |
|---|
| | 411 | } |
|---|
| | 412 | } |
|---|
| | 413 | else if( token.find( ".isActive" ) != string::npos ) |
|---|
| | 414 | { |
|---|
| | 415 | int leftPos = token.find( ".isActive" ); |
|---|
| | 416 | string layoutId = token.substr( 0, leftPos ); |
|---|
| | 417 | GenericLayout *pLayout = pTheme->getLayoutById( layoutId ); |
|---|
| | 418 | if( pLayout ) |
|---|
| | 419 | { |
|---|
| | 420 | // Push the isActive variable onto the stack |
|---|
| | 421 | varStack.push_back( &pLayout->getActiveVar() ); |
|---|
| | 422 | } |
|---|
| | 423 | else |
|---|
| | 424 | { |
|---|
| | 425 | msg_Err( getIntf(), "unknown layout (%s)", layoutId.c_str() ); |
|---|
| 410 | 426 | return NULL; |
|---|
| 411 | 427 | } |
|---|
| rc90405b |
r28bd3a4 |
|
| 27 | 27 | #include "os_factory.hpp" |
|---|
| 28 | 28 | #include "os_graphics.hpp" |
|---|
| | 29 | #include "var_manager.hpp" |
|---|
| 29 | 30 | #include "../controls/ctrl_generic.hpp" |
|---|
| 30 | 31 | #include "../controls/ctrl_video.hpp" |
|---|
| | 32 | #include "../utils/var_bool.hpp" |
|---|
| 31 | 33 | |
|---|
| 32 | 34 | |
|---|
| … | … | |
| 37 | 39 | m_height( height ), m_minWidth( minWidth ), m_maxWidth( maxWidth ), |
|---|
| 38 | 40 | m_minHeight( minHeight ), m_maxHeight( maxHeight ), m_pVideoControl( NULL ), |
|---|
| 39 | | m_visible( false ) |
|---|
| | 41 | m_visible( false ), m_pVarActive( NULL ) |
|---|
| 40 | 42 | { |
|---|
| 41 | 43 | // Get the OSFactory |
|---|
| … | … | |
| 43 | 45 | // Create the graphics buffer |
|---|
| 44 | 46 | m_pImage = pOsFactory->createOSGraphics( width, height ); |
|---|
| | 47 | |
|---|
| | 48 | // Create the "active layout" variable and register it in the manager |
|---|
| | 49 | m_pVarActive = new VarBoolImpl( pIntf ); |
|---|
| | 50 | VarManager::instance( pIntf )->registerVar( VariablePtr( m_pVarActive ) ); |
|---|
| 45 | 51 | } |
|---|
| 46 | 52 | |
|---|
| rf6482bd |
r28bd3a4 |
|
| 37 | 37 | class CtrlGeneric; |
|---|
| 38 | 38 | class CtrlVideo; |
|---|
| | 39 | class VarBoolImpl; |
|---|
| 39 | 40 | |
|---|
| 40 | 41 | |
|---|
| … | … | |
| 129 | 130 | virtual void onHide(); |
|---|
| 130 | 131 | |
|---|
| | 132 | /// Give access to the "active layout" variable |
|---|
| | 133 | // FIXME: we give read/write access |
|---|
| | 134 | VarBoolImpl &getActiveVar() { return *m_pVarActive; } |
|---|
| | 135 | |
|---|
| 131 | 136 | private: |
|---|
| 132 | 137 | /// Parent window of the layout |
|---|
| … | … | |
| 146 | 151 | /// Flag to know if the layout is visible |
|---|
| 147 | 152 | bool m_visible; |
|---|
| | 153 | /// Variable for the "active state" of the layout |
|---|
| | 154 | /** |
|---|
| | 155 | * Note: the layout is not an observer on this variable, because it |
|---|
| | 156 | * cannot be changed externally (i.e. without an explicit change of |
|---|
| | 157 | * layout). This way, we avoid using a setActiveLayoutInner method. |
|---|
| | 158 | */ |
|---|
| | 159 | mutable VarBoolImpl *m_pVarActive; |
|---|
| 148 | 160 | }; |
|---|
| 149 | 161 | |
|---|
| ra72b117 |
r28bd3a4 |
|
| 324 | 324 | { |
|---|
| 325 | 325 | bool isVisible = getVisibleVar().get(); |
|---|
| 326 | | if( m_pActiveLayout && isVisible ) |
|---|
| 327 | | { |
|---|
| 328 | | m_pActiveLayout->onHide(); |
|---|
| | 326 | if( m_pActiveLayout ) |
|---|
| | 327 | { |
|---|
| | 328 | if( isVisible ) |
|---|
| | 329 | { |
|---|
| | 330 | m_pActiveLayout->onHide(); |
|---|
| | 331 | } |
|---|
| | 332 | // The current layout becomes inactive |
|---|
| | 333 | m_pActiveLayout->getActiveVar().set( false ); |
|---|
| 329 | 334 | } |
|---|
| 330 | 335 | |
|---|
| … | … | |
| 339 | 344 | pLayout->onShow(); |
|---|
| 340 | 345 | } |
|---|
| | 346 | |
|---|
| | 347 | // The new layout is active |
|---|
| | 348 | pLayout->getActiveVar().set( true ); |
|---|
| 341 | 349 | } |
|---|
| 342 | 350 | |
|---|