add toolbar styled combobox

This commit is contained in:
Vadim Lopatin 2015-01-21 17:45:19 +03:00
parent 27e4b4e9cb
commit a276806ef3
7 changed files with 47 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 B

View File

@ -297,6 +297,12 @@
margins="1,1,1,1"
padding="4,4,4,4"
/>
<style id="TOOLBAR_CONTROL"
backgroundImageId="toolbar_control_background"
align="Center"
margins="1,1,1,1"
padding="4,4,4,4"
/>
<style id="TOOLBAR_SEPARATOR"
align="Center"
/>

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:drawable="toolbar_control_disabled"
android:state_enabled="false"
android:state_focused="true" />
<item
android:drawable="toolbar_button_hover"
android:state_hovered="true"
android:state_focused="true" />
<item
android:drawable="toolbar_button_hover"
android:state_focused="true"
/>
<item
android:drawable="toolbar_button_pressed"
android:state_pressed="true" />
<item
android:drawable="toolbar_button_hover"
android:state_hovered="true" />
<item
android:drawable="toolbar_control_normal" />
</selector>

View File

@ -1072,7 +1072,7 @@ class EditableContent {
}
}
/// save to file in current format
bool save(string filename) {
bool save(string filename = null) {
return save(filename, _format);
}
}

View File

@ -148,6 +148,8 @@ immutable string STYLE_TOOLBAR_HOST = "TOOLBAR_HOST";
immutable string STYLE_TOOLBAR = "TOOLBAR";
/// standard style id for toolbar button
immutable string STYLE_TOOLBAR_BUTTON = "TOOLBAR_BUTTON";
/// standard style id for toolbar control, e.g. combobox
immutable string STYLE_TOOLBAR_CONTROL = "TOOLBAR_CONTROL";
/// standard style id for toolbar separator
immutable string STYLE_TOOLBAR_SEPARATOR = "TOOLBAR_SEPARATOR";

View File

@ -24,6 +24,7 @@ module dlangui.widgets.toolbars;
import dlangui.widgets.widget;
import dlangui.widgets.layouts;
import dlangui.widgets.controls;
import dlangui.widgets.combobox;
/// Layout with several toolbars
class ToolBarHost : HorizontalLayout {
@ -76,6 +77,16 @@ class ToolBarSeparator : ImageWidget {
}
}
/// separator for toolbars
class ToolBarComboBox : ComboBox {
this(string ID, dstring[] items) {
super(ID, items);
styleId = STYLE_TOOLBAR_CONTROL;
if (items.length > 0)
selectedItemIndex = 0;
}
}
/// Layout with buttons
class ToolBar : HorizontalLayout {
this(string ID) {
@ -106,4 +117,8 @@ class ToolBar : HorizontalLayout {
}
}
void addControl(Widget widget) {
addChild(widget);
}
}