Commit Graph

32 Commits

Author SHA1 Message Date
Andreas Kling
94cd272ac0 LibGUI: Make CommonMenus::make_accessibility_menu() infallible 2023-08-14 14:57:54 +02:00
Andreas Kling
676ef0cc3d LibGUI: Make Menu::add_recent_files_list() infallible 2023-08-14 14:57:54 +02:00
Andreas Kling
f2faf2767f LibGUI: Remove Menu::try_add_action()
And fall back to the infallible add_action().
2023-08-14 14:57:54 +02:00
Andreas Kling
eec328e2ab LibGUI: Remove Menu::try_add_submenu()
And fall back to the infallible add_submenu().
2023-08-14 14:57:54 +02:00
Andreas Kling
1525fa3b8f LibGUI: Remove Menu::try_add_separator()
And fall back to the infallible add_separator().
2023-08-14 14:57:54 +02:00
Andreas Kling
ddbe6bd7b4 Userland: Rename Core::Object to Core::EventReceiver
This is a more precise description of what this class actually does.
2023-08-06 20:39:51 +02:00
Karol Kosek
51bd9ca037 LibGUI+Userland: Make Menu::*add_submmenu take name using new string 2023-04-19 07:59:54 +02:00
Karol Kosek
dccd70385d LibGUI+Browser: Set menu names using the new String class 2023-04-19 07:59:54 +02:00
Karol Kosek
956f4d9205 Userland: Construct Menus with name using the non-deprecated String 2023-04-19 07:59:54 +02:00
Karol Kosek
c4c1df7621 LibGUI: Store Menu names as new String 2023-04-19 07:59:54 +02:00
MacDue
a2d333ff4a LibGUI: Allow updating the names of menus and submenus 2023-03-26 21:55:21 +01:00
Andreas Kling
21db2b7b90 Everywhere: Remove NonnullOwnPtr.h includes 2023-03-06 23:46:35 +01:00
Andreas Kling
359d6e7b0b Everywhere: Stop using NonnullOwnPtrVector
Same as NonnullRefPtrVector: weird semantics, questionable benefits.
2023-03-06 23:46:35 +01:00
Andreas Kling
544366ff2a LibGUI: Add a simple "recently open files" feature
This feature allows any application to easily install an automatically
updating list of recently open files in a GUI::Menu.

There are three main pieces to this mechanism:

- GUI::Application::set_config_domain(domain): This must be called
  before using the recent files feature. It informs the Application
  object about which config domain to find the relevant RecentFiles
  list under.

- GUI::Menu::add_recently_open_files(callback): This inserts the list
  in a menu. A callback must be provided to handle actually opening
  the recent file in some application-specific way.

- GUI::Application::set_most_recently_open_file(path): This updates
  the list of recently open files, both in the configuration files,
  and in the GUI menu.
2023-02-28 14:39:32 +01:00
Andreas Kling
faa1a09042 LibGUI: Fix const-correctness issues 2023-02-21 00:54:04 +01:00
MacDue
7be0b27dd3 Meta+Userland: Pass Gfx::IntPoint by value
This is just two ints or 8 bytes or the size of the reference on
x86_64 or AArch64.
2022-12-07 11:48:27 +01:00
Linus Groh
6e19ab2bbc AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null
state), and while it's going to use UTF-8, the name UTF8String is a
mouthful - so let's free up the String name by renaming the existing
class.
Making the old one have an annoying name will hopefully also help with
quick adoption :^)
2022-12-06 08:54:33 +01:00
thankyouverycool
f31a56d086 LibGUI: Add CommonMenus
Right now only the accessibility menu is shared across apps but
it's a good bit of boilerplate that can be consolidated and will
make adding ColorBlindnessFilters to other widgets trivial.
2022-11-19 11:04:11 +01:00
thankyouverycool
35e557c657 Browser+LibGUI+WindowServer: Open Button menus uniformly
Instead of letting buttons determine the relative position
of their menus, a workaround only used by Statusbar segments,
open them all uniformly for a nice, consistent UI.

Passing a rect to popup() now routes to open_button_menu(), an
analog to open_menubar_menu(), which adjusts the menu's popup
position in the same way. Fixes button menus obscuring the buttons
which spawn them and jutting out at odd corners depending on screen
position.
2022-09-08 10:17:27 +01:00
Idan Horowitz
086969277e Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
Itamar
935d023967 Userland: Rename WindowServerConnection=>ConnectionToWindowServer
This was done with CLion's automatic rename feature.
2022-02-25 22:35:12 +01:00
Marco Cutecchia
dbfe385879 LibGUI: Add 'remove_all_actions' method to 'Menu' 2022-02-21 16:31:56 +01:00
networkException
f49948cc48 LibGUI: Collect menu and submenu actions for CommandPalette
We now not only collect actions that are children of windows but also
all actions that are part of a window's menus and submenus :^)
2022-01-30 15:24:35 +01:00
Marcus Nilsson
708ec90bba LibGUI: Add Menu::set_children_actions_enabled() helper
This adds a helper function to Menu that allows us to set all the
children enabled/disabled.
2022-01-09 20:24:02 +01:00
Andreas Kling
a18631c5e7 LibGUI: Add GUI::Menu::try_add_submenu()
This is a fallible variant of add_submenu() that returns ErrorOr.
2021-11-24 23:07:31 +01:00
Andreas Kling
51c4de8774 LibGUI: Add GUI::Menu::try_add_action() and try_add_separator()
These are fallible variants that return ErrorOr. :^)
2021-11-24 13:52:01 +01:00
sin-ack
611370e7dc LibGUI, WindowServer: Greatly simplify menubar logic
Currently, any number of menubars can be plugged in and out of a window.
This is unnecessary complexity, since we only need one menubar on a
window. This commit removes most of the logic for dynamically attaching
and detaching menubars and makes one menubar always available. The
menubar is only considered existent if it has at least a single menu in
it (in other words, an empty menubar will not be shown).

This commit additionally fixes a bug wherein menus added after a menubar
has been attached would not have their rects properly setup, and would
therefore appear glitched out on the top left corner of the menubar.
2021-08-02 00:39:15 +02:00
Brian Gianforcaro
1682f0b760 Everything: Move to SPDX license identifiers in all files.
SPDX License Identifiers are a more compact / standardized
way of representing file license information.

See: https://spdx.dev/resources/use/#identifiers

This was done with the `ambr` search and replace tool.

 ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-22 11:22:27 +02:00
Andreas Kling
0e4eb62dd8 LibGUI: Make some API's take String instead of StringView 2021-04-17 01:27:30 +02:00
Andreas Kling
a2baab38fd Everywhere: It's now "Foobar", not "FooBar", and not "foo bar"
I hereby declare these to be full nouns that we don't split,
neither by space, nor by underscore:

- Breadcrumbbar
- Coolbar
- Menubar
- Progressbar
- Scrollbar
- Statusbar
- Taskbar
- Toolbar

This patch makes everything consistent by replacing every other variant
of these with the proper one. :^)
2021-04-13 16:58:15 +02:00
Andreas Kling
9b740f218b WindowServer+LibGUI: Notify clients when menus become visible/hidden
This will allow clients to react to these events.
2021-04-05 18:09:04 +02:00
Andreas Kling
13d7c09125 Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00