// XXX TODO: check that the layout isn't a layout of another window
- pWindow->setActiveLayout( pLayout );
+ getIntf()->p_sys->p_theme->getWindowManager().setActiveLayout( *pWindow,
+ *pLayout );
}
m_pTheme->m_layouts[rData.m_id] = GenericLayoutPtr( pLayout );
// Attach the layout to its window
- pWin->setActiveLayout( pLayout );
+ m_pTheme->getWindowManager().addLayout( *pWin, *pLayout );
}
void Builder::addAnchor( const BuilderData::Anchor &rData )
{
- TopWindow *pWin = m_pTheme->m_windows[rData.m_windowId].get();
- if( pWin == NULL )
+ GenericLayout *pLayout = m_pTheme->m_layouts[rData.m_layoutId].get();
+ if( pLayout == NULL )
{
- msg_Err( getIntf(), "unknown window id: %s", rData.m_windowId.c_str() );
+ msg_Err( getIntf(), "unknown layout id: %s", rData.m_layoutId.c_str() );
return;
}
Anchor *pAnc = new Anchor( getIntf(), rData.m_xPos, rData.m_yPos,
rData.m_range, rData.m_priority,
- *pCurve, *pWin );
- pWin->addAnchor( pAnc );
+ *pCurve, *pLayout );
+ pLayout->addAnchor( pAnc );
}
Font id:string fontFile:string size:int
Window id:string xPos:int yPos:int visible:bool dragDrop:bool playOnDrop:bool
Layout id:string width:int height:int minWidth:int maxWidth:int minHeight:int maxHeight:int windowId:string
-Anchor xPos:int yPos:int range:int priority:int points:string windowId:string
+Anchor xPos:int yPos:int range:int priority:int points:string layoutId:string
Button id:string xPos:int yPos:int leftTop:string rightBottom:string visible:string upId:string downId:string overId:string actionId:string tooltip:string help:string layer:int windowId:string layoutId:string
Checkbox id:string xPos:int yPos:int leftTop:string rightBottom:string visible:string up1Id:string down1Id:string over1Id:string up2Id:string down2Id:string over2Id:string state:string action1:string action2:string tooltip1:string tooltip2:string help:string layer:int windowId:string layoutId:string
Image id:string xPos:int yPos:int leftTop:string rightBottom:string visible:string bmpId:string actionId:string help:string layer:int windowId:string layoutId:string
/// Type definition
struct Anchor
{
- Anchor( int xPos, int yPos, int range, int priority, const string & points, const string & windowId ):
-m_xPos( xPos ), m_yPos( yPos ), m_range( range ), m_priority( priority ), m_points( points ), m_windowId( windowId ) {}
+ Anchor( int xPos, int yPos, int range, int priority, const string & points, const string & layoutId ):
+m_xPos( xPos ), m_yPos( yPos ), m_range( range ), m_priority( priority ), m_points( points ), m_layoutId( layoutId ) {}
int m_xPos;
int m_yPos;
int m_range;
int m_priority;
const string m_points;
- const string m_windowId;
+ const string m_layoutId;
};
/// List
list<Anchor> m_listAnchor;
{
const BuilderData::Anchor anchor( atoi( attr["x"] ) + m_xOffset,
atoi( attr["y"] ) + m_yOffset, atoi( attr["range"] ),
- atoi( attr["priority"] ), attr["points"], m_curWindowId );
+ atoi( attr["priority"] ), attr["points"], m_curLayoutId );
m_data.m_listAnchor.push_back( anchor );
}
* anchor.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: anchor.hpp,v 1.2 2004/03/02 21:45:15 ipkiss Exp $
+ * $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
#define ANCHOR_HPP
#include "skin_common.hpp"
-#include "generic_window.hpp"
+#include "generic_layout.hpp"
#include "../utils/bezier.hpp"
{
public:
Anchor( intf_thread_t *pIntf, int xPos, int yPos, int range,
- int priority, const Bezier &rCurve, GenericWindow &rWindow ):
+ int priority, const Bezier &rCurve, GenericLayout &rLayout ):
SkinObject( pIntf ), m_xPos( xPos ), m_yPos( yPos ),
m_rCurve( rCurve ), m_range( range ), m_priority( priority ),
- m_rWindow( rWindow ) {}
+ m_rLayout( rLayout ) {}
virtual ~Anchor() {}
/// Return true if the given anchor is hanged by this one
bool isPoint() const { return m_rCurve.getNbCtrlPoints() == 1; }
// Getters
- int getXPosAbs() const { return (m_xPos + m_rWindow.getLeft()); }
- int getYPosAbs() const { return (m_yPos + m_rWindow.getTop()); }
+ int getXPosAbs() const { return (m_xPos + m_rLayout.getLeft()); }
+ int getYPosAbs() const { return (m_yPos + m_rLayout.getTop()); }
private:
/// Coordinates relative to the window
int m_priority;
/// Parent window
- GenericWindow &m_rWindow;
+ GenericLayout &m_rLayout;
};
}
}
+
+const list<Anchor*>& GenericLayout::getAnchorList() const
+{
+ return m_anchorList;
+}
+
+
+void GenericLayout::addAnchor( Anchor *pAnchor )
+{
+ m_anchorList.push_back( pAnchor );
+}
+
#define GENERIC_LAYOUT_HPP
#include "skin_common.hpp"
+#include "top_window.hpp"
#include "../utils/pointer.hpp"
#include "../utils/position.hpp"
#include <list>
-class TopWindow;
+class Anchor;
class OSGraphics;
class CtrlGeneric;
/// Get the image of the layout
virtual OSGraphics *getImage() const { return m_pImage; }
+ /// Get the position of the layout (relative to the screen)
+ virtual int getLeft() const { return m_pWindow->getLeft(); }
+ virtual int getTop() const { return m_pWindow->getTop(); }
+
/// Get the size of the layout
virtual int getWidth() const { return m_width; }
virtual int getHeight() const { return m_height; }
/// Called by a control when its image has changed
virtual void onControlUpdate( const CtrlGeneric &rCtrl );
+ /// Get the list of the anchors of this layout
+ virtual const list<Anchor*>& getAnchorList() const;
+
+ /// Add an anchor to this layout
+ virtual void addAnchor( Anchor *pAnchor );
+
private:
/// Parent window of the layout
TopWindow *m_pWindow;
OSGraphics *m_pImage;
/// List of the controls in the layout
list<LayeredControl> m_controlList;
+ /// List of the anchors in the layout
+ list<Anchor*> m_anchorList;
};
}
+const GenericLayout& TopWindow::getActiveLayout() const
+{
+ return *m_pActiveLayout;
+}
+
+
void TopWindow::innerShow()
{
// First, refresh the layout and update the shape of the window
}
-const list<Anchor*> TopWindow::getAnchorList() const
-{
- return m_anchorList;
-}
-
-
-void TopWindow::addAnchor( Anchor *pAnchor )
-{
- m_anchorList.push_back( pAnchor );
-}
-
-
void TopWindow::onControlCapture( const CtrlGeneric &rCtrl )
{
// Set the capturing control
#include "../utils/pointer.hpp"
#include <list>
-class Anchor;
class OSWindow;
class OSGraphics;
class GenericLayout;
/// Change the active layout
virtual void setActiveLayout( GenericLayout *pLayout );
+ /// Get the active layout
+ virtual const GenericLayout& getActiveLayout() const;
+
/// Update the shape of the window from the active layout
virtual void updateShape();
/// Called by a control when its tooltip changed
virtual void onTooltipChange( const CtrlGeneric &rCtrl );
- /// Get the list of the anchors of this window
- virtual const list<Anchor*> getAnchorList() const;
-
- /// Add an anchor to this window
- virtual void addAnchor( Anchor *pAnchor );
-
protected:
/// Actually show the window
virtual void innerShow();
CtrlGeneric *m_pCapturingControl;
/// Control that has the focus
CtrlGeneric *m_pFocusControl;
- /// List of the anchors of this window
- list<Anchor*> m_anchorList;
/// Current key modifier (also used for mouse)
int m_currModifier;
*****************************************************************************/
#include "window_manager.hpp"
+#include "generic_layout.hpp"
#include "generic_window.hpp"
#include "os_factory.hpp"
#include "anchor.hpp"
// Iterate through all the windows
for( itWin1 = m_allWindows.begin(); itWin1 != m_allWindows.end(); itWin1++ )
{
- // Get the anchors of the window
- const AncList_t &ancList1 = (*itWin1)->getAnchorList();
+ // Get the anchors of the layout associated to the window
+ const AncList_t &ancList1 =
+ (*itWin1)->getActiveLayout().getAnchorList();
// Iterate through all the windows, starting with (*itWin1)
for( itWin2 = itWin1; itWin2 != m_allWindows.end(); itWin2++ )
continue;
// Now, check for anchoring between the 2 windows
- const AncList_t &ancList2 = (*itWin2)->getAnchorList();
+ const AncList_t &ancList2 =
+ (*itWin2)->getActiveLayout().getAnchorList();
for( itAnc1 = ancList1.begin(); itAnc1 != ancList1.end(); itAnc1++ )
{
for( itAnc2 = ancList2.begin();
continue;
}
- // Get the anchors of this moving window
- const AncList_t &movAnchors = (*itMov)->getAnchorList();
+ // Get the anchors in the main layout of this moving window
+ const AncList_t &movAnchors =
+ (*itMov)->getActiveLayout().getAnchorList();
// Iterate through the static windows
for( itSta = m_allWindows.begin();
continue;
}
- // Get the anchors of this static window
- const AncList_t &staAnchors = (*itSta)->getAnchorList();
+ // Get the anchors in the main layout of this static window
+ const AncList_t &staAnchors =
+ (*itSta)->getActiveLayout().getAnchorList();
// Check if there is an anchoring between one of the movAnchors
// and one of the staAnchors
m_pTooltip->hide();
}
}
+
+
+void WindowManager::addLayout( TopWindow &rWindow, GenericLayout &rLayout )
+{
+ rWindow.setActiveLayout( &rLayout );
+}
+
+
+void WindowManager::setActiveLayout( TopWindow &rWindow,
+ GenericLayout &rLayout )
+{
+ rWindow.setActiveLayout( &rLayout );
+ // Rebuild the dependencies
+ stopMove();
+}
class GenericFont;
+class GenericLayout;
class Anchor;
class Tooltip;
/// Hide the tooltip window
void hideTooltip();
+ /// Add a layout of the given window. This new layout will be the
+ /// active one.
+ void addLayout( TopWindow &rWindow, GenericLayout &rLayout );
+
+ /// Change the active layout of the given window
+ void setActiveLayout( TopWindow &rWindow, GenericLayout &rLayout );
+
private:
/// Some useful typedefs for lazy people like me
typedef set<TopWindow*> WinSet_t;