| 
									
										
										
										
											2019-06-07 11:50:05 +02:00
										 |  |  | #include <LibCore/CTimer.h>
 | 
					
						
							| 
									
										
										
										
											2019-05-24 22:47:01 +02:00
										 |  |  | #include <LibGUI/GApplication.h>
 | 
					
						
							|  |  |  | #include <LibGUI/GBoxLayout.h>
 | 
					
						
							| 
									
										
										
										
											2019-06-07 11:50:05 +02:00
										 |  |  | #include <LibGUI/GButton.h>
 | 
					
						
							| 
									
										
										
										
											2019-05-24 22:47:01 +02:00
										 |  |  | #include <LibGUI/GCheckBox.h>
 | 
					
						
							| 
									
										
										
										
											2019-06-07 11:50:05 +02:00
										 |  |  | #include <LibGUI/GGroupBox.h>
 | 
					
						
							|  |  |  | #include <LibGUI/GLabel.h>
 | 
					
						
							| 
									
										
										
										
											2019-05-24 22:47:01 +02:00
										 |  |  | #include <LibGUI/GProgressBar.h>
 | 
					
						
							| 
									
										
										
										
											2019-06-07 11:50:05 +02:00
										 |  |  | #include <LibGUI/GRadioButton.h>
 | 
					
						
							| 
									
										
										
										
											2019-05-24 22:47:01 +02:00
										 |  |  | #include <LibGUI/GScrollBar.h>
 | 
					
						
							|  |  |  | #include <LibGUI/GSlider.h>
 | 
					
						
							|  |  |  | #include <LibGUI/GSpinBox.h>
 | 
					
						
							| 
									
										
										
										
											2019-06-07 11:50:05 +02:00
										 |  |  | #include <LibGUI/GTextBox.h>
 | 
					
						
							|  |  |  | #include <LibGUI/GWidget.h>
 | 
					
						
							|  |  |  | #include <LibGUI/GWindow.h>
 | 
					
						
							| 
									
										
										
										
											2019-05-24 22:47:01 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | int main(int argc, char** argv) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     GApplication app(argc, argv); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     auto* window = new GWindow; | 
					
						
							|  |  |  |     window->set_rect(100, 100, 320, 480); | 
					
						
							|  |  |  |     window->set_title("Widget Gallery"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     auto* main_widget = new GWidget; | 
					
						
							|  |  |  |     window->set_main_widget(main_widget); | 
					
						
							|  |  |  |     main_widget->set_fill_with_background_color(true); | 
					
						
							|  |  |  |     main_widget->set_layout(make<GBoxLayout>(Orientation::Vertical)); | 
					
						
							|  |  |  |     main_widget->layout()->set_margins({ 4, 4, 4, 4 }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     auto* checkbox1 = new GCheckBox("GCheckBox 1", main_widget); | 
					
						
							|  |  |  |     auto* checkbox2 = new GCheckBox("GCheckBox 2", main_widget); | 
					
						
							|  |  |  |     checkbox2->set_enabled(false); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     auto* radio1 = new GRadioButton("GRadioButton 1", main_widget); | 
					
						
							|  |  |  |     auto* radio2 = new GRadioButton("GRadioButton 2", main_widget); | 
					
						
							|  |  |  |     radio2->set_enabled(false); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     auto* button1 = new GButton("GButton 1", main_widget); | 
					
						
							|  |  |  |     auto* button2 = new GButton("GButton 2", main_widget); | 
					
						
							|  |  |  |     button2->set_enabled(false); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     auto* progress1 = new GProgressBar(main_widget); | 
					
						
							|  |  |  |     new CTimer(100, [progress1] { | 
					
						
							|  |  |  |         progress1->set_value(progress1->value() + 1); | 
					
						
							|  |  |  |         if (progress1->value() == progress1->max()) | 
					
						
							|  |  |  |             progress1->set_value(progress1->min()); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     auto* label1 = new GLabel("GLabel 1", main_widget); | 
					
						
							|  |  |  |     auto* label2 = new GLabel("GLabel 2", main_widget); | 
					
						
							|  |  |  |     label2->set_enabled(false); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     auto* textbox1 = new GTextBox(main_widget); | 
					
						
							|  |  |  |     textbox1->set_text("GTextBox 1"); | 
					
						
							|  |  |  |     auto* textbox2 = new GTextBox(main_widget); | 
					
						
							|  |  |  |     textbox2->set_text("GTextBox 2"); | 
					
						
							|  |  |  |     textbox2->set_enabled(false); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     auto* spinbox1 = new GSpinBox(main_widget); | 
					
						
							|  |  |  |     auto* spinbox2 = new GSpinBox(main_widget); | 
					
						
							|  |  |  |     spinbox2->set_enabled(false); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     auto* slider1 = new GSlider(main_widget); | 
					
						
							|  |  |  |     auto* slider2 = new GSlider(main_widget); | 
					
						
							|  |  |  |     slider2->set_enabled(false); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     auto* scrollbar1 = new GScrollBar(Orientation::Horizontal, main_widget); | 
					
						
							|  |  |  |     scrollbar1->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed); | 
					
						
							|  |  |  |     scrollbar1->set_preferred_size({ 0, 16 }); | 
					
						
							|  |  |  |     scrollbar1->set_min(0); | 
					
						
							|  |  |  |     scrollbar1->set_max(100); | 
					
						
							|  |  |  |     scrollbar1->set_value(50); | 
					
						
							|  |  |  |     auto* scrollbar2 = new GScrollBar(Orientation::Horizontal, main_widget); | 
					
						
							|  |  |  |     scrollbar2->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed); | 
					
						
							|  |  |  |     scrollbar2->set_preferred_size({ 0, 16 }); | 
					
						
							|  |  |  |     scrollbar2->set_enabled(false); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     window->show(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     return app.exec(); | 
					
						
							|  |  |  | } |