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; }
/// returns all lines concatenated delimited by '\n'
@property dstring text() {
@property dstring text() const {
if (_lines.length == 0)
return "";
if (_lines.length == 1)

View File

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

View File

@ -56,4 +56,18 @@ class InputBox : Dialog {
_editor.selectAll();
_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;
}
@property override dstring text() {
@property override dstring text() const {
return _body.text;
}
@ -403,7 +403,7 @@ class IconTextComboBox : ComboBoxBase {
return cast(StringListAdapter)_adapter;
}
@property override dstring text() {
@property override dstring text() const {
return _body.text;
}

View File

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

View File

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

View File

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

View File

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

View File

@ -570,11 +570,17 @@ public:
@property FontRef font() const { return stateStyle.font; }
/// 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)
@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)
@property Widget text(UIString s) { return this; }
@property Widget text(UIString s) {
assert(false, __FUNCTION__~" isn't implemented");
}
/// override to handle font changes
protected void handleFontChanged() {}