22
22
23
23
static GWindow* make_launcher_window ();
24
24
static GWindow* make_progress_window ();
25
+ static GWindow* make_frames_window ();
25
26
26
27
void handle_sigchld (int )
27
28
{
@@ -44,6 +45,9 @@ int main(int argc, char** argv)
44
45
auto * progress_window = make_progress_window ();
45
46
progress_window->show ();
46
47
48
+ auto * frames_window = make_frames_window ();
49
+ frames_window->show ();
50
+
47
51
return app.exec ();
48
52
}
49
53
@@ -149,3 +153,37 @@ static GWindow* make_progress_window()
149
153
150
154
return window;
151
155
}
156
+
157
+ static GWindow* make_frames_window ()
158
+ {
159
+ auto * window = new GWindow;
160
+ window->set_title (" GFrame styles test" );
161
+ window->set_rect ({ 100 , 400 , 240 , 80 });
162
+
163
+ auto * widget = new GWidget;
164
+ widget->set_fill_with_background_color (true );
165
+ window->set_main_widget (widget);
166
+
167
+ widget->set_layout (make<GBoxLayout>(Orientation::Vertical));
168
+
169
+ widget->layout ()->set_margins ({ 8 , 8 , 8 , 8 });
170
+ widget->layout ()->set_spacing (8 );
171
+
172
+ auto add_label = [widget] (const String& text, GFrame::Shape shape, GFrame::Shadow shadow) {
173
+ auto * label = new GLabel (text, widget);
174
+ label->set_size_policy (SizePolicy::Fill, SizePolicy::Fill);
175
+ label->set_frame_shape (shape);
176
+ label->set_frame_shadow (shadow);
177
+ if (shape == GFrame::Shape::Container) {
178
+ label->set_fill_with_background_color (true );
179
+ label->set_background_color (Color::White);
180
+ }
181
+ };
182
+
183
+ add_label (" Panel + Raised" , GFrame::Shape::Panel, GFrame::Shadow::Raised);
184
+ add_label (" Panel + Sunken" , GFrame::Shape::Panel, GFrame::Shadow::Sunken);
185
+ add_label (" Container + Raised" , GFrame::Shape::Container, GFrame::Shadow::Raised);
186
+ add_label (" Container + Sunken" , GFrame::Shape::Container, GFrame::Shadow::Sunken);
187
+
188
+ return window;
189
+ }
0 commit comments