mirror of https://github.com/buggins/dlangui.git
better actions support
This commit is contained in:
parent
f509171b04
commit
6e1f11fd57
|
@ -188,6 +188,14 @@ class MenuItem {
|
||||||
res = add(new MenuItem(subitemAction));
|
res = add(new MenuItem(subitemAction));
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
|
}
|
||||||
|
/// adds submenu item(s) from one or more actions (will return item for last action)
|
||||||
|
MenuItem add(const Action[] subitemActions...) {
|
||||||
|
MenuItem res = null;
|
||||||
|
foreach(subitemAction; subitemActions) {
|
||||||
|
res = add(new MenuItem(subitemAction));
|
||||||
|
}
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
/// returns text description for first accelerator of action; null if no accelerators
|
/// returns text description for first accelerator of action; null if no accelerators
|
||||||
@property dstring acceleratorText() {
|
@property dstring acceleratorText() {
|
||||||
|
@ -228,6 +236,10 @@ class MenuItem {
|
||||||
_action = action;
|
_action = action;
|
||||||
_enabled = true;
|
_enabled = true;
|
||||||
}
|
}
|
||||||
|
this(const Action action) {
|
||||||
|
_action = action.clone;
|
||||||
|
_enabled = true;
|
||||||
|
}
|
||||||
~this() {
|
~this() {
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ class ToolBarHost : HorizontalLayout {
|
||||||
|
|
||||||
/// image button for toolbar
|
/// image button for toolbar
|
||||||
class ToolBarImageButton : ImageButton {
|
class ToolBarImageButton : ImageButton {
|
||||||
this(Action a) {
|
this(const Action a) {
|
||||||
super(a);
|
super(a);
|
||||||
styleId = STYLE_TOOLBAR_BUTTON;
|
styleId = STYLE_TOOLBAR_BUTTON;
|
||||||
focusable = false;
|
focusable = false;
|
||||||
|
@ -100,7 +100,7 @@ class ToolBar : HorizontalLayout {
|
||||||
addChild(widget);
|
addChild(widget);
|
||||||
}
|
}
|
||||||
/// adds image button to toolbar
|
/// adds image button to toolbar
|
||||||
void addButtons(Action[] actions...) {
|
void addButtons(const Action[] actions...) {
|
||||||
foreach(a; actions) {
|
foreach(a; actions) {
|
||||||
if (a.isSeparator) {
|
if (a.isSeparator) {
|
||||||
addChild(new ToolBarSeparator());
|
addChild(new ToolBarSeparator());
|
||||||
|
|
Loading…
Reference in New Issue