Several bug fixes.

CSS properties now support real CSS properties names.

--HG--
branch : dev
This commit is contained in:
Martín Lucas Golini
2019-11-03 03:34:02 -03:00
parent 99b867cc79
commit 33f8a2eebb
37 changed files with 482 additions and 461 deletions

View File

@@ -1,35 +1,35 @@
/* Global rules */
* {
textColor: #E6E6E6FF;
textShadowColor: #32323296;
textSelectedColor: #000;
textSelectionBackColor: #969696FF;
color: #E6E6E6FF;
shadow-color: #32323296;
selected-color: #000;
selection-back-color: #969696FF;
}
TabWidget {
tabSeparation: -1dp;
drawLineBelowTabs: true;
lineBelowTabsColor: #2f3030;
lineBelowTabsYOffset: 0dp;
tab-separation: -1dp;
line-below-tabs: true;
line-below-tabs-color: #2f3030;
line-below-tabs-y-offset: 0dp;
}
ProgressBar {
displayPercent: true;
verticalExpand: true;
fillerPadding: 2dp;
movementSpeed: 32, 0;
display-percent: true;
vertical-expand: true;
filler-padding: 2dp;
movement-speed: 32, 0;
}
WinMenu {
buttonMargin: 12dp;
button-margin: 12dp;
}
Menu,
PopUpMenu {
textColor: #E6E6E6FF;
minWidth: 100dp;
minSpaceForIcons: 24dp;
minRightMargin: 8dp;
color: #E6E6E6FF;
min-width: 100dp;
min-icon-space: 24dp;
min-margin-right: 8dp;
}
Menu:hover,
@@ -41,109 +41,109 @@ ListBox::item:hover,
Tab:selected,
Tab:hover,
Tab:pressed {
textColor: #FFF;
color: #FFF;
}
Slider {
halfSlider: true;
backgroundColor: #555;
half-slider: true;
background-color: #555;
}
ScrollBar {
expandBackground: true;
background-expand: true;
}
Window {
winFlags: shadow;
buttonsPositionFixer: -2, 0;
window-flags: shadow;
buttons-position-offset: -2, 0;
}
Window::title {
textColor: #E6E6E6FF;
textStyle: shadow;
color: #E6E6E6FF;
font-style: shadow;
}
Tooltip {
padding: 8dp;
textColor: black;
color: black;
}
#lvbox > * {
layout_marginTop: 8dp;
margin-top: 8dp;
}
#lvbox > #tpad {
layout_marginTop: 0dp;
borderWidth: 2dp;
borderColor: #66666666;
backgroundColor: #33FF3333;
backgroundImage: linear-gradient( #8c8886, #585857 );
borderRadius: 12;
textSize: 24dp;
margin-top: 0dp;
border-width: 2dp;
border-color: #66666666;
background-color: #33FF3333;
background-image: linear-gradient( #8c8886, #585857 );
border-radius: 12;
font-size: 24dp;
padding: 12dp;
transition: scale 0.25s, rotation 0.25s 0.25s, borderColor 0.25s, backgroundColor 0.25s, borderRadius 0.25s;
transition: scale 0.25s, rotation 0.25s 0.25s, border-color 0.25s, background-color 0.25s, border-radius 0.25s;
}
#lvbox > #tpad:hover {
scale: 1.1;
rotation: -3;
backgroundColor: #FF333333;
borderColor: #99999999;
borderRadius: 4;
background-color: #FF333333;
border-color: #99999999;
border-radius: 4;
}
#tpad2 {
layout_marginLeft: 0;
margin-left: 0;
padding: 24dp;
opacity: 0.8;
textSize: 24dp;
backgroundColor: #333;
font-size: 24dp;
background-color: #333;
transition: all 0.25s;
}
#tpad2:hover {
layout_marginLeft: 8dp;
margin-left: 8dp;
padding: 28dp;
opacity: 1;
borderRadius: 24;
backgroundColor: #656;
border-radius: 24;
background-color: #656;
}
#tpad3 {
borderWidth: 2dp;
borderColor: #1e2021d7;
backgroundImage: linear-gradient( #797a79, #585857 );
borderRadius: 3;
border-width: 2dp;
border-color: #1e2021d7;
background-image: linear-gradient( #797a79, #585857 );
border-radius: 3;
padding: 12dp;
transition: all 0.25;
textStyle: shadow;
textColor: white;
font-style: shadow;
color: white;
}
#tpad3:hover {
backgroundImage: linear-gradient( #9c9d9b, #5b5b5a );
borderColor: #1d1f1fd7;
borderRadius: 3;
background-image: linear-gradient( #9c9d9b, #5b5b5a );
border-color: #1d1f1fd7;
border-radius: 3;
cursor: hand;
textShadowColor: black;
shadow-color: black;
padding: 18dp 12dp 100dp 12dp;
}
#tpad3:pressed {
backgroundImage: linear-gradient( #4e4f4d, #414141 );
borderColor: #222320d7;
background-image: linear-gradient( #4e4f4d, #414141 );
border-color: #222320d7;
padding: 22dp 12dp 120dp 12dp;
}
#chbox,
#rdbut {
textSize:24dp;
font-size:24dp;
padding: 12dp;
backgroundColor: #333;
background-color: #333;
}
#tres {
backgroundColor: #444;
background-color: #444;
padding: 8dp;
transition: all 0.25s;
}
@@ -158,7 +158,7 @@ Tooltip {
}
#pbut:hover {
skinColor: #66ff44;
skin-color: #66ff44;
}
#test_2 > #rtest {
@@ -168,8 +168,8 @@ Tooltip {
#test_2 > #rtest #rttv {
background: #333;
textSize: 24dp;
borderRadius: 8;
font-size: 24dp;
border-radius: 8;
padding: 8dp;
transition: all 0.125s;
}
@@ -188,7 +188,7 @@ Tooltip {
#test_2 > #rtest:hover #rttv:pressed {
background: lime;
textColor: #333;
color: #333;
}
#test_3 {
@@ -219,7 +219,7 @@ Tooltip {
#test_3 > .rooter:hover .outer:hover .inner {
background: #DABA22;
layout_marginLeft: 16dp;
margin-left: 16dp;
}
#test_3 > .rooter:hover .outer:hover .inner:hover {
@@ -227,22 +227,22 @@ Tooltip {
}
#test_4 {
backgroundColor: #221122;
background-color: #221122;
}
#test_4 > RelativeLayout {
backgroundColor: #331133;
background-color: #331133;
padding: 8dp;
transition: all 0.125s;
}
#test_4 > RelativeLayout:hover {
backgroundColor: #442244;
background-color: #442244;
cursor: hand;
}
#test_4 > RelativeLayout:pressed {
backgroundColor: #662266;
background-color: #662266;
}
#test_4 > RelativeLayout > TextView {
@@ -250,83 +250,83 @@ Tooltip {
}
#test_4 > RelativeLayout:hover > TextView {
layout_marginLeft: 8dp;
margin-left: 8dp;
}
TabWidget {
paddingLeft: 8dp;
paddingRight: 8dp;
paddingBottom: 8dp;
paddingTop: 20dp;
backgroundColor: #656565;
padding-left: 8dp;
padding-right: 8dp;
padding-bottom: 8dp;
padding-top: 20dp;
background-color: #656565;
}
#lvbox {
backgroundColor: #222;
background-color: #222;
padding: 12dp;
}
.list {
textSize: 16dp;
font-size: 16dp;
padding: 8dp;
}
#tviewl {
textSize: 24dp;
backgroundColor: #333;
font-size: 24dp;
background-color: #333;
}
#tinput {
textSize: 24dp;
font-size: 24dp;
padding: 24dp;
}
#rvbox {
backgroundColor: #323232;
background-color: #323232;
padding: 12dp;
}
#rrl {
backgroundColor: #999;
background-color: #999;
padding: 24dp;
}
#rrl > #tmap {
textSize: 24dp;
font-size: 24dp;
padding: 12dp;
backgroundColor: #333;
background-color: #333;
}
.eltv {
textSize: 24dp;
font-size: 24dp;
padding: 12dp;
backgroundColor: #242424;
background-color: #242424;
}
#rrl > #el2,
#rrl > #tm,
#rrl > #tmp {
layout_margin: 12dp;
margin: 12dp;
}
#rrl > #slider {
padding: 32dp;
backgroundColor: #555;
background-color: #555;
}
#rrl > #scrollbar {
padding: 8dp;
backgroundColor: #12345666;
background-color: #12345666;
}
#rrl > #spinbox {
padding: 8dp;
backgroundColor: #54345666;
background-color: #54345666;
}
#rrl > TextEdit {
padding: 16dp;
layout_marginBottom: 140dp;
margin-bottom: 140dp;
}
#test_5 {
@@ -339,14 +339,14 @@ TabWidget {
}
#test_5 TextView {
layout_margin: 4dp;
margin: 4dp;
padding: 8dp;
layout_width: match_parent;
skin: button;
}
#test_6 {
layout_margin: 8dp;
margin: 8dp;
background: #323232;
}
@@ -354,7 +354,7 @@ TabWidget {
gravity: center;
background: #323232;
transition: all 0.2;
scaleType: expand;
scale-type: expand;
padding: 4dp;
}

View File

@@ -8,12 +8,12 @@
<CheckBox id="chbox" layout_width="wrap_content" layout_height="wrap_content" text="testing padding" />
<RadioButton id="rdbut" layout_width="wrap_content" layout_height="wrap_content" text="testing padding"/>
<TextInput id="tinput" layout_width="300dp" layout_height="wrap_content" text="testing padding" />
<Image id="tres" layout_width="32dp" layout_height="32dp" src="file://assets/tiles/1.png" scaleType="fit_inside" />
<Image id="tres" layout_width="32dp" layout_height="32dp" src="file://assets/tiles/1.png" scale-type="fit_inside" />
<hbox layout_width="match_parent" layout_height="wrap_content">
<Image id="tres2" layout_width="32dp" layout_height="32dp" src="https://bitbucket.org/SpartanJ/eepp/raw/01ab7c1f4c9924fbc5ef17fb85b6040709af0eda/bin/assets/icon/ee.png" scaleType="fit_inside" />
<Image id="tres2" layout_width="32dp" layout_height="32dp" src="https://bitbucket.org/SpartanJ/eepp/raw/01ab7c1f4c9924fbc5ef17fb85b6040709af0eda/bin/assets/sprites/2.png" scaleType="fit_inside" />
<Image id="tres2" layout_width="32dp" layout_height="32dp" src="https://bitbucket.org/SpartanJ/eepp/raw/01ab7c1f4c9924fbc5ef17fb85b6040709af0eda/bin/assets/sprites/3.png" scaleType="fit_inside" />
<Image id="tres2" layout_width="32dp" layout_height="32dp" src="https://bitbucket.org/SpartanJ/eepp/raw/01ab7c1f4c9924fbc5ef17fb85b6040709af0eda/bin/assets/sprites/4.png" scaleType="fit_inside" />
<Image id="tres2" layout_width="32dp" layout_height="32dp" src="https://bitbucket.org/SpartanJ/eepp/raw/01ab7c1f4c9924fbc5ef17fb85b6040709af0eda/bin/assets/icon/ee.png" scale-type="fit_inside" />
<Image id="tres2" layout_width="32dp" layout_height="32dp" src="https://bitbucket.org/SpartanJ/eepp/raw/01ab7c1f4c9924fbc5ef17fb85b6040709af0eda/bin/assets/sprites/2.png" scale-type="fit_inside" />
<Image id="tres2" layout_width="32dp" layout_height="32dp" src="https://bitbucket.org/SpartanJ/eepp/raw/01ab7c1f4c9924fbc5ef17fb85b6040709af0eda/bin/assets/sprites/3.png" scale-type="fit_inside" />
<Image id="tres2" layout_width="32dp" layout_height="32dp" src="https://bitbucket.org/SpartanJ/eepp/raw/01ab7c1f4c9924fbc5ef17fb85b6040709af0eda/bin/assets/sprites/4.png" scale-type="fit_inside" />
</hbox>
<DropDownList class="list" layout_width="300dp" layout_height="wrap_content" text="testing padding">
<item>Test</item>
@@ -34,12 +34,12 @@
<TextView class="eltv" id="el2" layout_width="wrap_content" layout_height="wrap_content" text="testing margin" layout_gravity="top|right" />
<TextView class="eltv" id="tm" layout_width="wrap_content" layout_height="wrap_content" text="testing margin" layout_gravity="bottom|left" />
<TextView class="eltv" id="tmp" layout_width="wrap_content" layout_height="wrap_content" text="testing margin padding" layout_gravity="bottom|right" />
<!-- <Loader layout_width="350dp" layout_height="350dp" layout_gravity="center" fillColor="#999" padding="44dp" outlinethickness="8dp" /> -->
<!-- <Loader layout_width="350dp" layout_height="350dp" layout_gravity="center" fill-color="#999" padding="44dp" outline-thickness="8dp" /> -->
<PushButton layout_width="wrap_content" layout_height="wrap_content" text="testing padding" layout_gravity="bottom|right" gravity="center" padding="8dp" layout_to_top_of="tmp" />
<PushButton id="pbut" text="OK!" textSize="16dp" icon="ok" layout_gravity="left|bottom" gravity="center" layout_width="wrap_content" layout_height="wrap_content" layout_marginBottom="8dp" padding="8dp" layout_to_top_of="tm" />
<PushButton id="pbut" text="OK!" font-size="16dp" icon="ok" layout_gravity="left|bottom" gravity="center" layout_width="wrap_content" layout_height="wrap_content" margin-bottom="8dp" padding="8dp" layout_to_top_of="tm" />
<Slider id="slider" orientation="horizontal" halfslider="true" layout_width="200dp" layout_height="wrap_content" layout_to_bottom_of="el1" />
<Slider id="slider" orientation="horizontal" half-slider="true" layout_width="200dp" layout_height="wrap_content" layout_to_bottom_of="el1" />
<ScrollBar id="scrollbar" orientation="horizontal" layout_width="200dp" layout_height="wrap_content" layout_to_bottom_of="slider" />
@@ -51,7 +51,7 @@
</hbox>
<hbox id="test_2" layout_width="match_parent" layout_height="match_parent">
<RelativeLayout id="rtest" layout_width="match_parent" layout_height="match_parent">
<TextView id="rttv" layout_width="wrap_content" layout_height="wrap_content" text="Hello World!" layout_gravity="center" />
<TextView id="rttv" layout_width="wrap_content" layout_height="wrap_content" text="Hello World!" layout_gravity="center" />
</RelativeLayout>
</hbox>
<hbox id="test_3" layout_width="match_parent" layout_height="match_parent">
@@ -76,7 +76,7 @@
<TextView text="Test 19" /><TextView text="Test 20" /><TextView text="Test 21" /><TextView text="Test 22" /><TextView text="Test 23" /><TextView text="Test 24" />
</vbox>
</ScrollView>
<GridLayout id="test_6" columnMode="size" rowMode="size" columnWidth="64dp" rowHeight="64dp" layout_width="match_parent" layout_height="wrap_content">
<GridLayout id="test_6" column-mode="size" row-mode="size" column-width="64dp" row-height="64dp" layout_width="match_parent" layout_height="wrap_content">
<Image src="file://assets/tiles/1.png" />
<Image src="file://assets/tiles/2.png" />
<Image src="file://assets/tiles/3.png" />

View File

@@ -1,63 +1,63 @@
<vbox layout_width="match_parent" layout_height="match_parent">
<TabWidget layout_width="match_parent" layout_height="match_parent" paddingLeft="8dp" paddingRight="8dp" paddingBottom="8dp" paddingTop="20dp" background="#656565">
<TabWidget layout_width="match_parent" layout_height="match_parent" padding-left="8dp" padding-right="8dp" padding-bottom="8dp" padding-top="20dp" background="#656565">
<hbox id="test_1" layout_width="match_parent" layout_height="match_parent">
<vbox id="lvbox" layout_width="match_parent" layout_weight="0.5" layout_height="match_parent" background="#222" padding="12dp">
<TextView layout_width="wrap_content" layout_height="wrap_content" text="Testing TextView"/>
<PushButton layout_width="wrap_content" layout_height="wrap_content" text="Testing PushButton" />
<CheckBox layout_width="wrap_content" layout_height="wrap_content" layout_marginTop="8dp" text="Testing CheckBox" />
<RadioButton layout_width="wrap_content" layout_height="wrap_content" layout_marginTop="8dp" text="Testing RadioButton"/>
<DropDownList layout_width="300dp" layout_height="wrap_content" layout_marginTop="8dp" text="Testing DropDownList">
<CheckBox layout_width="wrap_content" layout_height="wrap_content" margin-top="8dp" text="Testing CheckBox" />
<RadioButton layout_width="wrap_content" layout_height="wrap_content" margin-top="8dp" text="Testing RadioButton"/>
<DropDownList layout_width="300dp" layout_height="wrap_content" margin-top="8dp" text="Testing DropDownList">
<item>Test</item>
<item>Test 2</item>
<item>Test 3</item>
</DropDownList>
<Image layout_width="32dp" layout_height="32dp" src="file://assets/tiles/1.png" layout_marginTop="8dp" />
<ListBox layout_width="300dp" layout_height="100dp" layout_marginTop="8dp" text="Testing ListBox">
<Image layout_width="32dp" layout_height="32dp" src="file://assets/tiles/1.png" margin-top="8dp" />
<ListBox layout_width="300dp" layout_height="100dp" margin-top="8dp" text="Testing ListBox">
<item>Test</item>
<item>Test 2</item>
<item>Test 3</item>
</ListBox>
<ProgressBar layout_width="300dp" layout_height="wrap_content" layout_marginTop="8dp" progress="50" layout_marginTop="8dp" />
<ScrollBar id="scrollbar" orientation="horizontal" layout_width="300dp" layout_height="wrap_content" layout_marginTop="8dp" />
<Slider id="scrollbar" orientation="horizontal" layout_width="300dp" layout_height="wrap_content" layout_marginTop="8dp" />
<!-- <Sprite layout_width="wrap_content" layout_height="wrap_content" src="" layout_marginTop="8dp" /> -->
<ComboBox layout_width="300dp" layout_height="wrap_content" layout_marginTop="8dp" text="Testing ComboBox" layout_marginTop="8dp">
<ProgressBar layout_width="300dp" layout_height="wrap_content" margin-top="8dp" progress="50" margin-top="8dp" />
<ScrollBar id="scrollbar" orientation="horizontal" layout_width="300dp" layout_height="wrap_content" margin-top="8dp" />
<Slider id="scrollbar" orientation="horizontal" layout_width="300dp" layout_height="wrap_content" margin-top="8dp" />
<!-- <Sprite layout_width="wrap_content" layout_height="wrap_content" src="" margin-top="8dp" /> -->
<ComboBox layout_width="300dp" layout_height="wrap_content" margin-top="8dp" text="Testing ComboBox" margin-top="8dp">
<item>Test</item>
<item>Test 2</item>
<item>Test 3</item>
</ComboBox>
<TextInput layout_width="300dp" layout_height="wrap_content" layout_marginTop="8dp" text="Testing TextInput" />
<TextEdit layout_width="300dp" layout_height="60dp" layout_marginTop="8dp" text="Testing TextEdit" />
<SelectButton layout_width="wrap_content" layout_height="wrap_content" text="Testing SelectButton" layout_marginTop="8dp" />
<!-- <TextureRegion layout_width="32dp" layout_height="32dp" src="" layout_marginTop="8dp" layout_marginTop="8dp" /> -->
<TextInput layout_width="300dp" layout_height="wrap_content" margin-top="8dp" text="Testing TextInput" />
<TextEdit layout_width="300dp" layout_height="60dp" margin-top="8dp" text="Testing TextEdit" />
<SelectButton layout_width="wrap_content" layout_height="wrap_content" text="Testing SelectButton" margin-top="8dp" />
<!-- <TextureRegion layout_width="32dp" layout_height="32dp" src="" margin-top="8dp" margin-top="8dp" /> -->
</vbox>
<vbox id="rvbox" layout_width="match_parent" layout_weight="0.5" layout_height="match_parent" background="#323232" padding="12dp">
<RelativeLayout id="rrl" layout_width="match_parent" layout_height="match_parent" background="#999" padding="24dp">
<TextView layout_width="match_parent" layout_height="match_parent" text="testing match_parent" textSize="24dp" padding="12dp" background="#333" gravity="center" />
<TextView id="el1" layout_width="wrap_content" layout_height="wrap_content" text="testing padding" textSize="24dp" padding="12dp" background="#242424" />
<TextView layout_width="wrap_content" layout_height="wrap_content" text="testing margin" textSize="24dp" padding="12dp" background="#242424" layout_gravity="top|right" layout_margin="12dp" />
<TextView id="tm" layout_width="wrap_content" layout_height="wrap_content" text="testing margin" textSize="24dp" background="#242424" layout_gravity="bottom|left" layout_margin="12dp" />
<TextView id="tmp" layout_width="wrap_content" layout_height="wrap_content" text="testing margin padding" textSize="24dp" background="#242424" layout_gravity="bottom|right" layout_margin="12dp" padding="12dp" />
<Loader layout_width="350dp" layout_height="350dp" layout_gravity="center" fillColor="#999" padding="44dp" outlinethickness="8dp" />
<TextView layout_width="match_parent" layout_height="match_parent" text="testing match_parent" font-size="24dp" padding="12dp" background="#333" gravity="center" />
<TextView id="el1" layout_width="wrap_content" layout_height="wrap_content" text="testing padding" font-size="24dp" padding="12dp" background="#242424" />
<TextView layout_width="wrap_content" layout_height="wrap_content" text="testing margin" font-size="24dp" padding="12dp" background="#242424" layout_gravity="top|right" margin="12dp" />
<TextView id="tm" layout_width="wrap_content" layout_height="wrap_content" text="testing margin" font-size="24dp" background="#242424" layout_gravity="bottom|left" margin="12dp" />
<TextView id="tmp" layout_width="wrap_content" layout_height="wrap_content" text="testing margin padding" font-size="24dp" background="#242424" layout_gravity="bottom|right" margin="12dp" padding="12dp" />
<Loader layout_width="350dp" layout_height="350dp" layout_gravity="center" fill-color="#999" padding="44dp" outline-thickness="8dp" />
<Sprite layout_width="96dp" layout_height="96dp" src="bn" padding="8dp" background="#888" gravity="center" layout_marginTop="56dp" gravity="right|bottom" />
<TextureRegion layout_width="96dp" layout_height="96dp" src="bn01" padding="8dp" background="#787" gravity="center" layout_marginTop="162dp" gravity="right|bottom" />
<Sprite layout_width="96dp" layout_height="96dp" src="bn" padding="8dp" background="#888" gravity="center" margin-top="56dp" gravity="right|bottom" />
<TextureRegion layout_width="96dp" layout_height="96dp" src="bn01" padding="8dp" background="#787" gravity="center" margin-top="162dp" gravity="right|bottom" />
<PushButton layout_width="wrap_content" layout_height="wrap_content" text="testing padding" layout_gravity="bottom|right" gravity="center" padding="8dp" layout_to_top_of="tmp" />
<PushButton text="OK!" textSize="16dp" icon="ok" layout_gravity="left|bottom" gravity="center" layout_width="wrap_content" layout_height="wrap_content" layout_marginBottom="8dp" padding="8dp" layout_to_top_of="tm" />
<PushButton text="OK!" font-size="16dp" icon="ok" layout_gravity="left|bottom" gravity="center" layout_width="wrap_content" layout_height="wrap_content" margin-bottom="8dp" padding="8dp" layout_to_top_of="tm" />
<Slider id="slider" orientation="horizontal" halfslider="true" layout_width="200dp" layout_height="wrap_content" padding="32dp" background="#555" layout_to_bottom_of="el1" />
<Slider id="slider" orientation="horizontal" half-slider="true" layout_width="200dp" layout_height="wrap_content" padding="32dp" background="#555" layout_to_bottom_of="el1" />
<ScrollBar id="scrollbar" orientation="horizontal" layout_width="200dp" layout_height="wrap_content" padding="8dp" background="#12345666" layout_to_bottom_of="slider" />
<SpinBox id="spinbox" layout_width="200dp" layout_height="wrap_content" padding="8dp" background="#54345666" layout_to_bottom_of="scrollbar" />
<TextEdit layout_width="200dp" layout_height="50dp" layout_gravity="bottom|center_horizontal" padding="16dp" layout_marginBottom="140dp" />
<TextEdit layout_width="200dp" layout_height="50dp" layout_gravity="bottom|center_horizontal" padding="16dp" margin-bottom="140dp" />
</RelativeLayout>
</vbox>
</hbox>
<hbox id="test_2" layout_width="match_parent" layout_height="match_parent">
<TextView layout_width="match_parent" layout_height="match_parent" text="Hello World!" gravity="center" background="#333" textSize="24dp" borderRadius="128" />
<TextView layout_width="match_parent" layout_height="match_parent" text="Hello World!" gravity="center" background="#333" font-size="24dp" border-radius="128" />
</hbox>
<Tab name="Padding Test" owns="test_1" />

View File

@@ -1,38 +1,38 @@
/* Global rules */
* {
textColor: #E6E6E6FF;
textShadowColor: #32323296;
textSelectedColor: #000;
textSelectionBackColor: #969696FF;
color: #E6E6E6FF;
shadow-color: #32323296;
selected-color: #000;
selection-back-color: #969696FF;
}
TabWidget {
tabSeparation: -1dp;
drawLineBelowTabs: true;
lineBelowTabsColor: #2f3030;
lineBelowTabsYOffset: 0dp;
tab-separation: -1dp;
line-below-tabs: true;
line-below-tabs-color: #2f3030;
line-below-tabs-y-offset: 0dp;
}
ProgressBar {
displayPercent: true;
verticalExpand: true;
fillerPadding: 2dp;
movementSpeed: 32, 0;
display-percent: true;
vertical-expand: true;
filler-padding: 2dp;
movement-speed: 32, 0;
}
WinMenu {
buttonMargin: 12dp;
button-margin: 12dp;
}
Menu,
PopUpMenu {
textColor: #E6E6E6FF;
minWidth: 100dp;
minSpaceForIcons: 24dp;
minRightMargin: 8dp;
color: #E6E6E6FF;
min-width: 100dp;
min-icon-space: 24dp;
min-margin-right: 8dp;
}
Menu:hover,
Menu:hover,
PopUpMenu:hover,
Menu::Item:hover,
Menu::CheckBox:hover,
@@ -41,28 +41,29 @@ ListBox::item:hover,
Tab:selected,
Tab:hover,
Tab:pressed {
textColor: #FFF;
color: #FFF;
}
Slider {
halfSlider: true;
Slider {
half-slider: true;
}
ScrollBar {
expandBackground: true;
background-expand: true;
}
Window {
winFlags: shadow;
buttonsPositionFixer: -2, 0;
window-flags: shadow;
buttons-position-offset: -2, 0;
}
Window::title {
textColor: #E6E6E6FF;
textStyle: shadow;
color: #E6E6E6FF;
font-style: shadow;
}
Tooltip {
padding: 8dp;
textColor: black;
color: black;
}

View File

@@ -37,5 +37,6 @@
#include <eepp/system/iostreaminflate.hpp>
#include <eepp/system/iostreamdeflate.hpp>
#include <eepp/system/virtualfilesystem.hpp>
#include <eepp/system/scopedbuffer.hpp>
#endif

View File

@@ -127,7 +127,9 @@ class EE_API UIListBox : public UITouchDragableWidget {
std::vector<UIListBoxItem *> mItems;
std::vector<String> mTexts;
void updateScroll( bool FromScrollChange = false );
void updateScroll( bool fromScrollChange = false );
void updateScrollBarState();
void onScrollValueChange( const Event * Event );

View File

@@ -168,17 +168,17 @@ void StyleSheetPropertiesParser::addProperty( const std::string& name, std::stri
if ( name == "padding" ) {
value = String::toLower( String::trim( value ) );
Rectf rect( NodeAttribute( name, value ).asRectf() );
mProperties[ "paddingleft" ] = StyleSheetProperty( "paddingleft", String::toStr( rect.Left ) );
mProperties[ "paddingright" ] = StyleSheetProperty( "paddingright", String::toStr( rect.Right ) );
mProperties[ "paddingtop" ] = StyleSheetProperty( "paddingtop", String::toStr( rect.Top ) );
mProperties[ "paddingbottom" ] = StyleSheetProperty( "paddingbottom", String::toStr( rect.Bottom ) );
} else if ( name == "layout_margin" ) {
mProperties[ "padding-left" ] = StyleSheetProperty( "padding-left", String::toStr( rect.Left ) );
mProperties[ "padding-right" ] = StyleSheetProperty( "padding-right", String::toStr( rect.Right ) );
mProperties[ "padding-top" ] = StyleSheetProperty( "padding-top", String::toStr( rect.Top ) );
mProperties[ "padding-bottom" ] = StyleSheetProperty( "padding-bottom", String::toStr( rect.Bottom ) );
} else if ( name == "margin" ) {
value = String::toLower( String::trim( value ) );
Rect rect( NodeAttribute( name, value ).asRect() );
mProperties[ "layout_marginleft" ] = StyleSheetProperty( "layout_marginleft", String::toStr( rect.Left ) );
mProperties[ "layout_marginright" ] = StyleSheetProperty( "layout_marginright", String::toStr( rect.Right ) );
mProperties[ "layout_margintop" ] = StyleSheetProperty( "layout_margintop", String::toStr( rect.Top ) );
mProperties[ "layout_marginbottom" ] = StyleSheetProperty( "layout_marginbottom", String::toStr( rect.Bottom ) );
mProperties[ "margin-left" ] = StyleSheetProperty( "margin-left", String::toStr( rect.Left ) );
mProperties[ "margin-right" ] = StyleSheetProperty( "margin-right", String::toStr( rect.Right ) );
mProperties[ "margin-top" ] = StyleSheetProperty( "margin-top", String::toStr( rect.Top ) );
mProperties[ "margin-bottom" ] = StyleSheetProperty( "margin-bottom", String::toStr( rect.Bottom ) );
} else {
mProperties[ name ] = StyleSheetProperty( name, value );
}

View File

@@ -1,9 +1,5 @@
#include <eepp/ui/css/stylesheetproperty.hpp>
#include <eepp/core/string.hpp>
#include <eepp/graphics/pixeldensity.hpp>
#include <eepp/graphics/text.hpp>
#include <eepp/ui/uihelper.hpp>
#include <algorithm>
namespace EE { namespace UI { namespace CSS {

View File

@@ -97,6 +97,7 @@ void StyleSheetSelectorRule::pushSelectorTypeIdentifier( TypeIdentifier selector
case GLOBAL:
mTagName = name;
mSpecificity += SpecificityGlobal;
break;
case TAG:
mTagName = name;
mSpecificity += SpecificityTag;

View File

@@ -60,47 +60,47 @@ TextureAtlasEditor::TextureAtlasEditor( UIWindow * AttatchTo, const TGEditorClos
</WinMenu>
<LinearLayout layout_width="match_parent" layout_height="0dp" layout_weight="1" orientation="horizontal">
<TextureAtlasTextureRegionEditor layout_width="match_parent" layout_height="match_parent" layout_weight="1"
flags="clip" backgroundColor="#00000032" borderWidth="1" borderColor="#000000FF" />
<LinearLayout orientation="vertical" layout_width="210dp" layout_height="match_parent" layout_marginLeft="8dp" layout_marginRight="8dp">
<TextView text="Texture Filter:" fontStyle="shadow" layout_marginTop="4dp" layout_marginBottom="4dp" />
<DropDownList id="textureFilter" layout_width="match_parent" layout_height="wrap_content" layout_gravity="center_vertical" selectedText="Linear">
flags="clip" background-color="#00000032" border-width="1" border-color="#000000FF" />
<LinearLayout orientation="vertical" layout_width="210dp" layout_height="match_parent" margin-left="8dp" margin-right="8dp">
<TextView text="Texture Filter:" font-style="shadow" margin-top="4dp" margin-bottom="4dp" />
<DropDownList id="textureFilter" layout_width="match_parent" layout_height="wrap_content" layout_gravity="center_vertical" selected-text="Linear">
<item>Linear</item>
<item>Nearest</item>
</DropDownList>
<TextView text="TextureRegion List:" fontStyle="shadow" layout_marginTop="8dp" layout_marginBottom="8dp" />
<TextView text="TextureRegion List:" font-style="shadow" margin-top="8dp" margin-bottom="8dp" />
<TabWidget layout_width="match_parent" layout_height="0dp" layout_weight="1">
<ScrollView id="GridView" layout_width="match_parent" layout_height="144dp" touchdrag="true">
<GridLayout columnMode="size" rowMode="size" columnWidth="64dp" rowHeight="64dp" layout_width="match_parent" layout_height="wrap_content" id="gridlayout" />
<GridLayout columnMode="size" rowMode="size" columnWidth="64dp" row-height="64dp" layout_width="match_parent" layout_height="wrap_content" id="gridlayout" />
</ScrollView>
<ListBox id="TextureRegionList" layout_width="match_parent" layout_height="144dp" touchDrag="true" />
<Tab name="List" owns="TextureRegionList" />
<Tab name="Grid" owns="GridView" />
</TabWidget>
<TextView text="Current TextureRegion:" fontStyle="shadow" layout_marginTop="16dp" layout_marginBottom="16dp" />
<TextView text="Current TextureRegion:" font-style="shadow" margin-top="16dp" margin-bottom="16dp" />
<LinearLayout orientation="horizontal" layout_width="match_parent" layout_height="wrap_content">
<TextView text="Offset X:" fontStyle="shadow" layout_width="match_parent" layout_height="wrap_content" layout_weight="1"
layout_marginRight="8dp" layout_gravity="center" gravity="right|center_vertical" />
<SpinBox id="offX" layout_width="100dp" layout_height="wrap_content" minValue="-32000" maxValue="32000" />
<TextView text="Offset X:" font-style="shadow" layout_width="match_parent" layout_height="wrap_content" layout_weight="1"
margin-right="8dp" layout_gravity="center" gravity="right|center_vertical" />
<SpinBox id="offX" layout_width="100dp" layout_height="wrap_content" min-value="-32000" max-value="32000" />
</LinearLayout>
<LinearLayout orientation="horizontal" layout_width="match_parent" layout_height="wrap_content">
<TextView text="Offset Y:" fontStyle="shadow" layout_width="match_parent" layout_height="wrap_content" layout_weight="1"
layout_marginRight="8dp" layout_gravity="center" gravity="right|center_vertical" />
<SpinBox id="offY" layout_width="100dp" layout_height="wrap_content" minValue="-32000" maxValue="32000" />
<TextView text="Offset Y:" font-style="shadow" layout_width="match_parent" layout_height="wrap_content" layout_weight="1"
margin-right="8dp" layout_gravity="center" gravity="right|center_vertical" />
<SpinBox id="offY" layout_width="100dp" layout_height="wrap_content" min-value="-32000" max-value="32000" />
</LinearLayout>
<LinearLayout orientation="horizontal" layout_width="match_parent" layout_height="wrap_content">
<TextView text="Dest. Width" fontStyle="shadow" layout_width="match_parent" layout_height="wrap_content" layout_weight="1"
layout_marginRight="8dp" layout_gravity="center" gravity="right|center_vertical" />
<SpinBox id="destW" layout_width="100dp" layout_height="wrap_content" minValue="0" maxValue="32000" />
<TextView text="Dest. Width" font-style="shadow" layout_width="match_parent" layout_height="wrap_content" layout_weight="1"
margin-right="8dp" layout_gravity="center" gravity="right|center_vertical" />
<SpinBox id="destW" layout_width="100dp" layout_height="wrap_content" min-value="0" max-value="32000" />
</LinearLayout>
<LinearLayout orientation="horizontal" layout_width="match_parent" layout_height="wrap_content">
<TextView text="Dest. Height" fontStyle="shadow" layout_width="match_parent" layout_height="wrap_content" layout_weight="1"
layout_marginRight="8dp" layout_gravity="center" gravity="right|center_vertical" />
<SpinBox id="destH" layout_width="100dp" layout_height="wrap_content" minValue="0" maxValue="32000" />
<TextView text="Dest. Height" font-style="shadow" layout_width="match_parent" layout_height="wrap_content" layout_weight="1"
margin-right="8dp" layout_gravity="center" gravity="right|center_vertical" />
<SpinBox id="destH" layout_width="100dp" layout_height="wrap_content" min-value="0" max-value="32000" />
</LinearLayout>
<PushButton id="resetDest" text="Reset Dest. Size" layout_width="match_parent" layout_height="wrap_content" layout_marginBottom="8dp" layout_marginTop="8dp" />
<PushButton id="resetOff" text="Reset Offset" layout_width="match_parent" layout_height="wrap_content" layout_marginBottom="8dp" />
<PushButton id="centerOff" text="Centered Offset" layout_width="match_parent" layout_height="wrap_content" layout_marginBottom="8dp" />
<PushButton id="hbotOff" text="Half-Bottom Offset" layout_width="match_parent" layout_height="wrap_content" layout_marginBottom="8dp" />
<PushButton id="resetDest" text="Reset Dest. Size" layout_width="match_parent" layout_height="wrap_content" margin-bottom="8dp" margin-top="8dp" />
<PushButton id="resetOff" text="Reset Offset" layout_width="match_parent" layout_height="wrap_content" margin-bottom="8dp" />
<PushButton id="centerOff" text="Centered Offset" layout_width="match_parent" layout_height="wrap_content" margin-bottom="8dp" />
<PushButton id="hbotOff" text="Half-Bottom Offset" layout_width="match_parent" layout_height="wrap_content" margin-bottom="8dp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

View File

@@ -28,10 +28,10 @@ TextureAtlasNew::TextureAtlasNew( TGCreateCb NewTGCb ) :
mUIWindow->setTitle( "New Texture Atlas" );
std::string layout = R"xml(
<LinearLayout id='container' layout_width='match_parent' layout_height='wrap_content' layout_marginLeft='8dp' layout_marginRight='8dp' layout_marginTop='8dp'>
<LinearLayout layout_width='match_parent' layout_height='wrap_content' orientation='horizontal' layout_marginBottom='8dp'>
<LinearLayout id='container' layout_width='match_parent' layout_height='wrap_content' margin-left='8dp' margin-right='8dp' margin-top='8dp'>
<LinearLayout layout_width='match_parent' layout_height='wrap_content' orientation='horizontal' margin-bottom='8dp'>
<TextView layout_width='match_parent' layout_weight='0.7' layout_height='wrap_content' layout_gravity='center_vertical' text='Save File Format:' />
<DropDownList id='saveType' layout_width='match_parent' layout_weight='0.3' layout_height='wrap_content' layout_gravity='center_vertical' selectedText='PNG'>
<DropDownList id='saveType' layout_width='match_parent' layout_weight='0.3' layout_height='wrap_content' layout_gravity='center_vertical' selected-text='PNG'>
<item>TGA</item>
<item>BMP</item>
<item>PNG</item>
@@ -39,21 +39,21 @@ TextureAtlasNew::TextureAtlasNew( TGCreateCb NewTGCb ) :
<item>JPG</item>
</DropDownList>
</LinearLayout>
<LinearLayout layout_width='match_parent' layout_height='wrap_content' orientation='horizontal' layout_marginBottom='8dp'>
<LinearLayout layout_width='match_parent' layout_height='wrap_content' orientation='horizontal' margin-bottom='8dp'>
<TextView layout_width='match_parent' layout_weight='0.7' layout_height='wrap_content' layout_gravity='center_vertical' text='Max. Texture Atlas Width:' />
<ComboBox id='maxTAWidth' layout_width='match_parent' layout_weight='0.3' layout_height='wrap_content' layout_gravity='center_vertical' onlyNumbers='true' />
</LinearLayout>
<LinearLayout layout_width='match_parent' layout_height='wrap_content' orientation='horizontal' layout_marginBottom='8dp'>
<LinearLayout layout_width='match_parent' layout_height='wrap_content' orientation='horizontal' margin-bottom='8dp'>
<TextView layout_width='match_parent' layout_weight='0.7' layout_height='wrap_content' layout_gravity='center_vertical' text='Max. Texture Atlas Height:' />
<ComboBox id='maxTAHeight' layout_width='match_parent' layout_weight='0.3' layout_height='wrap_content' layout_gravity='center_vertical' onlyNumbers='true' />
</LinearLayout>
<LinearLayout layout_width='match_parent' layout_height='wrap_content' orientation='horizontal' layout_marginBottom='8dp'>
<LinearLayout layout_width='match_parent' layout_height='wrap_content' orientation='horizontal' margin-bottom='8dp'>
<TextView layout_width='match_parent' layout_weight='0.7' layout_height='wrap_content' layout_gravity='center_vertical' text='Space between sub textures (pixels):' />
<SpinBox id='pixelSpace' layout_width='match_parent' layout_weight='0.3' layout_height='wrap_content' layout_gravity='center_vertical' />
</LinearLayout>
<LinearLayout layout_width='match_parent' layout_height='wrap_content' orientation='horizontal' layout_marginBottom='8dp'>
<LinearLayout layout_width='match_parent' layout_height='wrap_content' orientation='horizontal' margin-bottom='8dp'>
<TextView layout_width='match_parent' layout_weight='0.7' layout_height='wrap_content' layout_gravity='center_vertical' text='Pixel Density:' />
<DropDownList id='pixelDensity' layout_width='match_parent' layout_weight='0.3' layout_height='wrap_content' layout_gravity='center_vertical' selectedText='MDPI'>
<DropDownList id='pixelDensity' layout_width='match_parent' layout_weight='0.3' layout_height='wrap_content' layout_gravity='center_vertical' selected-text='MDPI'>
<item>MDPI</item>
<item>HDPI</item>
<item>XHDPI</item>
@@ -61,20 +61,20 @@ TextureAtlasNew::TextureAtlasNew( TGCreateCb NewTGCb ) :
<item>XXXHDPI</item>
</DropDownList>
</LinearLayout>
<LinearLayout layout_width='match_parent' layout_height='wrap_content' orientation='horizontal' layout_marginBottom='8dp'>
<LinearLayout layout_width='match_parent' layout_height='wrap_content' orientation='horizontal' margin-bottom='8dp'>
<TextView layout_width='match_parent' layout_weight='0.7' layout_height='wrap_content' layout_gravity='center_vertical' text='Texture Filter:' />
<DropDownList id='textureFilter' layout_width='match_parent' layout_weight='0.3' layout_height='wrap_content' layout_gravity='center_vertical' selectedText='Linear'>
<DropDownList id='textureFilter' layout_width='match_parent' layout_weight='0.3' layout_height='wrap_content' layout_gravity='center_vertical' selected-text='Linear'>
<item>Linear</item>
<item>Nearest</item>
</DropDownList>
</LinearLayout>
<TextView layout_width='match_parent' layout_height='wrap_content' layout_gravity='center_vertical' text='TextureAtlas Folder Path:' />
<LinearLayout layout_width='match_parent' layout_height='wrap_content' orientation='horizontal' layout_marginBottom='8dp'>
<LinearLayout layout_width='match_parent' layout_height='wrap_content' orientation='horizontal' margin-bottom='8dp'>
<TextInput id='pathInput' layout_width='match_parent' layout_height='match_parent' layout_weight='1' allowEditing='false' />
<PushButton id='openPath' layout_width='32dp' layout_height='wrap_content' text='...' />
</LinearLayout>
<LinearLayout layout_gravity='center_vertical|right' layout_width='wrap_content' layout_height='wrap_content' orientation='horizontal' layout_marginBottom='16dp'>
<PushButton id='okButton' layout_width='wrap_content' layout_height='wrap_content' layout_weight='0.2' icon='ok' text='OK' layout_marginRight='4dp' />
<LinearLayout layout_gravity='center_vertical|right' layout_width='wrap_content' layout_height='wrap_content' orientation='horizontal' margin-bottom='16dp'>
<PushButton id='okButton' layout_width='wrap_content' layout_height='wrap_content' layout_weight='0.2' icon='ok' text='OK' margin-right='4dp' />
<PushButton id='cancelButton' layout_width='wrap_content' layout_height='wrap_content' layout_weight='0.2' icon='cancel' text='Cancel' />
</LinearLayout>
</LinearLayout>

View File

@@ -263,10 +263,17 @@ void UIDropDownList::destroyListBox() {
bool UIDropDownList::setAttribute( const NodeAttribute& attribute, const Uint32& state ) {
const std::string& name = attribute.getName();
if ( "popuptomaincontrol" == name ) {
if ( "popup-to-main-control" == name || "popuptomaincontrol" == name ) {
setPopUpToMainControl( attribute.asBool() );
} else if ( "maxnumvisibleitems" == name ) {
} else if ( "max-visible-items" == name || "maxvisibleitems" == name ) {
setMaxNumVisibleItems( attribute.asUint() );
} else if ( "selected-index" == name || "selected-text" == name ||
"scrollbar-type" == name || "row-height" == name ||
"vscroll-mode" == name || "hscroll-mode" == name ||
"selectedindex" == name || "selectedtext" == name ||
"scrollbartype" == name || "rowheight" == name ||
"vscrollmode" == name || "hscrollmode" == name) {
mListBox->setAttribute( attribute, state );
} else {
return UITextInput::setAttribute( attribute, state );
}
@@ -277,16 +284,10 @@ bool UIDropDownList::setAttribute( const NodeAttribute& attribute, const Uint32&
void UIDropDownList::loadFromXmlNode(const pugi::xml_node & node) {
beginAttributesTransaction();
UITextInput::loadFromXmlNode( node );
for (pugi::xml_attribute_iterator ait = node.attributes_begin(); ait != node.attributes_end(); ++ait) {
if ( String::startsWith( std::string( ait->name() ), "listbox_" ) ) {
mListBox->setAttribute( NodeAttribute( std::string( ait->name() + 8 ), ait->value() ) );
}
}
mListBox->loadItemsFromXmlNode( node );
UITextInput::loadFromXmlNode( node );
endAttributesTransaction();
}

View File

@@ -207,29 +207,29 @@ Sizef UIGridLayout::getTargetElementSize() const {
bool UIGridLayout::setAttribute( const NodeAttribute& attribute, const Uint32& state ) {
const std::string& name = attribute.getName();
if ( "columnspan" == name ) {
if ( "column-span" == name || "columnspan" == name ) {
setSpan( Sizei( attribute.asInt(), mSpan.y ) );
} else if ( "rowspan" == name ) {
} else if ( "row-span" == name || "rowspan" == name ) {
setSpan( Sizei( mSpan.x, attribute.asInt() ) );
} else if ( "span" == name ) {
setSpan( Sizei( attribute.asInt(), attribute.asInt() ) );
} else if ( "columnmode" == name ) {
} else if ( "column-mode" == name || "columnmode" == name ) {
std::string val( attribute.asString() );
String::toLowerInPlace( val );
setColumnMode( "size" == val ? Size : Weight );
} else if ( "rowmode" == name ) {
} else if ( "row-mode" == name || "rowmode" == name ) {
std::string val( attribute.asString() );
String::toLowerInPlace( val );
setRowMode( "size" == val ? Size : Weight );
} else if ( "columnweight" == name ) {
} else if ( "column-weight" == name || "columnweight" == name ) {
setColumnWeight( attribute.asFloat() );
} else if ( "columnwidth" == name ) {
} else if ( "column-width" == name || "columnwidth" == name ) {
setColumnWidth( attribute.asInt() );
} else if ( "rowweight" == name ) {
} else if ( "row-weight" == name || "rowweight" == name ) {
setRowWeight( attribute.asFloat() );
} else if ( "rowheight" == name ) {
} else if ( "row-height" == name || "rowheight" == name ) {
setRowHeight( attribute.asInt() );
} else if ( "reversedraw" == name ) {
} else if ( "reverse-draw" == name || "reversedraw" == name ) {
setReverseDraw( attribute.asBool() );
} else {
return UILayout::setAttribute( attribute, state );

View File

@@ -221,7 +221,7 @@ bool UIImage::setAttribute( const NodeAttribute& attribute, const Uint32& state
setDrawable( res );
}
} else if ( "scaletype" == name ) {
} else if ( "scale-type" == name || "scaletype" == name ) {
std::string val = attribute.asString();
String::toLowerInPlace( val );

View File

@@ -311,6 +311,7 @@ void UIListBox::onSizeChange() {
}
containerResize();
updateScrollBarState();
updateListBoxItemsSize();
updateScroll();
@@ -451,22 +452,11 @@ void UIListBox::createItemIndex( const Uint32& i ) {
}
}
void UIListBox::updateScroll( bool FromScrollChange ) {
if ( !mItems.size() )
return;
void UIListBox::updateScrollBarState() {
bool clipped = 0 != mContainer->isClipped();
UIListBoxItem * Item;
Uint32 i, RelPos = 0, RelPosMax;
Int32 ItemPos, ItemPosMax;
Int32 tHLastScroll = mHScrollInit;
Uint32 VisibleItems = mContainer->getSize().getHeight() / mRowHeight;
mItemsNotVisible = (Int32)mItems.size() - VisibleItems;
bool wasScrollVisible = mVScrollBar->isVisible();
bool wasHScrollVisible = mHScrollBar->isVisible();
bool Clipped = 0 != mContainer->isClipped();
Uint32 visibleItems = mContainer->getSize().getHeight() / mRowHeight;
mItemsNotVisible = (Int32)mItems.size() - visibleItems;
if ( mItemsNotVisible <= 0 ) {
if ( UI_SCROLLBAR_ALWAYS_ON == mVScrollMode ) {
@@ -486,7 +476,7 @@ void UIListBox::updateScroll( bool FromScrollChange ) {
}
}
if ( Clipped && ( UI_SCROLLBAR_AUTO == mHScrollMode || UI_SCROLLBAR_ALWAYS_ON == mHScrollMode ) ) {
if ( clipped && ( UI_SCROLLBAR_AUTO == mHScrollMode || UI_SCROLLBAR_ALWAYS_ON == mHScrollMode ) ) {
if ( ( mVScrollBar->isVisible() && mContainer->getPixelsSize().getWidth() - mVScrollBar->getPixelsSize().getWidth() < (Int32)mMaxTextWidth ) ||
( !mVScrollBar->isVisible() && mContainer->getPixelsSize().getWidth() < (Int32)mMaxTextWidth ) ) {
mHScrollBar->setVisible( true );
@@ -515,41 +505,57 @@ void UIListBox::updateScroll( bool FromScrollChange ) {
}
}
}
}
VisibleItems = mContainer->getSize().getHeight() / mRowHeight;
mItemsNotVisible = (Uint32)mItems.size() - VisibleItems;
Int32 Scrolleable = (Int32)mItems.size() * mRowHeight - mContainer->getSize().getHeight();
void UIListBox::updateScroll( bool fromScrollChange ) {
if ( !mItems.size() )
return;
bool clipped = 0 != mContainer->isClipped();
UIListBoxItem * item;
Uint32 i, relPos = 0, relPosMax;
Int32 itemPos, itemPosMax;
Int32 tHLastScroll = mHScrollInit;
bool wasScrollVisible = mVScrollBar->isVisible();
bool wasHScrollVisible = mHScrollBar->isVisible();
updateScrollBarState();
bool visibleItems = mContainer->getSize().getHeight() / mRowHeight;
mItemsNotVisible = (Uint32)mItems.size() - visibleItems;
Int32 scrolleable = (Int32)mItems.size() * mRowHeight - mContainer->getSize().getHeight();
bool isScrollVisible = mVScrollBar->isVisible();
bool isHScrollVisible = mHScrollBar->isVisible();
bool FirstVisible = false;
if ( Clipped && mSmoothScroll ) {
if ( Scrolleable >= 0 )
RelPos = (Uint32)( mVScrollBar->getValue() * Scrolleable );
if ( clipped && mSmoothScroll ) {
if ( scrolleable >= 0 )
relPos = (Uint32)( mVScrollBar->getValue() * scrolleable );
else
RelPos = 0;
relPos = 0;
RelPosMax = RelPos + mContainer->getSize().getHeight() + mRowHeight;
relPosMax = relPos + mContainer->getSize().getHeight() + mRowHeight;
if ( ( FromScrollChange && eeINDEX_NOT_FOUND != mLastPos && mLastPos == RelPos ) && ( tHLastScroll == mHScrollInit ) )
if ( ( fromScrollChange && eeINDEX_NOT_FOUND != mLastPos && mLastPos == relPos ) && ( tHLastScroll == mHScrollInit ) )
return;
mLastPos = RelPos;
mLastPos = relPos;
for ( i = 0; i < mItems.size(); i++ ) {
Item = mItems[i];
ItemPos = mRowHeight * i;
ItemPosMax = ItemPos + mRowHeight;
item = mItems[i];
itemPos = mRowHeight * i;
itemPosMax = itemPos + mRowHeight;
if ( ( ItemPos >= (Int32)RelPos || ItemPosMax >= (Int32)RelPos ) && ( ItemPos <= (Int32)RelPosMax ) ) {
if ( NULL == Item ) {
if ( ( itemPos >= (Int32)relPos || itemPosMax >= (Int32)relPos ) && ( itemPos <= (Int32)relPosMax ) ) {
if ( NULL == item ) {
createItemIndex( i );
Item = mItems[i];
item = mItems[i];
}
Item->setPosition( mHScrollInit, ItemPos - (Int32)RelPos );
Item->setEnabled( true );
Item->setVisible( true );
item->setPosition( mHScrollInit, itemPos - (Int32)relPos );
item->setEnabled( true );
item->setVisible( true );
if ( !FirstVisible ) {
mVisibleFirst = i;
@@ -559,44 +565,44 @@ void UIListBox::updateScroll( bool FromScrollChange ) {
mVisibleLast = i;
} else {
eeSAFE_DELETE( mItems[i] );
Item = NULL;
item = NULL;
}
if ( NULL != Item ) {
if ( NULL != item ) {
if ( ( !wasScrollVisible && isScrollVisible ) || ( wasScrollVisible && !isScrollVisible ) ||( !wasHScrollVisible && isHScrollVisible ) || ( wasHScrollVisible && !isHScrollVisible ) )
itemUpdateSize( Item );
itemUpdateSize( item );
}
}
} else {
RelPosMax = (Uint32)mItems.size();
relPosMax = (Uint32)mItems.size();
if ( mItemsNotVisible > 0 ) {
RelPos = (Uint32)( mVScrollBar->getValue() * mItemsNotVisible );
RelPosMax = RelPos + VisibleItems;
relPos = (Uint32)( mVScrollBar->getValue() * mItemsNotVisible );
relPosMax = relPos + visibleItems;
}
if ( ( FromScrollChange && eeINDEX_NOT_FOUND != mLastPos && mLastPos == RelPos ) && ( !Clipped || tHLastScroll == mHScrollInit ) )
if ( ( fromScrollChange && eeINDEX_NOT_FOUND != mLastPos && mLastPos == relPos ) && ( !clipped || tHLastScroll == mHScrollInit ) )
return;
mLastPos = RelPos;
mLastPos = relPos;
for ( i = 0; i < mItems.size(); i++ ) {
Item = mItems[i];
ItemPos = mRowHeight * ( (Int32)i - (Int32)RelPos );
item = mItems[i];
itemPos = mRowHeight * ( (Int32)i - (Int32)relPos );
if ( i >= RelPos && i < RelPosMax ) {
if ( NULL == Item ) {
if ( i >= relPos && i < relPosMax ) {
if ( NULL == item ) {
createItemIndex( i );
Item = mItems[i];
item = mItems[i];
}
if ( Clipped )
Item->setPosition( mHScrollInit, ItemPos );
if ( clipped )
item->setPosition( mHScrollInit, itemPos );
else
Item->setPosition( 0, ItemPos );
item->setPosition( 0, itemPos );
Item->setEnabled( true );
Item->setVisible( true );
item->setEnabled( true );
item->setVisible( true );
if ( !FirstVisible ) {
mVisibleFirst = i;
@@ -606,12 +612,12 @@ void UIListBox::updateScroll( bool FromScrollChange ) {
mVisibleLast = i;
} else {
eeSAFE_DELETE( mItems[i] );
Item = NULL;
item = NULL;
}
if ( NULL != Item ) {
if ( NULL != item ) {
if ( ( !wasScrollVisible && isScrollVisible ) || ( wasScrollVisible && !isScrollVisible ) ||( !wasHScrollVisible && isHScrollVisible ) || ( wasHScrollVisible && !isHScrollVisible ) )
itemUpdateSize( Item );
itemUpdateSize( item );
}
}
}
@@ -953,30 +959,30 @@ const UI_SCROLLBAR_MODE& UIListBox::getHorizontalScrollMode() {
bool UIListBox::setAttribute( const NodeAttribute& attribute, const Uint32& state ) {
const std::string& name = attribute.getName();
if ( "rowheight" == name ) {
if ( "row-height" == name || "rowheight" == name ) {
setRowHeight( attribute.asInt() );
} else if ( "verticalscrollmode" == name || "vscrollmode" == name ) {
} else if ( "vscroll-mode" == name || "vscrollmode" == name ) {
std::string val = attribute.asString();
if ( "auto" == val ) setVerticalScrollMode( UI_SCROLLBAR_AUTO );
else if ( "on" == val ) setVerticalScrollMode( UI_SCROLLBAR_ALWAYS_ON );
else if ( "off" == val ) setVerticalScrollMode( UI_SCROLLBAR_ALWAYS_OFF );
} else if ( "horizontalscrollmode" == name || "hscrollmode" == name ) {
} else if ( "hscroll-mode" == name || "hscrollmode" == name ) {
std::string val = attribute.asString();
if ( "auto" == val ) setHorizontalScrollMode( UI_SCROLLBAR_AUTO );
else if ( "on" == val ) setHorizontalScrollMode( UI_SCROLLBAR_ALWAYS_ON );
else if ( "off" == val ) setHorizontalScrollMode( UI_SCROLLBAR_ALWAYS_OFF );
} else if ( "selectedindex" == name ) {
} else if ( "selected-index" == name || "selectedindex" == name ) {
setSelected( attribute.asUint() );
} else if ( "selectedtext" == name ) {
} else if ( "selected-text" == name || "selectedtext" == name ) {
setSelected( attribute.asString() );
} else if ( "scrollbartype" == name ) {
} else if ( "scrollbar-type" == name || "scrollbartype" == name ) {
std::string val( attribute.asString() );
String::toLowerInPlace( val );
if ( "nobuttons" == val ) {
if ( "no-buttons" == val || "nobuttons" == val ) {
mVScrollBar->setScrollBarType( UIScrollBar::NoButtons );
mHScrollBar->setScrollBarType( UIScrollBar::NoButtons );
} else if ( "twobuttons" == val ) {
} else if ( "two-buttons" == val || "twobuttons" == val ) {
mVScrollBar->setScrollBarType( UIScrollBar::TwoButtons );
mHScrollBar->setScrollBarType( UIScrollBar::NoButtons );
}

View File

@@ -200,19 +200,19 @@ bool UILoader::setAttribute( const NodeAttribute& attribute, const Uint32& state
if ( "indeterminate" == name ) {
setIndeterminate( attribute.asBool() );
} else if ( "maxprogress" == name ) {
} else if ( "max-progress" == name || "maxprogress" == name ) {
setMaxProgress( attribute.asFloat() );
} else if ( "progress" == name ) {
setProgress( attribute.asFloat() );
} else if ( "fillcolor" == name ) {
} else if ( "fill-color" == name || "fillcolor" == name ) {
setFillColor( attribute.asColor() );
} else if ( "radius" == name ) {
setRadius( attribute.asFloat() );
} else if ( "outlinethickness" == name ) {
} else if ( "outline-thickness" == name || "outlinethickness" == name ) {
setOutlineThickness( attribute.asFloat() );
} else if ( "animationspeed" == name ) {
} else if ( "animation-speed" == name || "animationspeed" == name ) {
setAnimationSpeed( attribute.asFloat() );
} else if ( "arcstartangle" == name ) {
} else if ( "arc-start-angle" == name || "arcstartangle" == name ) {
setArcStartAngle( attribute.asFloat() );
} else {
return UIWidget::setAttribute( attribute, state );

View File

@@ -191,12 +191,12 @@ UINode * UIMenu::getItem( const String& Text ) {
for ( Uint32 i = 0; i < mItems.size(); i++ ) {
if ( mItems[i]->isType( UI_TYPE_MENUITEM ) ) {
UIMenuItem * tMenuItem = reinterpret_cast<UIMenuItem*>( mItems[i] );
if ( tMenuItem->getText() == Text )
return tMenuItem;
}
}
return NULL;
}
@@ -573,12 +573,12 @@ void UIMenu::loadFromXmlNode( const pugi::xml_node& node ) {
bool UIMenu::setAttribute(const NodeAttribute & attribute, const Uint32 & state) {
const std::string& name = attribute.getName();
if ( "minwidth" == name ) {
if ( "min-width" == name || "minwidth" == name ) {
mStyleConfig.MinWidth = attribute.asInt();
onSizeChange();
} else if ( "minrightmargin" == name ) {
} else if ( "min-margin-right" == name || "minmarginright" == name ) {
setMinRightMargin( attribute.asDpDimensionUint() );
} else if ( "minspaceforicons" == name ) {
} else if ( "min-icon-space" == name || "miniconspace" == name ) {
setMinSpaceForIcons( attribute.asDpDimensionUint() );
} else {
return UIWidget::setAttribute( attribute, state );

View File

@@ -210,26 +210,26 @@ UITextView * UIProgressBar::getTextBox() const {
bool UIProgressBar::setAttribute( const NodeAttribute& attribute, const Uint32& state ) {
const std::string& name = attribute.getName();
if ( "totalsteps" == name ) {
if ( "total-steps" == name || "totalsteps" == name ) {
setTotalSteps( attribute.asFloat() );
} else if ( "progress" == name ) {
setProgress( attribute.asFloat() );
} else if ( "verticalexpand" == name ) {
} else if ( "vertical-expand" == name || "verticalexpand" == name ) {
setVerticalExpand( attribute.asBool() );
} else if ( "displaypercent" == name ) {
} else if ( "display-percent" == name || "displaypercent" == name ) {
setDisplayPercent( attribute.asBool() );
} else if ( "fillerpadding" == name ) {
} else if ( "filler-padding" == name || "fillerpadding" == name ) {
Float val = attribute.asDpDimension();
setFillerPadding( Rectf( val, val, val, val ) );
} else if ( "fillerpaddingleft" == name ) {
} else if ( "filler-padding-left" == name || "fillerpaddingleft" == name ) {
setFillerPadding( Rectf( attribute.asDpDimension(), mStyleConfig.FillerPadding.Top, mStyleConfig.FillerPadding.Right, mStyleConfig.FillerPadding.Bottom ) );
} else if ( "fillerpaddingright" == name ) {
} else if ( "filler-padding-right" == name || "fillerpaddingright" == name ) {
setFillerPadding( Rectf( mStyleConfig.FillerPadding.Left, mStyleConfig.FillerPadding.Top, attribute.asDpDimension(), mStyleConfig.FillerPadding.Bottom ) );
} else if ( "fillerpaddingtop" == name ) {
} else if ( "filler-padding-top" == name || "fillerpaddingtop" == name ) {
setFillerPadding( Rectf( mStyleConfig.FillerPadding.Left, attribute.asDpDimension(), mStyleConfig.FillerPadding.Right, mStyleConfig.FillerPadding.Bottom ) );
} else if ( "fillerpaddingbottom" == name ) {
} else if ( "filler-padding-bottom" == name || "fillerpaddingbottom" == name ) {
setFillerPadding( Rectf( mStyleConfig.FillerPadding.Left, mStyleConfig.FillerPadding.Top, mStyleConfig.FillerPadding.Right, attribute.asDpDimension() ) );
} else if ( "movementspeed" == name ) {
} else if ( "movement-speed" == name || "movementspeed" == name ) {
setMovementSpeed( attribute.asVector2f() );
} else {
return UIWidget::setAttribute( attribute, state );
@@ -244,7 +244,7 @@ const UIProgressBar::StyleConfig & UIProgressBar::getStyleConfig() const {
void UIProgressBar::onAlphaChange() {
UINode::onAlphaChange();
mTextBox->setAlpha( mAlpha );
}

View File

@@ -301,11 +301,11 @@ bool UIPushButton::setAttribute( const NodeAttribute& attribute, const Uint32& s
} else if ( NULL != ( icon = DrawableSearcher::searchByName( val ) ) ) {
setIcon( icon );
}
} else if ( "iconminsize" == name ) {
} else if ( "min-icon-size" == name || "miniconsize" == name ) {
setIconMinimumSize( attribute.asSizei() );
} else if ( "iconhorizontalmargin" == name ) {
} else if ( "icon-horizontal-margin" == name || "iconhorizontalmargin" == name ) {
setIconHorizontalMargin( attribute.asInt() );
} else if ( "iconautomargin" == name ) {
} else if ( "icon-auto-margin" == name || "iconautomargin" == name ) {
mStyleConfig.IconAutoMargin = attribute.asBool();
if ( mStyleConfig.IconAutoMargin )

View File

@@ -315,29 +315,27 @@ bool UIScrollBar::setAttribute( const NodeAttribute& attribute, const Uint32& st
setOrientation( UI_HORIZONTAL );
else if ( "vertical" == val )
setOrientation( UI_VERTICAL );
} else if ( "minvalue" == name ) {
} else if ( "min-value" == name || "minvalue" == name ) {
setMinValue( attribute.asFloat() );
} else if ( "maxvalue" == name ) {
} else if ( "max-value" == name || "maxvalue" == name ) {
setMaxValue( attribute.asFloat() );
} else if ( "value" == name ) {
setValue( attribute.asFloat() );
} else if ( "clickstep" == name ) {
} else if ( "click-step" == name || "clickstep" == name ) {
setClickStep( attribute.asFloat() );
} else if ( "pagestep" == name ) {
} else if ( "page-step" == name || "pagestep" == name ) {
setPageStep( attribute.asFloat() );
} else if ( "scrollbartype" == name ) {
} else if ( "scrollbar-type" == name || "scrollbartype" == name ) {
std::string val = attribute.asString();
String::toLowerInPlace( val );
if ( "nobuttons" == val ) {
if ( "no-buttons" == val || "nobuttons" == val ) {
setScrollBarType( NoButtons );
} else if ( "twobuttons" == val ) {
} else if ( "two-buttons" == val || "twobuttons" == val ) {
setScrollBarType( TwoButtons );
}
} else if ( "expandbackground" == name ) {
} else if ( "background-expand" == name || "backgroundexpand" == name ) {
setExpandBackground( attribute.asBool() );
} else if ( "padding" == name ) {
return UIWidget::setAttribute( attribute, state );
} else {
return UIWidget::setAttribute( attribute, state );
}
@@ -375,7 +373,7 @@ UINode * UIScrollBar::setOrientation( const UI_ORIENTATION & orientation ) {
void UIScrollBar::onAlphaChange() {
UINode::onAlphaChange();
mSlider->setAlpha( mAlpha );
mBtnUp->setAlpha( mAlpha );
mBtnDown->setAlpha( mAlpha );

View File

@@ -250,28 +250,28 @@ bool UIScrollView::setAttribute( const NodeAttribute& attribute, const Uint32& s
if ( "inclusive" == val ) setViewType( Inclusive );
else if ( "exclusive" == val ) setViewType( Exclusive );
} else if ( "vscroll_mode" == name ) {
} else if ( "vscroll-mode" == name || "vscrollmode" == name ) {
std::string val( attribute.asString() );
String::toLowerInPlace( val );
if ( "on" == val ) setVerticalScrollMode( UI_SCROLLBAR_ALWAYS_ON );
else if ( "off" == val ) setVerticalScrollMode( UI_SCROLLBAR_ALWAYS_ON );
else if ( "auto" == val ) setVerticalScrollMode( UI_SCROLLBAR_AUTO );
} else if ( "hscroll_mode" == name ) {
} else if ( "hscroll-mode" == name || "hscrollmode" == name ) {
std::string val( attribute.asString() );
String::toLowerInPlace( val );
if ( "on" == val ) setHorizontalScrollMode( UI_SCROLLBAR_ALWAYS_ON );
else if ( "off" == val ) setHorizontalScrollMode( UI_SCROLLBAR_ALWAYS_ON );
else if ( "auto" == val ) setHorizontalScrollMode( UI_SCROLLBAR_AUTO );
} else if ( "scrollbartype" == name ) {
} else if ( "scrollbar-type" == name || "scrollbartype" == name ) {
std::string val( attribute.asString() );
String::toLowerInPlace( val );
if ( "nobuttons" == val ) {
if ( "no-buttons" == val || "nobuttons" == val ) {
mVScroll->setScrollBarType( UIScrollBar::NoButtons );
mHScroll->setScrollBarType( UIScrollBar::NoButtons );
} else if ( "twobuttons" == val ) {
} else if ( "two-buttons" == val || "twobuttons" == val ) {
mVScroll->setScrollBarType( UIScrollBar::TwoButtons );
mHScroll->setScrollBarType( UIScrollBar::NoButtons );
}

View File

@@ -105,9 +105,7 @@ void UISlider::onPaddingChange() {
}
void UISlider::adjustChilds() {
UISkin * tSkin = NULL;
tSkin = mSlider->getSkin();
UISkin * tSkin = mSlider->getSkin();
if ( NULL != tSkin ) {
if ( mPageStep == 0 ) {
@@ -183,7 +181,7 @@ void UISlider::fixSliderPos() {
mSlider->setPosition( mBackSlider->getSize().getWidth() + mPadding.Left, 0 );
} else {
if ( mSlider->getPosition().x > mBackSlider->getSize().getWidth() - mSlider->getSize().getWidth() + mPadding.Left )
mSlider->setPosition( mBackSlider->getSize().getWidth() - mSlider->getSize().getWidth() + mPadding.Left, 0 );
mSlider->setPosition( eemax(0.f, mBackSlider->getSize().getWidth() - mSlider->getSize().getWidth()) + mPadding.Left, 0 );
}
mSlider->centerVertical();
@@ -203,7 +201,7 @@ void UISlider::fixSliderPos() {
mSlider->setPosition( 0, mBackSlider->getSize().getHeight() + mPadding.Top );
} else {
if ( mSlider->getPosition().y > mBackSlider->getSize().getHeight() - mSlider->getSize().getHeight() + mPadding.Top ) {
mSlider->setPosition( 0, mBackSlider->getSize().getHeight() - mSlider->getSize().getHeight() + mPadding.Top );
mSlider->setPosition( 0, eemax(0.f, mBackSlider->getSize().getHeight() - mSlider->getSize().getHeight()) + mPadding.Top );
}
}
@@ -411,7 +409,7 @@ UINode * UISlider::getSliderButton() const {
void UISlider::onAlphaChange() {
UINode::onAlphaChange();
mBackSlider->setAlpha( mAlpha );
mSlider->setAlpha( mAlpha );
}
@@ -439,19 +437,19 @@ bool UISlider::setAttribute( const NodeAttribute& attribute, const Uint32& state
setOrientation( UI_HORIZONTAL );
else if ( "vertical" == val )
setOrientation( UI_VERTICAL );
} else if ( "minvalue" == name ) {
} else if ( "min-value" == name || "minvalue" == name ) {
setMinValue( attribute.asFloat() );
} else if ( "maxvalue" == name ) {
} else if ( "max-value" == name || "maxvalue" == name ) {
setMaxValue( attribute.asFloat() );
} else if ( "value" == name ) {
setValue( attribute.asFloat() );
} else if ( "clickstep" == name ) {
} else if ( "click-step" == name || "clickstep" == name ) {
setClickStep( attribute.asFloat() );
} else if ( "pagestep" == name ) {
} else if ( "page-step" == name || "pagestep" == name ) {
setPageStep( attribute.asFloat() );
} else if ( "halfslider" == name ) {
} else if ( "half-slider" == name || "halfslider" == name ) {
setAllowHalfSliderOut( attribute.asBool() );
} else if ( "expandbackground" == name ) {
} else if ( "background-expand" == name || "backgroundexpand" == name ) {
setExpandBackground( attribute.asBool() );
} else {
return UIWidget::setAttribute( attribute, state );

View File

@@ -262,7 +262,7 @@ bool UISpinBox::dotsInNumbersAllowed() {
void UISpinBox::onAlphaChange() {
UINode::onAlphaChange();
mInput->setAlpha( mAlpha );
mPushUp->setAlpha( mAlpha );
mPushDown->setAlpha( mAlpha );
@@ -278,13 +278,13 @@ bool UISpinBox::setAttribute( const NodeAttribute& attribute, const Uint32& stat
bool attributeSet = true;
if ( "minvalue" == name ) {
if ( "min-value" == name || "minvalue" == name ) {
setMinValue(attribute.asFloat() );
} else if ( "maxvalue" == name ) {
} else if ( "max-value" == name || "maxvalue" == name ) {
setMaxValue(attribute.asFloat() );
} else if ( "value" == name ) {
setValue(attribute.asFloat() );
} else if ( "clickstep" == name ) {
} else if ( "click-step" == name || "clickstep" == name ) {
setClickStep(attribute.asFloat() );
} else {
attributeSet = UIWidget::setAttribute( attribute, state );

View File

@@ -32,16 +32,16 @@ bool UIStyle::stateExists( const EE::Uint32& ) const {
void UIStyle::setStyleSheetProperty( const StyleSheetProperty& attribute ) {
if ( attribute.getName() == "padding" ) {
Rectf rect( NodeAttribute( attribute.getName(), attribute.getValue() ).asRectf() );
mElementStyle.setProperty( StyleSheetProperty( "paddingleft", String::toStr( rect.Left ), attribute.getSpecificity(), attribute.isVolatile() ) );
mElementStyle.setProperty( StyleSheetProperty( "paddingright", String::toStr( rect.Right ), attribute.getSpecificity(), attribute.isVolatile() ) );
mElementStyle.setProperty( StyleSheetProperty( "paddingtop", String::toStr( rect.Top ), attribute.getSpecificity(), attribute.isVolatile() ) );
mElementStyle.setProperty( StyleSheetProperty( "paddingbottom", String::toStr( rect.Bottom ), attribute.getSpecificity(), attribute.isVolatile() ) );
} else if ( attribute.getName() == "layout_margin" ) {
mElementStyle.setProperty( StyleSheetProperty( "padding-left", String::toStr( rect.Left ), attribute.getSpecificity(), attribute.isVolatile() ) );
mElementStyle.setProperty( StyleSheetProperty( "padding-right", String::toStr( rect.Right ), attribute.getSpecificity(), attribute.isVolatile() ) );
mElementStyle.setProperty( StyleSheetProperty( "padding-top", String::toStr( rect.Top ), attribute.getSpecificity(), attribute.isVolatile() ) );
mElementStyle.setProperty( StyleSheetProperty( "padding-bottom", String::toStr( rect.Bottom ), attribute.getSpecificity(), attribute.isVolatile() ) );
} else if ( attribute.getName() == "margin" ) {
Rect rect( NodeAttribute( attribute.getName(), attribute.getValue() ).asRect() );
mElementStyle.setProperty( StyleSheetProperty( "layout_marginleft", String::toStr( rect.Left ), attribute.getSpecificity(), attribute.isVolatile() ) );
mElementStyle.setProperty( StyleSheetProperty( "layout_marginright", String::toStr( rect.Right ), attribute.getSpecificity(), attribute.isVolatile() ) );
mElementStyle.setProperty( StyleSheetProperty( "layout_margintop", String::toStr( rect.Top ), attribute.getSpecificity(), attribute.isVolatile() ) );
mElementStyle.setProperty( StyleSheetProperty( "layout_marginbottom", String::toStr( rect.Bottom ), attribute.getSpecificity(), attribute.isVolatile() ) );
mElementStyle.setProperty( StyleSheetProperty( "margin-left", String::toStr( rect.Left ), attribute.getSpecificity(), attribute.isVolatile() ) );
mElementStyle.setProperty( StyleSheetProperty( "margin-right", String::toStr( rect.Right ), attribute.getSpecificity(), attribute.isVolatile() ) );
mElementStyle.setProperty( StyleSheetProperty( "margin-top", String::toStr( rect.Top ), attribute.getSpecificity(), attribute.isVolatile() ) );
mElementStyle.setProperty( StyleSheetProperty( "margin-bottom", String::toStr( rect.Bottom ), attribute.getSpecificity(), attribute.isVolatile() ) );
} else {
mElementStyle.setProperty( attribute );
}

View File

@@ -150,7 +150,7 @@ bool UITab::setAttribute( const NodeAttribute& attribute, const Uint32& state )
if ( "name" == name || "text" == name ) {
if ( NULL != mSceneNode && mSceneNode->isUISceneNode() )
setText( static_cast<UISceneNode*>( mSceneNode )->getTranslatorString( attribute.asString() ) );
} else if ( "controlowned" == name || "owns" == name ) {
} else if ( "owns" == name ) {
mOwnedName = attribute.asString();
setOwnedControl();
} else {

View File

@@ -622,26 +622,26 @@ bool UITable::isTouchOverAllowedChilds() {
bool UITable::setAttribute( const NodeAttribute& attribute, const Uint32& state ) {
const std::string& name = attribute.getName();
if ( "rowheight" == name ) {
if ( "row-height" == name || "rowheight" == name ) {
setRowHeight( attribute.asInt() );
} else if ( "verticalscrollmode" == name || "vscrollmode" == name ) {
} else if ( "vscroll-mode" == name || "vscrollmode" == name ) {
std::string val = attribute.asString();
if ( "auto" == val ) setVerticalScrollMode( UI_SCROLLBAR_AUTO );
else if ( "on" == val ) setVerticalScrollMode( UI_SCROLLBAR_ALWAYS_ON );
else if ( "off" == val ) setVerticalScrollMode( UI_SCROLLBAR_ALWAYS_OFF );
} else if ( "horizontalscrollmode" == name || "hscrollmode" == name ) {
} else if ( "hscroll-mode" == name || "hscrollmode" == name ) {
std::string val = attribute.asString();
if ( "auto" == val ) setHorizontalScrollMode( UI_SCROLLBAR_AUTO );
else if ( "on" == val ) setHorizontalScrollMode( UI_SCROLLBAR_ALWAYS_ON );
else if ( "off" == val ) setHorizontalScrollMode( UI_SCROLLBAR_ALWAYS_OFF );
} else if ( "scrollbartype" == name ) {
} else if ( "scrollbar-type" == name || "scrollbartype" == name ) {
std::string val( attribute.asString() );
String::toLowerInPlace( val );
if ( "nobuttons" == val ) {
if ( "no-buttons" == val || "nobuttons" == val ) {
mVScrollBar->setScrollBarType( UIScrollBar::NoButtons );
mHScrollBar->setScrollBarType( UIScrollBar::NoButtons );
} else if ( "twobuttons" == val ) {
} else if ( "two-buttons" == val || "twobuttons" == val ) {
mVScrollBar->setScrollBarType( UIScrollBar::TwoButtons );
mHScrollBar->setScrollBarType( UIScrollBar::NoButtons );
}

View File

@@ -122,23 +122,23 @@ void UITabWidget::setStyleConfig(const StyleConfig & styleConfig) {
bool UITabWidget::setAttribute( const NodeAttribute& attribute, const Uint32& state ) {
const std::string& name = attribute.getName();
if ( "maxtextlength" == name ) {
if ( "max-text-length" == name || "maxtextlength" == name ) {
setMaxTextLength( attribute.asUint(1) );
} else if ( "mintabwidth" == name ) {
} else if ( "min-tab-width" == name || "mintabwidth" == name ) {
setMinTabWidth( attribute.asUint(1) );
} else if ( "maxtabwidth" == name ) {
} else if ( "max-tab-width" == name || "maxtabwidth" == name ) {
setMaxTabWidth( attribute.asUint() );
} else if ( "tabclosable" == name ) {
} else if ( "tab-closable" == name || "tabclosable" == name ) {
setTabsClosable( attribute.asBool() );
} else if ( "specialbordertabs" == name ) {
} else if ( "special-border-tabs" == name || "specialbordertabs" == name ) {
setSpecialBorderTabs( attribute.asBool() );
} else if ( "drawlinebelowtabs" == name ) {
} else if ( "line-below-tabs" == name || "linebelowtabs" == name ) {
setDrawLineBelowTabs( attribute.asBool() );
} else if ( "linebelowtabscolor" == name ) {
} else if ( "line-below-tabs-color" == name || "linebelowtabscolor" == name ) {
setLineBelowTabsColor( attribute.asColor() );
} else if ( "linebelowtabsyoffset" == name ) {
} else if ( "line-below-tabs-y-offset" == name || "linebelowtabsyoffset" == name ) {
setLineBelowTabsYOffset( attribute.asDpDimensionI() );
} else if ( "tabseparation" == name ) {
} else if ( "tab-separation" == name || "tabseparation" == name ) {
setTabSeparation( attribute.asDpDimensionI() );
} else {
return UIWidget::setAttribute( attribute, state );

View File

@@ -485,14 +485,14 @@ bool UITextEdit::setAttribute( const NodeAttribute& attribute, const Uint32& sta
if ( NULL != mSceneNode && mSceneNode->isUISceneNode() ) {
setText( static_cast<UISceneNode*>( mSceneNode )->getTranslatorString( attribute.asString() ) );
}
} else if ( "allowediting" == name ) {
} else if ( "allow-editing" == name || "allowediting" == name ) {
setAllowEditing( attribute.asBool() );
} else if ( "verticalscrollmode" == name || "vscrollmode" == name ) {
} else if ( "vscroll-mode" == name || "vscrollmode" == name ) {
std::string val = attribute.asString();
if ( "auto" == val ) setVerticalScrollMode( UI_SCROLLBAR_AUTO );
else if ( "on" == val ) setVerticalScrollMode( UI_SCROLLBAR_ALWAYS_ON );
else if ( "off" == val ) setVerticalScrollMode( UI_SCROLLBAR_ALWAYS_OFF );
} else if ( "horizontalscrollmode" == name || "hscrollmode" == name ) {
} else if ( "hscroll-mode" == name || "hscrollmode" == name ) {
std::string val = attribute.asString();
if ( "auto" == val ) setHorizontalScrollMode( UI_SCROLLBAR_AUTO );
else if ( "on" == val ) setHorizontalScrollMode( UI_SCROLLBAR_ALWAYS_ON );

View File

@@ -359,15 +359,15 @@ bool UITextInput::setAttribute( const NodeAttribute& attribute, const Uint32& st
if ( NULL != mSceneNode && mSceneNode->isUISceneNode() ) {
setText( static_cast<UISceneNode*>( mSceneNode )->getTranslatorString( attribute.asString() ) );
}
} else if ( "allowediting" == name ) {
} else if ( "allow-editing" == name || "allowediting" == name ) {
setAllowEditing( attribute.asBool() );
} else if ( "maxlength" == name ) {
} else if ( "max-length" == name || "maxlength" == name ) {
setMaxLength( attribute.asUint() );
} else if ( "freeediting" == name ) {
} else if ( "free-editing" == name || "freeediting" == name ) {
setFreeEditing( attribute.asBool() );
} else if ( "onlynumbers" == name ) {
} else if ( "only-numbers" == name || "onlynumbers" == name ) {
getInputTextBuffer()->setAllowOnlyNumbers( attribute.asBool(), getInputTextBuffer()->dotsInNumbersAllowed() );
} else if ( "allowdot" == name ) {
} else if ( "allow-dot" == name || "allowdot" == name ) {
getInputTextBuffer()->setAllowOnlyNumbers( getInputTextBuffer()->onlyNumbersAllowed(), attribute.asBool() );
} else {
return UITextView::setAttribute( attribute, state );

View File

@@ -105,7 +105,7 @@ void UITextureRegion::draw() {
autoAlign();
drawTextureRegion();
} else {
} else {
mTextureRegion->setDestSize( Vector2f( (Float)pxSize.x, (Float)pxSize.y ) );
autoAlign();
@@ -200,13 +200,13 @@ const Vector2f& UITextureRegion::getAlignOffset() const {
bool UITextureRegion::setAttribute( const NodeAttribute& attribute, const Uint32& state ) {
const std::string& name = attribute.getName();
if ( "src" == name || "textureregion" == name ) {
if ( "src" == name ) {
Drawable * res = NULL;
if ( NULL != ( res = TextureAtlasManager::instance()->getTextureRegionByName( attribute.asString() ) ) && res->getDrawableType() == Drawable::TEXTUREREGION ) {
setTextureRegion( static_cast<TextureRegion*>( res ) );
}
} else if ( "scaletype" == name ) {
} else if ( "scale-type" == name || "scaletype" == name ) {
std::string val = attribute.asString();
String::toLowerInPlace( val );

View File

@@ -570,7 +570,7 @@ bool UITextView::setAttribute( const NodeAttribute& attribute, const Uint32& sta
if ( "text" == name ) {
if ( NULL != mSceneNode && mSceneNode->isUISceneNode() )
setText( static_cast<UISceneNode*>( mSceneNode )->getTranslatorString( attribute.asString() ) );
} else if ( "textcolor" == name ) {
} else if ( "color" == name || "textcolor" == name ) {
SAVE_NORMAL_STATE_ATTR( getFontColor().toHexString() );
Color color = attribute.asColor();
@@ -587,7 +587,7 @@ bool UITextView::setAttribute( const NodeAttribute& attribute, const Uint32& sta
} else {
setFontColor( color );
}
} else if ( "textshadowcolor" == name ) {
} else if ( "shadow-color" == name || "textshadowcolor" == name ) {
SAVE_NORMAL_STATE_ATTR( getFontShadowColor().toHexString() );
Color color = attribute.asColor();
@@ -604,19 +604,19 @@ bool UITextView::setAttribute( const NodeAttribute& attribute, const Uint32& sta
} else {
setFontShadowColor( color );
}
} else if ( "textselectedcolor" == name ) {
} else if ( "selected-color" == name || "textselectedcolor" == name ) {
mFontStyleConfig.FontSelectedColor = attribute.asColor();
} else if ( "textselectionbackcolor" == name ) {
} else if ( "selection-back-color" == name || "textselectionbackcolor" == name ) {
setSelectionBackColor( attribute.asColor() );
} else if ( "fontfamily" == name || "fontname" == name ) {
} else if ( "font-family" == name || "font-name" == name || "fontfamily" == name || "fontname" == name ) {
SAVE_NORMAL_STATE_ATTR( getFont()->getName() );
setFont( FontManager::instance()->getByName( attribute.asString() ) );
} else if ( "textsize" == name || "fontsize" == name || "charactersize" == name ) {
} else if ( "font-size" == name || "textsize" == name || "fontsize" == name ) {
SAVE_NORMAL_STATE_ATTR( String::format( "%dpx", getCharacterSize() ) );
setCharacterSize( attribute.asDpDimensionI() );
} else if ( "textstyle" == name || "fontstyle" == name ) {
} else if ( "font-style" == name || "textstyle" == name || "fontstyle" == name ) {
Uint32 flags = attribute.asFontStyle();
SAVE_NORMAL_STATE_ATTR( Text::styleFlagToString( getFontStyle() ) );
@@ -628,18 +628,18 @@ bool UITextView::setAttribute( const NodeAttribute& attribute, const Uint32& sta
}
setFontStyle( flags );
} else if ( "wordwrap" == name || "word_wrap" == name ) {
} else if ( "wordwrap" == name || "word-wrap" == name ) {
if ( attribute.asBool() )
mFlags |= UI_WORD_WRAP;
else
mFlags &= ~UI_WORD_WRAP;
autoShrink();
} else if ( "fontoutlinethickness" == name ) {
} else if ( "text-stroke-width" == name || "fontoutlinethickness" == name ) {
SAVE_NORMAL_STATE_ATTR( String::toStr( PixelDensity::dpToPx( getOutlineThickness() ) ) )
setOutlineThickness( PixelDensity::dpToPx( attribute.asDpDimension() ) );
} else if ( "fontoutlinecolor" == name ) {
} else if ( "text-stroke-color" == name || "fontoutlinecolor" == name ) {
SAVE_NORMAL_STATE_ATTR( getOutlineColor().toHexString() );
Color color = attribute.asColor();
@@ -656,7 +656,7 @@ bool UITextView::setAttribute( const NodeAttribute& attribute, const Uint32& sta
} else {
setOutlineColor( color );
}
} else if ( "textselection" == name ) {
} else if ( "text-selection" == name || "textselection" == name ) {
mFlags|= UI_TEXT_SELECTION_ENABLED;
} else {
return UIWidget::setAttribute( attribute, state );

View File

@@ -158,6 +158,8 @@ void UITooltip::onAutoSize() {
(int)mTextCache->getTextWidth() + mRealPadding.Left + mRealPadding.Right,
(int)mTextCache->getTextHeight() + mRealPadding.Top + mRealPadding.Bottom
) );
autoAlign();
}
}
@@ -328,21 +330,19 @@ void UITooltip::setFontStyleConfig(const UIFontStyleConfig & styleConfig) {
bool UITooltip::setAttribute( const NodeAttribute& attribute, const Uint32& state ) {
const std::string& name = attribute.getName();
if ( "textcolor" == name ) {
if ( "color" == name ) {
setFontColor( attribute.asColor() );
} else if ( "padding" == name ) {
setPadding( attribute.asRectf() );
} else if ( "textshadowcolor" == name ) {
} else if ( "shadow-color" == name || "textshadowcolor" == name ) {
setFontShadowColor( attribute.asColor() );
} else if ( "fontfamily" == name || "fontname" == name ) {
} else if ( "font-family" == name || "font-name" == name || "fontfamily" == name || "fontname" == name ) {
setFont( FontManager::instance()->getByName( attribute.asString() ) );
} else if ( "textsize" == name || "fontsize" == name || "charactersize" == name ) {
} else if ( "font-size" == name || "textsize" == name || "fontsize" == name ) {
setCharacterSize( attribute.asDpDimensionI() );
} else if ( "textstyle" == name || "fontstyle" == name ) {
} else if ( "font-style" == name || "textstyle" == name || "fontstyle" == name ) {
setFontStyle( attribute.asFontStyle() );
} else if ( "fontoutlinethickness" == name ) {
} else if ( "text-stroke-width" == name || "fontoutlinethickness" == name ) {
setOutlineThickness( attribute.asDpDimension() );
} else if ( "fontoutlinecolor" == name ) {
} else if ( "text-stroke-color" == name || "fontoutlinecolor" == name ) {
setOutlineColor( attribute.asColor() );
} else {
return UIWidget::setAttribute( attribute, state );

View File

@@ -149,9 +149,9 @@ void UITouchDragableWidget::scheduledUpdate( const Time& time ) {
bool UITouchDragableWidget::setAttribute( const NodeAttribute& attribute, const Uint32& state ) {
const std::string& name = attribute.getName();
if ( "touchdrag" == name ) {
if ( "touch-drag" == name || "touchdrag" == name ) {
setTouchDragEnabled( attribute.asBool() );
} else if ( "touchdragdeceleration" == name ) {
} else if ( "touchdrag-deceleration" == name || "touchdragdeceleration" == name ) {
setTouchDragDeceleration( Vector2f( attribute.asFloat(), attribute.asFloat() ) );
} else {
return UIWidget::setAttribute( attribute, state );

View File

@@ -140,7 +140,6 @@ UIWidget * UIWidget::setLayoutSizeRules(const LayoutSizeRules & layoutWidthRules
}
UIWidget * UIWidget::setLayoutPositionRule(const LayoutPositionRules & layoutPositionRule, UIWidget * of) {
if ( mLayoutPositionRule != layoutPositionRule || mLayoutPositionRuleWidget != of ) {
mLayoutPositionRule = layoutPositionRule;
mLayoutPositionRuleWidget = of;
@@ -758,11 +757,11 @@ bool UIWidget::setAttribute( const NodeAttribute& attribute, const Uint32& state
Drawable * res = NULL;
if ( Color::isColorString( attribute.getValue() ) ) {
setAttribute( NodeAttribute( "backgroundcolor", attribute.getValue() ) );
setAttribute( NodeAttribute( "background-color", attribute.getValue() ) );
} else if ( NULL != ( res = DrawableSearcher::searchByName( attribute.getValue() ) ) ) {
setBackgroundDrawable( res, res->getDrawableType() == Drawable::SPRITE );
}
} else if ( "backgroundcolor" == name ) {
} else if ( "background-color" == name || "backgroundcolor" == name ) {
SAVE_NORMAL_STATE_ATTR( getBackgroundColor().toHexString() );
Color color = attribute.asColor();
@@ -780,7 +779,7 @@ bool UIWidget::setAttribute( const NodeAttribute& attribute, const Uint32& state
} else {
setBackgroundColor( color );
}
} else if ( "backgroundimage" == name ) {
} else if ( "background-image" == name || "backgroundimage" == name ) {
NodeAttribute::FunctionType functionType = NodeAttribute::FunctionType::parse( attribute.getValue() );
Drawable * res = NULL;
@@ -815,7 +814,7 @@ bool UIWidget::setAttribute( const NodeAttribute& attribute, const Uint32& state
rectColors.BottomLeft = rectColors.BottomRight = Color::fromString( params.at(2) );
}
} else {
return setAttribute( NodeAttribute( "backgroundcolor", params.at(0) ) );
return setAttribute( NodeAttribute( "background-color", params.at(0) ) );
}
drawable->setRectColors( rectColors );
@@ -829,11 +828,11 @@ bool UIWidget::setAttribute( const NodeAttribute& attribute, const Uint32& state
Drawable * res = NULL;
if ( Color::isColorString( attribute.getValue() ) ) {
setAttribute( NodeAttribute( "foregroundcolor", attribute.getValue() ) );
setAttribute( NodeAttribute( "foreground-color", attribute.getValue() ) );
} else if ( NULL != ( res = DrawableSearcher::searchByName( attribute.getValue() ) ) ) {
setForegroundDrawable( res, res->getDrawableType() == Drawable::SPRITE );
}
} else if ( "foregroundcolor" == name ) {
} else if ( "foreground-color" == name || "foregroundcolor" == name ) {
SAVE_NORMAL_STATE_ATTR( getForegroundColor().toHexString() );
Color color = attribute.asColor();
@@ -851,11 +850,11 @@ bool UIWidget::setAttribute( const NodeAttribute& attribute, const Uint32& state
} else {
setForegroundColor( color );
}
} else if ( "foregroundradius" == name ) {
} else if ( "foreground-radius" == name || "foregroundradius" == name ) {
SAVE_NORMAL_STATE_ATTR( String::toStr( getForegroundRadius() ) );
setForegroundRadius( attribute.asUint() );
} else if ( "bordercolor" == name ) {
} else if ( "border-color" == name || "bordercolor" == name ) {
SAVE_NORMAL_STATE_ATTR( getBorderColor().toHexString() )
Color color = attribute.asColor();
@@ -873,11 +872,11 @@ bool UIWidget::setAttribute( const NodeAttribute& attribute, const Uint32& state
} else {
setBorderColor( color );
}
} else if ( "borderwidth" == name ) {
} else if ( "border-width" == name || "borderwidth" == name ) {
SAVE_NORMAL_STATE_ATTR( String::toStr( getBorderWidth() ) );
setBorderWidth( attribute.asDpDimensionI("1") );
} else if ( "borderradius" == name ) {
} else if ( "border-radius" == name || "borderradius" == name ) {
SAVE_NORMAL_STATE_ATTR( String::format( "%d", getBorderRadius() ) );
Uint32 borderRadius = attribute.asUint();
@@ -916,7 +915,7 @@ bool UIWidget::setAttribute( const NodeAttribute& attribute, const Uint32& state
SAVE_NORMAL_STATE_ATTR( mSkinName );
mSkinName = attribute.asString();
setThemeSkin( mSkinName );
} else if ( "skincolor" == name ) {
} else if ( "skin-color" == name || "skincolor" == name ) {
SAVE_NORMAL_STATE_ATTR( getSkinColor().toHexString() );
Color color = attribute.asColor();
@@ -991,25 +990,25 @@ bool UIWidget::setAttribute( const NodeAttribute& attribute, const Uint32& state
}
}
}
} else if ( String::startsWith( name, "layout_margin" ) ) {
} else if ( String::startsWith( name, "margin" ) || String::startsWith( name, "layout_margin" ) ) {
SAVE_NORMAL_STATE_ATTR( String::format( "%d %d %d %d", mLayoutMargin.Left, mLayoutMargin.Top, mLayoutMargin.Right, mLayoutMargin.Bottom ) );
Rect margin;
Uint32 marginFlag = 0;
if ( "layout_margin" == name ) {
if ( "margin" == name || "layout_margin" == name ) {
margin = attribute.asRect();
marginFlag = Actions::MarginMove::All;
} else if ( "layout_marginleft" == name ) {
} else if ( "margin-left" == name || "layout_marginleft" == name ) {
margin = Rect( attribute.asDpDimensionI(), mLayoutMargin.Top, mLayoutMargin.Right, mLayoutMargin.Bottom );
marginFlag = Actions::MarginMove::Left;
} else if ( "layout_marginright" == name ) {
} else if ( "margin-right" == name || "layout_marginright" == name ) {
margin = Rect( mLayoutMargin.Left, mLayoutMargin.Top, attribute.asDpDimensionI(), mLayoutMargin.Bottom );
marginFlag = Actions::MarginMove::Right;
} else if ( "layout_margintop" == name ) {
} else if ( "margin-top" == name || "layout_margintop" == name ) {
margin = Rect( mLayoutMargin.Left, attribute.asDpDimensionI(), mLayoutMargin.Right, mLayoutMargin.Bottom );
marginFlag = Actions::MarginMove::Top;
} else if ( "layout_marginbottom" == name ) {
} else if ( "margin-bottom" == name || "layout_marginbottom" == name ) {
margin = Rect( mLayoutMargin.Left, mLayoutMargin.Top, mLayoutMargin.Right, attribute.asDpDimensionI() );
marginFlag = Actions::MarginMove::Bottom;
}
@@ -1027,11 +1026,11 @@ bool UIWidget::setAttribute( const NodeAttribute& attribute, const Uint32& state
}
} else if ( "tooltip" == name ) {
setTooltipText( attribute.asString() );
} else if ( "layout_weight" == name ) {
} else if ( "layout_weight" == name || "layout-weight" == name ) {
SAVE_NORMAL_STATE_ATTR( String::toStr( getLayoutWeight() ) );
setLayoutWeight( attribute.asFloat() );
} else if ( "layout_gravity" == name ) {
} else if ( "layout_gravity" == name || "layout-gravity" == name ) {
SAVE_NORMAL_STATE_ATTR( getLayoutGravityString() );
std::string gravityStr = attribute.asString();
@@ -1063,7 +1062,7 @@ bool UIWidget::setAttribute( const NodeAttribute& attribute, const Uint32& state
setLayoutGravity( gravity );
}
} else if ( "layout_width" == name ) {
} else if ( "layout_width" == name || "layout-width" == name ) {
SAVE_NORMAL_STATE_ATTR( getLayoutWidthRulesString() );
std::string val = attribute.asString();
@@ -1082,7 +1081,7 @@ bool UIWidget::setAttribute( const NodeAttribute& attribute, const Uint32& state
setInternalWidth( PixelDensity::toDpFromStringI( val ) );
onSizeChange();
}
} else if ( "layout_height" == name ) {
} else if ( "layout_height" == name || "layout-height" == name ) {
SAVE_NORMAL_STATE_ATTR( getLayoutHeightRulesString() );
std::string val = attribute.asString();
@@ -1156,15 +1155,15 @@ bool UIWidget::setAttribute( const NodeAttribute& attribute, const Uint32& state
} else {
setScale( attribute.asVector2f() );
}
} else if ( "rotationoriginpoint" == name ) {
} else if ( "rotation-origin-point" == name || "rotationoriginpoint" == name ) {
SAVE_NORMAL_STATE_ATTR( getRotationOriginPoint().toString() );
setRotationOriginPoint( attribute.asOriginPoint() );
} else if ( "scaleoriginpoint" == name ) {
} else if ( "scale-origin-point" == name || "scaleoriginpoint" == name ) {
SAVE_NORMAL_STATE_ATTR( getScaleOriginPoint().toString() );
setScaleOriginPoint( attribute.asOriginPoint() );
} else if ( "blendmode" == name ) {
} else if ( "blend-mode" == name || "blendmode" == name ) {
// TODO: SAVE_NORMAL_STATE_ATTR
setBlendMode( attribute.asBlendMode() );
} else if ( String::startsWith( name, "padding" ) ) {
@@ -1176,16 +1175,16 @@ bool UIWidget::setAttribute( const NodeAttribute& attribute, const Uint32& state
if ( "padding" == name ) {
padding = ( attribute.asRectf() );
paddingFlag = Actions::PaddingTransition::All;
} else if ( "paddingleft" == name ) {
} else if ( "padding-left" == name || "paddingleft" == name ) {
padding = Rectf( attribute.asDpDimension(), mPadding.Top, mPadding.Right, mPadding.Bottom );
paddingFlag = Actions::PaddingTransition::Left;
} else if ( "paddingright" == name ) {
} else if ( "padding-right" == name || "paddingright" == name ) {
padding = Rectf( mPadding.Left, mPadding.Top, attribute.asDpDimension(), mPadding.Bottom );
paddingFlag = Actions::PaddingTransition::Right;
} else if ( "paddingtop" == name ) {
} else if ( "padding-top" == name || "paddingtop" == name ) {
padding = Rectf( mPadding.Left, attribute.asDpDimension(), mPadding.Right, mPadding.Bottom );
paddingFlag = Actions::PaddingTransition::Top;
} else if ( "paddingbottom" == name ) {
} else if ( "padding-bottom" == name || "paddingbottom" == name ) {
padding = Rectf( mPadding.Left, mPadding.Top, mPadding.Right, attribute.asDpDimension() );
paddingFlag = Actions::PaddingTransition::Bottom;
}

View File

@@ -802,7 +802,7 @@ void UIWindow::tryResize( const UI_RESIZE_TYPE& Type ) {
Vector2f Pos = getEventDispatcher()->getMousePosf();
worldToNode( Pos );
mResizeType = Type;
Pos = PixelDensity::dpToPx( Pos );
@@ -1414,14 +1414,14 @@ bool UIWindow::setAttribute( const NodeAttribute& attribute, const Uint32& state
setSize( mDpSize.getWidth(), attribute.asInt() );
} else if ( "title" == name ) {
setTitle( attribute.asString() );
} else if ( "basealpha" == name ) {
} else if ( "base-alpha" == name || "basealpha" == name ) {
unsigned int val = attribute.asUint();
if ( val <= 255 )
setBaseAlpha( (Uint8)val );
} else if ( "buttonspositionfixer" == name ) {
} else if ( "buttons-position-offset" == name || "buttonspositionoffset" == name ) {
mStyleConfig.ButtonsPositionFixer = attribute.asVector2i();
fixChildsSize();
} else if ( "winflags" == name ) {
} else if ( "window-flags" == name || "winflags" == name ) {
std::string flagsStr = attribute.asString();
String::toLowerInPlace( flagsStr );
std::vector<std::string> strings = String::split( flagsStr, '|' );
@@ -1450,24 +1450,24 @@ bool UIWindow::setAttribute( const NodeAttribute& attribute, const Uint32& state
mStyleConfig.WinFlags |= winflags;
updateWinFlags();
}
} else if ( "decorationsize" == name ) {
} else if ( "decoration-size" == name || "decorationsize" == name ) {
mStyleConfig.DecorationSize = attribute.asSizei();
fixChildsSize();
} else if ( "bordersize" == name ) {
} else if ( "border-size" == name || "bordersize" == name ) {
mStyleConfig.BorderSize = attribute.asSizei();
fixChildsSize();
} else if ( "minwindowsize" == name ) {
} else if ( "min-window-size" == name || "minwindowsize" == name ) {
mStyleConfig.MinWindowSize = attribute.asSizef();
fixChildsSize();
} else if ( "buttonsseparation" == name ) {
} else if ( "buttons-separation" == name || "buttonsseparation" == name ) {
mStyleConfig.ButtonsSeparation = attribute.asUint();
fixChildsSize();
} else if ( "mincornerdistance" == name ) {
} else if ( "min-corner-distance" == name || "mincornerdistance" == name ) {
mStyleConfig.MinCornerDistance = attribute.asInt();
} else if ( "decorationautosize" == name ) {
} else if ( "decoration-auto-size" == name || "decorationautosize" == name ) {
mStyleConfig.DecorationAutoSize = attribute.asBool();
fixChildsSize();
} else if ( "borderautosize" == name ) {
} else if ( "border-auto-size" == name || "borderautosize" == name ) {
mStyleConfig.BorderAutoSize = attribute.asBool();
fixChildsSize();
} else {

View File

@@ -161,13 +161,13 @@ void UIWinMenu::setFirstButtonMargin( const Uint32& buttonMargin ) {
bool UIWinMenu::setAttribute( const NodeAttribute& attribute, const Uint32 & state ) {
const std::string& name = attribute.getName();
if ( "marginbetweenbuttons" == name ) {
if ( "margin-between-buttons" == name || "marginbetweenbuttons" == name ) {
setMarginBetweenButtons( attribute.asDpDimensionUint() );
} else if ( "buttonmargin" == name ) {
} else if ( "button-margin" == name || "buttonmargin" == name ) {
setButtonMargin( attribute.asDpDimensionUint() );
} else if ( "menuheight" == name ) {
} else if ( "menu-height" == name || "menuheight" == name ) {
setMenuHeight( attribute.asDpDimensionUint() );
} else if ( "firstbuttonmargin" == name ) {
} else if ( "first-button-margin-left" == name || "firstbuttonmarginleft" == name ) {
setFirstButtonMargin( attribute.asDpDimensionUint() );
} else {
return UIWidget::setAttribute( attribute, state );

View File

@@ -1,4 +1,8 @@
/* Copyright (c) 2016-2017 Taylor C. Richberger <taywee@gmx.com> and Pavel
/* A simple header-only C++ argument parser library.
*
* https://github.com/Taywee/args
*
* Copyright (c) 2016-2019 Taylor C. Richberger <taywee@gmx.com> and Pavel
* Belikov
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -1633,11 +1637,11 @@ namespace args
public:
Subparser(std::vector<std::string> args_, ArgumentParser &parser_, const Command &command_, const HelpParams &helpParams_)
: args(std::move(args_)), parser(&parser_), helpParams(helpParams_), command(command_)
: Group({}, Validators::AllChildGroups), args(std::move(args_)), parser(&parser_), helpParams(helpParams_), command(command_)
{
}
Subparser(const Command &command_, const HelpParams &helpParams_) : helpParams(helpParams_), command(command_)
Subparser(const Command &command_, const HelpParams &helpParams_) : Group({}, Validators::AllChildGroups), helpParams(helpParams_), command(command_)
{
}
@@ -2128,18 +2132,23 @@ namespace args
return;
}
auto onValidationError = [&]
{
std::ostringstream problem;
problem << "Group validation failed somewhere!";
#ifdef ARGS_NOEXCEPT
error = Error::Validation;
errorMsg = problem.str();
#else
throw ValidationError(problem.str());
#endif
};
for (Base *child: Children())
{
if (child->IsGroup() && !child->Matched())
{
std::ostringstream problem;
problem << "Group validation failed somewhere!";
#ifdef ARGS_NOEXCEPT
error = Error::Validation;
errorMsg = problem.str();
#else
throw ValidationError(problem.str());
#endif
onValidationError();
}
child->Validate(shortprefix, longprefix);
@@ -2148,6 +2157,10 @@ namespace args
if (subparser != nullptr)
{
subparser->Validate(shortprefix, longprefix);
if (!subparser->Matched())
{
onValidationError();
}
}
if (selectedCommand == nullptr && commandIsRequired && (Group::HasCommand() || subparserHasCommand))
@@ -3256,9 +3269,14 @@ namespace args
operator ()(const std::string &name, const std::string &value, T &destination)
{
std::istringstream ss(value);
ss >> destination >> std::ws;
bool failed = !(ss >> destination);
if (ss.rdbuf()->in_avail() > 0)
if (!failed)
{
ss >> std::ws;
}
if (ss.rdbuf()->in_avail() > 0 || failed)
{
#ifdef ARGS_NOEXCEPT
(void)name;