Skip to content

Commit

Permalink
Add support for font-size to LineEdit and Text-Edit widgets. (#872)
Browse files Browse the repository at this point in the history
closes #435
  • Loading branch information
besok committed Jan 26, 2022
1 parent e3c4209 commit 38bd191
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 2 deletions.
6 changes: 5 additions & 1 deletion docs/widgets.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ A widget used to enter a single line of text
### Properties

* **`text`** (*string*): The text being edited
* **`font-size`** (*length*): the size of the font of the input text
* **`has-focus`**: (*bool*): Set to true when the line edit currently has the focus
* **`placeholder-text`**: (*string*): A placeholder text being shown when there is no text in the edit field
* **`enabled`**: (*bool*): Defaults to true. When false, nothing can be entered
Expand All @@ -182,6 +183,7 @@ Example := Window {
width: 200px;
height: 25px;
LineEdit {
font-size: 14px;
width: parent.width;
height: parent.height;
placeholder-text: "Enter text here";
Expand All @@ -199,6 +201,7 @@ shortcut will be implemented in a future version: <https://github.com/sixtyfpsui
### Properties

* **`text`** (*string*): The text being edited
* **`font-size`** (*length*): the size of the font of the input text
* **`has-focus`**: (*bool*): Set to true when the widget currently has the focus
* **`enabled`**: (*bool*): Defaults to true. When false, nothing can be entered
* **`wrap`** (*enum [`TextWrap`](builtin_elements.md#textwrap)*): The way the text wraps (default: word-wrap).
Expand All @@ -215,6 +218,7 @@ Example := Window {
width: 200px;
height: 200px;
TextEdit {
font-size: 14px;
width: parent.width;
height: parent.height;
text: "Lorem ipsum dolor sit amet\n, consectetur adipisici elit";
Expand Down Expand Up @@ -416,7 +420,7 @@ import { AboutSixtyFPS } from "sixtyfps_widgets.60";
Example := Window {
width: 128px;
height: 128px;
AboutSixtyFPS {
AboutSixtyFPS {
}
}
```
4 changes: 3 additions & 1 deletion sixtyfps_compiler/widgets/common/common.60
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import { StyleMetrics, ScrollView } from "sixtyfps_widgets_impl.60";
export LineEditInner := Rectangle {
callback accepted(string);
callback edited(string);
property<string> placeholder-text;
property <string> placeholder-text;
property font-size <=> input.font-size;
property text <=> input.text;
property placeholder-color <=> placeholder.color;
property enabled <=> input.enabled;
Expand Down Expand Up @@ -41,6 +42,7 @@ export LineEditInner := Rectangle {
}

export TextEdit := ScrollView {
property <length> font-size <=> input.font-size;
property <string> text <=> input.text;
has-focus <=> input.has-focus;
enabled <=> input.enabled;
Expand Down
1 change: 1 addition & 0 deletions sixtyfps_compiler/widgets/fluent/sixtyfps_widgets.60
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ export TabBarImpl := HorizontalLayout {
export TabWidget := TabWidget {}

export LineEdit := Rectangle {
property <length> font-size <=> inner.font-size;
property <string> text <=> inner.text;
property <string> placeholder-text <=> inner.placeholder-text;
property <bool> has-focus: inner.has-focus;
Expand Down
1 change: 1 addition & 0 deletions sixtyfps_compiler/widgets/native/sixtyfps_widgets.60
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export GroupBox := NativeGroupBox {
}
}
export LineEdit := NativeLineEdit {
property <length> font-size <=> inner.font-size;
property <string> text <=> inner.text;
property <string> placeholder-text <=> inner.placeholder-text;
enabled: true;
Expand Down
1 change: 1 addition & 0 deletions sixtyfps_compiler/widgets/ugly/sixtyfps_widgets.60
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ export TabBarImpl := HorizontalLayout {
}

export LineEdit := Rectangle {
property <length> font-size <=> inner.font-size;
property <string> text <=> inner.text;
property <string> placeholder-text <=> inner.placeholder-text;
property <bool> has-focus: inner.has-focus;
Expand Down

0 comments on commit 38bd191

Please sign in to comment.