mirror of https://github.com/buggins/dlangui.git
update styles for treem, list items, menu items
This commit is contained in:
parent
98b99f1d7d
commit
9bcff67702
|
@ -1,14 +1,14 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
|
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||||
<item
|
<item
|
||||||
android:drawable="#C0000000,1px"
|
android:drawable="btn_disabled"
|
||||||
android:state_enabled="false"
|
android:state_enabled="false"
|
||||||
android:state_focused="true" />
|
android:state_focused="true" />
|
||||||
<item
|
<item
|
||||||
android:drawable="#80000000,1px,#E04040FF"
|
android:drawable="btn_pressed"
|
||||||
android:state_focused="true" />
|
android:state_focused="true" />
|
||||||
<item
|
<item
|
||||||
android:drawable="#A00000FF"
|
android:drawable="btn_normal"
|
||||||
android:state_selected="true" />
|
android:state_selected="true" />
|
||||||
<item
|
<item
|
||||||
android:drawable="#E04040FF"
|
android:drawable="#E04040FF"
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||||
|
<item
|
||||||
|
android:drawable="#C0000000,1px"
|
||||||
|
android:state_enabled="false"
|
||||||
|
android:state_focused="true" />
|
||||||
|
<item
|
||||||
|
android:drawable="#80000000,1px,#E04040FF"
|
||||||
|
android:state_focused="true" />
|
||||||
|
<item
|
||||||
|
android:drawable="#A00000FF"
|
||||||
|
android:state_selected="true" />
|
||||||
|
<item
|
||||||
|
android:drawable="#E04040FF"
|
||||||
|
android:state_hovered="true" />
|
||||||
|
<item
|
||||||
|
android:drawable="@null" />
|
||||||
|
</selector>
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||||
|
<item
|
||||||
|
android:drawable="btn_disabled"
|
||||||
|
android:state_enabled="false"
|
||||||
|
android:state_focused="true" />
|
||||||
|
<item
|
||||||
|
android:drawable="btn_pressed"
|
||||||
|
android:state_focused="true" />
|
||||||
|
<item
|
||||||
|
android:drawable="btn_normal"
|
||||||
|
android:state_selected="true" />
|
||||||
|
<item
|
||||||
|
android:drawable="#E04040FF"
|
||||||
|
android:state_hovered="true" />
|
||||||
|
<item
|
||||||
|
android:drawable="@null" />
|
||||||
|
</selector>
|
|
@ -159,12 +159,9 @@
|
||||||
textFlags="Parent"
|
textFlags="Parent"
|
||||||
/>
|
/>
|
||||||
<style id="MENU_ITEM"
|
<style id="MENU_ITEM"
|
||||||
|
backgroundImageId="menu_item_background"
|
||||||
padding="4,2,4,2"
|
padding="4,2,4,2"
|
||||||
>
|
>
|
||||||
<state state_focused="true" backgroundColor="#40C0C000"/>
|
|
||||||
<state state_pressed="true" backgroundColor="#4080C000"/>
|
|
||||||
<state state_selected="true" backgroundColor="#00F8F9Fa"/>
|
|
||||||
<state state_hovered="true" backgroundColor="#C0FFFF00"/>
|
|
||||||
</style>
|
</style>
|
||||||
<style id="MENU_ICON"
|
<style id="MENU_ICON"
|
||||||
margins="2,2,2,2"
|
margins="2,2,2,2"
|
||||||
|
@ -314,16 +311,18 @@
|
||||||
fontFace="Arial"
|
fontFace="Arial"
|
||||||
fontFamily="SansSerif"
|
fontFamily="SansSerif"
|
||||||
fontSize="16">
|
fontSize="16">
|
||||||
<state state_focused="true" backgroundColor="#40C0C000"/>
|
|
||||||
<state state_pressed="true" backgroundColor="#4080C000"/>
|
|
||||||
<state state_selected="true" backgroundColor="#00F8F9Fa"/>
|
|
||||||
<state state_hovered="true" backgroundColor="#C0FFFF00"/>
|
|
||||||
</style>
|
</style>
|
||||||
<style id="TREE_ITEM_EXPAND_ICON"
|
<style id="TREE_ITEM_EXPAND_ICON"
|
||||||
margins="2,0,2,0"
|
margins="2,0,2,0"
|
||||||
align="Left|VCenter"
|
align="Left|VCenter"
|
||||||
textFlags="Parent"
|
textFlags="Parent"
|
||||||
/>
|
/>
|
||||||
|
<style id="TREE_ITEM_BODY"
|
||||||
|
margins="2,0,2,0"
|
||||||
|
align="Left|VCenter"
|
||||||
|
textFlags="Parent"
|
||||||
|
backgroundImageId="list_item_background"
|
||||||
|
/>
|
||||||
<style id="TREE_ITEM_ICON"
|
<style id="TREE_ITEM_ICON"
|
||||||
margins="2,0,2,0"
|
margins="2,0,2,0"
|
||||||
align="Left|VCenter"
|
align="Left|VCenter"
|
||||||
|
|
|
@ -102,8 +102,11 @@ immutable string STYLE_EDIT_LINE = "EDIT_LINE";
|
||||||
immutable string STYLE_EDIT_BOX = "EDIT_BOX";
|
immutable string STYLE_EDIT_BOX = "EDIT_BOX";
|
||||||
/// standard style id for background similar to transparent button
|
/// standard style id for background similar to transparent button
|
||||||
immutable string STYLE_TRANSPARENT_BUTTON_BACKGROUND = "TRANSPARENT_BUTTON_BACKGROUND";
|
immutable string STYLE_TRANSPARENT_BUTTON_BACKGROUND = "TRANSPARENT_BUTTON_BACKGROUND";
|
||||||
|
|
||||||
/// standard style id for tree item
|
/// standard style id for tree item
|
||||||
immutable string STYLE_TREE_ITEM = "TREE_ITEM";
|
immutable string STYLE_TREE_ITEM = "TREE_ITEM";
|
||||||
|
/// standard style id for tree item body (icon + label)
|
||||||
|
immutable string STYLE_TREE_ITEM_BODY = "TREE_ITEM_BODY";
|
||||||
/// standard style id for tree item label
|
/// standard style id for tree item label
|
||||||
immutable string STYLE_TREE_ITEM_LABEL = "TREE_ITEM_LABEL";
|
immutable string STYLE_TREE_ITEM_LABEL = "TREE_ITEM_LABEL";
|
||||||
/// standard style id for tree item icon
|
/// standard style id for tree item icon
|
||||||
|
|
|
@ -470,6 +470,7 @@ class TreeItemWidget : HorizontalLayout {
|
||||||
ImageWidget _expander;
|
ImageWidget _expander;
|
||||||
ImageWidget _icon;
|
ImageWidget _icon;
|
||||||
TextWidget _label;
|
TextWidget _label;
|
||||||
|
HorizontalLayout _body;
|
||||||
long lastClickTime;
|
long lastClickTime;
|
||||||
|
|
||||||
@property TreeItem item() { return _item; }
|
@property TreeItem item() { return _item; }
|
||||||
|
@ -519,21 +520,24 @@ class TreeItemWidget : HorizontalLayout {
|
||||||
lastClickTime = ts;
|
lastClickTime = ts;
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
_body = new HorizontalLayout("item_body");
|
||||||
|
_body.styleId = STYLE_TREE_ITEM_BODY;
|
||||||
|
_body.setState(State.Parent);
|
||||||
if (_item.iconRes.length > 0) {
|
if (_item.iconRes.length > 0) {
|
||||||
_icon = new ImageWidget("icon", _item.iconRes);
|
_icon = new ImageWidget("icon", _item.iconRes);
|
||||||
_icon.styleId = STYLE_TREE_ITEM_ICON;
|
_icon.styleId = STYLE_TREE_ITEM_ICON;
|
||||||
_icon.setState(State.Parent);
|
_icon.setState(State.Parent);
|
||||||
|
_body.addChild(_icon);
|
||||||
}
|
}
|
||||||
_label = new TextWidget("label", _item.text);
|
_label = new TextWidget("label", _item.text);
|
||||||
_label.styleId = STYLE_TREE_ITEM_LABEL;
|
_label.styleId = STYLE_TREE_ITEM_LABEL;
|
||||||
_label.setState(State.Parent);
|
_label.setState(State.Parent);
|
||||||
|
_body.addChild(_label);
|
||||||
// append children
|
// append children
|
||||||
addChild(_tab);
|
addChild(_tab);
|
||||||
if (_expander)
|
if (_expander)
|
||||||
addChild(_expander);
|
addChild(_expander);
|
||||||
if (_icon)
|
addChild(_body);
|
||||||
addChild(_icon);
|
|
||||||
addChild(_label);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override bool onKeyEvent(KeyEvent event) {
|
override bool onKeyEvent(KeyEvent event) {
|
||||||
|
|
Loading…
Reference in New Issue