summaryrefslogtreecommitdiff
path: root/Applications/HexEditor/HexEditor.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-02-02 15:07:41 +0100
committerAndreas Kling <kling@serenityos.org>2020-02-02 15:15:33 +0100
commitc5bd9d4ed1d80ac91d46146565127b0c185f1b43 (patch)
treeb4ee9ba5999778450f8eb4006df89110617b4a10 /Applications/HexEditor/HexEditor.cpp
parent2d39da5405a4527e91e853ddb1e56a539c96c6c1 (diff)
downloadserenity-c5bd9d4ed1d80ac91d46146565127b0c185f1b43.zip
LibGUI: Put all classes in the GUI namespace and remove the leading G
This took me a moment. Welcome to the new world of GUI::Widget! :^)
Diffstat (limited to 'Applications/HexEditor/HexEditor.cpp')
-rw-r--r--Applications/HexEditor/HexEditor.cpp38
1 files changed, 19 insertions, 19 deletions
diff --git a/Applications/HexEditor/HexEditor.cpp b/Applications/HexEditor/HexEditor.cpp
index d5f3514ce2..a965009484 100644
--- a/Applications/HexEditor/HexEditor.cpp
+++ b/Applications/HexEditor/HexEditor.cpp
@@ -41,8 +41,8 @@
#include <stdio.h>
#include <unistd.h>
-HexEditor::HexEditor(GWidget* parent)
- : GScrollableWidget(parent)
+HexEditor::HexEditor(GUI::Widget* parent)
+ : ScrollableWidget(parent)
{
set_frame_shape(FrameShape::Container);
set_frame_shadow(FrameShadow::Sunken);
@@ -139,7 +139,7 @@ bool HexEditor::copy_selected_hex_to_clipboard()
output_string_builder.appendf("%02X ", m_buffer.data()[i]);
}
- GClipboard::the().set_data(output_string_builder.to_string());
+ GUI::Clipboard::the().set_data(output_string_builder.to_string());
return true;
}
@@ -153,7 +153,7 @@ bool HexEditor::copy_selected_text_to_clipboard()
output_string_builder.appendf("%c", isprint(m_buffer.data()[i]) ? m_buffer[i] : '.');
}
- GClipboard::the().set_data(output_string_builder.to_string());
+ GUI::Clipboard::the().set_data(output_string_builder.to_string());
return true;
}
@@ -176,7 +176,7 @@ bool HexEditor::copy_selected_hex_to_clipboard_as_c_code()
}
output_string_builder.append("\n};\n");
- GClipboard::the().set_data(output_string_builder.to_string());
+ GUI::Clipboard::the().set_data(output_string_builder.to_string());
return true;
}
@@ -195,9 +195,9 @@ void HexEditor::set_content_length(int length)
set_content_size({ offset_margin_width() + (m_bytes_per_row * (character_width() * 3)) + 10 + (m_bytes_per_row * character_width()) + 20, total_rows() * line_height() + 10 });
}
-void HexEditor::mousedown_event(GMouseEvent& event)
+void HexEditor::mousedown_event(GUI::MouseEvent& event)
{
- if (event.button() != GMouseButton::Left) {
+ if (event.button() != GUI::MouseButton::Left) {
return;
}
@@ -259,7 +259,7 @@ void HexEditor::mousedown_event(GMouseEvent& event)
}
}
-void HexEditor::mousemove_event(GMouseEvent& event)
+void HexEditor::mousemove_event(GUI::MouseEvent& event)
{
auto absolute_x = horizontal_scrollbar().value() + event.x();
auto absolute_y = vertical_scrollbar().value() + event.y();
@@ -274,12 +274,12 @@ void HexEditor::mousemove_event(GMouseEvent& event)
auto text_end_x = text_start_x + (bytes_per_row() * character_width());
auto text_end_y = text_start_y + 5 + (total_rows() * line_height());
- window()->set_override_cursor(GStandardCursor::None);
+ window()->set_override_cursor(GUI::StandardCursor::None);
if ((absolute_x >= hex_start_x && absolute_x <= hex_end_x
&& absolute_y >= hex_start_y && absolute_y <= hex_end_y)
|| (absolute_x >= text_start_x && absolute_x <= text_end_x
&& absolute_y >= text_start_y && absolute_y <= text_end_y)) {
- window()->set_override_cursor(GStandardCursor::IBeam);
+ window()->set_override_cursor(GUI::StandardCursor::IBeam);
}
if (m_in_drag_select) {
@@ -311,9 +311,9 @@ void HexEditor::mousemove_event(GMouseEvent& event)
}
}
-void HexEditor::mouseup_event(GMouseEvent& event)
+void HexEditor::mouseup_event(GUI::MouseEvent& event)
{
- if (event.button() == GMouseButton::Left) {
+ if (event.button() == GUI::MouseButton::Left) {
if (m_in_drag_select) {
if (m_selection_end == -1 || m_selection_start == -1) {
m_selection_start = -1;
@@ -344,7 +344,7 @@ void HexEditor::scroll_position_into_view(int position)
scroll_into_view(rect, true, true);
}
-void HexEditor::keydown_event(GKeyEvent& event)
+void HexEditor::keydown_event(GUI::KeyEvent& event)
{
#ifdef HEX_DEBUG
printf("HexEditor::keydown_event key=%d\n", event.key());
@@ -414,7 +414,7 @@ void HexEditor::keydown_event(GKeyEvent& event)
}
}
-void HexEditor::hex_mode_keydown_event(GKeyEvent& event)
+void HexEditor::hex_mode_keydown_event(GUI::KeyEvent& event)
{
if ((event.key() >= KeyCode::Key_0 && event.key() <= KeyCode::Key_9) || (event.key() >= KeyCode::Key_A && event.key() <= KeyCode::Key_F)) {
@@ -439,7 +439,7 @@ void HexEditor::hex_mode_keydown_event(GKeyEvent& event)
}
}
-void HexEditor::text_mode_keydown_event(GKeyEvent& event)
+void HexEditor::text_mode_keydown_event(GUI::KeyEvent& event)
{
m_tracked_changes.set(m_position, m_buffer.data()[m_position]);
m_buffer.data()[m_position] = (u8)event.text().characters()[0]; // save the first 4 bits, OR the new value in the last 4
@@ -462,11 +462,11 @@ void HexEditor::did_change()
on_change();
}
-void HexEditor::paint_event(GPaintEvent& event)
+void HexEditor::paint_event(GUI::PaintEvent& event)
{
- GFrame::paint_event(event);
+ GUI::Frame::paint_event(event);
- GPainter painter(*this);
+ GUI::Painter painter(*this);
painter.add_clip_rect(widget_inner_rect());
painter.add_clip_rect(event.rect());
painter.fill_rect(event.rect(), Color::White);
@@ -567,5 +567,5 @@ void HexEditor::paint_event(GPaintEvent& event)
void HexEditor::leave_event(Core::Event&)
{
ASSERT(window());
- window()->set_override_cursor(GStandardCursor::None);
+ window()->set_override_cursor(GUI::StandardCursor::None);
}