mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:27:35 +00:00
Add clang-format file
Also run it across the whole tree to get everything using the One True Style. We don't yet run this in an automated fashion as it's a little slow, but there is a snippet to do so in makeall.sh.
This commit is contained in:
parent
c11351ac50
commit
0dc9af5f7e
286 changed files with 3244 additions and 2424 deletions
|
@ -1,13 +1,14 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/Function.h>
|
||||
#include <LibGUI/GModel.h>
|
||||
#include <LibGUI/GScrollableWidget.h>
|
||||
#include <AK/Function.h>
|
||||
|
||||
class GTextBox;
|
||||
|
||||
class GAbstractView : public GScrollableWidget {
|
||||
friend class GModel;
|
||||
|
||||
public:
|
||||
explicit GAbstractView(GWidget* parent);
|
||||
virtual ~GAbstractView() override;
|
||||
|
@ -23,7 +24,7 @@ public:
|
|||
virtual void did_update_model();
|
||||
virtual void did_update_selection();
|
||||
|
||||
virtual Rect content_rect(const GModelIndex&) const { return { }; }
|
||||
virtual Rect content_rect(const GModelIndex&) const { return {}; }
|
||||
void begin_editing(const GModelIndex&);
|
||||
void stop_editing();
|
||||
|
||||
|
|
|
@ -1,23 +1,25 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/AKString.h>
|
||||
#include <AK/Badge.h>
|
||||
#include <AK/Function.h>
|
||||
#include <AK/HashTable.h>
|
||||
#include <AK/Retainable.h>
|
||||
#include <AK/Retained.h>
|
||||
#include <AK/Weakable.h>
|
||||
#include <AK/WeakPtr.h>
|
||||
#include <AK/Badge.h>
|
||||
#include <AK/HashTable.h>
|
||||
#include <SharedGraphics/GraphicsBitmap.h>
|
||||
#include <AK/Weakable.h>
|
||||
#include <LibGUI/GShortcut.h>
|
||||
#include <SharedGraphics/GraphicsBitmap.h>
|
||||
|
||||
class GButton;
|
||||
class GMenuItem;
|
||||
class GWidget;
|
||||
|
||||
class GAction : public Retainable<GAction>, public Weakable<GAction> {
|
||||
class GAction : public Retainable<GAction>
|
||||
, public Weakable<GAction> {
|
||||
public:
|
||||
enum class ShortcutScope {
|
||||
enum class ShortcutScope
|
||||
{
|
||||
None,
|
||||
ApplicationGlobal,
|
||||
WidgetLocal,
|
||||
|
@ -62,7 +64,11 @@ public:
|
|||
bool is_checkable() const { return m_checkable; }
|
||||
void set_checkable(bool checkable) { m_checkable = checkable; }
|
||||
|
||||
bool is_checked() const { ASSERT(is_checkable()); return m_checked; }
|
||||
bool is_checked() const
|
||||
{
|
||||
ASSERT(is_checkable());
|
||||
return m_checked;
|
||||
}
|
||||
void set_checked(bool);
|
||||
|
||||
void register_button(Badge<GButton>, GButton&);
|
||||
|
@ -77,8 +83,10 @@ private:
|
|||
GAction(const String& text, RetainPtr<GraphicsBitmap>&& icon, Function<void(GAction&)> = nullptr, GWidget* = nullptr);
|
||||
GAction(const String& text, const String& custom_data = String(), Function<void(GAction&)> = nullptr, GWidget* = nullptr);
|
||||
|
||||
template<typename Callback> void for_each_toolbar_button(Callback);
|
||||
template<typename Callback> void for_each_menu_item(Callback);
|
||||
template<typename Callback>
|
||||
void for_each_toolbar_button(Callback);
|
||||
template<typename Callback>
|
||||
void for_each_menu_item(Callback);
|
||||
|
||||
String m_text;
|
||||
String m_custom_data;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/Badge.h>
|
||||
#include <AK/OwnPtr.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/OwnPtr.h>
|
||||
#include <LibGUI/GShortcut.h>
|
||||
|
||||
class GAction;
|
||||
|
|
|
@ -15,4 +15,3 @@ public:
|
|||
private:
|
||||
Orientation m_orientation;
|
||||
};
|
||||
|
||||
|
|
|
@ -43,4 +43,3 @@ private:
|
|||
TextAlignment m_text_alignment { TextAlignment::Center };
|
||||
WeakPtr<GAction> m_action;
|
||||
};
|
||||
|
||||
|
|
|
@ -17,4 +17,3 @@ public:
|
|||
private:
|
||||
virtual void paint_event(GPaintEvent&) override;
|
||||
};
|
||||
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
#pragma once
|
||||
|
||||
#include <LibGUI/GWindow.h>
|
||||
#include <LibGUI/GEventLoop.h>
|
||||
#include <LibGUI/GWindow.h>
|
||||
|
||||
class GDialog : public GWindow {
|
||||
public:
|
||||
enum ExecResult { ExecOK = 0, ExecCancel = 1, ExecAborted = 2 };
|
||||
enum ExecResult
|
||||
{
|
||||
ExecOK = 0,
|
||||
ExecCancel = 1,
|
||||
ExecAborted = 2
|
||||
};
|
||||
|
||||
virtual ~GDialog() override;
|
||||
|
||||
|
|
|
@ -1,16 +1,18 @@
|
|||
#pragma once
|
||||
|
||||
#include <LibGUI/GModel.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <LibGUI/GModel.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
class GDirectoryModel final : public GModel {
|
||||
friend int thumbnail_thread(void*);
|
||||
|
||||
public:
|
||||
static Retained<GDirectoryModel> create() { return adopt(*new GDirectoryModel); }
|
||||
virtual ~GDirectoryModel() override;
|
||||
|
||||
enum Column {
|
||||
enum Column
|
||||
{
|
||||
Icon = 0,
|
||||
Name,
|
||||
Size,
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
#pragma once
|
||||
|
||||
#include <Kernel/KeyCode.h>
|
||||
#include <LibCore/CEvent.h>
|
||||
#include <LibGUI/GWindowType.h>
|
||||
#include <SharedGraphics/Point.h>
|
||||
#include <SharedGraphics/Rect.h>
|
||||
#include <Kernel/KeyCode.h>
|
||||
#include <LibGUI/GWindowType.h>
|
||||
|
||||
class CObject;
|
||||
|
||||
class GEvent : public CEvent{
|
||||
class GEvent : public CEvent {
|
||||
public:
|
||||
enum Type {
|
||||
enum Type
|
||||
{
|
||||
Show = 1000,
|
||||
Hide,
|
||||
Paint,
|
||||
|
@ -43,9 +44,12 @@ public:
|
|||
__End_WM_Events,
|
||||
};
|
||||
|
||||
GEvent() { }
|
||||
explicit GEvent(Type type) : CEvent(type) { }
|
||||
virtual ~GEvent() { }
|
||||
GEvent() {}
|
||||
explicit GEvent(Type type)
|
||||
: CEvent(type)
|
||||
{
|
||||
}
|
||||
virtual ~GEvent() {}
|
||||
|
||||
bool is_key_event() const { return type() == KeyUp || type() == KeyDown; }
|
||||
bool is_paint_event() const { return type() == Paint; }
|
||||
|
@ -175,6 +179,7 @@ public:
|
|||
|
||||
const Size& old_size() const { return m_old_size; }
|
||||
const Size& size() const { return m_size; }
|
||||
|
||||
private:
|
||||
Size m_old_size;
|
||||
Size m_size;
|
||||
|
@ -213,7 +218,8 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
enum GMouseButton : byte {
|
||||
enum GMouseButton : byte
|
||||
{
|
||||
None = 0,
|
||||
Left = 1,
|
||||
Right = 2,
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
#include <LibCore/CEventLoop.h>
|
||||
#include <WindowServer/WSAPITypes.h>
|
||||
#include <LibGUI/GEvent.h>
|
||||
#include <WindowServer/WSAPITypes.h>
|
||||
|
||||
class GAction;
|
||||
class CObject;
|
||||
|
@ -16,7 +16,7 @@ public:
|
|||
|
||||
static GEventLoop& current() { return static_cast<GEventLoop&>(CEventLoop::current()); }
|
||||
|
||||
static bool post_message_to_server(const WSAPI_ClientMessage&, const ByteBuffer& extra_data = { });
|
||||
static bool post_message_to_server(const WSAPI_ClientMessage&, const ByteBuffer& extra_data = {});
|
||||
bool wait_for_specific_event(WSAPI_ServerMessage::Type, WSAPI_ServerMessage&);
|
||||
WSAPI_ServerMessage sync_request(const WSAPI_ClientMessage& request, WSAPI_ServerMessage::Type response_type);
|
||||
|
||||
|
|
|
@ -4,8 +4,14 @@
|
|||
|
||||
class GFileSystemModel : public GModel {
|
||||
friend class Node;
|
||||
|
||||
public:
|
||||
enum Mode { Invalid, DirectoriesOnly, FilesAndDirectories };
|
||||
enum Mode
|
||||
{
|
||||
Invalid,
|
||||
DirectoriesOnly,
|
||||
FilesAndDirectories
|
||||
};
|
||||
|
||||
static Retained<GFileSystemModel> create(const String& root_path = "/", Mode mode = Mode::FilesAndDirectories)
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/AKString.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/Function.h>
|
||||
#include <AK/HashMap.h>
|
||||
|
||||
class Font;
|
||||
|
||||
|
@ -20,7 +20,8 @@ public:
|
|||
void for_each_font(Function<void(const String&)>);
|
||||
void for_each_fixed_width_font(Function<void(const String&)>);
|
||||
|
||||
Metadata get_metadata_by_name(const String& name) const {
|
||||
Metadata get_metadata_by_name(const String& name) const
|
||||
{
|
||||
return m_name_to_metadata.get(name);
|
||||
};
|
||||
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
#pragma once
|
||||
|
||||
#include <SharedGraphics/GraphicsBitmap.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <SharedGraphics/GraphicsBitmap.h>
|
||||
|
||||
class GIconImpl : public Retainable<GIconImpl> {
|
||||
public:
|
||||
static Retained<GIconImpl> create() { return adopt(*new GIconImpl); }
|
||||
~GIconImpl() { }
|
||||
~GIconImpl() {}
|
||||
|
||||
const GraphicsBitmap* bitmap_for_size(int) const;
|
||||
void set_bitmap_for_size(int, RetainPtr<GraphicsBitmap>&&);
|
||||
|
||||
private:
|
||||
GIconImpl() { }
|
||||
GIconImpl() {}
|
||||
HashMap<int, RetainPtr<GraphicsBitmap>> m_bitmaps;
|
||||
};
|
||||
|
||||
|
@ -23,7 +23,7 @@ public:
|
|||
explicit GIcon(RetainPtr<GraphicsBitmap>&&, RetainPtr<GraphicsBitmap>&&);
|
||||
explicit GIcon(const GIconImpl&);
|
||||
GIcon(const GIcon&);
|
||||
~GIcon() { }
|
||||
~GIcon() {}
|
||||
|
||||
static GIcon default_icon(const String&);
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#pragma once
|
||||
|
||||
#include <LibGUI/GModel.h>
|
||||
#include <LibGUI/GAbstractView.h>
|
||||
#include <AK/Function.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <LibGUI/GAbstractView.h>
|
||||
#include <LibGUI/GModel.h>
|
||||
|
||||
class GScrollBar;
|
||||
class Painter;
|
||||
|
|
|
@ -36,4 +36,3 @@ private:
|
|||
TextAlignment m_text_alignment { TextAlignment::Center };
|
||||
bool m_should_stretch_icon { false };
|
||||
};
|
||||
|
||||
|
|
|
@ -32,7 +32,8 @@ public:
|
|||
|
||||
protected:
|
||||
struct Entry {
|
||||
enum class Type {
|
||||
enum class Type
|
||||
{
|
||||
Invalid = 0,
|
||||
Widget,
|
||||
Layout,
|
||||
|
@ -51,4 +52,3 @@ protected:
|
|||
GMargins m_margins;
|
||||
int m_spacing { 4 };
|
||||
};
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#pragma once
|
||||
|
||||
#include <LibGUI/GModel.h>
|
||||
#include <LibGUI/GAbstractView.h>
|
||||
#include <AK/Function.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <LibGUI/GAbstractView.h>
|
||||
#include <LibGUI/GModel.h>
|
||||
|
||||
class GScrollBar;
|
||||
class Painter;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
class GMargins {
|
||||
public:
|
||||
GMargins() { }
|
||||
GMargins() {}
|
||||
GMargins(int left, int top, int right, int bottom)
|
||||
: m_left(left)
|
||||
, m_top(top)
|
||||
|
@ -10,7 +10,7 @@ public:
|
|||
, m_bottom(bottom)
|
||||
{
|
||||
}
|
||||
~GMargins() { }
|
||||
~GMargins() {}
|
||||
|
||||
bool is_null() const { return !m_left && !m_top && !m_right && !m_bottom; }
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#pragma once
|
||||
|
||||
#include <LibGUI/GMenuItem.h>
|
||||
#include <AK/Function.h>
|
||||
#include <AK/Retainable.h>
|
||||
#include <AK/Retained.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibGUI/GMenuItem.h>
|
||||
|
||||
class GAction;
|
||||
class Point;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
#include <LibGUI/GMenu.h>
|
||||
#include <AK/Badge.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibGUI/GMenu.h>
|
||||
|
||||
class GApplication;
|
||||
|
||||
|
|
|
@ -8,7 +8,12 @@ class GMenu;
|
|||
|
||||
class GMenuItem {
|
||||
public:
|
||||
enum Type { Invalid, Action, Separator };
|
||||
enum Type
|
||||
{
|
||||
Invalid,
|
||||
Action,
|
||||
Separator
|
||||
};
|
||||
|
||||
GMenuItem(unsigned menu_id, Type);
|
||||
GMenuItem(unsigned menu_id, Retained<GAction>&&);
|
||||
|
@ -43,4 +48,3 @@ private:
|
|||
bool m_checked { false };
|
||||
RetainPtr<GAction> m_action;
|
||||
};
|
||||
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
|
||||
class GMessageBox : public GDialog {
|
||||
public:
|
||||
enum class Type {
|
||||
enum class Type
|
||||
{
|
||||
None,
|
||||
Information,
|
||||
Warning,
|
||||
|
|
|
@ -12,11 +12,17 @@
|
|||
class Font;
|
||||
class GAbstractView;
|
||||
|
||||
enum class GSortOrder { None, Ascending, Descending };
|
||||
enum class GSortOrder
|
||||
{
|
||||
None,
|
||||
Ascending,
|
||||
Descending
|
||||
};
|
||||
|
||||
class GModelNotification {
|
||||
public:
|
||||
enum Type {
|
||||
enum Type
|
||||
{
|
||||
Invalid = 0,
|
||||
ModelUpdated,
|
||||
};
|
||||
|
@ -43,22 +49,30 @@ public:
|
|||
const Font* font { nullptr };
|
||||
};
|
||||
|
||||
enum class Role { Display, Sort, Custom, ForegroundColor, BackgroundColor, Icon };
|
||||
enum class Role
|
||||
{
|
||||
Display,
|
||||
Sort,
|
||||
Custom,
|
||||
ForegroundColor,
|
||||
BackgroundColor,
|
||||
Icon
|
||||
};
|
||||
|
||||
virtual ~GModel();
|
||||
|
||||
virtual int row_count(const GModelIndex& = GModelIndex()) const = 0;
|
||||
virtual int column_count(const GModelIndex& = GModelIndex()) const = 0;
|
||||
virtual String row_name(int) const { return { }; }
|
||||
virtual String column_name(int) const { return { }; }
|
||||
virtual ColumnMetadata column_metadata(int) const { return { }; }
|
||||
virtual String row_name(int) const { return {}; }
|
||||
virtual String column_name(int) const { return {}; }
|
||||
virtual ColumnMetadata column_metadata(int) const { return {}; }
|
||||
virtual GVariant data(const GModelIndex&, Role = Role::Display) const = 0;
|
||||
virtual void update() = 0;
|
||||
virtual GModelIndex parent_index(const GModelIndex&) const { return { }; }
|
||||
virtual GModelIndex parent_index(const GModelIndex&) const { return {}; }
|
||||
virtual GModelIndex index(int row, int column = 0, const GModelIndex& = GModelIndex()) const { return create_index(row, column); }
|
||||
virtual GModelIndex sibling(int row, int column, const GModelIndex& parent) const;
|
||||
virtual bool is_editable(const GModelIndex&) const { return false; }
|
||||
virtual void set_data(const GModelIndex&, const GVariant&) { }
|
||||
virtual void set_data(const GModelIndex&, const GVariant&) {}
|
||||
|
||||
bool is_valid(const GModelIndex& index) const
|
||||
{
|
||||
|
@ -70,7 +84,7 @@ public:
|
|||
|
||||
virtual int key_column() const { return -1; }
|
||||
virtual GSortOrder sort_order() const { return GSortOrder::None; }
|
||||
virtual void set_key_column_and_sort_order(int, GSortOrder) { }
|
||||
virtual void set_key_column_and_sort_order(int, GSortOrder) {}
|
||||
|
||||
void register_view(Badge<GAbstractView>, GAbstractView&);
|
||||
void unregister_view(Badge<GAbstractView>, GAbstractView&);
|
||||
|
|
|
@ -4,8 +4,9 @@ class GModel;
|
|||
|
||||
class GModelIndex {
|
||||
friend class GModel;
|
||||
|
||||
public:
|
||||
GModelIndex() { }
|
||||
GModelIndex() {}
|
||||
|
||||
bool is_valid() const { return m_row != -1 && m_column != -1; }
|
||||
int row() const { return m_row; }
|
||||
|
|
|
@ -19,7 +19,12 @@ public:
|
|||
String caption() const { return m_caption; }
|
||||
void set_caption(const String& caption) { m_caption = caption; }
|
||||
|
||||
enum Format { NoText, Percentage, ValueSlashMax };
|
||||
enum Format
|
||||
{
|
||||
NoText,
|
||||
Percentage,
|
||||
ValueSlashMax
|
||||
};
|
||||
Format format() const { return m_format; }
|
||||
void set_format(Format format) { m_format = format; }
|
||||
|
||||
|
|
|
@ -17,11 +17,13 @@ protected:
|
|||
private:
|
||||
virtual bool is_radio_button() const final { return true; }
|
||||
|
||||
template<typename Callback> void for_each_in_group(Callback);
|
||||
template<typename Callback>
|
||||
void for_each_in_group(Callback);
|
||||
static Size circle_size();
|
||||
};
|
||||
|
||||
template<> inline bool is<GRadioButton>(const CObject& object)
|
||||
template<>
|
||||
inline bool is<GRadioButton>(const CObject& object)
|
||||
{
|
||||
if (!is<GWidget>(object))
|
||||
return false;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <LibGUI/GWidget.h>
|
||||
#include <AK/Function.h>
|
||||
#include <LibGUI/GWidget.h>
|
||||
|
||||
class GScrollBar final : public GWidget {
|
||||
public:
|
||||
|
@ -28,7 +28,8 @@ public:
|
|||
|
||||
virtual const char* class_name() const override { return "GScrollBar"; }
|
||||
|
||||
enum Component {
|
||||
enum Component
|
||||
{
|
||||
Invalid,
|
||||
DecrementButton,
|
||||
IncrementButton,
|
||||
|
|
|
@ -40,7 +40,7 @@ protected:
|
|||
explicit GScrollableWidget(GWidget* parent);
|
||||
virtual void resize_event(GResizeEvent&) override;
|
||||
virtual void mousewheel_event(GMouseEvent&) override;
|
||||
virtual void did_scroll() { }
|
||||
virtual void did_scroll() {}
|
||||
void set_content_size(const Size&);
|
||||
void set_size_occupied_by_fixed_elements(const Size&);
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
#pragma once
|
||||
|
||||
#include <Kernel/KeyCode.h>
|
||||
#include <AK/AKString.h>
|
||||
#include <AK/Traits.h>
|
||||
#include <Kernel/KeyCode.h>
|
||||
|
||||
class GShortcut {
|
||||
public:
|
||||
GShortcut() { }
|
||||
GShortcut() {}
|
||||
GShortcut(byte modifiers, KeyCode key)
|
||||
: m_modifiers(modifiers)
|
||||
, m_key(key)
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#pragma once
|
||||
|
||||
#include <LibGUI/GModel.h>
|
||||
#include <LibGUI/GAbstractView.h>
|
||||
#include <AK/Function.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <LibGUI/GAbstractView.h>
|
||||
#include <LibGUI/GModel.h>
|
||||
|
||||
class GScrollBar;
|
||||
class Painter;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <LibGUI/GTextEditor.h>
|
||||
#include <AK/Function.h>
|
||||
#include <LibGUI/GTextEditor.h>
|
||||
|
||||
class GTextBox final : public GTextEditor {
|
||||
public:
|
||||
|
@ -10,4 +10,3 @@ public:
|
|||
|
||||
virtual const char* class_name() const override { return "GTextBox"; }
|
||||
};
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
#include <LibGUI/GScrollableWidget.h>
|
||||
#include <AK/Function.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <LibGUI/GScrollableWidget.h>
|
||||
#include <SharedGraphics/TextAlignment.h>
|
||||
|
||||
class GAction;
|
||||
|
@ -12,7 +12,7 @@ class Painter;
|
|||
|
||||
class GTextPosition {
|
||||
public:
|
||||
GTextPosition() { }
|
||||
GTextPosition() {}
|
||||
GTextPosition(int line, int column)
|
||||
: m_line(line)
|
||||
, m_column(column)
|
||||
|
@ -38,11 +38,19 @@ private:
|
|||
|
||||
class GTextRange {
|
||||
public:
|
||||
GTextRange() { }
|
||||
GTextRange(const GTextPosition& start, const GTextPosition& end) : m_start(start) , m_end(end) { }
|
||||
GTextRange() {}
|
||||
GTextRange(const GTextPosition& start, const GTextPosition& end)
|
||||
: m_start(start)
|
||||
, m_end(end)
|
||||
{
|
||||
}
|
||||
|
||||
bool is_valid() const { return m_start.is_valid() && m_end.is_valid(); }
|
||||
void clear() { m_start = { }; m_end = { }; }
|
||||
void clear()
|
||||
{
|
||||
m_start = {};
|
||||
m_end = {};
|
||||
}
|
||||
|
||||
GTextPosition& start() { return m_start; }
|
||||
GTextPosition& end() { return m_end; }
|
||||
|
@ -54,7 +62,11 @@ public:
|
|||
void set_start(const GTextPosition& position) { m_start = position; }
|
||||
void set_end(const GTextPosition& position) { m_end = position; }
|
||||
|
||||
void set(const GTextPosition& start, const GTextPosition& end) { m_start = start; m_end = end; }
|
||||
void set(const GTextPosition& start, const GTextPosition& end)
|
||||
{
|
||||
m_start = start;
|
||||
m_end = end;
|
||||
}
|
||||
|
||||
private:
|
||||
GTextPosition normalized_start() const { return m_start < m_end ? m_start : m_end; }
|
||||
|
@ -66,7 +78,11 @@ private:
|
|||
|
||||
class GTextEditor : public GScrollableWidget {
|
||||
public:
|
||||
enum Type { MultiLine, SingleLine };
|
||||
enum Type
|
||||
{
|
||||
MultiLine,
|
||||
SingleLine
|
||||
};
|
||||
GTextEditor(Type, GWidget* parent);
|
||||
virtual ~GTextEditor() override;
|
||||
|
||||
|
@ -149,6 +165,7 @@ private:
|
|||
|
||||
class Line {
|
||||
friend class GTextEditor;
|
||||
|
||||
public:
|
||||
Line();
|
||||
explicit Line(const String&);
|
||||
|
|
|
@ -21,7 +21,12 @@ private:
|
|||
virtual void paint_event(GPaintEvent&) override;
|
||||
|
||||
struct Item {
|
||||
enum Type { Invalid, Separator, Action };
|
||||
enum Type
|
||||
{
|
||||
Invalid,
|
||||
Separator,
|
||||
Action
|
||||
};
|
||||
Type type { Invalid };
|
||||
RetainPtr<GAction> action;
|
||||
};
|
||||
|
|
|
@ -27,7 +27,8 @@ public:
|
|||
void clear();
|
||||
~GVariant();
|
||||
|
||||
enum class Type {
|
||||
enum class Type
|
||||
{
|
||||
Invalid,
|
||||
Bool,
|
||||
Int,
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/AKString.h>
|
||||
#include <AK/Badge.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <LibCore/CElapsedTimer.h>
|
||||
#include <LibCore/CObject.h>
|
||||
#include <LibGUI/GEvent.h>
|
||||
#include <LibGUI/GShortcut.h>
|
||||
#include <LibCore/CObject.h>
|
||||
#include <SharedGraphics/Rect.h>
|
||||
#include <SharedGraphics/Color.h>
|
||||
#include <SharedGraphics/Font.h>
|
||||
#include <AK/Badge.h>
|
||||
#include <AK/AKString.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <SharedGraphics/Rect.h>
|
||||
|
||||
class GraphicsBitmap;
|
||||
class GAction;
|
||||
|
@ -17,10 +17,26 @@ class GLayout;
|
|||
class GMenu;
|
||||
class GWindow;
|
||||
|
||||
enum class SizePolicy { Fixed, Fill };
|
||||
enum class Orientation { Horizontal, Vertical };
|
||||
enum class HorizontalDirection { Left, Right };
|
||||
enum class VerticalDirection { Up, Down };
|
||||
enum class SizePolicy
|
||||
{
|
||||
Fixed,
|
||||
Fill
|
||||
};
|
||||
enum class Orientation
|
||||
{
|
||||
Horizontal,
|
||||
Vertical
|
||||
};
|
||||
enum class HorizontalDirection
|
||||
{
|
||||
Left,
|
||||
Right
|
||||
};
|
||||
enum class VerticalDirection
|
||||
{
|
||||
Up,
|
||||
Down
|
||||
};
|
||||
|
||||
class GWidget : public CObject {
|
||||
public:
|
||||
|
@ -178,7 +194,7 @@ public:
|
|||
template<typename Callback>
|
||||
void for_each_child_widget(Callback callback)
|
||||
{
|
||||
for_each_child([&] (auto& child) {
|
||||
for_each_child([&](auto& child) {
|
||||
if (is<GWidget>(child))
|
||||
return callback(to<GWidget>(child));
|
||||
return IterationDecision::Continue;
|
||||
|
@ -224,7 +240,8 @@ private:
|
|||
HashMap<GShortcut, GAction*> m_local_shortcut_actions;
|
||||
};
|
||||
|
||||
template<> inline bool is<GWidget>(const CObject& object)
|
||||
template<>
|
||||
inline bool is<GWidget>(const CObject& object)
|
||||
{
|
||||
return object.is_widget();
|
||||
}
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
#pragma once
|
||||
|
||||
#include <LibCore/CObject.h>
|
||||
#include <LibGUI/GWindowType.h>
|
||||
#include <SharedGraphics/Rect.h>
|
||||
#include <SharedGraphics/GraphicsBitmap.h>
|
||||
#include <AK/AKString.h>
|
||||
#include <AK/WeakPtr.h>
|
||||
#include <LibCore/CObject.h>
|
||||
#include <LibGUI/GWindowType.h>
|
||||
#include <SharedGraphics/GraphicsBitmap.h>
|
||||
#include <SharedGraphics/Rect.h>
|
||||
|
||||
class GWidget;
|
||||
class GWMEvent;
|
||||
|
||||
enum class GStandardCursor {
|
||||
enum class GStandardCursor
|
||||
{
|
||||
None = 0,
|
||||
Arrow,
|
||||
IBeam,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
enum class GWindowType {
|
||||
enum class GWindowType
|
||||
{
|
||||
Invalid = 0,
|
||||
Normal,
|
||||
Menu,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue