Merge pull request #509 from denizzzka/input_fix

Adds InputBox.text set/get
This commit is contained in:
Vadim Lopatin 2017-11-08 16:52:58 +03:00 committed by GitHub
commit dd702747f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 31 additions and 11 deletions

View File

@ -614,7 +614,7 @@ class EditableContent {
@property EditStateMark[] editMarks() { return _editMarks; } @property EditStateMark[] editMarks() { return _editMarks; }
/// returns all lines concatenated delimited by '\n' /// returns all lines concatenated delimited by '\n'
@property dstring text() { @property dstring text() const {
if (_lines.length == 0) if (_lines.length == 0)
return ""; return "";
if (_lines.length == 1) if (_lines.length == 1)

View File

@ -1210,7 +1210,7 @@ class FileNameEditLine : HorizontalLayout {
@property void caption(dstring s) { _caption = s; } @property void caption(dstring s) { _caption = s; }
/// returns widget content text (override to support this) /// returns widget content text (override to support this)
override @property dstring text() { return _edFileName.text; } override @property dstring text() const { return _edFileName.text; }
/// sets widget content text (override to support this) /// sets widget content text (override to support this)
override @property Widget text(dstring s) { _edFileName.text = s; return this; } override @property Widget text(dstring s) { _edFileName.text = s; return this; }
/// sets widget content text (override to support this) /// sets widget content text (override to support this)

View File

@ -56,4 +56,18 @@ class InputBox : Dialog {
_editor.selectAll(); _editor.selectAll();
_editor.setFocus(); _editor.setFocus();
} }
override dstring text() const {
return _text;
}
override Widget text(dstring t) {
_text = t;
return this;
}
override Widget text(UIString s) {
_text = s;
return this;
}
} }

View File

@ -284,7 +284,7 @@ class ComboBox : ComboBoxBase {
return cast(StringListAdapter)_adapter; return cast(StringListAdapter)_adapter;
} }
@property override dstring text() { @property override dstring text() const {
return _body.text; return _body.text;
} }
@ -403,7 +403,7 @@ class IconTextComboBox : ComboBoxBase {
return cast(StringListAdapter)_adapter; return cast(StringListAdapter)_adapter;
} }
@property override dstring text() { @property override dstring text() const {
return _body.text; return _body.text;
} }

View File

@ -355,7 +355,7 @@ class ImageTextButton : HorizontalLayout {
protected TextWidget _label; protected TextWidget _label;
/// Get label text /// Get label text
override @property dstring text() { return _label.text; } override @property dstring text() const { return _label.text; }
/// Set label plain unicode string /// Set label plain unicode string
override @property Widget text(dstring s) { _label.text = s; requestLayout(); return this; } override @property Widget text(dstring s) { _label.text = s; requestLayout(); return this; }
/// Set label string resource Id /// Set label string resource Id

View File

@ -995,7 +995,7 @@ class EditWidgetBase : ScrollWidgetBase, EditableContentListener, MenuItemAction
protected bool _lastReportedModifiedState; protected bool _lastReportedModifiedState;
/// get widget text /// get widget text
override @property dstring text() { return _content.text; } override @property dstring text() const { return _content.text; }
/// set text /// set text
override @property Widget text(dstring s) { override @property Widget text(dstring s) {

View File

@ -53,7 +53,7 @@ class GroupBox : LinearLayout {
} }
/// get widget text /// get widget text
override @property dstring text() { return _caption.text; } override @property dstring text() const { return _caption.text; }
/// set text to show /// set text to show
override @property Widget text(dstring s) { override @property Widget text(dstring s) {
_caption.text = s; _caption.text = s;

View File

@ -38,7 +38,7 @@ class StatusLineTextPanel : StatusLinePanelBase {
addChild(_text); addChild(_text);
} }
/// returns widget content text (override to support this) /// returns widget content text (override to support this)
override @property dstring text() { return _text.text; } override @property dstring text() const { return _text.text; }
/// sets widget content text (override to support this) /// sets widget content text (override to support this)
override @property Widget text(dstring s) { _text.text = s; return this; } override @property Widget text(dstring s) { _text.text = s; return this; }
/// sets widget content text (override to support this) /// sets widget content text (override to support this)

View File

@ -570,11 +570,17 @@ public:
@property FontRef font() const { return stateStyle.font; } @property FontRef font() const { return stateStyle.font; }
/// returns widget content text (override to support this) /// returns widget content text (override to support this)
@property dstring text() { return ""; } @property dstring text() const {
assert(false, __FUNCTION__~" isn't implemented");
}
/// sets widget content text (override to support this) /// sets widget content text (override to support this)
@property Widget text(dstring s) { return this; } @property Widget text(dstring s) {
assert(false, __FUNCTION__~" isn't implemented");
}
/// sets widget content text (override to support this) /// sets widget content text (override to support this)
@property Widget text(UIString s) { return this; } @property Widget text(UIString s) {
assert(false, __FUNCTION__~" isn't implemented");
}
/// override to handle font changes /// override to handle font changes
protected void handleFontChanged() {} protected void handleFontChanged() {}