1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-25 10:55:07 +00:00

LibGUI: Put all classes in the GUI namespace and remove the leading G

This took me a moment. Welcome to the new world of GUI::Widget! :^)
This commit is contained in:
Andreas Kling 2020-02-02 15:07:41 +01:00
parent 2d39da5405
commit c5bd9d4ed1
337 changed files with 5400 additions and 4816 deletions

View file

@ -31,17 +31,19 @@
#include <LibGUI/GResizeCorner.h>
#include <LibGUI/GStatusBar.h>
GStatusBar::GStatusBar(GWidget* parent)
: GStatusBar(1, parent)
namespace GUI {
StatusBar::StatusBar(Widget* parent)
: StatusBar(1, parent)
{
}
GStatusBar::GStatusBar(int label_count, GWidget* parent)
: GWidget(parent)
StatusBar::StatusBar(int label_count, Widget* parent)
: Widget(parent)
{
set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
set_preferred_size(0, 20);
set_layout(make<GHBoxLayout>());
set_layout(make<HBoxLayout>());
layout()->set_margins({ 2, 2, 2, 2 });
layout()->set_spacing(2);
@ -51,16 +53,16 @@ GStatusBar::GStatusBar(int label_count, GWidget* parent)
for (auto i = 0; i < label_count; i++)
m_labels.append(create_label());
m_corner = GResizeCorner::construct(this);
m_corner = ResizeCorner::construct(this);
}
GStatusBar::~GStatusBar()
StatusBar::~StatusBar()
{
}
NonnullRefPtr<GLabel> GStatusBar::create_label()
NonnullRefPtr<Label> StatusBar::create_label()
{
auto label = GLabel::construct(this);
auto label = Label::construct(this);
label->set_frame_shadow(FrameShadow::Sunken);
label->set_frame_shape(FrameShape::Panel);
label->set_frame_thickness(1);
@ -68,29 +70,31 @@ NonnullRefPtr<GLabel> GStatusBar::create_label()
return label;
}
void GStatusBar::set_text(const StringView& text)
void StatusBar::set_text(const StringView& text)
{
m_labels.first().set_text(text);
}
String GStatusBar::text() const
String StatusBar::text() const
{
return m_labels.first().text();
}
void GStatusBar::set_text(int index, const StringView& text)
void StatusBar::set_text(int index, const StringView& text)
{
m_labels.at(index).set_text(text);
}
String GStatusBar::text(int index) const
String StatusBar::text(int index) const
{
return m_labels.at(index).text();
}
void GStatusBar::paint_event(GPaintEvent& event)
void StatusBar::paint_event(PaintEvent& event)
{
GPainter painter(*this);
Painter painter(*this);
painter.add_clip_rect(event.rect());
StylePainter::paint_surface(painter, rect(), palette(), !spans_entire_window_horizontally());
}
}