mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
LibGUI: Remove some header dependencies from Widget.h
This commit is contained in:
parent
08cae2773d
commit
34c7322d77
Notes:
sideshowbarker
2024-07-19 09:20:07 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/34c7322d77c
36 changed files with 86 additions and 35 deletions
|
@ -30,8 +30,9 @@
|
|||
#include <LibGUI/Desktop.h>
|
||||
#include <LibGUI/Label.h>
|
||||
#include <LibGUI/Window.h>
|
||||
#include <sys/utsname.h>
|
||||
#include <LibGfx/Font.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/utsname.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include "GlyphEditorWidget.h"
|
||||
#include <LibGUI/Painter.h>
|
||||
#include <LibGfx/Font.h>
|
||||
|
||||
GlyphEditorWidget::GlyphEditorWidget(Gfx::Font& mutable_font, GUI::Widget* parent)
|
||||
: GUI::Frame(parent)
|
||||
|
|
|
@ -25,8 +25,9 @@
|
|||
*/
|
||||
|
||||
#include "GlyphMapWidget.h"
|
||||
#include <LibGfx/Palette.h>
|
||||
#include <LibGUI/Painter.h>
|
||||
#include <LibGfx/Font.h>
|
||||
#include <LibGfx/Palette.h>
|
||||
|
||||
GlyphMapWidget::GlyphMapWidget(Gfx::Font& mutable_font, GUI::Widget* parent)
|
||||
: GUI::Frame(parent)
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include <LibGUI/MenuBar.h>
|
||||
#include <LibGUI/Window.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/Font.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <AK/NonnullRefPtrVector.h>
|
||||
#include <AK/StdLibExtras.h>
|
||||
#include <LibGUI/ScrollableWidget.h>
|
||||
#include <LibGfx/Font.h>
|
||||
#include <LibGfx/TextAlignment.h>
|
||||
|
||||
class HexEditor : public GUI::ScrollableWidget {
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "PaintableWidget.h"
|
||||
#include <LibGUI/BoxLayout.h>
|
||||
#include <LibGUI/ColorPicker.h>
|
||||
#include <LibGfx/Palette.h>
|
||||
|
||||
class ColorWidget : public GUI::Frame {
|
||||
C_OBJECT(ColorWidget)
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include "GraphWidget.h"
|
||||
#include <LibGUI/Painter.h>
|
||||
#include <LibGfx/Font.h>
|
||||
|
||||
GraphWidget::GraphWidget(GUI::Widget* parent)
|
||||
: GUI::Frame(parent)
|
||||
|
|
|
@ -28,10 +28,11 @@
|
|||
#include "GraphWidget.h"
|
||||
#include <AK/JsonObject.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibGfx/StylePainter.h>
|
||||
#include <LibGUI/BoxLayout.h>
|
||||
#include <LibGUI/Label.h>
|
||||
#include <LibGUI/Painter.h>
|
||||
#include <LibGfx/Font.h>
|
||||
#include <LibGfx/StylePainter.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include <LibGUI/Slider.h>
|
||||
#include <LibGUI/Widget.h>
|
||||
#include <LibGUI/Window.h>
|
||||
#include <LibGfx/Font.h>
|
||||
#include <LibVT/TerminalWidget.h>
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
|
|
|
@ -28,8 +28,9 @@
|
|||
#include <AK/String.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibGfx/Palette.h>
|
||||
#include <LibGUI/Painter.h>
|
||||
#include <LibGfx/Font.h>
|
||||
#include <LibGfx/Palette.h>
|
||||
|
||||
TextWidget::TextWidget(GUI::Widget* parent)
|
||||
: GUI::Frame(parent)
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <LibGUI/Label.h>
|
||||
#include <LibGUI/StackWidget.h>
|
||||
#include <LibGUI/Window.h>
|
||||
#include <LibGfx/Font.h>
|
||||
#include <LibGfx/PNGLoader.h>
|
||||
|
||||
#include "TextWidget.h"
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "FormWidget.h"
|
||||
#include "WidgetTreeModel.h"
|
||||
#include <AK/LogStream.h>
|
||||
#include <LibGfx/Palette.h>
|
||||
|
||||
void CursorTool::on_mousedown(GUI::MouseEvent& event)
|
||||
{
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <LibCore/Timer.h>
|
||||
#include <LibGUI/BoxLayout.h>
|
||||
#include <LibGUI/Label.h>
|
||||
#include <LibGfx/Font.h>
|
||||
#include <unistd.h>
|
||||
|
||||
ProcessStateWidget::ProcessStateWidget(GUI::Widget* parent)
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <LibGUI/FontDatabase.h>
|
||||
#include <LibGUI/Painter.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/Font.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <LibGUI/Button.h>
|
||||
#include <LibGUI/Label.h>
|
||||
#include <LibGUI/Widget.h>
|
||||
#include <LibGfx/Font.h>
|
||||
|
||||
namespace GUI {
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <LibGUI/Frame.h>
|
||||
#include <LibGUI/SpinBox.h>
|
||||
#include <LibGUI/Widget.h>
|
||||
#include <LibGfx/Palette.h>
|
||||
|
||||
namespace GUI {
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <AK/StringBuilder.h>
|
||||
#include <LibGUI/Painter.h>
|
||||
#include <LibGUI/ProgressBar.h>
|
||||
#include <LibGfx/Palette.h>
|
||||
|
||||
namespace GUI {
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <LibGUI/Widget.h>
|
||||
#include <LibGUI/Window.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/Font.h>
|
||||
|
||||
class AudioWidget final : public GUI::Widget {
|
||||
C_OBJECT(AudioWidget)
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <LibGUI/Painter.h>
|
||||
#include <LibGUI/Widget.h>
|
||||
#include <LibGUI/Window.h>
|
||||
#include <LibGfx/Font.h>
|
||||
#include <LibGfx/Palette.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <LibGUI/Painter.h>
|
||||
#include <LibGUI/Widget.h>
|
||||
#include <LibGUI/Window.h>
|
||||
#include <LibGfx/Font.h>
|
||||
#include <LibGfx/Palette.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
|
Loading…
Reference in a new issue