Commit graph

883 commits

Author SHA1 Message Date
Ben Wiederhake
70fe126d01 LibGUI: Enable icons for SubMenus
It doesn't make sense for a top-level menu to have an icon, however
we do not have dedicated classes to distinguish these.

Furthermore, the only other place to store an icon is MenuItem.
Storing it there would be highly confusing, as MenuItem-with-Action
then would have two icons: one in Action and one in MenuItem.
And because we need to be able to replace the icon during realization,
this would need to write-through to Action somehow.

That's why I went with Menu, not MenuItem.
2020-07-28 16:29:44 +02:00
Ben Wiederhake
048f149f51 LibGUI: Refactor icon realization in Menu
This factors out icon realization into its own function, making it possible to
use the same code with other classes that have icon() and set_icon() methods.
2020-07-28 16:29:44 +02:00
Ben Wiederhake
082b7d6b0c LibGUI: Set correct default value during menu destruction 2020-07-28 16:29:44 +02:00
thankyouverycool
6448f94372 DevTools+LibGUI: Make ProcessChooser a general Dialog in LibGUI
Moves ProcessChooser and RunningProcessesModel to LibGUI and
generalizes their construction for use by other apps. Updates
Profiler to reflect the change and use its new icons.
2020-07-28 16:29:36 +02:00
Nico Weber
9ee1edae2a CppLexer: Support raw string literals
Handles prefixes and delimiters (`R"(text)", `u8R"f(text)f"`, ...).
2020-07-27 12:11:19 +02:00
Nico Weber
4d783338c1 CppLexer: Support L, u, u8, U prefixes on string and char literals 2020-07-27 12:11:19 +02:00
Nico Weber
34dc163441 CppLexer: Correctly highlight hex escapes in string and char literals
\x consumes all hex digits following it. (If the resulting number
then doesn't fit in the character type, the compiler emits an
error.)

\x would be much more convenient to use if it was always followed
by exactly two hex digits (with \u and \U for higher codepoints),
but that's sadly not the world we live in.
2020-07-27 12:11:04 +02:00
Nico Weber
c1b7fd644c CppLexer: Support \U escapes in addition to \u escapes 2020-07-27 12:10:46 +02:00
Nico Weber
7a1c328417 CppLexer: Add token types for "::", "::*", ".*", "->*" 2020-07-27 01:04:17 +02:00
Nico Weber
1992dbd637 CppLexer: Add token types for ".", "->" 2020-07-27 01:04:17 +02:00
Nico Weber
95113d15fe CppLexer: Add token types for "!", "!=", "~", "?", ":" 2020-07-27 01:04:17 +02:00
Nico Weber
29bc978564 CppLexer: Add token types for "^", "^=" 2020-07-27 01:04:17 +02:00
Nico Weber
c38b8d63f8 CppLexer: Add token types for "++", "--" 2020-07-27 01:04:17 +02:00
Nico Weber
598b5e4595 CppLexer: Add token types for "&", "&&", "&=", "|", "||", "|=" 2020-07-27 01:04:17 +02:00
Nico Weber
345b303262 CppLexer: Add token types for ">", ">=", ">>", ">>=" 2020-07-27 01:04:17 +02:00
Nico Weber
97c4344f33 CppLexer: Add token types for "<", "<=", "<<", "<<=", "<>" 2020-07-27 01:04:17 +02:00
Andreas Kling
3e389f4cdc LibGUI: Remove accidentally committed file :^) 2020-07-26 20:05:15 +02:00
Nico Weber
96d13f75cf CppLexer: Add token types for "+", "+=", "-", "-=", "=", "==", "/", "/="
Mostly so that TextEdit doesn't emit logspam when I write `int a = 4`
in a test program.
2020-07-26 19:52:26 +02:00
Nico Weber
5a36d8acb8 CppLexer: Add token type for "*=" 2020-07-26 19:52:26 +02:00
Andreas Kling
e0b8b4ac67 LibCore+LibGUI: Switch to using AK::is and AK::downcast 2020-07-26 17:51:00 +02:00
thankyouverycool
c50f258b7a LibGUI+WindowServer: Allow applets to retrieve their location
MenuApplet windows can now call rect_in_menubar to return their
location in the MenuBar.
2020-07-26 11:32:12 +02:00
Andreas Kling
a655cf5b41 LibGUI: Break up Window::event() into many smaller functions
This function was unbearably huge. Handle each event type in its own
function instead so you can see what's going on.
2020-07-24 01:03:24 +02:00
Andreas Kling
0a95f8d346 LibGUI: Add {Horizontal,Vertical}Slider to the forwarding header 2020-07-23 19:59:38 +02:00
Andreas Kling
4392413cd1 LibGUI: Make window-parented actions actually scoped to the window
We were relying on Core::is<Window>() to tell us whether the parent
of an action is a window. This didn't work since we only saw a forward
declaration of GUI::Window in Action.cpp.

This is an unfortunate flaw in the is<T> pattern and we should solve
it somehow but not in this patch.
2020-07-23 19:52:18 +02:00
Andreas Kling
9d4cd565e3 LibGUI: Fix build after renaming Image => ImageWidget 2020-07-23 17:43:44 +02:00
Andreas Kling
299824de73 LibGUI: Rename GUI::Image => GUI::ImageWidget
"Image" was a bit too vague, "ImageWidget" is obviously a widget of
some sort.
2020-07-23 17:31:08 +02:00
Sasan Hezarkhani
a2bbacbfc8 TextEditor: Jump to word break when deleting and holding Ctrl modifier 2020-07-23 13:08:55 +02:00
AnotherTest
c9c7069f9e LibGUI: Remove unnecessary LibHTTP #include
This closes #2848.
2020-07-22 17:48:11 +02:00
thankyouverycool
c90fe7ce93 LibGUI: Use ControlBoxButtons in SpinBox and ComboBox
Converts the buttons of these widgets into ControlBoxButtons.
2020-07-20 21:03:48 +02:00
thankyouverycool
bf59cd7ca5 LibGUI: Add ControlBoxButton to LibGUI
ControlBoxButton consolidates the paint_event for buttons
used in composite box widgets like ComboBox and SpinBox. Its
button bitmaps are built with create_from_ascii like WindowFrame
and ScrollBar controls, making theming more uniform.
2020-07-20 21:03:48 +02:00
Andreas Kling
76523a3d2d LibGUI: Show the special home directory icon in GUI::FilePicker 2020-07-19 21:42:00 +02:00
Andreas Kling
dc696ba85c LibGUI: Show a special icon for the home directory in FileSystemModel 2020-07-19 21:37:19 +02:00
Andreas Kling
9710c9742c LibGUI+FileManager: Add setting for showing/hiding dotfiles
GUI::FileSystemModel can now be told to display (or not display) files
whose name start with a dot (other than . and ..)
2020-07-19 21:15:00 +02:00
thankyouverycool
a4b2d6cf1e LibGUI: Set parent icon, margins and disable resize for InputBox
Gives a more compact, uniform appearance to input boxes.
2020-07-18 16:27:57 +02:00
thankyouverycool
d976b31ef6 LibGUI: Paint slider knob as indented when disabled
Better visual feedback when sliders won't budge.
2020-07-18 16:27:57 +02:00
Andreas Kling
5f0d24cab2 LibGUI: Turn a heap-allocated event into a stack-allocated one 2020-07-16 20:46:44 +02:00
Tom
65a11fb5f9 LibGUI: Add InputBox::show with required parent window argument
Similar to MessageBox::show, this encourages passing in a window.
2020-07-16 16:10:21 +02:00
Tom
27bd2eab22 LibWeb: Require parent window argument for MessageBox
Since the vast majority of message boxes should be modal, require
the parent window to be passed in, which can be nullptr for the
rare case that they don't. By it being the first argument, the
default arguments also don't need to be explicitly stated in most
cases, and it encourages passing in a parent window handle.

Fix up several message boxes that should have been modal.
2020-07-16 16:10:21 +02:00
Tom
6568765e8f LibGUI: Add parent window argument to FilePicker functions
Since FilePicker almost always should be modal, add the parent
window as mandatory first argument.
2020-07-16 16:10:21 +02:00
Tom
9844088964 LibGUI: Clear previous main widget's window 2020-07-16 16:10:21 +02:00
Tom
bbdf0665fc WindowServer: Expose window parent information and more modal improvements
* The parent information is necessary by the Taskbar to be able to
  determine a modal window's parent
* Minimize and maximize modal window stacks together
2020-07-16 16:10:21 +02:00
thankyouverycool
1f8e9727ec LibGUI: Remove on_activity_change from ComboBox
Unnecessary since the inclusion of window accessories.
2020-07-16 00:45:35 +02:00
thankyouverycool
a038f82326 LibGUI: Disallow typing in DisplayOnly TextEditors 2020-07-16 00:06:18 +02:00
Tom
ec3737510d WindowServer: Add accessory windows
Accessory windows are windows that, when activated, will activate
their parent and bring all other accessory windows of that parent
to the front of the window stack. Accessory windows can only be
active input windows. The accessory window's parent is always the
active window regardless of whether it is also the active input
window.

In order to route input correctly, input is now sent to the active
input window, which can be any accessory window or their parent,
or any regular window.
2020-07-15 17:15:45 +02:00
Sergey Bugaev
5fd8dbacb1 LibGUI+FileManager: Fix forgetting to map sorting proxy model indexes
Also assert indexes are valid in a few more places.

Finally fixes https://github.com/SerenityOS/serenity/issues/1440 and
https://github.com/SerenityOS/serenity/issues/2787 :^)
2020-07-15 13:41:46 +02:00
thankyouverycool
6a78db07f1 LibGUI: Add hover highlighting and keyboard controls to ComboBox
Adds a new highlighting effect to the actively selected row in
ComboBox ListView. ComboBoxEditor can now be controlled with
page up, page down, and the up and down arrow keys. ESC and loss
of focus now cause comboboxes to close. Now activates on mouseup
as well as return.
2020-07-15 13:19:44 +02:00
thankyouverycool
b2783a234a LibGUI: Use enum for TextEditor modes & add new DisplayOnly mode
Adds a new, more restrictive read-only state to TextEditor which
forbids copying, selecting, editor cursors, and context menus.
Provides a unique appearance on focus which accomodates ComboBox
widgets. All TextEditor modes are now accessed by enum and
set_mode() which sets the editor to Editable, ReadOnly or
DisplayOnly. Updates applications still using set_readonly().
2020-07-15 13:19:44 +02:00
thankyouverycool
dc716194c8 LibGUI: Add on_activity_change function to Window
Reports changes on the active/inactive state of a window.
2020-07-15 13:19:44 +02:00
Tom
8ae37bccf1 LibGUI: Fix menu leak when default action changed 2020-07-15 00:11:30 +02:00
Tom
50903fd88c FileManager: Add "Open with" menu if alternative applications are available 2020-07-15 00:11:30 +02:00