Commit graph

70 commits

Author SHA1 Message Date
Andreas Kling
32e5c8c689 GTextEditor: Add on_selection_changed callback.
This is probably a bit eager and won't coalesce all updates or even
ignore no-op changes to the selection.
2019-04-12 02:52:34 +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
4ab0cd5d4c LibGUI: Move frame painting from GFrame to StylePainter.
This way it can be used by others who might not have a GFrame object.
2019-04-10 03:43:46 +02:00
Andreas Kling
313ac51832 LibGUI: Turn GTextBox into a wrapper around a single-line GTextEditor. 2019-04-10 03:08:29 +02:00
Andreas Kling
151b7149e6 GTextEditor: Add GTextEditor::on_change callback for when content changes. 2019-04-09 16:20:36 +02:00
Andreas Kling
bcc00857a4 AK: Revert Eternal<T> for now since it doesn't work as intended. 2019-04-05 05:14:20 +02:00
Andreas Kling
c02c9880b6 AK: Add Eternal<T> and use it in various places.
This is useful for static locals that never need to be destroyed:

Thing& Thing::the()
{
    static Eternal<Thing> the;
    return the;
}

The object will be allocated in data segment memory and will never have
its destructor invoked.
2019-04-03 16:52:25 +02:00
Andreas Kling
dcf6726487 WindowServer: Add support for per-window override cursors.
Use this to implement automatic switching to an I-beam cursor when hovering
over a GTextEditor. :^)
2019-03-31 23:52:02 +02:00
Andreas Kling
f249c40aaa Rename Painter::set_clip_rect() to add_clip_rect().
It was confusing to see multiple calls to set_foo() in a row. Since this is
an intersecting operation, let's call it add_clip_rect() instead.
2019-03-29 15:01:54 +01:00
Andreas Kling
9d7a513681 GTextEditor: Keep tweaking the single-line look. 2019-03-29 01:57:29 +01:00
Andreas Kling
5d72cf5a3f LibGUI: Improve GFrame's look for Container shapes.
This is now starting to look like a proper container. Very nice :^)
2019-03-28 20:15:13 +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
3dc4255eb4 LibGUI: Use GFrame to draw the frames around GItemView and GTableView. 2019-03-28 16:58:29 +01:00
Andreas Kling
1fc03a7644 LibGUI: Make GScrollableWidget a GFrame and fix up GTextEditor for it. 2019-03-28 16:14:26 +01:00
Andreas Kling
cb296ffede LibGUI: Add a GFrame class that can be inherited by framey widgets.
This will gather the code for painting sunken/raised frames etc in a single
place and make it easier add a bit of pleasant shading to UI's. :^)
2019-03-28 15:30:29 +01:00
Andreas Kling
670e376e27 Tweak the look of various UI surfaces and buttons. 2019-03-27 20:48:23 +01:00
Andreas Kling
0058da734e Kernel: Add Inode::truncate(size).
- Use this to implement the O_TRUNC open flag.
- Fix creat() to pass O_CREAT | O_TRUNC | O_WRONLY.
- Make sure we truncate wherever appropriate.
2019-03-27 16:42:30 +01:00
Andreas Kling
a3390b6f1c GTextEditor: Draw a simple border around single-line editors. 2019-03-25 14:13:21 +01:00
Andreas Kling
838a06096a GTextEditor: Shift+Delete should delete the current line. 2019-03-25 13:14:02 +01:00
Andreas Kling
b4da451c9a WindowServer+LibGUI: Implement automatic cursor tracking.
When a mouse button is pressed inside a window, put that window into an
automatic mouse tracking state where all mouse events are sent to that
window until all mouse buttons are released.

This might feel even better if it only cared about the mouse buttons you
actually pressed while *inside* the windows to get released, I don't know.
I'll have to use it for a while and see how it's like.
2019-03-24 15:01:56 +01:00
Andreas Kling
ed2303e2d8 TextEditor: The delete key should work even when there's no selection. 2019-03-20 23:11:00 +01:00
Andreas Kling
daa1dcb5e8 FileManager: Use a GTextEditor for the location bar + tweak icons. 2019-03-20 18:12:56 +01:00
Andreas Kling
46577a6948 GTextEditor: Fix invalidation glitches in single-line mode. 2019-03-19 02:45:49 +01:00
Andreas Kling
a6538feed1 LibGUI: Add GInputBox for getting a string from a modal dialog.
Use this to implement some of the toolbar actions in IRCClient. :^)
2019-03-19 01:41:00 +01:00
Andreas Kling
ec8bffb06d LibGUI: Let GTextEditor deal with its horizontal padding internally.
I originally wanted to have the padding concept in GScrollableWidget
but it's really finicky with the ruler and everything.
2019-03-16 23:16:37 +01:00
Andreas Kling
3854e752cb LibGUI: Make GTextEditor inherit from GScrollableWidget.
This is quite nice, now we can share a ton of logic. :^)
2019-03-16 16:54:51 +01:00
Andreas Kling
7e3673f710 GTextEditor: Disable the ruler in single-line mode.
Also make it possible to hide the ruler in multi-line mode, if you should
want to do that. :^)
2019-03-15 17:54:05 +01:00
Andreas Kling
1fc283ed7d IRCClient+LibGUI: Add an input box so we can send messages to channels.
Implement this using a GTextEditor with a special single-line mode.
This new mode needs some polishing, but it's already very useful.
2019-03-15 17:37:13 +01:00
Andreas Kling
10dcd3a47f GTextEditor: Make sure the scroll corner helper widget is filled in. 2019-03-11 12:52:07 +01:00
Andreas Kling
5d69bf06d2 LibGUI: Don't fill widgets with background color by defualt. 2019-03-10 13:16:36 +01:00
Andreas Kling
8017c1e17c GTextEditor: Let the Tab key insert up to 4 spaces. 2019-03-10 11:08:36 +01:00
Andreas Kling
b4a099d212 GTextEditor: Allow jumping lines by hitting Left/Right at start/end of line. 2019-03-09 22:02:35 +01:00
Andreas Kling
0a7137617d GTextEditor: Simplify painting of the ruler. 2019-03-09 21:30:16 +01:00
Andreas Kling
3c2139b824 GTextEditor: Use Painter save/restore to simplify. 2019-03-09 16:48:43 +01:00
Andreas Kling
5a28392660 GTextEditor: Use a subwidget for the scrollbar corner and tighten clipping. 2019-03-08 18:58:40 +01:00
Andreas Kling
ccda716028 GTextEditor: Backspace and Delete should work regardless of modifier state. 2019-03-08 18:50:14 +01:00
Andreas Kling
032549d7bf GTextEditor: Refactor selection into a GTextRange class.
This is a bit more expressive than "selection start + current cursor".
2019-03-08 18:28:24 +01:00
Andreas Kling
f40d11f06d LibGUI+WindowServer: Implement drag-to-select behavior in GTextEditor.
To make this feel right, I needed to start passing keyboard modifiers along
with mouse events. That allows shift-clicking to extend the selection. :^)
2019-03-08 17:53:02 +01:00
Andreas Kling
6d172725c0 GTextEditor: Fix text_position_at() behavior when passed negative values. 2019-03-08 17:13:31 +01:00
Andreas Kling
c4937f01d8 GTextEditor: Simplify delete_selection(). 2019-03-08 15:55:58 +01:00
Andreas Kling
5602f3be6c GTextEditor: Ctrl+A should select the entire document. 2019-03-08 14:12:41 +01:00
Andreas Kling
220c7b5f75 GTextEditor: Replace selection on input or Backspace/Delete. 2019-03-08 14:10:34 +01:00
Andreas Kling
48d48679b0 GTextEditor: Work on cut/copy/paste operations. 2019-03-08 14:08:15 +01:00
Andreas Kling
6576ac8332 GTextEditor: Add selected_text() function.
I don't have a clipboard to actually put the copied selection onto yet,
so just print the selected text to stdout so we can see what it is.
2019-03-08 01:59:59 +01:00
Andreas Kling
b5521e1b0d GTextEditor: Add basic selection support. 2019-03-08 00:49:45 +01:00
Andreas Kling
27b0aab13e GTextEditor: Unbreak forward merge with Delete. 2019-03-07 20:15:05 +01:00
Andreas Kling
9867fe1025 GTextEditor: Add a ruler column that always shows the line numbers. 2019-03-07 20:05:05 +01:00
Andreas Kling
f13c62f225 GTextEditor: Fix double effect of backspace/delete in some cases. 2019-03-07 17:18:22 +01:00
Andreas Kling
f8b72ab3ab GTextEditor: Add basic PageUp/PageDown navigation support. 2019-03-07 17:11:17 +01:00
Andreas Kling
187d7cb400 GTextEditor: Add write_to_file(String path) :^) 2019-03-07 17:06:11 +01:00