mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:48:14 +00:00
LibGUI: Run clang-format on everything.
This commit is contained in:
parent
bc951ca565
commit
7ad8790d80
43 changed files with 525 additions and 363 deletions
|
@ -1,5 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/StdLibExtras.h>
|
||||
|
||||
namespace AK {
|
||||
|
||||
template<typename T>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#include <Kernel/KeyCode.h>
|
||||
#include <LibGUI/GAbstractView.h>
|
||||
#include <LibGUI/GModel.h>
|
||||
#include <LibGUI/GScrollBar.h>
|
||||
#include <LibGUI/GPainter.h>
|
||||
#include <LibGUI/GScrollBar.h>
|
||||
#include <LibGUI/GTextBox.h>
|
||||
#include <Kernel/KeyCode.h>
|
||||
|
||||
GAbstractView::GAbstractView(GWidget* parent)
|
||||
: GScrollableWidget(parent)
|
||||
|
|
|
@ -29,7 +29,6 @@ GAction::GAction(const StringView& text, const GShortcut& shortcut, Function<voi
|
|||
{
|
||||
}
|
||||
|
||||
|
||||
GAction::GAction(const StringView& text, const GShortcut& shortcut, RetainPtr<GraphicsBitmap>&& icon, Function<void(GAction&)> on_activation_callback, GWidget* widget)
|
||||
: on_activation(move(on_activation_callback))
|
||||
, m_text(text)
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#include <LibGUI/GAction.h>
|
||||
#include <LibGUI/GApplication.h>
|
||||
#include <LibGUI/GEventLoop.h>
|
||||
#include <LibGUI/GMenuBar.h>
|
||||
#include <LibGUI/GAction.h>
|
||||
#include <LibGUI/GWindow.h>
|
||||
#include <LibGUI/GLabel.h>
|
||||
#include <LibGUI/GMenuBar.h>
|
||||
#include <LibGUI/GPainter.h>
|
||||
#include <LibGUI/GWindow.h>
|
||||
#include <WindowServer/WSAPITypes.h>
|
||||
|
||||
static GApplication* s_the;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#include "GButton.h"
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <Kernel/KeyCode.h>
|
||||
#include <LibGUI/GAction.h>
|
||||
#include <LibGUI/GPainter.h>
|
||||
#include <SharedGraphics/StylePainter.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <LibGUI/GAction.h>
|
||||
#include <Kernel/KeyCode.h>
|
||||
|
||||
GButton::GButton(GWidget* parent)
|
||||
: GAbstractButton(parent)
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#include <Kernel/KeyCode.h>
|
||||
#include <LibGUI/GCheckBox.h>
|
||||
#include <LibGUI/GPainter.h>
|
||||
#include <SharedGraphics/CharacterBitmap.h>
|
||||
#include <SharedGraphics/StylePainter.h>
|
||||
#include <Kernel/KeyCode.h>
|
||||
|
||||
static const char* s_checked_bitmap_data = {
|
||||
" "
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <LibC/SharedBuffer.h>
|
||||
#include <LibGUI/GClipboard.h>
|
||||
#include <LibGUI/GEventLoop.h>
|
||||
#include <WindowServer/WSAPITypes.h>
|
||||
#include <LibC/SharedBuffer.h>
|
||||
|
||||
GClipboard& GClipboard::the()
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include <LibGUI/GDesktop.h>
|
||||
#include <LibGUI/GDialog.h>
|
||||
#include <LibGUI/GEventLoop.h>
|
||||
#include <LibGUI/GDesktop.h>
|
||||
|
||||
GDialog::GDialog(CObject* parent)
|
||||
: GWindow(parent)
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
#include "GDirectoryModel.h"
|
||||
#include <dirent.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <grp.h>
|
||||
#include <pwd.h>
|
||||
#include <AK/FileSystemPath.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <SharedGraphics/GraphicsBitmap.h>
|
||||
#include <LibGUI/GPainter.h>
|
||||
#include <LibCore/CLock.h>
|
||||
#include <LibCore/CDirIterator.h>
|
||||
#include <LibCore/CLock.h>
|
||||
#include <LibGUI/GPainter.h>
|
||||
#include <SharedGraphics/GraphicsBitmap.h>
|
||||
#include <dirent.h>
|
||||
#include <grp.h>
|
||||
#include <pwd.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static CLockable<HashMap<String, RetainPtr<GraphicsBitmap>>>& thumbnail_cache()
|
||||
{
|
||||
|
@ -94,13 +94,20 @@ int GDirectoryModel::column_count(const GModelIndex&) const
|
|||
String GDirectoryModel::column_name(int column) const
|
||||
{
|
||||
switch (column) {
|
||||
case Column::Icon: return "";
|
||||
case Column::Name: return "Name";
|
||||
case Column::Size: return "Size";
|
||||
case Column::Owner: return "Owner";
|
||||
case Column::Group: return "Group";
|
||||
case Column::Permissions: return "Mode";
|
||||
case Column::Inode: return "Inode";
|
||||
case Column::Icon:
|
||||
return "";
|
||||
case Column::Name:
|
||||
return "Name";
|
||||
case Column::Size:
|
||||
return "Size";
|
||||
case Column::Owner:
|
||||
return "Owner";
|
||||
case Column::Group:
|
||||
return "Group";
|
||||
case Column::Permissions:
|
||||
return "Mode";
|
||||
case Column::Inode:
|
||||
return "Inode";
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
@ -108,13 +115,20 @@ String GDirectoryModel::column_name(int column) const
|
|||
GModel::ColumnMetadata GDirectoryModel::column_metadata(int column) const
|
||||
{
|
||||
switch (column) {
|
||||
case Column::Icon: return { 16, TextAlignment::Center };
|
||||
case Column::Name: return { 120, TextAlignment::CenterLeft };
|
||||
case Column::Size: return { 80, TextAlignment::CenterRight };
|
||||
case Column::Owner: return { 50, TextAlignment::CenterLeft };
|
||||
case Column::Group: return { 50, TextAlignment::CenterLeft };
|
||||
case Column::Permissions: return { 80, TextAlignment::CenterLeft };
|
||||
case Column::Inode: return { 80, TextAlignment::CenterRight };
|
||||
case Column::Icon:
|
||||
return { 16, TextAlignment::Center };
|
||||
case Column::Name:
|
||||
return { 120, TextAlignment::CenterLeft };
|
||||
case Column::Size:
|
||||
return { 80, TextAlignment::CenterRight };
|
||||
case Column::Owner:
|
||||
return { 50, TextAlignment::CenterLeft };
|
||||
case Column::Group:
|
||||
return { 50, TextAlignment::CenterLeft };
|
||||
case Column::Permissions:
|
||||
return { 80, TextAlignment::CenterLeft };
|
||||
case Column::Inode:
|
||||
return { 80, TextAlignment::CenterRight };
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
@ -175,8 +189,7 @@ static String permission_string(mode_t mode)
|
|||
mode & S_IWGRP ? 'w' : '-',
|
||||
mode & S_ISGID ? 's' : (mode & S_IXGRP ? 'x' : '-'),
|
||||
mode & S_IROTH ? 'r' : '-',
|
||||
mode & S_IWOTH ? 'w' : '-'
|
||||
);
|
||||
mode & S_IWOTH ? 'w' : '-');
|
||||
|
||||
if (mode & S_ISVTX)
|
||||
builder.append("t");
|
||||
|
@ -207,25 +220,39 @@ GVariant GDirectoryModel::data(const GModelIndex& index, Role role) const
|
|||
auto& entry = this->entry(index.row());
|
||||
if (role == Role::Sort) {
|
||||
switch (index.column()) {
|
||||
case Column::Icon: return entry.is_directory() ? 0 : 1;
|
||||
case Column::Name: return entry.name;
|
||||
case Column::Size: return (int)entry.size;
|
||||
case Column::Owner: return name_for_uid(entry.uid);
|
||||
case Column::Group: return name_for_gid(entry.gid);
|
||||
case Column::Permissions: return permission_string(entry.mode);
|
||||
case Column::Inode: return (int)entry.inode;
|
||||
case Column::Icon:
|
||||
return entry.is_directory() ? 0 : 1;
|
||||
case Column::Name:
|
||||
return entry.name;
|
||||
case Column::Size:
|
||||
return (int)entry.size;
|
||||
case Column::Owner:
|
||||
return name_for_uid(entry.uid);
|
||||
case Column::Group:
|
||||
return name_for_gid(entry.gid);
|
||||
case Column::Permissions:
|
||||
return permission_string(entry.mode);
|
||||
case Column::Inode:
|
||||
return (int)entry.inode;
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
if (role == Role::Display) {
|
||||
switch (index.column()) {
|
||||
case Column::Icon: return icon_for(entry);
|
||||
case Column::Name: return entry.name;
|
||||
case Column::Size: return (int)entry.size;
|
||||
case Column::Owner: return name_for_uid(entry.uid);
|
||||
case Column::Group: return name_for_gid(entry.gid);
|
||||
case Column::Permissions: return permission_string(entry.mode);
|
||||
case Column::Inode: return (int)entry.inode;
|
||||
case Column::Icon:
|
||||
return icon_for(entry);
|
||||
case Column::Name:
|
||||
return entry.name;
|
||||
case Column::Size:
|
||||
return (int)entry.size;
|
||||
case Column::Owner:
|
||||
return name_for_uid(entry.uid);
|
||||
case Column::Group:
|
||||
return name_for_gid(entry.gid);
|
||||
case Column::Permissions:
|
||||
return permission_string(entry.mode);
|
||||
case Column::Inode:
|
||||
return (int)entry.inode;
|
||||
}
|
||||
}
|
||||
if (role == Role::Icon) {
|
||||
|
|
|
@ -1,24 +1,23 @@
|
|||
#include <LibCore/CObject.h>
|
||||
#include "GEventLoop.h"
|
||||
#include "GEvent.h"
|
||||
#include "GWindow.h"
|
||||
#include <LibGUI/GApplication.h>
|
||||
#include <LibGUI/GAction.h>
|
||||
#include <LibCore/CNotifier.h>
|
||||
#include <LibGUI/GMenu.h>
|
||||
#include <LibGUI/GDesktop.h>
|
||||
#include <LibGUI/GWidget.h>
|
||||
#include <LibC/unistd.h>
|
||||
#include <LibC/stdio.h>
|
||||
#include <LibC/errno.h>
|
||||
#include <LibC/fcntl.h>
|
||||
#include <LibC/stdio.h>
|
||||
#include <LibC/stdlib.h>
|
||||
#include <LibC/string.h>
|
||||
#include <LibC/time.h>
|
||||
#include <LibC/sys/select.h>
|
||||
#include <LibC/sys/socket.h>
|
||||
#include <LibC/sys/time.h>
|
||||
#include <LibC/errno.h>
|
||||
#include <LibC/string.h>
|
||||
#include <LibC/stdlib.h>
|
||||
#include <LibC/time.h>
|
||||
#include <LibC/unistd.h>
|
||||
#include <LibCore/CNotifier.h>
|
||||
#include <LibCore/CObject.h>
|
||||
#include <LibGUI/GAction.h>
|
||||
#include <LibGUI/GApplication.h>
|
||||
#include <LibGUI/GDesktop.h>
|
||||
#include <LibGUI/GMenu.h>
|
||||
#include <LibGUI/GWidget.h>
|
||||
#include <sys/uio.h>
|
||||
|
||||
//#define GEVENTLOOP_DEBUG
|
||||
|
@ -156,20 +155,42 @@ void GEventLoop::handle_mouse_event(const WSAPI_ServerMessage& event, GWindow& w
|
|||
#endif
|
||||
GMouseEvent::Type type;
|
||||
switch (event.type) {
|
||||
case WSAPI_ServerMessage::Type::MouseMove: type = GEvent::MouseMove; break;
|
||||
case WSAPI_ServerMessage::Type::MouseUp: type = GEvent::MouseUp; break;
|
||||
case WSAPI_ServerMessage::Type::MouseDown: type = GEvent::MouseDown; break;
|
||||
case WSAPI_ServerMessage::Type::MouseDoubleClick: type = GEvent::MouseDoubleClick; break;
|
||||
case WSAPI_ServerMessage::Type::MouseWheel: type = GEvent::MouseWheel; break;
|
||||
default: ASSERT_NOT_REACHED(); break;
|
||||
case WSAPI_ServerMessage::Type::MouseMove:
|
||||
type = GEvent::MouseMove;
|
||||
break;
|
||||
case WSAPI_ServerMessage::Type::MouseUp:
|
||||
type = GEvent::MouseUp;
|
||||
break;
|
||||
case WSAPI_ServerMessage::Type::MouseDown:
|
||||
type = GEvent::MouseDown;
|
||||
break;
|
||||
case WSAPI_ServerMessage::Type::MouseDoubleClick:
|
||||
type = GEvent::MouseDoubleClick;
|
||||
break;
|
||||
case WSAPI_ServerMessage::Type::MouseWheel:
|
||||
type = GEvent::MouseWheel;
|
||||
break;
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
break;
|
||||
}
|
||||
GMouseButton button { GMouseButton::None };
|
||||
switch (event.mouse.button) {
|
||||
case WSAPI_MouseButton::NoButton: button = GMouseButton::None; break;
|
||||
case WSAPI_MouseButton::Left: button = GMouseButton::Left; break;
|
||||
case WSAPI_MouseButton::Right: button = GMouseButton::Right; break;
|
||||
case WSAPI_MouseButton::Middle: button = GMouseButton::Middle; break;
|
||||
default: ASSERT_NOT_REACHED(); break;
|
||||
case WSAPI_MouseButton::NoButton:
|
||||
button = GMouseButton::None;
|
||||
break;
|
||||
case WSAPI_MouseButton::Left:
|
||||
button = GMouseButton::Left;
|
||||
break;
|
||||
case WSAPI_MouseButton::Right:
|
||||
button = GMouseButton::Right;
|
||||
break;
|
||||
case WSAPI_MouseButton::Middle:
|
||||
button = GMouseButton::Middle;
|
||||
break;
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
break;
|
||||
}
|
||||
post_event(window, make<GMouseEvent>(type, event.mouse.position, event.mouse.buttons, button, event.mouse.modifiers, event.mouse.wheel_delta));
|
||||
}
|
||||
|
|
|
@ -68,8 +68,8 @@ GFilePicker::GFilePicker(const StringView& path, CObject* parent)
|
|||
if (input_box.exec() == GInputBox::ExecOK && !input_box.text_value().is_empty()) {
|
||||
auto new_dir_path = FileSystemPath(String::format("%s/%s",
|
||||
m_model->path().characters(),
|
||||
input_box.text_value().characters()
|
||||
)).string();
|
||||
input_box.text_value().characters()))
|
||||
.string();
|
||||
int rc = mkdir(new_dir_path.characters(), 0777);
|
||||
if (rc < 0) {
|
||||
GMessageBox::show(String::format("mkdir(\"%s\") failed: %s", new_dir_path.characters(), strerror(errno)), "Error", GMessageBox::Type::Error, this);
|
||||
|
|
|
@ -1,17 +1,22 @@
|
|||
#include <LibGUI/GFileSystemModel.h>
|
||||
#include <LibCore/CDirIterator.h>
|
||||
#include <AK/FileSystemPath.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <sys/stat.h>
|
||||
#include <LibCore/CDirIterator.h>
|
||||
#include <LibGUI/GFileSystemModel.h>
|
||||
#include <dirent.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
struct GFileSystemModel::Node {
|
||||
String name;
|
||||
Node* parent { nullptr };
|
||||
Vector<Node*> children;
|
||||
enum Type { Unknown, Directory, File };
|
||||
enum Type
|
||||
{
|
||||
Unknown,
|
||||
Directory,
|
||||
File
|
||||
};
|
||||
Type type { Unknown };
|
||||
|
||||
bool has_traversed { false };
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include <LibGUI/GFontDatabase.h>
|
||||
#include <LibCore/CDirIterator.h>
|
||||
#include <LibGUI/GFontDatabase.h>
|
||||
#include <SharedGraphics/Font.h>
|
||||
#include <dirent.h>
|
||||
#include <stdio.h>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include <LibGUI/GFrame.h>
|
||||
#include <SharedGraphics/StylePainter.h>
|
||||
#include <LibGUI/GPainter.h>
|
||||
#include <SharedGraphics/StylePainter.h>
|
||||
|
||||
GFrame::GFrame(GWidget* parent)
|
||||
: GWidget(parent)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <LibGUI/GInputBox.h>
|
||||
#include <LibGUI/GBoxLayout.h>
|
||||
#include <LibGUI/GLabel.h>
|
||||
#include <LibGUI/GButton.h>
|
||||
#include <LibGUI/GInputBox.h>
|
||||
#include <LibGUI/GLabel.h>
|
||||
#include <LibGUI/GTextEditor.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#include <Kernel/KeyCode.h>
|
||||
#include <LibGUI/GItemView.h>
|
||||
#include <LibGUI/GModel.h>
|
||||
#include <LibGUI/GScrollBar.h>
|
||||
#include <LibGUI/GPainter.h>
|
||||
#include <Kernel/KeyCode.h>
|
||||
#include <LibGUI/GScrollBar.h>
|
||||
|
||||
GItemView::GItemView(GWidget* parent)
|
||||
: GAbstractView(parent)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <LibGUI/GListView.h>
|
||||
#include <LibGUI/GScrollBar.h>
|
||||
#include <LibGUI/GPainter.h>
|
||||
#include <Kernel/KeyCode.h>
|
||||
#include <LibGUI/GListView.h>
|
||||
#include <LibGUI/GPainter.h>
|
||||
#include <LibGUI/GScrollBar.h>
|
||||
|
||||
GListView::GListView(GWidget* parent)
|
||||
: GAbstractView(parent)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <LibGUI/GAction.h>
|
||||
#include <LibGUI/GMenu.h>
|
||||
#include <LibGUI/GEventLoop.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <LibGUI/GAction.h>
|
||||
#include <LibGUI/GEventLoop.h>
|
||||
#include <LibGUI/GMenu.h>
|
||||
|
||||
//#define GMENU_DEBUG
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include <LibGUI/GMenuBar.h>
|
||||
#include <LibGUI/GEventLoop.h>
|
||||
#include <LibGUI/GMenuBar.h>
|
||||
|
||||
GMenuBar::GMenuBar()
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include <LibGUI/GMenuItem.h>
|
||||
#include <LibGUI/GAction.h>
|
||||
#include <LibGUI/GEventLoop.h>
|
||||
#include <LibGUI/GMenuItem.h>
|
||||
#include <WindowServer/WSAPITypes.h>
|
||||
|
||||
GMenuItem::GMenuItem(unsigned menu_id, Type type)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <LibGUI/GMessageBox.h>
|
||||
#include <LibGUI/GBoxLayout.h>
|
||||
#include <LibGUI/GLabel.h>
|
||||
#include <LibGUI/GButton.h>
|
||||
#include <LibGUI/GLabel.h>
|
||||
#include <LibGUI/GMessageBox.h>
|
||||
#include <stdio.h>
|
||||
|
||||
void GMessageBox::show(const StringView& text, const StringView& title, Type type, CObject* parent)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include <LibGUI/GModel.h>
|
||||
#include <LibGUI/GAbstractView.h>
|
||||
#include <LibGUI/GModel.h>
|
||||
|
||||
GModel::GModel()
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include <LibGUI/GProgressBar.h>
|
||||
#include <LibGUI/GPainter.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <LibGUI/GPainter.h>
|
||||
#include <LibGUI/GProgressBar.h>
|
||||
|
||||
GProgressBar::GProgressBar(GWidget* parent)
|
||||
: GFrame(parent)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include <LibGUI/GRadioButton.h>
|
||||
#include <LibGUI/GPainter.h>
|
||||
#include <LibGUI/GRadioButton.h>
|
||||
#include <SharedGraphics/GraphicsBitmap.h>
|
||||
|
||||
static RetainPtr<GraphicsBitmap> s_unfilled_circle_bitmap;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include <LibGUI/GResizeCorner.h>
|
||||
#include <LibGUI/GPainter.h>
|
||||
#include <LibGUI/GResizeCorner.h>
|
||||
#include <LibGUI/GWindow.h>
|
||||
#include <SharedGraphics/GraphicsBitmap.h>
|
||||
#include <WindowServer/WSAPITypes.h>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#include <LibGUI/GPainter.h>
|
||||
#include <LibGUI/GScrollBar.h>
|
||||
#include <SharedGraphics/StylePainter.h>
|
||||
#include <SharedGraphics/CharacterBitmap.h>
|
||||
#include <SharedGraphics/GraphicsBitmap.h>
|
||||
#include <LibGUI/GPainter.h>
|
||||
#include <SharedGraphics/StylePainter.h>
|
||||
|
||||
static const char* s_up_arrow_bitmap_data = {
|
||||
" "
|
||||
|
@ -28,7 +28,6 @@ static const char* s_down_arrow_bitmap_data = {
|
|||
" "
|
||||
};
|
||||
|
||||
|
||||
static const char* s_left_arrow_bitmap_data = {
|
||||
" "
|
||||
" # "
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include <LibGUI/GScrollableWidget.h>
|
||||
#include <LibGUI/GScrollBar.h>
|
||||
#include <LibGUI/GScrollableWidget.h>
|
||||
|
||||
GScrollableWidget::GScrollableWidget(GWidget* parent)
|
||||
: GFrame(parent)
|
||||
|
|
|
@ -1,114 +1,218 @@
|
|||
#include <LibGUI/GShortcut.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <LibGUI/GShortcut.h>
|
||||
|
||||
static String to_string(KeyCode key)
|
||||
{
|
||||
switch (key) {
|
||||
case Key_Escape: return "Escape";
|
||||
case Key_Tab: return "Tab";
|
||||
case Key_Backspace: return "Backspace";
|
||||
case Key_Return: return "Return";
|
||||
case Key_Insert: return "Insert";
|
||||
case Key_Delete: return "Delete";
|
||||
case Key_PrintScreen: return "PrintScreen";
|
||||
case Key_SysRq: return "SysRq";
|
||||
case Key_Home: return "Home";
|
||||
case Key_End: return "End";
|
||||
case Key_Left: return "Left";
|
||||
case Key_Up: return "Up";
|
||||
case Key_Right: return "Right";
|
||||
case Key_Down: return "Down";
|
||||
case Key_PageUp: return "PageUp";
|
||||
case Key_PageDown: return "PageDown";
|
||||
case Key_Shift: return "Shift";
|
||||
case Key_Control: return "Control";
|
||||
case Key_Alt: return "Alt";
|
||||
case Key_CapsLock: return "CapsLock";
|
||||
case Key_NumLock: return "NumLock";
|
||||
case Key_ScrollLock: return "ScrollLock";
|
||||
case Key_F1: return "F1";
|
||||
case Key_F2: return "F2";
|
||||
case Key_F3: return "F3";
|
||||
case Key_F4: return "F4";
|
||||
case Key_F5: return "F5";
|
||||
case Key_F6: return "F6";
|
||||
case Key_F7: return "F7";
|
||||
case Key_F8: return "F8";
|
||||
case Key_F9: return "F9";
|
||||
case Key_F10: return "F10";
|
||||
case Key_F11: return "F11";
|
||||
case Key_F12: return "F12";
|
||||
case Key_Space: return "Space";
|
||||
case Key_ExclamationPoint: return "!";
|
||||
case Key_DoubleQuote: return "\"";
|
||||
case Key_Hashtag: return "#";
|
||||
case Key_Dollar: return "$";
|
||||
case Key_Percent: return "%";
|
||||
case Key_Ampersand: return "&";
|
||||
case Key_Apostrophe: return "'";
|
||||
case Key_LeftParen: return "(";
|
||||
case Key_RightParen: return ")";
|
||||
case Key_Asterisk: return "*";
|
||||
case Key_Plus: return "+";
|
||||
case Key_Comma: return ",";
|
||||
case Key_Minus: return "-";
|
||||
case Key_Period: return ",";
|
||||
case Key_Slash: return "/";
|
||||
case Key_0: return "0";
|
||||
case Key_1: return "1";
|
||||
case Key_2: return "2";
|
||||
case Key_3: return "3";
|
||||
case Key_4: return "4";
|
||||
case Key_5: return "5";
|
||||
case Key_6: return "6";
|
||||
case Key_7: return "7";
|
||||
case Key_8: return "8";
|
||||
case Key_9: return "9";
|
||||
case Key_Colon: return ":";
|
||||
case Key_Semicolon: return ";";
|
||||
case Key_LessThan: return "<";
|
||||
case Key_Equal: return "=";
|
||||
case Key_GreaterThan: return ">";
|
||||
case Key_QuestionMark: return "?";
|
||||
case Key_AtSign: return "@";
|
||||
case Key_A: return "A";
|
||||
case Key_B: return "B";
|
||||
case Key_C: return "C";
|
||||
case Key_D: return "D";
|
||||
case Key_E: return "E";
|
||||
case Key_F: return "F";
|
||||
case Key_G: return "G";
|
||||
case Key_H: return "H";
|
||||
case Key_I: return "I";
|
||||
case Key_J: return "J";
|
||||
case Key_K: return "K";
|
||||
case Key_L: return "L";
|
||||
case Key_M: return "M";
|
||||
case Key_N: return "N";
|
||||
case Key_O: return "O";
|
||||
case Key_P: return "P";
|
||||
case Key_Q: return "Q";
|
||||
case Key_R: return "R";
|
||||
case Key_S: return "S";
|
||||
case Key_T: return "T";
|
||||
case Key_U: return "U";
|
||||
case Key_V: return "V";
|
||||
case Key_W: return "W";
|
||||
case Key_X: return "X";
|
||||
case Key_Y: return "Y";
|
||||
case Key_Z: return "Z";
|
||||
case Key_LeftBracket: return "[";
|
||||
case Key_RightBracket: return "]";
|
||||
case Key_Backslash: return "\\";
|
||||
case Key_Circumflex: return "^";
|
||||
case Key_Underscore: return "_";
|
||||
case Key_LeftBrace: return "{";
|
||||
case Key_RightBrace: return "}";
|
||||
case Key_Pipe: return "|";
|
||||
case Key_Tilde: return "~";
|
||||
case Key_Backtick: return "`";
|
||||
case Key_Escape:
|
||||
return "Escape";
|
||||
case Key_Tab:
|
||||
return "Tab";
|
||||
case Key_Backspace:
|
||||
return "Backspace";
|
||||
case Key_Return:
|
||||
return "Return";
|
||||
case Key_Insert:
|
||||
return "Insert";
|
||||
case Key_Delete:
|
||||
return "Delete";
|
||||
case Key_PrintScreen:
|
||||
return "PrintScreen";
|
||||
case Key_SysRq:
|
||||
return "SysRq";
|
||||
case Key_Home:
|
||||
return "Home";
|
||||
case Key_End:
|
||||
return "End";
|
||||
case Key_Left:
|
||||
return "Left";
|
||||
case Key_Up:
|
||||
return "Up";
|
||||
case Key_Right:
|
||||
return "Right";
|
||||
case Key_Down:
|
||||
return "Down";
|
||||
case Key_PageUp:
|
||||
return "PageUp";
|
||||
case Key_PageDown:
|
||||
return "PageDown";
|
||||
case Key_Shift:
|
||||
return "Shift";
|
||||
case Key_Control:
|
||||
return "Control";
|
||||
case Key_Alt:
|
||||
return "Alt";
|
||||
case Key_CapsLock:
|
||||
return "CapsLock";
|
||||
case Key_NumLock:
|
||||
return "NumLock";
|
||||
case Key_ScrollLock:
|
||||
return "ScrollLock";
|
||||
case Key_F1:
|
||||
return "F1";
|
||||
case Key_F2:
|
||||
return "F2";
|
||||
case Key_F3:
|
||||
return "F3";
|
||||
case Key_F4:
|
||||
return "F4";
|
||||
case Key_F5:
|
||||
return "F5";
|
||||
case Key_F6:
|
||||
return "F6";
|
||||
case Key_F7:
|
||||
return "F7";
|
||||
case Key_F8:
|
||||
return "F8";
|
||||
case Key_F9:
|
||||
return "F9";
|
||||
case Key_F10:
|
||||
return "F10";
|
||||
case Key_F11:
|
||||
return "F11";
|
||||
case Key_F12:
|
||||
return "F12";
|
||||
case Key_Space:
|
||||
return "Space";
|
||||
case Key_ExclamationPoint:
|
||||
return "!";
|
||||
case Key_DoubleQuote:
|
||||
return "\"";
|
||||
case Key_Hashtag:
|
||||
return "#";
|
||||
case Key_Dollar:
|
||||
return "$";
|
||||
case Key_Percent:
|
||||
return "%";
|
||||
case Key_Ampersand:
|
||||
return "&";
|
||||
case Key_Apostrophe:
|
||||
return "'";
|
||||
case Key_LeftParen:
|
||||
return "(";
|
||||
case Key_RightParen:
|
||||
return ")";
|
||||
case Key_Asterisk:
|
||||
return "*";
|
||||
case Key_Plus:
|
||||
return "+";
|
||||
case Key_Comma:
|
||||
return ",";
|
||||
case Key_Minus:
|
||||
return "-";
|
||||
case Key_Period:
|
||||
return ",";
|
||||
case Key_Slash:
|
||||
return "/";
|
||||
case Key_0:
|
||||
return "0";
|
||||
case Key_1:
|
||||
return "1";
|
||||
case Key_2:
|
||||
return "2";
|
||||
case Key_3:
|
||||
return "3";
|
||||
case Key_4:
|
||||
return "4";
|
||||
case Key_5:
|
||||
return "5";
|
||||
case Key_6:
|
||||
return "6";
|
||||
case Key_7:
|
||||
return "7";
|
||||
case Key_8:
|
||||
return "8";
|
||||
case Key_9:
|
||||
return "9";
|
||||
case Key_Colon:
|
||||
return ":";
|
||||
case Key_Semicolon:
|
||||
return ";";
|
||||
case Key_LessThan:
|
||||
return "<";
|
||||
case Key_Equal:
|
||||
return "=";
|
||||
case Key_GreaterThan:
|
||||
return ">";
|
||||
case Key_QuestionMark:
|
||||
return "?";
|
||||
case Key_AtSign:
|
||||
return "@";
|
||||
case Key_A:
|
||||
return "A";
|
||||
case Key_B:
|
||||
return "B";
|
||||
case Key_C:
|
||||
return "C";
|
||||
case Key_D:
|
||||
return "D";
|
||||
case Key_E:
|
||||
return "E";
|
||||
case Key_F:
|
||||
return "F";
|
||||
case Key_G:
|
||||
return "G";
|
||||
case Key_H:
|
||||
return "H";
|
||||
case Key_I:
|
||||
return "I";
|
||||
case Key_J:
|
||||
return "J";
|
||||
case Key_K:
|
||||
return "K";
|
||||
case Key_L:
|
||||
return "L";
|
||||
case Key_M:
|
||||
return "M";
|
||||
case Key_N:
|
||||
return "N";
|
||||
case Key_O:
|
||||
return "O";
|
||||
case Key_P:
|
||||
return "P";
|
||||
case Key_Q:
|
||||
return "Q";
|
||||
case Key_R:
|
||||
return "R";
|
||||
case Key_S:
|
||||
return "S";
|
||||
case Key_T:
|
||||
return "T";
|
||||
case Key_U:
|
||||
return "U";
|
||||
case Key_V:
|
||||
return "V";
|
||||
case Key_W:
|
||||
return "W";
|
||||
case Key_X:
|
||||
return "X";
|
||||
case Key_Y:
|
||||
return "Y";
|
||||
case Key_Z:
|
||||
return "Z";
|
||||
case Key_LeftBracket:
|
||||
return "[";
|
||||
case Key_RightBracket:
|
||||
return "]";
|
||||
case Key_Backslash:
|
||||
return "\\";
|
||||
case Key_Circumflex:
|
||||
return "^";
|
||||
case Key_Underscore:
|
||||
return "_";
|
||||
case Key_LeftBrace:
|
||||
return "{";
|
||||
case Key_RightBrace:
|
||||
return "}";
|
||||
case Key_Pipe:
|
||||
return "|";
|
||||
case Key_Tilde:
|
||||
return "~";
|
||||
case Key_Backtick:
|
||||
return "`";
|
||||
|
||||
case Key_Invalid: return "Invalid";
|
||||
case Key_Invalid:
|
||||
return "Invalid";
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include <LibGUI/GSlider.h>
|
||||
#include <LibGUI/GPainter.h>
|
||||
#include <LibGUI/GSlider.h>
|
||||
#include <SharedGraphics/StylePainter.h>
|
||||
|
||||
GSlider::GSlider(GWidget* parent)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <LibGUI/GSortingProxyModel.h>
|
||||
#include <AK/QuickSort.h>
|
||||
#include <stdlib.h>
|
||||
#include <LibGUI/GSortingProxyModel.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
GSortingProxyModel::GSortingProxyModel(Retained<GModel>&& target)
|
||||
: m_target(move(target))
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include <LibGUI/GSpinBox.h>
|
||||
#include <LibGUI/GButton.h>
|
||||
#include <LibGUI/GSpinBox.h>
|
||||
#include <LibGUI/GTextEditor.h>
|
||||
|
||||
GSpinBox::GSpinBox(GWidget* parent)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include <LibGUI/GSplitter.h>
|
||||
#include <LibGUI/GBoxLayout.h>
|
||||
#include <LibGUI/GSplitter.h>
|
||||
#include <LibGUI/GWindow.h>
|
||||
|
||||
GSplitter::GSplitter(Orientation orientation, GWidget* parent)
|
||||
|
@ -65,7 +65,8 @@ void GSplitter::mousemove_event(GMouseEvent& event)
|
|||
if (!m_first_resizee || !m_second_resizee) {
|
||||
// One or both of the resizees were deleted during an ongoing resize, screw this.
|
||||
m_resizing = false;
|
||||
return;;
|
||||
return;
|
||||
;
|
||||
}
|
||||
int minimum_size = 0;
|
||||
auto new_first_resizee_size = m_first_resizee_start_size;
|
||||
|
@ -112,5 +113,4 @@ void GSplitter::mouseup_event(GMouseEvent& event)
|
|||
m_resizing = false;
|
||||
if (!rect().contains(event.position()))
|
||||
window()->set_override_cursor(GStandardCursor::None);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include <LibGUI/GStackWidget.h>
|
||||
#include <LibGUI/GBoxLayout.h>
|
||||
#include <LibGUI/GStackWidget.h>
|
||||
|
||||
GStackWidget::GStackWidget(GWidget* parent)
|
||||
: GWidget(parent)
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#include <LibGUI/GStatusBar.h>
|
||||
#include <LibGUI/GLabel.h>
|
||||
#include <LibGUI/GBoxLayout.h>
|
||||
#include <SharedGraphics/StylePainter.h>
|
||||
#include <LibGUI/GLabel.h>
|
||||
#include <LibGUI/GPainter.h>
|
||||
#include <LibGUI/GResizeCorner.h>
|
||||
#include <LibGUI/GStatusBar.h>
|
||||
#include <SharedGraphics/StylePainter.h>
|
||||
|
||||
GStatusBar::GStatusBar(GWidget* parent)
|
||||
: GWidget(parent)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include <LibGUI/GTabWidget.h>
|
||||
#include <LibGUI/GBoxLayout.h>
|
||||
#include <LibGUI/GPainter.h>
|
||||
#include <LibGUI/GTabWidget.h>
|
||||
#include <SharedGraphics/StylePainter.h>
|
||||
|
||||
GTabWidget::GTabWidget(GWidget* parent)
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
#include <LibGUI/GTableView.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <Kernel/KeyCode.h>
|
||||
#include <LibGUI/GAction.h>
|
||||
#include <LibGUI/GMenu.h>
|
||||
#include <LibGUI/GModel.h>
|
||||
#include <LibGUI/GScrollBar.h>
|
||||
#include <LibGUI/GPainter.h>
|
||||
#include <LibGUI/GScrollBar.h>
|
||||
#include <LibGUI/GTableView.h>
|
||||
#include <LibGUI/GTextBox.h>
|
||||
#include <LibGUI/GWindow.h>
|
||||
#include <LibGUI/GMenu.h>
|
||||
#include <LibGUI/GAction.h>
|
||||
#include <Kernel/KeyCode.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
|
||||
GTableView::GTableView(GWidget* parent)
|
||||
: GAbstractView(parent)
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
#include <LibGUI/GTextEditor.h>
|
||||
#include <LibGUI/GScrollBar.h>
|
||||
#include <LibGUI/GFontDatabase.h>
|
||||
#include <LibGUI/GClipboard.h>
|
||||
#include <LibGUI/GPainter.h>
|
||||
#include <LibGUI/GWindow.h>
|
||||
#include <LibGUI/GMenu.h>
|
||||
#include <LibGUI/GAction.h>
|
||||
#include <Kernel/KeyCode.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <unistd.h>
|
||||
#include <Kernel/KeyCode.h>
|
||||
#include <LibGUI/GAction.h>
|
||||
#include <LibGUI/GClipboard.h>
|
||||
#include <LibGUI/GFontDatabase.h>
|
||||
#include <LibGUI/GMenu.h>
|
||||
#include <LibGUI/GPainter.h>
|
||||
#include <LibGUI/GScrollBar.h>
|
||||
#include <LibGUI/GTextEditor.h>
|
||||
#include <LibGUI/GWindow.h>
|
||||
#include <ctype.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <unistd.h>
|
||||
|
||||
GTextEditor::GTextEditor(Type type, GWidget* parent)
|
||||
: GScrollableWidget(parent)
|
||||
|
@ -37,27 +37,33 @@ void GTextEditor::create_actions()
|
|||
{
|
||||
m_undo_action = GAction::create("Undo", { Mod_Ctrl, Key_Z }, GraphicsBitmap::load_from_file("/res/icons/16x16/undo.png"), [&](const GAction&) {
|
||||
// FIXME: Undo
|
||||
}, this);
|
||||
},
|
||||
this);
|
||||
|
||||
m_redo_action = GAction::create("Redo", { Mod_Ctrl, Key_Y }, GraphicsBitmap::load_from_file("/res/icons/16x16/redo.png"), [&](const GAction&) {
|
||||
// FIXME: Redo
|
||||
}, this);
|
||||
},
|
||||
this);
|
||||
|
||||
m_cut_action = GAction::create("Cut", { Mod_Ctrl, Key_X }, GraphicsBitmap::load_from_file("/res/icons/cut16.png"), [&](const GAction&) {
|
||||
cut();
|
||||
}, this);
|
||||
},
|
||||
this);
|
||||
|
||||
m_copy_action = GAction::create("Copy", { Mod_Ctrl, Key_C }, GraphicsBitmap::load_from_file("/res/icons/16x16/edit-copy.png"), [&](const GAction&) {
|
||||
copy();
|
||||
}, this);
|
||||
},
|
||||
this);
|
||||
|
||||
m_paste_action = GAction::create("Paste", { Mod_Ctrl, Key_V }, GraphicsBitmap::load_from_file("/res/icons/paste16.png"), [&](const GAction&) {
|
||||
paste();
|
||||
}, this);
|
||||
},
|
||||
this);
|
||||
|
||||
m_delete_action = GAction::create("Delete", { 0, Key_Delete }, GraphicsBitmap::load_from_file("/res/icons/16x16/delete.png"), [&](const GAction&) {
|
||||
do_delete();
|
||||
}, this);
|
||||
},
|
||||
this);
|
||||
}
|
||||
|
||||
void GTextEditor::set_text(const StringView& text)
|
||||
|
@ -289,8 +295,7 @@ void GTextEditor::paint_event(GPaintEvent& event)
|
|||
String::format("%u", i),
|
||||
is_current_line ? Font::default_bold_font() : font(),
|
||||
TextAlignment::CenterRight,
|
||||
is_current_line ? Color::DarkGray : Color::MidGray
|
||||
);
|
||||
is_current_line ? Color::DarkGray : Color::MidGray);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -310,7 +315,8 @@ void GTextEditor::paint_event(GPaintEvent& event)
|
|||
int selection_end_column_on_line = selection.end().line() == i ? selection.end().column() : line.length();
|
||||
|
||||
int selection_left = content_x_for_position({ i, selection_start_column_on_line });
|
||||
int selection_right = content_x_for_position({ i, selection_end_column_on_line });;
|
||||
int selection_right = content_x_for_position({ i, selection_end_column_on_line });
|
||||
;
|
||||
|
||||
Rect selection_rect { selection_left, line_rect.y(), selection_right - selection_left, line_rect.height() };
|
||||
painter.fill_rect(selection_rect, Color::from_rgb(0x955233));
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#include <LibGUI/GToolBar.h>
|
||||
#include <LibGUI/GAction.h>
|
||||
#include <LibGUI/GBoxLayout.h>
|
||||
#include <LibGUI/GButton.h>
|
||||
#include <LibGUI/GAction.h>
|
||||
#include <LibGUI/GPainter.h>
|
||||
#include <LibGUI/GToolBar.h>
|
||||
|
||||
GToolBar::GToolBar(GWidget* parent)
|
||||
: GWidget(parent)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include <LibGUI/GTreeView.h>
|
||||
#include <LibGUI/GPainter.h>
|
||||
#include <LibGUI/GScrollBar.h>
|
||||
#include <LibGUI/GTreeView.h>
|
||||
|
||||
//#define DEBUG_ITEM_RECTS
|
||||
|
||||
|
|
|
@ -252,4 +252,3 @@ String GVariant::to_string() const
|
|||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
#include "GEvent.h"
|
||||
#include "GEventLoop.h"
|
||||
#include "GWindow.h"
|
||||
#include <LibGUI/GLayout.h>
|
||||
#include <AK/Assertions.h>
|
||||
#include <SharedGraphics/GraphicsBitmap.h>
|
||||
#include <LibGUI/GAction.h>
|
||||
#include <LibGUI/GPainter.h>
|
||||
#include <LibGUI/GApplication.h>
|
||||
#include <LibGUI/GLayout.h>
|
||||
#include <LibGUI/GMenu.h>
|
||||
#include <LibGUI/GPainter.h>
|
||||
#include <SharedGraphics/GraphicsBitmap.h>
|
||||
#include <unistd.h>
|
||||
|
||||
GWidget::GWidget(GWidget* parent)
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
#include "GEvent.h"
|
||||
#include "GEventLoop.h"
|
||||
#include "GWidget.h"
|
||||
#include <SharedGraphics/GraphicsBitmap.h>
|
||||
#include <LibGUI/GPainter.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <LibC/stdio.h>
|
||||
#include <LibC/stdlib.h>
|
||||
#include <LibC/unistd.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <LibGUI/GPainter.h>
|
||||
#include <SharedGraphics/GraphicsBitmap.h>
|
||||
|
||||
//#define UPDATE_COALESCING_DEBUG
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue