1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:38:11 +00:00

LibGUI: Remove some header dependencies from Widget.h

This commit is contained in:
Andreas Kling 2020-02-14 23:53:11 +01:00
parent 08cae2773d
commit 34c7322d77
36 changed files with 86 additions and 35 deletions

View file

@ -29,6 +29,7 @@
#include <LibGUI/Button.h>
#include <LibGUI/Label.h>
#include <LibGUI/Widget.h>
#include <LibGfx/Font.h>
namespace GUI {

View file

@ -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 {

View file

@ -24,7 +24,6 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <LibGfx/Palette.h>
#include <LibGUI/Action.h>
#include <LibGUI/Application.h>
#include <LibGUI/Desktop.h>
@ -33,6 +32,8 @@
#include <LibGUI/Painter.h>
#include <LibGUI/Window.h>
#include <LibGUI/WindowServerConnection.h>
#include <LibGfx/Font.h>
#include <LibGfx/Palette.h>
namespace GUI {

View file

@ -26,11 +26,13 @@
#include <AK/StringBuilder.h>
#include <Kernel/KeyCode.h>
#include <LibGfx/StylePainter.h>
#include <LibGUI/Action.h>
#include <LibGUI/ActionGroup.h>
#include <LibGUI/Button.h>
#include <LibGUI/Painter.h>
#include <LibGfx/Font.h>
#include <LibGfx/Palette.h>
#include <LibGfx/StylePainter.h>
namespace GUI {

View file

@ -25,11 +25,12 @@
*/
#include <Kernel/KeyCode.h>
#include <LibGfx/CharacterBitmap.h>
#include <LibGfx/Palette.h>
#include <LibGfx/StylePainter.h>
#include <LibGUI/CheckBox.h>
#include <LibGUI/Painter.h>
#include <LibGfx/CharacterBitmap.h>
#include <LibGfx/Font.h>
#include <LibGfx/Palette.h>
#include <LibGfx/StylePainter.h>
namespace GUI {

View file

@ -30,6 +30,7 @@
#include <LibGUI/Frame.h>
#include <LibGUI/SpinBox.h>
#include <LibGUI/Widget.h>
#include <LibGfx/Palette.h>
namespace GUI {

View file

@ -24,10 +24,11 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <LibGfx/CharacterBitmap.h>
#include <LibGUI/ColumnsView.h>
#include <LibGUI/Painter.h>
#include <LibGUI/ScrollBar.h>
#include <LibGfx/CharacterBitmap.h>
#include <LibGfx/Palette.h>
namespace GUI {

View file

@ -24,9 +24,10 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <LibGfx/StylePainter.h>
#include <LibGUI/Frame.h>
#include <LibGUI/Painter.h>
#include <LibGfx/Palette.h>
#include <LibGfx/StylePainter.h>
namespace GUI {

View file

@ -24,10 +24,11 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <LibGfx/Palette.h>
#include <LibGfx/StylePainter.h>
#include <LibGUI/GroupBox.h>
#include <LibGUI/Painter.h>
#include <LibGfx/Font.h>
#include <LibGfx/Palette.h>
#include <LibGfx/StylePainter.h>
namespace GUI {

View file

@ -24,10 +24,11 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <LibGfx/Bitmap.h>
#include <LibGfx/Palette.h>
#include <LibGUI/Label.h>
#include <LibGUI/Painter.h>
#include <LibGfx/Bitmap.h>
#include <LibGfx/Font.h>
#include <LibGfx/Palette.h>
namespace GUI {

View file

@ -28,6 +28,7 @@
#include <LibGUI/Button.h>
#include <LibGUI/Label.h>
#include <LibGUI/MessageBox.h>
#include <LibGfx/Font.h>
#include <stdio.h>
namespace GUI {

View file

@ -28,6 +28,7 @@
#include <AK/StringBuilder.h>
#include <LibGUI/Painter.h>
#include <LibGUI/ProgressBar.h>
#include <LibGfx/Palette.h>
namespace GUI {

View file

@ -24,10 +24,12 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <LibGfx/Bitmap.h>
#include <LibGfx/StylePainter.h>
#include <LibGUI/Painter.h>
#include <LibGUI/RadioButton.h>
#include <LibGfx/Bitmap.h>
#include <LibGfx/Font.h>
#include <LibGfx/Palette.h>
#include <LibGfx/StylePainter.h>
namespace GUI {

View file

@ -28,6 +28,7 @@
#include <AK/StdLibExtras.h>
#include <LibGUI/Painter.h>
#include <LibGUI/Slider.h>
#include <LibGfx/Palette.h>
#include <LibGfx/StylePainter.h>
namespace GUI {

View file

@ -24,12 +24,13 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <LibGfx/StylePainter.h>
#include <LibGUI/BoxLayout.h>
#include <LibGUI/Label.h>
#include <LibGUI/Painter.h>
#include <LibGUI/ResizeCorner.h>
#include <LibGUI/StatusBar.h>
#include <LibGfx/Palette.h>
#include <LibGfx/StylePainter.h>
namespace GUI {

View file

@ -24,11 +24,12 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <LibGfx/Palette.h>
#include <LibGfx/StylePainter.h>
#include <LibGUI/BoxLayout.h>
#include <LibGUI/Painter.h>
#include <LibGUI/TabWidget.h>
#include <LibGfx/Font.h>
#include <LibGfx/Palette.h>
#include <LibGfx/StylePainter.h>
namespace GUI {

View file

@ -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);
}
}

View file

@ -31,14 +31,12 @@
#include <AK/String.h>
#include <LibCore/ElapsedTimer.h>
#include <LibCore/Object.h>
#include <LibGfx/Color.h>
#include <LibGfx/Font.h>
#include <LibGfx/Orientation.h>
#include <LibGfx/Palette.h>
#include <LibGfx/Rect.h>
#include <LibGfx/SystemTheme.h>
#include <LibGUI/Event.h>
#include <LibGUI/Shortcut.h>
#include <LibGfx/Color.h>
#include <LibGfx/Forward.h>
#include <LibGfx/Orientation.h>
#include <LibGfx/Rect.h>
#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<Layout> 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<Gfx::Font> m_font;