Commit graph

17 commits

Author SHA1 Message Date
Andreas Kling
977863ea07 LibGUI: Include keyboard modifier state with button on_click calls
This will allow you us to implement special behavior when Ctrl+clicking
a button.
2020-05-12 20:31:16 +02:00
Andreas Kling
77916f030f LibGUI: Use "OK, Cancel" button order in ColorPicker 2020-04-29 19:29:09 +02:00
Andreas Kling
51ab0e967e LibGUI: Use a sunken GUI::Frame for the ColorPicker color spectrum
This looks a lot nicer than just a plain widget. :^)
2020-04-29 19:28:19 +02:00
Andreas Kling
d7d5788469 LibGUI: ColorPicker should pick custom color from bitmap, not window
It's not always safe to access pixel data of a window's backing store
since the kernel may decide to purge it at his leisure. Fix this by
instead picking colors from the color spectrum bitmap directly instead.

Also fix up mouse event logic while we're here so it only cares about
the left mouse button

Fixes #1657.
2020-04-29 19:17:40 +02:00
Andreas Kling
6a01827046 LibGUI: Exit ColorPicker (successfully) when double-clicking a color
It feels natural that if I double click a color button, the dialog
closes successfully and "returns" that color.
2020-04-29 19:17:40 +02:00
Andreas Kling
f8069418e1 LibGUI: Transfer "color has alpha channel" state 2020-04-29 16:22:09 +02:00
Andreas Kling
2463a285ee LibGUI: Make GUI::TabWidget::add_tab<T>() return a T&
Since the newly constructed sub-widget is owned by the TabWidget,
we can simply return a T& here. :^)
2020-04-04 11:10:07 +02:00
Andreas Kling
9430918026 LibGUI: Move ColorPicker's helper classes fully into ColorPicker.cpp
Since these are not used by the outside world, no need to expose them.
2020-04-04 10:38:39 +02:00
Hüseyin ASLITÜRK
177b30629c LibGUI: Add color palette and custom color selection in the ColorPicker 2020-04-04 10:32:44 +02:00
Andreas Kling
b29ff7b821 LibGUI: Don't use Core::Object::add() to instantiate dialogs
Now that add() returns a WidgetType&, we can't rely on the parent of a
GUI::Dialog to still keep it alive after exec() returns. This happens
because exec() will call remove_from_parent() on itself before
returning.

And so we go back to the old idiom for creating a GUI::Dialog centered
above a specific window. Just call GUI::Dialog::construct(), passing
the "parent" window as the last parameter.
2020-03-04 21:04:06 +01:00
Andreas Kling
028c011760 LibCore: Make Core::Object::add<ChildType> return a ChildType&
Since the returned object is now owned by the callee object, we can
simply vend a ChildType&. This allows us to use "." instead of "->"
at the call site, which is quite nice. :^)
2020-03-04 21:04:06 +01:00
Andreas Kling
0f3e57a6fb LibGUI: Use GUI::Window::set_main_widget<WidgetType>() in clients 2020-03-04 14:26:16 +01:00
Andreas Kling
4697195645 LibGUI: Use set_layout<LayoutType>() in lots of client code 2020-03-04 13:49:48 +01:00
Andreas Kling
a26b63a958 LibGUI: Remove Button& parameter from Button::on_click hook
There was but a single user of this parameter and it's a bit tedious
to write it out every time, so let's get rid of it.
2020-03-03 17:02:38 +01:00
Andreas Kling
45c25ffecd LibGUI: Use Core::Object::add() a whole bunch 2020-02-23 11:10:52 +01:00
Andreas Kling
34c7322d77 LibGUI: Remove some header dependencies from Widget.h 2020-02-14 23:53:11 +01:00
Andreas Kling
6a9cc66b97 LibGUI: Remove leading G from filenames 2020-02-06 20:33:02 +01:00
Renamed from Libraries/LibGUI/GColorPicker.cpp (Browse further)