mirror of https://github.com/buggins/dlangui.git
add toolbar styled combobox
This commit is contained in:
parent
27e4b4e9cb
commit
a276806ef3
Binary file not shown.
After Width: | Height: | Size: 249 B |
Binary file not shown.
After Width: | Height: | Size: 247 B |
|
@ -297,6 +297,12 @@
|
||||||
margins="1,1,1,1"
|
margins="1,1,1,1"
|
||||||
padding="4,4,4,4"
|
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"
|
<style id="TOOLBAR_SEPARATOR"
|
||||||
align="Center"
|
align="Center"
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -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>
|
|
@ -1072,7 +1072,7 @@ class EditableContent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// save to file in current format
|
/// save to file in current format
|
||||||
bool save(string filename) {
|
bool save(string filename = null) {
|
||||||
return save(filename, _format);
|
return save(filename, _format);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -148,6 +148,8 @@ immutable string STYLE_TOOLBAR_HOST = "TOOLBAR_HOST";
|
||||||
immutable string STYLE_TOOLBAR = "TOOLBAR";
|
immutable string STYLE_TOOLBAR = "TOOLBAR";
|
||||||
/// standard style id for toolbar button
|
/// standard style id for toolbar button
|
||||||
immutable string STYLE_TOOLBAR_BUTTON = "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
|
/// standard style id for toolbar separator
|
||||||
immutable string STYLE_TOOLBAR_SEPARATOR = "TOOLBAR_SEPARATOR";
|
immutable string STYLE_TOOLBAR_SEPARATOR = "TOOLBAR_SEPARATOR";
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ module dlangui.widgets.toolbars;
|
||||||
import dlangui.widgets.widget;
|
import dlangui.widgets.widget;
|
||||||
import dlangui.widgets.layouts;
|
import dlangui.widgets.layouts;
|
||||||
import dlangui.widgets.controls;
|
import dlangui.widgets.controls;
|
||||||
|
import dlangui.widgets.combobox;
|
||||||
|
|
||||||
/// Layout with several toolbars
|
/// Layout with several toolbars
|
||||||
class ToolBarHost : HorizontalLayout {
|
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
|
/// Layout with buttons
|
||||||
class ToolBar : HorizontalLayout {
|
class ToolBar : HorizontalLayout {
|
||||||
this(string ID) {
|
this(string ID) {
|
||||||
|
@ -106,4 +117,8 @@ class ToolBar : HorizontalLayout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void addControl(Widget widget) {
|
||||||
|
addChild(widget);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue