Commit 91a9eee8 authored by Erwan Tulou's avatar Erwan Tulou

skins2: add width/height parameters to slider

These parameters will allow to create a slider which adapts to the display.
width/height parameters will be optional. If set, the initial slider will
be resized to meet these requirements.

A main use case will be the possibility to create a fullscreen timeslider
that automatically spans the whole screen whatever the screen resolution.
e.g syntax would be <Slider width="100%" ....>
parent d15b308e
......@@ -902,12 +902,13 @@ void Builder::addSlider( const BuilderData::Slider &rData )
m_pTheme->m_controls[rData.m_id + "_bg"] = CtrlGenericPtr( pBackground );
// Compute the position of the control
int width = (rData.m_width > 0) ? rData.m_width : pCurve->getWidth();
int height = (rData.m_height > 0) ? rData.m_height : pCurve->getHeight();
const GenericRect *pRect;
GET_BOX( pRect, rData.m_panelId , pLayout);
const Position pos = makePosition( rData.m_leftTop, rData.m_rightBottom,
rData.m_xPos, rData.m_yPos,
pCurve->getWidth(), pCurve->getHeight(),
*pRect,
width, height, *pRect,
rData.m_xKeepRatio, rData.m_yKeepRatio );
pLayout->addControl( pBackground, pos, rData.m_layer );
......
......@@ -16,7 +16,7 @@ IniFile id:string file:string
Panel id:string xPos:int yPos:int leftTop:string rightBottom:string xKeepRatio:bool yKeepRatio:bool width:int height:int layer:int windowId:string layoutId:string panelId:string
Text id:string xPos:int yPos:int visible:string fontId:string text:string width:int leftTop:string rightBottom:string xKeepRatio:bool yKeepRatio:bool color:uint32_t scrolling:string alignment:string focus:string help:string layer:int windowId:string layoutId:string panelId:string
RadialSlider id:string visible:string xPos:int yPos:int leftTop:string rightBottom:string xKeepRatio:bool yKeepRatio:bool sequence:string nbImages:int minAngle:float maxAngle:float value:string tooltip:string help:string layer:int windowId:string layoutId:string panelId:string
Slider id:string visible:string xPos:int yPos:int leftTop:string rightBottom:string xKeepRatio:bool yKeepRatio:bool upId:string downId:string overId:string points:string thickness:int value:string imageId:string nbHoriz:int nbVert:int padHoriz:int padVert:int tooltip:string help:string layer:int windowId:string layoutId:string panelId:string
Slider id:string visible:string xPos:int yPos:int width:int height:int leftTop:string rightBottom:string xKeepRatio:bool yKeepRatio:bool upId:string downId:string overId:string points:string thickness:int value:string imageId:string nbHoriz:int nbVert:int padHoriz:int padVert:int tooltip:string help:string layer:int windowId:string layoutId:string panelId:string
List id:string xPos:int yPos:int visible:string width:int height:int leftTop:string rightBottom:string xKeepRatio:bool yKeepRatio:bool fontId:string var:string bgImageId:string fgColor:string playColor:string bgColor1:string bgColor2:string selColor:string help:string layer:int windowId:string layoutId:string panelId:string
Tree id:string xPos:int yPos:int visible:string flat:string width:int height:int leftTop:string rightBottom:string xKeepRatio:bool yKeepRatio:bool fontId:string var:string bgImageId:string itemImageId:string openImageId:string closedImageId:string fgColor:string playColor:string bgColor1:string bgColor2:string selColor:string help:string layer:int windowId:string layoutId:string panelId:string
Video id:string xPos:int yPos:int width:int height:int leftTop:string rightBottom:string xKeepRatio:bool yKeepRatio:bool visible:string autoResize:bool help:string layer:int windowId:string layoutId:string panelId:string
......@@ -396,13 +396,15 @@ m_id( id ), m_visible( visible ), m_xPos( xPos ), m_yPos( yPos ), m_leftTop( lef
/// Type definition
struct Slider
{
Slider( const string & id, const string & visible, int xPos, int yPos, const string & leftTop, const string & rightBottom, bool xKeepRatio, bool yKeepRatio, const string & upId, const string & downId, const string & overId, const string & points, int thickness, const string & value, const string & imageId, int nbHoriz, int nbVert, int padHoriz, int padVert, const string & tooltip, const string & help, int layer, const string & windowId, const string & layoutId, const string & panelId ):
m_id( id ), m_visible( visible ), m_xPos( xPos ), m_yPos( yPos ), m_leftTop( leftTop ), m_rightBottom( rightBottom ), m_xKeepRatio( xKeepRatio ), m_yKeepRatio( yKeepRatio ), m_upId( upId ), m_downId( downId ), m_overId( overId ), m_points( points ), m_thickness( thickness ), m_value( value ), m_imageId( imageId ), m_nbHoriz( nbHoriz ), m_nbVert( nbVert ), m_padHoriz( padHoriz ), m_padVert( padVert ), m_tooltip( tooltip ), m_help( help ), m_layer( layer ), m_windowId( windowId ), m_layoutId( layoutId ), m_panelId( panelId ) {}
Slider( const string & id, const string & visible, int xPos, int yPos, int width, int height, const string & leftTop, const string & rightBottom, bool xKeepRatio, bool yKeepRatio, const string & upId, const string & downId, const string & overId, const string & points, int thickness, const string & value, const string & imageId, int nbHoriz, int nbVert, int padHoriz, int padVert, const string & tooltip, const string & help, int layer, const string & windowId, const string & layoutId, const string & panelId ):
m_id( id ), m_visible( visible ), m_xPos( xPos ), m_yPos( yPos ), m_width( width ), m_height( height ), m_leftTop( leftTop ), m_rightBottom( rightBottom ), m_xKeepRatio( xKeepRatio ), m_yKeepRatio( yKeepRatio ), m_upId( upId ), m_downId( downId ), m_overId( overId ), m_points( points ), m_thickness( thickness ), m_value( value ), m_imageId( imageId ), m_nbHoriz( nbHoriz ), m_nbVert( nbVert ), m_padHoriz( padHoriz ), m_padVert( padVert ), m_tooltip( tooltip ), m_help( help ), m_layer( layer ), m_windowId( windowId ), m_layoutId( layoutId ), m_panelId( panelId ) {}
string m_id;
string m_visible;
int m_xPos;
int m_yPos;
int m_width;
int m_height;
string m_leftTop;
string m_rightBottom;
bool m_xKeepRatio;
......
......@@ -556,6 +556,8 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
DefaultAttr( attr, "visible", "true" );
DefaultAttr( attr, "x", "0" );
DefaultAttr( attr, "y", "0" );
DefaultAttr( attr, "width", "-1" );
DefaultAttr( attr, "height", "-1" );
DefaultAttr( attr, "lefttop", "lefttop" );
DefaultAttr( attr, "rightbottom", "lefttop" );
DefaultAttr( attr, "xkeepratio", "false" );
......@@ -578,9 +580,11 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
getRefDimensions( refWidth, refHeight, false );
int x = getDimension( attr["x"], refWidth );
int y = getDimension( attr["y"], refHeight );
int width = getDimension( attr["width"], refWidth );
int height = getDimension( attr["height"], refHeight );
const BuilderData::Slider slider( uniqueId( attr["id"] ),
attr["visible"], x + m_xOffset,
y + m_yOffset, attr["lefttop"],
attr["visible"], x + m_xOffset, y + m_yOffset,
width, height, attr["lefttop"],
attr["rightbottom"], convertBoolean( attr["xkeepratio"] ),
convertBoolean( attr["ykeepratio"] ), attr["up"], attr["down"],
attr["over"], attr["points"], atoi( attr["thickness"] ),
......
......@@ -200,6 +200,8 @@
visible CDATA "true"
x CDATA "0"
y CDATA "0"
width CDATA "-1"
height CDATA "-1"
lefttop CDATA "lefttop"
rightbottom CDATA "lefttop"
xkeepratio CDATA "false"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment