diff --git a/Applications/About/main.cpp b/Applications/About/main.cpp index cc761d7a88c..b4803209ac6 100644 --- a/Applications/About/main.cpp +++ b/Applications/About/main.cpp @@ -30,8 +30,9 @@ #include #include #include -#include +#include #include +#include int main(int argc, char** argv) { diff --git a/Applications/FontEditor/GlyphEditorWidget.cpp b/Applications/FontEditor/GlyphEditorWidget.cpp index 8dbb0de9a83..d6b7ff48d12 100644 --- a/Applications/FontEditor/GlyphEditorWidget.cpp +++ b/Applications/FontEditor/GlyphEditorWidget.cpp @@ -26,6 +26,7 @@ #include "GlyphEditorWidget.h" #include +#include GlyphEditorWidget::GlyphEditorWidget(Gfx::Font& mutable_font, GUI::Widget* parent) : GUI::Frame(parent) diff --git a/Applications/FontEditor/GlyphMapWidget.cpp b/Applications/FontEditor/GlyphMapWidget.cpp index 3f64194a5b3..e8bcf4d9089 100644 --- a/Applications/FontEditor/GlyphMapWidget.cpp +++ b/Applications/FontEditor/GlyphMapWidget.cpp @@ -25,8 +25,9 @@ */ #include "GlyphMapWidget.h" -#include #include +#include +#include GlyphMapWidget::GlyphMapWidget(Gfx::Font& mutable_font, GUI::Widget* parent) : GUI::Frame(parent) diff --git a/Applications/FontEditor/main.cpp b/Applications/FontEditor/main.cpp index fded4827ea2..1183daff391 100644 --- a/Applications/FontEditor/main.cpp +++ b/Applications/FontEditor/main.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include int main(int argc, char** argv) diff --git a/Applications/HexEditor/HexEditor.h b/Applications/HexEditor/HexEditor.h index 9e1ce1f7136..25469cfc0ad 100644 --- a/Applications/HexEditor/HexEditor.h +++ b/Applications/HexEditor/HexEditor.h @@ -33,6 +33,7 @@ #include #include #include +#include #include class HexEditor : public GUI::ScrollableWidget { diff --git a/Applications/PaintBrush/PaletteWidget.cpp b/Applications/PaintBrush/PaletteWidget.cpp index a2c6b78f56c..a178bc20414 100644 --- a/Applications/PaintBrush/PaletteWidget.cpp +++ b/Applications/PaintBrush/PaletteWidget.cpp @@ -28,6 +28,7 @@ #include "PaintableWidget.h" #include #include +#include class ColorWidget : public GUI::Frame { C_OBJECT(ColorWidget) diff --git a/Applications/SystemMonitor/GraphWidget.cpp b/Applications/SystemMonitor/GraphWidget.cpp index 235eff37f64..9023b55768a 100644 --- a/Applications/SystemMonitor/GraphWidget.cpp +++ b/Applications/SystemMonitor/GraphWidget.cpp @@ -26,6 +26,7 @@ #include "GraphWidget.h" #include +#include GraphWidget::GraphWidget(GUI::Widget* parent) : GUI::Frame(parent) diff --git a/Applications/SystemMonitor/MemoryStatsWidget.cpp b/Applications/SystemMonitor/MemoryStatsWidget.cpp index 8731232dee5..fae50431bb9 100644 --- a/Applications/SystemMonitor/MemoryStatsWidget.cpp +++ b/Applications/SystemMonitor/MemoryStatsWidget.cpp @@ -28,10 +28,11 @@ #include "GraphWidget.h" #include #include -#include #include #include #include +#include +#include #include #include diff --git a/Applications/Terminal/main.cpp b/Applications/Terminal/main.cpp index 071dbce8e52..9e7d7bfcd0a 100644 --- a/Applications/Terminal/main.cpp +++ b/Applications/Terminal/main.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include diff --git a/Applications/Welcome/TextWidget.cpp b/Applications/Welcome/TextWidget.cpp index f631be29890..070801f4c6f 100644 --- a/Applications/Welcome/TextWidget.cpp +++ b/Applications/Welcome/TextWidget.cpp @@ -28,8 +28,9 @@ #include #include #include -#include #include +#include +#include TextWidget::TextWidget(GUI::Widget* parent) : GUI::Frame(parent) diff --git a/Applications/Welcome/main.cpp b/Applications/Welcome/main.cpp index 59fd06c060b..3af84bdc2f6 100644 --- a/Applications/Welcome/main.cpp +++ b/Applications/Welcome/main.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include "TextWidget.h" diff --git a/DevTools/HackStudio/CursorTool.cpp b/DevTools/HackStudio/CursorTool.cpp index f4ac8ff4686..63ee928399d 100644 --- a/DevTools/HackStudio/CursorTool.cpp +++ b/DevTools/HackStudio/CursorTool.cpp @@ -29,6 +29,7 @@ #include "FormWidget.h" #include "WidgetTreeModel.h" #include +#include void CursorTool::on_mousedown(GUI::MouseEvent& event) { diff --git a/DevTools/HackStudio/ProcessStateWidget.cpp b/DevTools/HackStudio/ProcessStateWidget.cpp index 4ad6e208826..e724a66fb25 100644 --- a/DevTools/HackStudio/ProcessStateWidget.cpp +++ b/DevTools/HackStudio/ProcessStateWidget.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include ProcessStateWidget::ProcessStateWidget(GUI::Widget* parent) diff --git a/Games/Snake/SnakeGame.cpp b/Games/Snake/SnakeGame.cpp index 8cebca5c26b..a560d895d68 100644 --- a/Games/Snake/SnakeGame.cpp +++ b/Games/Snake/SnakeGame.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include diff --git a/Libraries/LibGUI/AboutDialog.cpp b/Libraries/LibGUI/AboutDialog.cpp index 1e7418e01f2..2a6982ffe56 100644 --- a/Libraries/LibGUI/AboutDialog.cpp +++ b/Libraries/LibGUI/AboutDialog.cpp @@ -29,6 +29,7 @@ #include #include #include +#include namespace GUI { diff --git a/Libraries/LibGUI/AbstractTableView.h b/Libraries/LibGUI/AbstractTableView.h index 2ec222ca018..6dea47aeacd 100644 --- a/Libraries/LibGUI/AbstractTableView.h +++ b/Libraries/LibGUI/AbstractTableView.h @@ -37,7 +37,7 @@ class TableCellPaintingDelegate { public: virtual ~TableCellPaintingDelegate() {} - virtual void paint(Painter&, const Gfx::Rect&, const Palette&, const Model&, const ModelIndex&) = 0; + virtual void paint(Painter&, const Gfx::Rect&, const Gfx::Palette&, const Model&, const ModelIndex&) = 0; }; class AbstractTableView : public AbstractView { diff --git a/Libraries/LibGUI/Application.cpp b/Libraries/LibGUI/Application.cpp index 88b88e1ed53..7a0b1401c78 100644 --- a/Libraries/LibGUI/Application.cpp +++ b/Libraries/LibGUI/Application.cpp @@ -24,7 +24,6 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include #include #include #include @@ -33,6 +32,8 @@ #include #include #include +#include +#include namespace GUI { diff --git a/Libraries/LibGUI/Button.cpp b/Libraries/LibGUI/Button.cpp index 30fdde59555..5ec77339c77 100644 --- a/Libraries/LibGUI/Button.cpp +++ b/Libraries/LibGUI/Button.cpp @@ -26,11 +26,13 @@ #include #include -#include #include #include #include #include +#include +#include +#include namespace GUI { diff --git a/Libraries/LibGUI/CheckBox.cpp b/Libraries/LibGUI/CheckBox.cpp index 8b5ca9c060d..34e87ac7d9a 100644 --- a/Libraries/LibGUI/CheckBox.cpp +++ b/Libraries/LibGUI/CheckBox.cpp @@ -25,11 +25,12 @@ */ #include -#include -#include -#include #include #include +#include +#include +#include +#include namespace GUI { diff --git a/Libraries/LibGUI/ColorPicker.cpp b/Libraries/LibGUI/ColorPicker.cpp index 461ad5d0faf..4e3e7906b13 100644 --- a/Libraries/LibGUI/ColorPicker.cpp +++ b/Libraries/LibGUI/ColorPicker.cpp @@ -30,6 +30,7 @@ #include #include #include +#include namespace GUI { diff --git a/Libraries/LibGUI/ColumnsView.cpp b/Libraries/LibGUI/ColumnsView.cpp index 068ea0b73e9..85c30a575ab 100644 --- a/Libraries/LibGUI/ColumnsView.cpp +++ b/Libraries/LibGUI/ColumnsView.cpp @@ -24,10 +24,11 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include #include #include #include +#include +#include namespace GUI { diff --git a/Libraries/LibGUI/Frame.cpp b/Libraries/LibGUI/Frame.cpp index 6c9dfdc7a9d..6025e72698b 100644 --- a/Libraries/LibGUI/Frame.cpp +++ b/Libraries/LibGUI/Frame.cpp @@ -24,9 +24,10 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include #include #include +#include +#include namespace GUI { diff --git a/Libraries/LibGUI/GroupBox.cpp b/Libraries/LibGUI/GroupBox.cpp index 9f1263d8df0..db9cb6480d2 100644 --- a/Libraries/LibGUI/GroupBox.cpp +++ b/Libraries/LibGUI/GroupBox.cpp @@ -24,10 +24,11 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include -#include #include #include +#include +#include +#include namespace GUI { diff --git a/Libraries/LibGUI/Label.cpp b/Libraries/LibGUI/Label.cpp index 14f272cb946..944d66084ed 100644 --- a/Libraries/LibGUI/Label.cpp +++ b/Libraries/LibGUI/Label.cpp @@ -24,10 +24,11 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include -#include #include #include +#include +#include +#include namespace GUI { diff --git a/Libraries/LibGUI/MessageBox.cpp b/Libraries/LibGUI/MessageBox.cpp index 24bde0c8821..c910b3a3863 100644 --- a/Libraries/LibGUI/MessageBox.cpp +++ b/Libraries/LibGUI/MessageBox.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include namespace GUI { diff --git a/Libraries/LibGUI/ProgressBar.cpp b/Libraries/LibGUI/ProgressBar.cpp index b957a159c1b..92dfc06f04f 100644 --- a/Libraries/LibGUI/ProgressBar.cpp +++ b/Libraries/LibGUI/ProgressBar.cpp @@ -28,6 +28,7 @@ #include #include #include +#include namespace GUI { diff --git a/Libraries/LibGUI/RadioButton.cpp b/Libraries/LibGUI/RadioButton.cpp index 51b12b9d3d4..e633a909b5c 100644 --- a/Libraries/LibGUI/RadioButton.cpp +++ b/Libraries/LibGUI/RadioButton.cpp @@ -24,10 +24,12 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include -#include #include #include +#include +#include +#include +#include namespace GUI { diff --git a/Libraries/LibGUI/Slider.cpp b/Libraries/LibGUI/Slider.cpp index 2e3677b64ff..bb4eb142e72 100644 --- a/Libraries/LibGUI/Slider.cpp +++ b/Libraries/LibGUI/Slider.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include namespace GUI { diff --git a/Libraries/LibGUI/StatusBar.cpp b/Libraries/LibGUI/StatusBar.cpp index 7e0699a4d94..8f9d41820a5 100644 --- a/Libraries/LibGUI/StatusBar.cpp +++ b/Libraries/LibGUI/StatusBar.cpp @@ -24,12 +24,13 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include #include #include #include #include #include +#include +#include namespace GUI { diff --git a/Libraries/LibGUI/TabWidget.cpp b/Libraries/LibGUI/TabWidget.cpp index f389f6fa3a8..e1ee40cbceb 100644 --- a/Libraries/LibGUI/TabWidget.cpp +++ b/Libraries/LibGUI/TabWidget.cpp @@ -24,11 +24,12 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include -#include #include #include #include +#include +#include +#include namespace GUI { diff --git a/Libraries/LibGUI/Widget.cpp b/Libraries/LibGUI/Widget.cpp index 0997b527731..a363a730baf 100644 --- a/Libraries/LibGUI/Widget.cpp +++ b/Libraries/LibGUI/Widget.cpp @@ -94,6 +94,8 @@ const WidgetClassRegistration* WidgetClassRegistration::find(const String& class Widget::Widget(Widget* parent) : Core::Object(parent, true) + , m_background_role(Gfx::ColorRole::Window) + , m_foreground_role(Gfx::ColorRole::WindowText) , m_font(Gfx::Font::default_font()) , m_palette(Application::the().palette().impl()) { @@ -731,4 +733,19 @@ void Widget::set_palette(const Palette& palette) m_palette = palette.impl(); } +void Widget::set_background_role(ColorRole role) +{ + m_background_role = role; +} + +void Widget::set_foreground_role(ColorRole role) +{ + m_foreground_role = role; +} + +Gfx::Palette Widget::palette() const +{ + return Gfx::Palette(*m_palette); +} + } diff --git a/Libraries/LibGUI/Widget.h b/Libraries/LibGUI/Widget.h index d294673dcad..35b2c1121f5 100644 --- a/Libraries/LibGUI/Widget.h +++ b/Libraries/LibGUI/Widget.h @@ -31,14 +31,12 @@ #include #include #include -#include -#include -#include -#include -#include -#include #include #include +#include +#include +#include +#include #define REGISTER_GWIDGET(class_name) \ extern WidgetClassRegistration registration_##class_name; \ @@ -191,11 +189,11 @@ public: void move_by(int x, int y) { move_by({ x, y }); } void move_by(const Gfx::Point& delta) { set_relative_rect({ relative_position().translated(delta), size() }); } - ColorRole background_role() const { return m_background_role; } - void set_background_role(ColorRole role) { m_background_role = role; } + Gfx::ColorRole background_role() const { return m_background_role; } + void set_background_role(Gfx::ColorRole); - ColorRole foreground_role() const { return m_foreground_role; } - void set_foreground_role(ColorRole role) { m_foreground_role = role; } + Gfx::ColorRole foreground_role() const { return m_foreground_role; } + void set_foreground_role(Gfx::ColorRole); Color background_color() const { return m_background_color; } Color foreground_color() const { return m_foreground_color; } @@ -275,8 +273,8 @@ public: void do_layout(); - Palette palette() const { return Palette(*m_palette); } - void set_palette(const Palette&); + Gfx::Palette palette() const; + void set_palette(const Gfx::Palette&); protected: explicit Widget(Widget* parent = nullptr); @@ -321,8 +319,8 @@ private: OwnPtr m_layout; Gfx::Rect m_relative_rect; - ColorRole m_background_role { ColorRole::Window }; - ColorRole m_foreground_role { ColorRole::WindowText }; + Gfx::ColorRole m_background_role; + Gfx::ColorRole m_foreground_role; Color m_background_color; Color m_foreground_color; NonnullRefPtr m_font; diff --git a/Libraries/LibGfx/Forward.h b/Libraries/LibGfx/Forward.h index 0ecd623a5ad..325ec0c3576 100644 --- a/Libraries/LibGfx/Forward.h +++ b/Libraries/LibGfx/Forward.h @@ -41,6 +41,7 @@ class GlyphBitmap; class ImageDecoder; class Painter; class Palette; +class PaletteImpl; class Point; class Rect; class Size; @@ -49,6 +50,7 @@ class SystemTheme; class Triangle; enum class BitmapFormat; +enum class ColorRole; } diff --git a/MenuApplets/Audio/main.cpp b/MenuApplets/Audio/main.cpp index a2d310914e9..15b93d8a092 100644 --- a/MenuApplets/Audio/main.cpp +++ b/MenuApplets/Audio/main.cpp @@ -30,6 +30,7 @@ #include #include #include +#include class AudioWidget final : public GUI::Widget { C_OBJECT(AudioWidget) diff --git a/MenuApplets/Clock/main.cpp b/MenuApplets/Clock/main.cpp index d7a1c24f0bb..1cb22e85db3 100644 --- a/MenuApplets/Clock/main.cpp +++ b/MenuApplets/Clock/main.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include diff --git a/MenuApplets/UserName/main.cpp b/MenuApplets/UserName/main.cpp index 8b5f4090822..8ffc122566f 100644 --- a/MenuApplets/UserName/main.cpp +++ b/MenuApplets/UserName/main.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include