Commit graph

68 commits

Author SHA1 Message Date
Andreas Kling
04b9dc2d30 Libraries: Create top level directory for libraries.
Things were getting a little crowded in the project root, so this patch
moves the Lib*/ directories into Libraries/.
2019-07-04 16:16:50 +02:00
Andreas Kling
315716d193 GUI: Use Win2K-like "warm gray" color instead of the older colder gray.
Someone suggested this a long time ago and I never got around to it.
So here we go, here's the warm gray! I have to admit I like it better. :^)
2019-06-30 09:23:16 +02:00
Andreas Kling
90b1354688 AK: Rename RetainPtr => RefPtr and Retained => NonnullRefPtr. 2019-06-21 18:37:47 +02:00
Andreas Kling
7ad8790d80 LibGUI: Run clang-format on everything. 2019-06-07 11:46:02 +02:00
Andreas Kling
fdf3608c8a Update Badge<T> instantiations to simply be {}. 2019-05-31 15:44:04 +02:00
Andreas Kling
0c85d3dba9 LibCore+LibGUI: Add is<T>(CObject&) and to<T>(CObject&) helpers. 2019-05-27 04:06:01 +02:00
Andreas Kling
723ba91f74 LibGUI: Add GWidget::for_each_child_widget(callback). 2019-05-27 03:52:33 +02:00
Andreas Kling
d12857fc36 LibGUI: Notify widgets when their enabled state changes.
This is done by dispatching a (synchronous) "EnabledChange" event that can
be picked up in change_event(). Use this event to kick widgets out of their
"being pressed"-type modes if the user is interacting with them while the
state is programmatically changed.
2019-05-25 13:40:57 +02:00
Robin Burchell
a4b0dfff43 Move double click events from LibGUI to the window server 2019-05-15 22:45:28 +02:00
Andreas Kling
ad731cc08f LibGUI: Support cycling through focusable widgets with Tab and Shift-Tab. 2019-05-15 02:39:58 +02:00
Andreas Kling
dab9901235 WindowServer+LibGUI: Handle mouse wheel deltas in the mouse event stream.
The wheel events will end up in GWidget::mousewheel_event(GMouseEvent&)
on the client-side. This patch also implements basic wheel scrolling in
GScrollableWidget via this mechanism. :^)
2019-05-13 19:52:57 +02:00
Andreas Kling
49d0cdabac GWidget: Ignore updates if self has !updates_enabled().
We were only checking when propagating updates to parents, duh.
2019-05-02 04:19:59 +02:00
Andreas Kling
6d5507313e GWidget: Add set_updates_enabled() for temporarily suppressing updates. 2019-05-02 03:47:01 +02:00
Andreas Kling
ba2e97aa52 LibGUI: Track double-clicking per individual mouse button.
Clicking two separate buttons in quick succession shouldn't be interpreted
as a double click.
2019-04-26 14:15:11 +02:00
Andreas Kling
5c5ce4f885 LibGUI: Allow GActions to be scoped either globally or widget-locally.
This makes it possible for e.g GTextEditor to create a bunch of actions
with popular shortcuts like Ctrl+C, etc, without polluting the global
shortcut namespace. Widget-local actions will only activate while their
corresponding widget has focus. :^)
2019-04-20 21:56:56 +02:00
Andreas Kling
568f3125f3 GWidget: Always update self after a child is removed.
We could probably tighten the amount of invalidation we do here, but this is
definitely more correct than not invalidating at all.
2019-04-18 23:25:30 +02:00
Andreas Kling
9e6b0ccc0e LibCore+LibGUI: Make CObject child events synchronous.
...and then make GWidget layout invalidation lazy. This way we coalesce
multiple invalidations into a single relayout and we don't have to worry
about child widgets not being fully constructed.
2019-04-18 22:57:24 +02:00
Andreas Kling
a747a10eab LibGUI: Refactor context menus to be event-driven instead of declarative.
The declarative approach had way too many limitations. This patch adds a
context menu event that can be hooked to prepare a custom context menu on
demand just-in-time. :^)
2019-04-18 04:12:27 +02:00
Andreas Kling
ac324f14b8 GWidget: Add move_by() and make set_relative_rect() invalidate parent. 2019-04-16 22:59:27 +02:00
Andreas Kling
f61549ca5f Make better use of geometry class helpers in some places. 2019-04-16 13:58:02 +02:00
Andreas Kling
952f334de7 GWidget: Tidy up the hit-testing code somewhat. 2019-04-16 13:25:00 +02:00
Andreas Kling
c812d63ea6 GWidget: Remove unnecessary extra parent lookup in move_to_{back,front}(). 2019-04-16 04:01:14 +02:00
Andreas Kling
04500c1ae2 GWidget: Add some new child z-ordering facilities.
- child_at(Point)
- move_to_front()
- move_to_back()
- is_frontmost()
- is_backmost()

This patch also makes it possible to receive the mouse event that triggers
a context menu before the context menu is shown. I'm not sure this is the
best design for context menus but it works for now.
2019-04-16 03:47:55 +02:00
Andreas Kling
3f6408919f AK: Improve smart pointer ergonomics a bit. 2019-04-14 02:36:06 +02:00
Andreas Kling
7a74b76769 GWidget: Silence debug spam about the click clock. 2019-04-13 16:15:47 +02:00
Andreas Kling
c06a3bdeb4 LibGUI+WindowServer: Add support for per-GWidget context menus.
You can now simply assign a GMenu as a GWidget's context menu and it will
automagically pop up on right click. :^)
2019-04-12 17:18:13 +02:00
Andreas Kling
269886fc4e GWidget: Add "enabled" state for widgets.
There's nothing magical that happens for painting, each widget needs to
handle it manually in their painting code.
2019-04-12 02:51:16 +02:00
Andreas Kling
c6ffb3e2b8 VisualBuilder: Use real GWidgets instead of pretend VBWidgets.
That first design was the wrong idea. Instead, have VBWidget instantiate
a GWidget of the appropriate type and parent it to the VBForm.
We then use a new "greedy hit-testing" mechanism in GWidget to prevent any
mouse events from reaching the VBForm's children.

To paint the grabbers above the child widgets, I added a slightly hackish
but kind of neat second_paint_event() that is called after a widget has
painted all of his children. :^)
2019-04-11 03:34:37 +02:00
Andreas Kling
2f1f51b8ab LibCore: Move LibGUI/GObject to LibCore/CObject. 2019-04-10 17:01:54 +02:00
Andreas Kling
b8062f69d8 LibCore: Add CEvent and make LibGUI/GEvent inherit from it. 2019-04-10 16:56:55 +02:00
Andreas Kling
9311164439 GWidget: Make hit testing respect child z-order.
This was as simple as iterating the children in reverse order. Duh. :^)
2019-04-10 02:08:32 +02:00
Andreas Kling
7f2eeb0b35 LibGUI+WindowServer: Add support for GWidget tooltips.
Any GWidget can have a tooltip and it will automatically pop up below the
center of the widget when hovered. GActions added to GToolBars will use
the action text() as their tooltip automagically. :^)
2019-04-08 18:58:44 +02:00
Andreas Kling
e74f32ae40 LibGUI: Always invalidate layout on GWidget child removal.
This code can get a bit confused when the child is destroyed before we
handle the ChildRemoved event. In those cases, the GChildEvent::child()
getter will return nullptr as it's backed by a WeakPtr.

To work around this issue, just always invalidate the layout for now.
This can be made a lot tighter in the future.
2019-04-06 21:15:13 +02:00
Andreas Kling
96104b5524 Taskbar: More bringup work. We now see a basic window list. 2019-04-04 01:44:35 +02:00
Andreas Kling
c9b0d87927 LibGUI: Fix broken doubleclick detection due to uninitialized GElapsedTimer. 2019-04-01 22:03:32 +02:00
Andreas Kling
a5135dbf01 LibGUI: Remove debug spam in GWidget::spans_entire_window_horizontally(). 2019-03-29 02:22:17 +01:00
Andreas Kling
d48f486634 LibGUI: Don't draw left and right side of surfaces that span entire window.
In other words, if a surface stretches from the left side of the window
all the way to the right side, skip shading and highlighting the sides.
This makes widgets blend together just slightly with the window. :^)
2019-03-29 02:20:22 +01:00
Andreas Kling
9fa21fa585 LibGUI: Add a GPainter class that inherits from Painter.
This gets rid of the last little piece of LibGUI knowledge in Painter.
2019-03-28 17:19:56 +01:00
Andreas Kling
20137e45f4 LibGUI: Ignore GWidget::update() on invisible widgets. 2019-03-25 13:58:30 +01:00
Andreas Kling
614dafea32 FileManager+LibGUI: Show thumbnail generation progress in the statusbar. 2019-03-25 04:25:25 +01:00
Andreas Kling
20f7d7ec67 LibGUI: Add GWidget::doubleclick_event().
Now double-clicking an item in a GTableView or GItemView will activate it.
2019-03-25 01:43:32 +01:00
Andreas Kling
3a3aa74b2e IRCClient: Add a toolbar with some actions. 2019-03-15 23:24:40 +01:00
Andreas Kling
ad08165a25 LibGUI: Hit testing should skip invisible widgets. 2019-03-15 16:45:27 +01:00
Andreas Kling
497300c492 LibGUI: Add a GStackWidget for many widgets sharing a single location.
Call set_active_widget(GWidget*) to put a new widget on top.
2019-03-15 16:12:06 +01:00
Andreas Kling
fa02d2a39b Rework the rendering model so that clients instantiate backing stores.
This makes interactive resizing work a lot better, althought it's still not
perfect. There are still glitches and unpleasant flashes of zeroed memory.
2019-02-20 22:08:14 +01:00
Andreas Kling
bf30502560 LibGUI: Implement enter/leave events (with WindowServer support.)
Windows now learn when the mouse cursor leaves or enters them.
Use this to implement GWidget::{enter,leave}_event() and use that
to implement the CoolBar button effect. :^)
2019-02-20 10:12:19 +01:00
Andreas Kling
b704d3d295 LibGUI: Add a GToolBar class that can be populated with GActions.
The same action can be added to both a menu and a toolbar.
Use this to put a toolbar into FileManager. This is pretty neat. :^)
2019-02-20 02:39:46 +01:00
Andreas Kling
18062f4ad6 LibGUI: Remove some debugging noise. 2019-02-17 01:05:24 +01:00
Andreas Kling
640360e958 Move WindowServer to userspace.
This is a monster patch that required changing a whole bunch of things.
There are performance and stability issues all over the place, but it works.
Pretty cool, I have to admit :^)
2019-02-17 00:13:47 +01:00
Andreas Kling
db98327bdc Plumb menu item activation events from WindowServer to clients.
GMenu now has an "on_item_activation" callback that fires whenever one
of its items are activated. The menu item identifier is used to distinguish
between items.

Use this to implement font switching in Terminal. :^)
2019-02-12 10:08:35 +01:00