mirror of
https://github.com/RGBCube/serenity
synced 2025-07-23 14:07:42 +00:00
GGroupBox: Rename "name" property to "title"
This commit is contained in:
parent
3ae9fc5d88
commit
758e926b99
3 changed files with 12 additions and 12 deletions
|
@ -127,7 +127,7 @@ void VBWidget::setup_properties()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_type == VBWidgetType::GGroupBox) {
|
if (m_type == VBWidgetType::GGroupBox) {
|
||||||
VB_ADD_PROPERTY(GGroupBox, "name", name, set_name, string);
|
VB_ADD_PROPERTY(GGroupBox, "title", title, set_title, string);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_type == VBWidgetType::GScrollBar) {
|
if (m_type == VBWidgetType::GScrollBar) {
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
#include <LibGUI/GPainter.h>
|
#include <LibGUI/GPainter.h>
|
||||||
#include <SharedGraphics/StylePainter.h>
|
#include <SharedGraphics/StylePainter.h>
|
||||||
|
|
||||||
GGroupBox::GGroupBox(const String& name, GWidget* parent)
|
GGroupBox::GGroupBox(const String& title, GWidget* parent)
|
||||||
: GWidget(parent)
|
: GWidget(parent)
|
||||||
, m_name(name)
|
, m_title(title)
|
||||||
{
|
{
|
||||||
set_fill_with_background_color(true);
|
set_fill_with_background_color(true);
|
||||||
set_background_color(Color::LightGray);
|
set_background_color(Color::LightGray);
|
||||||
|
@ -25,15 +25,15 @@ void GGroupBox::paint_event(GPaintEvent& event)
|
||||||
};
|
};
|
||||||
StylePainter::paint_frame(painter, frame_rect, FrameShape::Box, FrameShadow::Sunken, 2);
|
StylePainter::paint_frame(painter, frame_rect, FrameShape::Box, FrameShadow::Sunken, 2);
|
||||||
|
|
||||||
Rect text_rect { 4, 0, font().width(m_name) + 6, font().glyph_height() };
|
Rect text_rect { 4, 0, font().width(m_title) + 6, font().glyph_height() };
|
||||||
painter.fill_rect(text_rect, background_color());
|
painter.fill_rect(text_rect, background_color());
|
||||||
painter.draw_text(text_rect, m_name, TextAlignment::Center, foreground_color());
|
painter.draw_text(text_rect, m_title, TextAlignment::Center, foreground_color());
|
||||||
}
|
}
|
||||||
|
|
||||||
void GGroupBox::set_name(const String& name)
|
void GGroupBox::set_title(const String& title)
|
||||||
{
|
{
|
||||||
if (m_name == name)
|
if (m_title == title)
|
||||||
return;
|
return;
|
||||||
m_name = name;
|
m_title = title;
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,11 +4,11 @@
|
||||||
|
|
||||||
class GGroupBox : public GWidget {
|
class GGroupBox : public GWidget {
|
||||||
public:
|
public:
|
||||||
GGroupBox(const String& name, GWidget* parent);
|
GGroupBox(const String& title, GWidget* parent);
|
||||||
virtual ~GGroupBox() override;
|
virtual ~GGroupBox() override;
|
||||||
|
|
||||||
String name() const { return m_name; }
|
String title() const { return m_title; }
|
||||||
void set_name(const String&);
|
void set_title(const String&);
|
||||||
|
|
||||||
virtual const char* class_name() const override { return "GGroupBox"; }
|
virtual const char* class_name() const override { return "GGroupBox"; }
|
||||||
|
|
||||||
|
@ -16,5 +16,5 @@ protected:
|
||||||
virtual void paint_event(GPaintEvent&) override;
|
virtual void paint_event(GPaintEvent&) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
String m_name;
|
String m_title;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue