mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-30 08:41:15 +00:00
TextEditor: Change cursor when reaching the ruler area
Noticed that mouse-overing the ruler area in the TextEditor does not change the cursor to the default cursor, instead, the beam cursor is used, which does not look nice. This PR extends the mousemove event and introduces a new set_editing_cursor() function that takes care of setting the cursor for the editor area.
This commit is contained in:
parent
299cebbbcb
commit
03e9697975
Notes:
sideshowbarker
2024-07-19 17:04:13 +09:00
Author: https://github.com/tsymalla Commit: https://github.com/SerenityOS/serenity/commit/03e96979755 Pull-request: https://github.com/SerenityOS/serenity/pull/14912
|
@ -28,6 +28,7 @@
|
|||
#include <LibGfx/Font/Font.h>
|
||||
#include <LibGfx/Font/FontDatabase.h>
|
||||
#include <LibGfx/Palette.h>
|
||||
#include <LibGfx/StandardCursor.h>
|
||||
#include <LibSyntax/Highlighter.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
|
@ -310,6 +311,12 @@ void TextEditor::mousemove_event(MouseEvent& event)
|
|||
update();
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_ruler_visible && (ruler_rect_in_inner_coordinates().contains(event.position()))) {
|
||||
set_override_cursor(Gfx::StandardCursor::None);
|
||||
} else {
|
||||
set_editing_cursor();
|
||||
}
|
||||
}
|
||||
|
||||
void TextEditor::select_current_line()
|
||||
|
@ -1672,6 +1679,11 @@ void TextEditor::set_mode(const Mode mode)
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
set_editing_cursor();
|
||||
}
|
||||
|
||||
void TextEditor::set_editing_cursor()
|
||||
{
|
||||
if (!is_displayonly())
|
||||
set_override_cursor(Gfx::StandardCursor::IBeam);
|
||||
else
|
||||
|
|
|
@ -95,6 +95,8 @@ public:
|
|||
bool is_displayonly() const { return m_mode == DisplayOnly; }
|
||||
void set_mode(const Mode);
|
||||
|
||||
void set_editing_cursor();
|
||||
|
||||
bool is_ruler_visible() const { return m_ruler_visible; }
|
||||
void set_ruler_visible(bool);
|
||||
|
||||
|
|
Loading…
Reference in a new issue