Andreas Kling
e6e4fe4f51
LibGUI: Add 1px of margin to EmojiPickerDialog
...
The left and top highlight edges were cut off by the dialog frame.
Add a small margin to make sure all buttons can be painted fully.
2020-12-31 14:39:23 +01:00
Andreas Kling
d441dec5d8
LibGUI: Make the emojis in the emoji input dialog fit in the window
...
GUI::Button has a default min-width of 32, so we have to override that
here in order to squeeze all the emojis into the window.
Fixes #4689 .
2020-12-31 14:32:09 +01:00
Andreas Kling
ddaa13577e
LibGUI: Add a new GUI::OpacitySlider widget :^)
...
This widgets offers a more visually intuitive way to adjust the opacity
of something.
2020-12-31 12:10:01 +01:00
Tom
eabbe03b97
LibGUI: Constrain relative cursor delta to valid range
2020-12-31 10:54:02 +01:00
Tom
0c57e16ce4
LibGUI: Don't change the actual combobox value while hovering it
...
We don't want to trigger an actual selection change until either
confirming the new selection by keyboard or clicking on it.
Dismissing the dropdown should have no effect on the current
selection.
Fixes #4657
2020-12-31 10:54:02 +01:00
Andreas Kling
412a91d58f
LibGfx: Add Gfx::Font::bold_variant() that does a proper font lookup
...
We previously had a cached bold variant font in Gfx::Font that was very
haphazardly located by filename pattern. This patches replaces that
mechanism with a proper Gfx::FontDatabase lookup for the same font but
with bold weight (700).
2020-12-31 01:51:18 +01:00
Andreas Kling
4f1db41a6c
LibGUI: Show font weight names instead of numeric weights in FontPicker
...
Map font weights to their names from the OpenType specification.
2020-12-31 01:13:52 +01:00
Andreas Kling
c770b0bbec
LibGUI: Don't keep creating new models in FontPicker
...
We can reuse the same model, as long as we call update() on them when
the list of weights/sizes change.
2020-12-31 00:46:00 +01:00
Andreas Kling
91493be4f3
LibGUI: Simplify FontPicker::set_font()
...
Use Vector::find_first_index() instead of iterating manually. :^)
2020-12-31 00:45:43 +01:00
Tom
54eeb8ee9a
AK: Fix a race condition with WeakPtr<T>::strong_ref and destruction
...
Since RefPtr<T> decrements the ref counter to 0 and after that starts
destructing the object, there is a window where the ref count is 0
and the weak references have not been revoked.
Also change WeakLink to be able to obtain a strong reference
concurrently and block revoking instead, which should happen a lot
less often.
Fixes a problem observed in #4621
2020-12-31 00:39:43 +01:00
Andreas Kling
3e00e3da72
LibGUI: Sort all the lists in the FontPicker
...
Fixes #4671 .
2020-12-31 00:33:50 +01:00
Andreas Kling
a68275914e
LibGUI: Tweak FontPicker layout
...
Make everything a bit smaller and hide the horizontal scrollbars in the
list views since we don't really need them.
2020-12-30 21:01:28 +01:00
Stephan Unverwerth
b4d1390714
LibGFX: Move default_xxx_font() methods from Font to FontDatabase
...
When we have an abstract font class it makes no sense to keep
these methods in the Font class.
2020-12-30 20:40:30 +01:00
Andreas Kling
8fe1643c4b
LibGUI: Make FontPicker correctly select the current font when opened
2020-12-30 20:37:51 +01:00
Andreas Kling
7e40c7cf99
LibGUI: Allow GUI::FilePicker to show only fixed-width fonts
...
This is useful when you really only want something monospaced. :^)
2020-12-30 20:37:51 +01:00
Andreas Kling
ddaa526769
LibGUI: Add a GUI::FontPicker dialog class :^)
...
This allows you to pick & choose a font by selecting the family, weight
and size you want. It shows you a nice preview sentence and everything.
2020-12-30 20:37:51 +01:00
Andreas Kling
aacab897e8
LibGUI: Add widget registration for GUI::ListView
2020-12-30 20:37:51 +01:00
asynts
7e62ffbc6e
AK+Format: Remove TypeErasedFormatParams& from format function.
2020-12-30 20:33:53 +01:00
Andreas Kling
aa941a31ed
LibGUI: Make SpinBox up/down buttons look right when disabled
2020-12-30 16:13:38 +01:00
Andreas Kling
26abb691d8
LibGUI: Make disabled scrollbars have more disabled looking icons
...
Draw a threed drop highlight under the arrows on disabled scrollbars.
This makes it more visible that they are disabled.
2020-12-30 16:13:38 +01:00
Andreas Kling
1215d2a642
LibGUI: Make GUI::ScrollBar inherit from AbstractSlider
2020-12-30 15:20:47 +01:00
Andreas Kling
cb67264f61
LibGUI: Rename AbstractSlider::on_value_changed => on_change
...
This matches other similar hook names.
2020-12-30 15:20:47 +01:00
Andreas Kling
3b445bc66a
LibGUI: Add page_step setting to AbstractSlider and use it in Slider
...
This makes clicking on the track of a GUI::Slider actually move the
knob more than 1 value unit (assuming page_step > 1)
2020-12-30 15:20:47 +01:00
Andreas Kling
fa836a4dda
LibGUI: Add GUI::AbstractSlider and move generic parts of Slider there
...
This will allow us to share some code between Slider and ScrollBar.
2020-12-30 15:20:47 +01:00
Andreas Kling
9227e66bb4
LibGUI: Use Window::center_within() in GUI::Dialog
2020-12-30 13:44:58 +01:00
Andreas Kling
04e3bcfa75
LibGUI: Add Window::center_within(Window)
...
This allows you to easily center one window within another window.
2020-12-30 13:41:53 +01:00
AnotherTest
90aeacbb58
LibGUI: Register a whole bunch of properties in various widgets
2020-12-30 12:53:39 +01:00
AnotherTest
20b74e4ede
LibGUI+HackStudio: Add an opt-in autocompletion interface to TextEditor
...
...and use that to implement autocomplete in HackStudio.
Now everyone can have autocomplete :^)
2020-12-30 12:53:39 +01:00
Andreas Kling
5b1a6d7c66
LibGUI: Move GUI::SeparatorWidget from ToolBar.cpp to its own file
...
This makes this nice line separator widget usable outside toolbars.
Also support both horizontal and vertical orientation. :^)
2020-12-30 03:52:27 +01:00
Andreas Kling
bc5635422b
LibGUI: Give a default min-width to a bunch of widgets
2020-12-30 02:57:45 +01:00
Andreas Kling
01ccbdb017
LibGUI: Register GUI::ComboBox :^)
2020-12-30 02:45:20 +01:00
Andreas Kling
e07a66d011
LibGUI: Remove unused Widget backcolor/forecolor properties
...
These were some leftovers from the VisualBuilder times.
2020-12-30 02:45:20 +01:00
Andreas Kling
675bfb934b
LibGUI: Unbreak GUI::ScrollBar default size
...
Oops, got my width/height mixed up here. :^)
2020-12-30 01:55:25 +01:00
Andreas Kling
1cca2405fc
LibGUI: Give some widgets a reasonable default fixed height
...
Instead of hard-coding 22 in random places, just make the following
widgets have a fixed height of 22 by default: Button, CheckBox,
ColorInput, ComboBox, RadioButton, SpinBox, TextBox.
In the future we can make this relative to the current font size,
but for now at least this centralizes the setting a bit better.
2020-12-30 01:54:53 +01:00
Andreas Kling
0f3b0b65ae
LibGUI+LibCore: Remove the GUI::SizePolicy enum
2020-12-30 01:38:29 +01:00
Andreas Kling
7dc5a3ead8
LibGUI: Rewrite layout system in terms of min and max sizes
...
This patch removes size policies and preferred sizes, and replaces them
with min-size and max-size for each widget.
Box layout now works in 3 passes:
1) Set all items (widgets/spacers) to their min-size
2) Distribute remaining space evenly, respecting max-size
3) Place widgets one after the other, adding spacing in between
I've also added convenience helpers for setting a fixed size (which is
the same as setting min-size and max-size to the same value.)
This significantly reduces the verbosity of widget layout and makes GML
a bit more pleasant to write, too. :^)
2020-12-30 01:36:41 +01:00
Andreas Kling
b2bba5ce5c
LibGUI: Make Layout::margins() return a const reference
2020-12-30 01:28:28 +01:00
Andreas Kling
ee85713e52
LibGUI: Add fixed_size/fixed_width/fixed_height helpers to Widget
...
Fixed sizes are really just shorthands for setting min and max size to
the same value.
This makes it much nicer to express fixed sizes in GML:
Before:
@GUI::Widget {
horizontal_size_policy: "Fixed"
preferred_width: 20
}
After:
@GUI::Widget {
fixed_width: 20
}
2020-12-30 01:28:28 +01:00
Andreas Kling
60e3f685db
LibGUI: Add min/max sizes to GUI::Widget
...
This patch adds min_size and max_size properties to GUI::Widget. These
can also be accessed as min_width/min_height and max_width/max_height.
Layouts will respect these constraints and size widgets accordingly.
2020-12-30 01:28:28 +01:00
Idan Horowitz
b05f048c05
LibGUI: offset value by minimum to ensure proper rendering of sliders
...
This subtracts the minimum from the value when rendering so that the
knob doesnt go off screen for a non-zero minimum.
2020-12-29 23:37:38 +01:00
AnotherTest
5e5eb615ec
Shell: Add runtime errors and implement break/continue
...
Such errors are raised when SyntaxError nodes are executed, and are also
used for internal control flow.
The 'break' and 'continue' commands are currently only allowed inside
for loops, and outside function bodies.
This also adds a 'loop' keyword for infinite loops.
2020-12-29 16:55:43 +01:00
Linus Groh
c39323401c
LibGUI: Consider comment tokens in GMLParser
...
It was just ignoring them, so any GML containing a comment would fail
to parse with "Expected child, property, or }"!
2020-12-29 15:42:30 +01:00
Linus Groh
d161007e9e
LibGUI: Register Label "text_alignment" property
2020-12-29 15:42:30 +01:00
Linus Groh
750a608441
LibGUI: Register TextEditor "mode" property
...
This makes it possible to construct a read-only (or display-only)
TextEditor in GML:
@GUI::TextEditor {
mode: "ReadOnly"
text: "Well hello friends! :^)"
}
2020-12-29 15:42:30 +01:00
Linus Groh
c4991d969c
LibGUI: Register the ImageWidget and LinkLabel widgets
2020-12-29 15:42:30 +01:00
Linus Groh
b8eb1baac8
LibGUI: Move REGISTER_WIDGET(GUI, TabWidget) to Widget.cpp
...
All the other (GUI) registrations happen here, so it's confusing to have
just one elsewhere ("wait... is TabWidget not registered?!").
2020-12-29 15:42:30 +01:00
Linus Groh
a514f2cbfd
LibGUI: Set default value of LinkLabel text argument to a null string
...
The regular Label also does this, being able to call the constructor
with no arguments is required for REGISTER_WIDGET(GUI, LinkLabel).
2020-12-29 15:42:30 +01:00
Andreas Kling
f06b240ce0
LibGUI: Enforce the SelectionMode in AbstractView::set_cursor()
2020-12-29 00:43:50 +01:00
Andreas Kling
66c0374fd7
LibGUI: Make FilePicker a little smaller by default
2020-12-29 00:30:25 +01:00
Andreas Kling
461c0afc25
LibGUI: Tweak FilePicker's default titles
2020-12-29 00:27:57 +01:00