mirror of https://github.com/buggins/dlangui.git
add empty parameters list constructor support to all widgets - for future usage by factory methods
This commit is contained in:
parent
f0883c5816
commit
466509b7fa
|
|
@ -314,3 +314,7 @@ class FileDialog : Dialog, CustomGridCellAdapter {
|
|||
_fileList.setFocus();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class FilePathPanel : FrameLayout {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -205,6 +205,8 @@ private class FreeTypeFontFile {
|
|||
case 0x2039:
|
||||
return '<';
|
||||
case 0x203A:
|
||||
case '‣':
|
||||
case '►':
|
||||
return '>';
|
||||
case 0x2044:
|
||||
return '/';
|
||||
|
|
|
|||
|
|
@ -139,6 +139,11 @@ class ComboBox : ComboBoxBase {
|
|||
protected StringListAdapter _adapter;
|
||||
protected EditLine _edit;
|
||||
|
||||
/// empty parameter list constructor - for usage by factory
|
||||
this() {
|
||||
this(null);
|
||||
}
|
||||
/// create with ID parameter
|
||||
this(string ID) {
|
||||
super(ID, (_adapter = new StringListAdapter()), true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -344,33 +344,40 @@ class Button : Widget {
|
|||
override @property Widget text(dstring s) { _text = s; requestLayout(); return this; }
|
||||
override @property Widget text(UIString s) { _text = s; requestLayout(); return this; }
|
||||
@property Widget textResource(string s) { _text = s; requestLayout(); return this; }
|
||||
this(string ID = null) {
|
||||
super(ID);
|
||||
/// empty parameter list constructor - for usage by factory
|
||||
this() {
|
||||
super(null);
|
||||
init(UIString());
|
||||
}
|
||||
|
||||
private void init(UIString label) {
|
||||
styleId = "BUTTON";
|
||||
_text = label;
|
||||
clickable = true;
|
||||
focusable = true;
|
||||
trackHover = true;
|
||||
}
|
||||
|
||||
/// create with ID parameter
|
||||
this(string ID) {
|
||||
super(ID);
|
||||
init(UIString());
|
||||
}
|
||||
this(string ID, UIString label) {
|
||||
super(ID);
|
||||
init(label);
|
||||
}
|
||||
this(string ID, dstring label) {
|
||||
super(ID);
|
||||
_text = label;
|
||||
styleId = "BUTTON";
|
||||
clickable = true;
|
||||
focusable = true;
|
||||
trackHover = true;
|
||||
init(UIString(label));
|
||||
}
|
||||
this(string ID, string labelResourceId) {
|
||||
super(ID);
|
||||
_text = labelResourceId;
|
||||
styleId = "BUTTON";
|
||||
clickable = true;
|
||||
focusable = true;
|
||||
trackHover = true;
|
||||
init(UIString(labelResourceId));
|
||||
}
|
||||
/// constructor from action
|
||||
this(const Action a) {
|
||||
this("button-action" ~ to!string(a.id));
|
||||
_text = a.labelValue;
|
||||
this("button-action" ~ to!string(a.id), a.labelValue);
|
||||
action = a;
|
||||
}
|
||||
|
||||
|
|
@ -408,6 +415,7 @@ class AbstractSlider : WidgetGroup {
|
|||
protected int _pageSize = 30;
|
||||
protected int _position = 20;
|
||||
|
||||
/// create with ID parameter
|
||||
this(string ID) {
|
||||
super(ID);
|
||||
}
|
||||
|
|
@ -656,7 +664,12 @@ class ScrollBar : AbstractSlider, OnClickHandler {
|
|||
return this;
|
||||
}
|
||||
|
||||
this(string ID = null, Orientation orient = Orientation.Vertical) {
|
||||
/// empty parameter list constructor - for usage by factory
|
||||
this() {
|
||||
this(null, Orientation.Vertical);
|
||||
}
|
||||
/// create with ID parameter
|
||||
this(string ID, Orientation orient = Orientation.Vertical) {
|
||||
super(ID);
|
||||
styleId = "SCROLLBAR";
|
||||
_orientation = orient;
|
||||
|
|
|
|||
|
|
@ -1712,6 +1712,11 @@ class EditWidgetBase : ScrollWidgetBase, EditableContentListener, MenuItemAction
|
|||
/// single line editor
|
||||
class EditLine : EditWidgetBase {
|
||||
|
||||
/// empty parameter list constructor - for usage by factory
|
||||
this() {
|
||||
this(null);
|
||||
}
|
||||
/// create with ID parameter
|
||||
this(string ID, dstring initialContent = null) {
|
||||
super(ID, ScrollBarMode.Invisible, ScrollBarMode.Invisible);
|
||||
_content = new EditableContent(false);
|
||||
|
|
@ -1880,6 +1885,11 @@ class EditLine : EditWidgetBase {
|
|||
|
||||
/// single line editor
|
||||
class EditBox : EditWidgetBase {
|
||||
/// empty parameter list constructor - for usage by factory
|
||||
this() {
|
||||
this(null);
|
||||
}
|
||||
/// create with ID parameter
|
||||
this(string ID, dstring initialContent = null, ScrollBarMode hscrollbarMode = ScrollBarMode.Visible, ScrollBarMode vscrollbarMode = ScrollBarMode.Visible) {
|
||||
super(ID, hscrollbarMode, vscrollbarMode);
|
||||
_content = new EditableContent(true); // multiline
|
||||
|
|
|
|||
|
|
@ -1163,7 +1163,12 @@ class StringGridWidget : StringGridWidgetBase {
|
|||
protected dstring[] _rowTitles;
|
||||
protected dstring[] _colTitles;
|
||||
|
||||
this(string ID = null) {
|
||||
/// empty parameter list constructor - for usage by factory
|
||||
this() {
|
||||
this(null);
|
||||
}
|
||||
/// create with ID parameter
|
||||
this(string ID) {
|
||||
super(ID);
|
||||
styleId = "EDIT_BOX";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -278,7 +278,12 @@ class ResizerWidget : Widget {
|
|||
protected string _styleVertical;
|
||||
protected string _styleHorizontal;
|
||||
|
||||
this(string ID = null) {
|
||||
/// empty parameter list constructor - for usage by factory
|
||||
this() {
|
||||
this(null);
|
||||
}
|
||||
/// create with ID parameter
|
||||
this(string ID) {
|
||||
super(ID);
|
||||
_styleVertical = "RESIZER_VERTICAL";
|
||||
_styleHorizontal = "RESIZER_HORIZONTAL";
|
||||
|
|
@ -461,7 +466,7 @@ class ResizerWidget : Widget {
|
|||
}
|
||||
|
||||
|
||||
|
||||
/// Arranges items either vertically or horizontally
|
||||
class LinearLayout : WidgetGroup {
|
||||
protected Orientation _orientation = Orientation.Vertical;
|
||||
/// returns linear layout orientation (Vertical, Horizontal)
|
||||
|
|
@ -469,7 +474,12 @@ class LinearLayout : WidgetGroup {
|
|||
/// sets linear layout orientation
|
||||
@property LinearLayout orientation(Orientation value) { _orientation = value; requestLayout(); return this; }
|
||||
|
||||
this(string ID = null) {
|
||||
/// empty parameter list constructor - for usage by factory
|
||||
this() {
|
||||
this(null);
|
||||
}
|
||||
/// create with ID parameter
|
||||
this(string ID) {
|
||||
super(ID);
|
||||
_layoutItems = new LayoutItems();
|
||||
}
|
||||
|
|
@ -523,15 +533,27 @@ class LinearLayout : WidgetGroup {
|
|||
|
||||
}
|
||||
|
||||
/// Arranges children vertically
|
||||
class VerticalLayout : LinearLayout {
|
||||
this(string ID = null) {
|
||||
/// empty parameter list constructor - for usage by factory
|
||||
this() {
|
||||
this(null);
|
||||
}
|
||||
/// create with ID parameter
|
||||
this(string ID) {
|
||||
super(ID);
|
||||
orientation = Orientation.Vertical;
|
||||
}
|
||||
}
|
||||
|
||||
/// Arranges children horizontally
|
||||
class HorizontalLayout : LinearLayout {
|
||||
this(string ID = null) {
|
||||
/// empty parameter list constructor - for usage by factory
|
||||
this() {
|
||||
this(null);
|
||||
}
|
||||
/// create with ID parameter
|
||||
this(string ID) {
|
||||
super(ID);
|
||||
orientation = Orientation.Horizontal;
|
||||
}
|
||||
|
|
@ -539,6 +561,11 @@ class HorizontalLayout : LinearLayout {
|
|||
|
||||
/// place all children into same place (usually, only one child should be visible at a time)
|
||||
class FrameLayout : WidgetGroup {
|
||||
/// empty parameter list constructor - for usage by factory
|
||||
this() {
|
||||
this(null);
|
||||
}
|
||||
/// create with ID parameter
|
||||
this(string ID) {
|
||||
super(ID);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -298,7 +298,12 @@ class ListWidget : WidgetGroup, OnScrollHandler {
|
|||
requestLayout();
|
||||
}
|
||||
|
||||
this(string ID = null, Orientation orientation = Orientation.Vertical) {
|
||||
/// empty parameter list constructor - for usage by factory
|
||||
this() {
|
||||
this(null);
|
||||
}
|
||||
/// create with ID parameter
|
||||
this(string ID, Orientation orientation = Orientation.Vertical) {
|
||||
super(ID);
|
||||
_orientation = orientation;
|
||||
focusable = true;
|
||||
|
|
|
|||
|
|
@ -342,8 +342,14 @@ class MenuItemWidget : WidgetGroup {
|
|||
addChild(_label);
|
||||
// accelerator
|
||||
dstring acc = _item.acceleratorText;
|
||||
if (_item.isSubmenu && !mainMenu)
|
||||
acc = "‣"d;
|
||||
if (_item.isSubmenu && !mainMenu) {
|
||||
version (Windows) {
|
||||
acc = ">"d;
|
||||
//acc = "►"d;
|
||||
} else {
|
||||
acc = "‣"d;
|
||||
}
|
||||
}
|
||||
if (acc !is null) {
|
||||
_accel = new TextWidget("MENU_ACCEL");
|
||||
_accel.styleId = "MENU_ACCEL";
|
||||
|
|
|
|||
|
|
@ -304,7 +304,12 @@ class ScrollWidget : ScrollWidgetBase {
|
|||
requestLayout();
|
||||
return this;
|
||||
}
|
||||
this(string ID = null, ScrollBarMode hscrollbarMode = ScrollBarMode.Visible, ScrollBarMode vscrollbarMode = ScrollBarMode.Visible) {
|
||||
/// empty parameter list constructor - for usage by factory
|
||||
this() {
|
||||
this(null);
|
||||
}
|
||||
/// create with ID parameter
|
||||
this(string ID, ScrollBarMode hscrollbarMode = ScrollBarMode.Visible, ScrollBarMode vscrollbarMode = ScrollBarMode.Visible) {
|
||||
super(ID, hscrollbarMode, vscrollbarMode);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -177,6 +177,11 @@ class TabControl : WidgetGroup {
|
|||
/// signal of tab change (e.g. by clicking on tab header)
|
||||
Signal!TabHandler onTabChangedListener;
|
||||
|
||||
/// empty parameter list constructor - for usage by factory
|
||||
this() {
|
||||
this(null);
|
||||
}
|
||||
/// create with ID parameter
|
||||
this(string ID) {
|
||||
super(ID);
|
||||
_items = new TabItemList();
|
||||
|
|
@ -373,6 +378,11 @@ class TabControl : WidgetGroup {
|
|||
|
||||
/// container for widgets controlled by TabControl
|
||||
class TabHost : FrameLayout, TabHandler {
|
||||
/// empty parameter list constructor - for usage by factory
|
||||
this() {
|
||||
this(null);
|
||||
}
|
||||
/// create with ID parameter
|
||||
this(string ID, TabControl tabControl = null) {
|
||||
super(ID);
|
||||
_tabControl = tabControl;
|
||||
|
|
@ -458,6 +468,11 @@ class TabHost : FrameLayout, TabHandler {
|
|||
class TabWidget : VerticalLayout, TabHandler {
|
||||
protected TabControl _tabControl;
|
||||
protected TabHost _tabHost;
|
||||
/// empty parameter list constructor - for usage by factory
|
||||
this() {
|
||||
this(null);
|
||||
}
|
||||
/// create with ID parameter
|
||||
this(string ID) {
|
||||
super(ID);
|
||||
_tabControl = new TabControl("TAB_CONTROL");
|
||||
|
|
|
|||
|
|
@ -549,7 +549,12 @@ class TreeWidgetBase : ScrollWidget, OnTreeContentChangeListener, OnTreeStateCh
|
|||
protected bool _needUpdateWidgets;
|
||||
protected bool _needUpdateWidgetStates;
|
||||
|
||||
this(string ID = null, ScrollBarMode hscrollbarMode = ScrollBarMode.Visible, ScrollBarMode vscrollbarMode = ScrollBarMode.Visible) {
|
||||
/// empty parameter list constructor - for usage by factory
|
||||
this() {
|
||||
this(null);
|
||||
}
|
||||
/// create with ID parameter
|
||||
this(string ID, ScrollBarMode hscrollbarMode = ScrollBarMode.Visible, ScrollBarMode vscrollbarMode = ScrollBarMode.Visible) {
|
||||
super(ID, hscrollbarMode, vscrollbarMode);
|
||||
contentWidget = new VerticalLayout("TREE_CONTENT");
|
||||
_tree = new TreeItems();
|
||||
|
|
@ -737,7 +742,12 @@ class TreeWidgetBase : ScrollWidget, OnTreeContentChangeListener, OnTreeStateCh
|
|||
|
||||
/// Tree widget with items which can have icons and labels
|
||||
class TreeWidget : TreeWidgetBase {
|
||||
this(string ID = null) {
|
||||
/// empty parameter list constructor - for usage by factory
|
||||
this() {
|
||||
this(null);
|
||||
}
|
||||
/// create with ID parameter
|
||||
this(string ID) {
|
||||
super(ID);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -177,8 +177,12 @@ class Widget {
|
|||
private static int _instanceCount = 0;
|
||||
private static bool _appShuttingDown = false;
|
||||
}
|
||||
/// create widget, with optional id
|
||||
this(string ID = null) {
|
||||
/// empty parameter list constructor - for usage by factory
|
||||
this() {
|
||||
this(null);
|
||||
}
|
||||
/// create with ID parameter
|
||||
this(string ID) {
|
||||
_id = ID;
|
||||
_state = State.Enabled;
|
||||
debug(resalloc) _instanceCount++;
|
||||
|
|
@ -1327,7 +1331,12 @@ alias WidgetList = ObjectList!Widget;
|
|||
/** Base class for widgets which have children. */
|
||||
class WidgetGroup : Widget {
|
||||
|
||||
this(string ID = null) {
|
||||
/// empty parameter list constructor - for usage by factory
|
||||
this() {
|
||||
this(null);
|
||||
}
|
||||
/// create with ID parameter
|
||||
this(string ID) {
|
||||
super(ID);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue