mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 22:07:34 +00:00
GGroupBox: Improve appearance with new FrameShape::Box style.
This commit is contained in:
parent
f0501a0102
commit
93b76628a5
5 changed files with 25 additions and 5 deletions
|
@ -18,7 +18,7 @@ VBForm::VBForm(const String& name, GWidget* parent)
|
||||||
set_greedy_for_hits(true);
|
set_greedy_for_hits(true);
|
||||||
|
|
||||||
auto box1 = VBWidget::create(WidgetType::GSpinBox, *this);
|
auto box1 = VBWidget::create(WidgetType::GSpinBox, *this);
|
||||||
box1->set_rect({ 10, 10, 81, 25 });
|
box1->set_rect({ 10, 10, 81, 21 });
|
||||||
m_widgets.append(move(box1));
|
m_widgets.append(move(box1));
|
||||||
|
|
||||||
auto box2 = VBWidget::create(WidgetType::GTextEditor, *this);
|
auto box2 = VBWidget::create(WidgetType::GTextEditor, *this);
|
||||||
|
@ -26,8 +26,12 @@ VBForm::VBForm(const String& name, GWidget* parent)
|
||||||
m_widgets.append(move(box2));
|
m_widgets.append(move(box2));
|
||||||
|
|
||||||
auto button1 = VBWidget::create(WidgetType::GButton, *this);
|
auto button1 = VBWidget::create(WidgetType::GButton, *this);
|
||||||
button1->set_rect({ 200, 50, 81, 25 });
|
button1->set_rect({ 200, 50, 81, 21 });
|
||||||
m_widgets.append(move(button1));
|
m_widgets.append(move(button1));
|
||||||
|
|
||||||
|
auto groupbox1 = VBWidget::create(WidgetType::GGroupBox, *this);
|
||||||
|
groupbox1->set_rect({ 300, 150, 161, 51 });
|
||||||
|
m_widgets.append(move(groupbox1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void VBForm::insert_widget(WidgetType type)
|
void VBForm::insert_widget(WidgetType type)
|
||||||
|
|
|
@ -26,12 +26,14 @@
|
||||||
#include <Kernel/Net/E1000NetworkAdapter.h>
|
#include <Kernel/Net/E1000NetworkAdapter.h>
|
||||||
#include <Kernel/Net/NetworkTask.h>
|
#include <Kernel/Net/NetworkTask.h>
|
||||||
|
|
||||||
#define SPAWN_LAUNCHER
|
//#define SPAWN_TERMINAL
|
||||||
|
//#define SPAWN_LAUNCHER
|
||||||
//#define SPAWN_GUITEST2
|
//#define SPAWN_GUITEST2
|
||||||
//#define SPAWN_FILE_MANAGER
|
//#define SPAWN_FILE_MANAGER
|
||||||
//#define SPAWN_PROCESS_MANAGER
|
//#define SPAWN_PROCESS_MANAGER
|
||||||
//#define SPAWN_TEXT_EDITOR
|
//#define SPAWN_TEXT_EDITOR
|
||||||
//#define SPAWN_FONTEDITOR
|
//#define SPAWN_FONTEDITOR
|
||||||
|
#define SPAWN_VISUAL_BUILDER
|
||||||
//#define SPAWN_MULTIPLE_SHELLS
|
//#define SPAWN_MULTIPLE_SHELLS
|
||||||
//#define STRESS_TEST_SPAWNING
|
//#define STRESS_TEST_SPAWNING
|
||||||
|
|
||||||
|
@ -101,13 +103,18 @@ VFS* vfs;
|
||||||
window_server_process->set_priority(Process::HighPriority);
|
window_server_process->set_priority(Process::HighPriority);
|
||||||
Process::create_user_process("/bin/Taskbar", (uid_t)100, (gid_t)100, (pid_t)0, error);
|
Process::create_user_process("/bin/Taskbar", (uid_t)100, (gid_t)100, (pid_t)0, error);
|
||||||
//Process::create_user_process("/bin/sh", (uid_t)100, (gid_t)100, (pid_t)0, error, { }, move(environment), tty0);
|
//Process::create_user_process("/bin/sh", (uid_t)100, (gid_t)100, (pid_t)0, error, { }, move(environment), tty0);
|
||||||
|
#ifdef SPAWN_TERMINAL
|
||||||
Process::create_user_process("/bin/Terminal", (uid_t)100, (gid_t)100, (pid_t)0, error, { }, { }, tty0);
|
Process::create_user_process("/bin/Terminal", (uid_t)100, (gid_t)100, (pid_t)0, error, { }, { }, tty0);
|
||||||
|
#endif
|
||||||
#ifdef SPAWN_GUITEST2
|
#ifdef SPAWN_GUITEST2
|
||||||
Process::create_user_process("/bin/guitest2", (uid_t)100, (gid_t)100, (pid_t)0, error, { }, { }, tty0);
|
Process::create_user_process("/bin/guitest2", (uid_t)100, (gid_t)100, (pid_t)0, error, { }, { }, tty0);
|
||||||
#endif
|
#endif
|
||||||
#ifdef SPAWN_LAUNCHER
|
#ifdef SPAWN_LAUNCHER
|
||||||
Process::create_user_process("/bin/Launcher", (uid_t)100, (gid_t)100, (pid_t)0, error, { }, { }, tty0);
|
Process::create_user_process("/bin/Launcher", (uid_t)100, (gid_t)100, (pid_t)0, error, { }, { }, tty0);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef SPAWN_VISUAL_BUILDER
|
||||||
|
Process::create_user_process("/bin/VisualBuilder", (uid_t)100, (gid_t)100, (pid_t)0, error, { }, { }, tty0);
|
||||||
|
#endif
|
||||||
#ifdef SPAWN_FILE_MANAGER
|
#ifdef SPAWN_FILE_MANAGER
|
||||||
Process::create_user_process("/bin/FileManager", (uid_t)100, (gid_t)100, (pid_t)0, error, { }, { }, tty0);
|
Process::create_user_process("/bin/FileManager", (uid_t)100, (gid_t)100, (pid_t)0, error, { }, { }, tty0);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -23,7 +23,7 @@ void GGroupBox::paint_event(GPaintEvent& event)
|
||||||
0, font().glyph_height() / 2,
|
0, font().glyph_height() / 2,
|
||||||
width(), height() - font().glyph_height() / 2
|
width(), height() - font().glyph_height() / 2
|
||||||
};
|
};
|
||||||
StylePainter::paint_frame(painter, frame_rect, FrameShape::Panel, FrameShadow::Sunken, 1);
|
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_name) + 6, font().glyph_height() };
|
||||||
painter.fill_rect(text_rect, background_color());
|
painter.fill_rect(text_rect, background_color());
|
||||||
|
|
|
@ -153,4 +153,13 @@ void StylePainter::paint_frame(Painter& painter, const Rect& rect, FrameShape sh
|
||||||
painter.draw_line(inner_container_frame_rect.top_left().translated(0, 1), inner_container_frame_rect.bottom_left().translated(0, -1), top_left_color);
|
painter.draw_line(inner_container_frame_rect.top_left().translated(0, 1), inner_container_frame_rect.bottom_left().translated(0, -1), top_left_color);
|
||||||
painter.draw_line(inner_container_frame_rect.top_right(), inner_container_frame_rect.bottom_right().translated(0, -1), bottom_right_color);
|
painter.draw_line(inner_container_frame_rect.top_right(), inner_container_frame_rect.bottom_right().translated(0, -1), bottom_right_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (shape == FrameShape::Box && thickness >= 2) {
|
||||||
|
swap(top_left_color, bottom_right_color);
|
||||||
|
Rect inner_rect = rect.shrunken(2, 2);
|
||||||
|
painter.draw_line(inner_rect.top_left(), inner_rect.top_right(), top_left_color);
|
||||||
|
painter.draw_line(inner_rect.bottom_left(), inner_rect.bottom_right(), bottom_right_color);
|
||||||
|
painter.draw_line(inner_rect.top_left().translated(0, 1), inner_rect.bottom_left().translated(0, -1), top_left_color);
|
||||||
|
painter.draw_line(inner_rect.top_right(), inner_rect.bottom_right().translated(0, -1), bottom_right_color);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ class Rect;
|
||||||
|
|
||||||
enum class ButtonStyle { Normal, CoolBar, OldNormal };
|
enum class ButtonStyle { Normal, CoolBar, OldNormal };
|
||||||
enum class FrameShadow { Plain, Raised, Sunken };
|
enum class FrameShadow { Plain, Raised, Sunken };
|
||||||
enum class FrameShape { NoFrame, Container, Panel, VerticalLine, HorizontalLine };
|
enum class FrameShape { NoFrame, Box, Container, Panel, VerticalLine, HorizontalLine };
|
||||||
|
|
||||||
class StylePainter {
|
class StylePainter {
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue