Taskbar: Replace TaskbarWidget with a simple GFrame.

There's no need for a custom widget here, at least not now.
This commit is contained in:
Andreas Kling 2019-04-08 17:17:16 +02:00
parent 6d5a54690e
commit 93a4a4c597
Notes: sideshowbarker 2024-07-19 14:47:32 +09:00
5 changed files with 11 additions and 42 deletions

View file

@ -1,6 +1,5 @@
OBJS = \
TaskbarWindow.o \
TaskbarWidget.o \
WindowList.o \
main.o

View file

@ -1,24 +0,0 @@
#include "TaskbarWidget.h"
#include <LibGUI/GLabel.h>
#include <LibGUI/GButton.h>
#include <LibGUI/GBoxLayout.h>
#include <LibGUI/GPainter.h>
#include <stdio.h>
TaskbarWidget::TaskbarWidget(WindowList& window_list, GWidget* parent)
: GFrame(parent)
, m_window_list(window_list)
{
set_fill_with_background_color(true);
set_layout(make<GBoxLayout>(Orientation::Horizontal));
layout()->set_margins({ 3, 2, 3, 2 });
layout()->set_spacing(3);
set_frame_thickness(1);
set_frame_shape(GFrame::Shape::Panel);
set_frame_shadow(GFrame::Shadow::Raised);
}
TaskbarWidget::~TaskbarWidget()
{
}

View file

@ -1,14 +0,0 @@
#include <LibGUI/GFrame.h>
class WindowList;
class TaskbarWidget final : public GFrame {
public:
TaskbarWidget(WindowList&, GWidget* parent = nullptr);
virtual ~TaskbarWidget() override;
virtual const char* class_name() const override { return "TaskbarWidget"; }
private:
WindowList& m_window_list;
};

View file

@ -1,9 +1,10 @@
#include "TaskbarWindow.h"
#include "TaskbarWidget.h"
#include <LibGUI/GWindow.h>
#include <LibGUI/GDesktop.h>
#include <LibGUI/GEventLoop.h>
#include <LibGUI/GBoxLayout.h>
#include <LibGUI/GButton.h>
#include <LibGUI/GFrame.h>
#include <WindowServer/WSAPITypes.h>
#include <stdio.h>
@ -17,7 +18,14 @@ TaskbarWindow::TaskbarWindow()
GDesktop::the().on_rect_change = [this] (const Rect& rect) { on_screen_rect_change(rect); };
auto* widget = new TaskbarWidget(m_window_list);
auto* widget = new GFrame;
widget->set_fill_with_background_color(true);
widget->set_layout(make<GBoxLayout>(Orientation::Horizontal));
widget->layout()->set_margins({ 3, 2, 3, 2 });
widget->layout()->set_spacing(3);
widget->set_frame_thickness(1);
widget->set_frame_shape(GFrame::Shape::Panel);
widget->set_frame_shadow(GFrame::Shadow::Raised);
set_main_widget(widget);
m_window_list.aid_create_button = [this] {

View file

@ -4,7 +4,7 @@
class GFrame : public GWidget {
public:
explicit GFrame(GWidget* parent);
explicit GFrame(GWidget* parent = nullptr);
virtual ~GFrame() override;
enum Shadow { Plain, Raised, Sunken };