Commit graph

651 commits

Author SHA1 Message Date
Andreas Kling
dc6b61dbcc LibGUI: Add ToolBar and ToolBarContainer to Forward.h 2020-04-25 17:20:10 +02:00
Andreas Kling
1887dc6de4 LibGUI: Make ToolBarContainer better at reacting to child events
Now you can remove a ToolBar from a ToolBarContainer and it will update
its own preferred size automatically.
2020-04-25 17:16:05 +02:00
Itamar
393560d8a2 HackStudio: GUI support for setting breakpoints on source code lines 2020-04-25 13:16:46 +02:00
Andreas Kling
0f4fa43541 LibGUI: Tweak TabWidget tab icon placement 2020-04-24 22:49:57 +02:00
Andreas Kling
4d8206f7c2 LibGUI: Use bold font for the currently active TabWidget tab 2020-04-24 22:44:36 +02:00
Andreas Kling
d6bbf12b7c LibGUI: Add "uniform tabs" mode to TabWidget (all tabs have same width)
...and enable this in the main Browser UI. :^)
2020-04-24 22:36:25 +02:00
Andreas Kling
53cb5325ee LibGUI: Allow TabWidget tabs to have icons and custom text alignment 2020-04-24 22:27:46 +02:00
Andreas Kling
45a932a600 Base: New "cut" action icon 2020-04-24 20:42:34 +02:00
Andreas Kling
1587b53001 LibGUI: Allow overriding the padding inside a TabWidget 2020-04-24 20:42:34 +02:00
DexesTTP
424f47cbe5 LibGUI: Fix display issue when selecting multi-lines in TextEditor
When selecting the start of a multi-line line, a selection rect was
displayed for the whole line but the text wasn't rendered properly.
This change prevents the selection rect from being drawn in virtual
lines with no selected characters.
2020-04-24 20:29:47 +02:00
Andreas Kling
c350bb9178 LibGUI: Fix laggy mouse selection in TextEditor widget
We were letting the automatic scrolling timer drive all selection
updates to fix an unwanted acceleration that was happening. However,
if a mousemove occurs *within* the editor widget, we should just
handle it right then and there.
2020-04-24 19:14:22 +02:00
Andreas Kling
344e66caaa LibGUI: Shrink GUI::Splitter by 1 pixel to make it look just right
Splitters were slightly oversized to work around the fact that we
were ignoring 2px on both sides of them. Now that the whole splitter
can be interacted with, we can lose 1px of fat and look great! :^)
2020-04-24 19:05:04 +02:00
Andreas Kling
42f0b2522b LibGUI: Introduce widget content margins + improve splitters
A GUI::Widget can now set an optional content margin (4x0 by default.)
Pixels in the content margin will be ignored for hit testing purposes.

Use this to allow frame-like widgets (like GUI::Frame!) to ignore any
mouse events in the frame area, and instead let those go to parent.

This allows GUI::Splitter to react "sooner" to mouse events that were
previously swallowed by the child widgets instead of ending up in the
splitter. The net effect is that 2 more pixels on each side of a
splitter handle are now interactive and usable for splitting! :^)
2020-04-24 19:05:02 +02:00
Andreas Kling
5d88022252 LibGUI: When removing a TabWidget tab, activate the next tab 2020-04-24 17:10:59 +02:00
Andreas Kling
a2bdcfabc9 LibGUI: Grant focus when activating a new stack/tab child widget
This makes opening a tab actually focus the opened tab.
2020-04-24 14:34:24 +02:00
Andreas Kling
d0578bfa32 LibGUI: Search the entire focus chain for shortcut actions
Instead of only looking in the focused widget, we now also look in the
ancestor chain of that widget for any ancestor with a registered action
for the given shortcut.

This makes it possible for parent widgets to capture action activations
while one of their children is focused.
2020-04-24 14:34:24 +02:00
Linus Groh
95b51e857d LibJS: Add TokenType::TemplateLiteral
This is required for template literals - we're not quite there yet, but at
least the parser can now tell us when this token is encountered -
currently this yields "Unexpected token Invalid". Not really helpful.

The character is a "backtick", but as we already have
TokenType::{StringLiteral,RegexLiteral} this seemed like a fitting name.

This also enables syntax highlighting for template literals in the js
REPL and LibGUI's JSSyntaxHighlighter.
2020-04-24 11:18:57 +02:00
Andreas Kling
4087e3cfb9 LibGUI: Add TabWidget functions to activate next/previous tab 2020-04-23 21:43:08 +02:00
Andreas Kling
ee7e7e6d55 LibGUI: Add TabWidget::set_tab_title(Widget&, StringView)
This lets you change the title of a tab after creating it.
2020-04-23 21:13:47 +02:00
Andreas Kling
933cf365e8 LibGUI: Tweak default ScrollBar size to make arrow icons centered :^) 2020-04-23 20:01:55 +02:00
Andreas Kling
108c08eb49 LibGUI: Make StatusBar 2px shorter vertically for a snugger fit 2020-04-23 18:52:34 +02:00
Andreas Kling
8260cbf7bd LibGUI: Tweak colorization of ScrollBar gutter 2020-04-23 17:54:59 +02:00
Andreas Kling
ab336e895f LibGUI: Add a ToolBarContainer widget and put most ToolBars in one
This mimics the Explorer toolbar container from Windows 2000 and looks
pretty neat! :^)
2020-04-23 17:44:49 +02:00
Andreas Kling
5b6c2f3bd6 LibGUI: Make sure the ResizeCorner aligns nicely inside StatusBar 2020-04-23 15:58:39 +02:00
Andreas Kling
cbc3d4fddd LibGUI: Tweak StatusBar layout margins 2020-04-23 14:45:04 +02:00
Andreas Kling
7da7bbe6f9 LibGUI: Decrease the default ToolBar height a little bit 2020-04-23 14:09:05 +02:00
Andreas Kling
56c73f03ce LibGUI: Get rid of the awkward horizontal line in StatusBar
Just fill StatusBar with button color instead of trying to share paint
code with ToolBar.
2020-04-23 13:53:17 +02:00
Hüseyin ASLITÜRK
74cc0560e8 LibGUI: MessageBox min width control for show messages
If message is too short calculate dialog width via buttons count. And icon is present lets align text to left.
2020-04-23 11:49:02 +02:00
angel
451b3fa73c LibGUI: Added error events to FileSystemModel
This will allow us to catch errors early on FileManager
2020-04-22 12:12:32 +02:00
Andreas Kling
5326eebb1b WindowServer+LibGUI: Notify DisplayLinks at 60 fps no matter what
The original implementation only sent out notifications when there was
something being drawn on screen. If nothing was going on, we'd get too
lazy and just not notify display links.

This obviously break requestAnimationFrame(), so now we just drive the
DisplayLinks at 60 fps no matter what. :^)
2020-04-22 00:07:48 +02:00
Andreas Kling
705cee528a LibGUI: Make it easier to create checkable GUI::Actions
This patch adds GUI::Action::create_checkable() helpers that work just
like the existing create() helpers, but the actions become checkable(!)

Clients are no longer required to manage the checked state of their
actions manually, but instead they will be checked/unchecked as needed
by GUI::Action itself before the activation hook is fired.
2020-04-21 17:21:28 +02:00
Andreas Kling
52a250cb61 LibGUI: Make MenuBar a Core::Object
This makes it show up in Inspector with all the menus inside it. :^)
2020-04-21 16:19:18 +02:00
Hüseyin ASLITÜRK
2abf2a2db1 LibGUI: MessageBox change height to icon cropping 2020-04-21 12:03:35 +02:00
Valtteri Koskivuori
3339a77f6c
LibGUI: Don't accelerate TextEditor autoscroll on wiggle (#1897)
This little tweak fixes the issue where the scrolling speeds up
significantly if the user wiggles their cursor. Just something obvious
I spotted while watching the video :^)
2020-04-21 09:54:46 +02:00
angel
441c2715bb LibGUI: Add Select all action to TextEditor
Previously, TextEditor processed the Select all command directly on the
keydown event handler. For this reason, WindowManager would not process
it as an action for the focused control and an action with the same
keyboard shortcut from the parent could override the TextEditor's one
even when it is focused.

For instance, when pressing Ctrl+A on the FileManager's path bar, all
files were selected instead, which is not the expected behavior.

Now the Select all command is an actual action on TextEditor, so that
WindowManager can process it correctly before any other actions. I also
added an icon for it!
2020-04-20 22:43:40 +02:00
Andreas Kling
563a377f6b LibGUI: Fix unpleasant selection behavior when dragging far to the left
If you select some text and drag the cursor outside the widget on the
left hand side, we would previously suddenly snap the selection cursor
to the end of the line instead of keeping it at the start of the line
as you would expect. This patch fixes that. :^)
2020-04-20 21:39:07 +02:00
Andreas Kling
5c15c24976 LibGUI: Keep scrolling while drag-selecting outside a TextEditor
If you start selecting text and move the cursor outside the TextEditor
widget area without letting go of the mouse button, we will now keep
scrolling a little bit every 100ms.
2020-04-20 21:31:49 +02:00
angel
e0a16f8752 FileManager+LibGUI: Allow drop on entire DirectoryView
Previously, drag and drop would only work when dragging between node
items on a DirectoryView. This commit makes it possible to drag files to
the empty area of the DirectoryView and copy files more easily between
windows.
2020-04-20 12:15:26 +02:00
Andreas Kling
c45e16f605 LibCore: Add StandardPaths thing to retrieve various standard locations
Fixes #1853.
2020-04-19 19:57:05 +02:00
Sergey Bugaev
f8b2a7b4a7 LibCore+LibGUI: Move DesktopServices to LibCore 2020-04-19 11:14:26 +02:00
Linus Groh
3474d7c88e WindowServer/LibGUI: Enforce minimum window size 2020-04-19 02:07:45 +02:00
Andreas Kling
3f08dd5ddc LibGUI: Add GUI::DesktopServices::open(URL)
This API is used to open a URL in whatever way the desktop system feels
is best. If you give it a file:// URL, it will try to work out a good
application to open the URL with. For all other protocols, it will open
a Browser instance. :^)
2020-04-18 21:56:28 +02:00
Andreas Kling
d17b42b28d LibGUI: Make view widgets fill background by default
Most clients will want background autofill, so let's make it the
default mode.
2020-04-18 21:55:37 +02:00
Andreas Kling
c7b7b65309 LibGUI: Fix ItemView crash when rubberbanding in main widget view
For some reason this was trying to access the Palette of the parent
widget which is obviously not going to work if the ItemView itself is
the main widget in its window.
2020-04-18 21:25:43 +02:00
Andreas Kling
54c980dbf2 LibGUI: Make ItemView respect Widget::fill_with_background_color()
This makes it possible to create a see-through ItemView. :^)
2020-04-18 21:23:39 +02:00
Andreas Kling
3d31f2e44b WindowServer: Add WindowType::Desktop
This new window type can be used to implement a desktop file manager
for example. :^)
2020-04-18 21:10:16 +02:00
Andreas Kling
228ace854c LibGfx: Don't allow creating bitmaps whose sizes would overflow
If the area or size_in_bytes calculation for a Gfx::Bitmap would
overflow, we now refuse to create such a bitmap and return nullptr.

Thanks to @itamar8910 for finding this! :^)
2020-04-15 12:28:49 +02:00
Andreas Kling
57464be8f1 LibGUI: Scroll AbstractView to top on model change 2020-04-14 19:12:10 +02:00
Hüseyin ASLITÜRK
c6944f8cc2 LibGUI: Use parrent window icon for MessageBox dialog icon 2020-04-12 18:08:11 +02:00
Andreas Kling
235ae80e5e LibGUI: Make TableView ignore custom colors for selected rows
This allows them to look selected instead.
2020-04-12 15:23:24 +02:00