Beispiel #1
0
	int main(const std::vector<std::string> &args)
	{
		try
		{
			GUIManager gui;

			DisplayCache gui_resources("../../../Resources/GUIThemeAero/resources.xml");
			DisplayCache app_resources("resources.xml");

			GUIWindowManagerSystem wm;
			gui.set_window_manager(wm);

			GUIThemeDefault theme;
			theme.set_resources(gui_resources);
			gui.set_theme(theme); 
			gui.set_css_document("theme.css");

			DisplayWindowDescription win_desc;
			win_desc.set_allow_resize(true);
			win_desc.set_title("Button WM System Test Application");
			win_desc.set_position(Rect(200, 200, 940, 640), false);
			Window window(&gui, win_desc);
			window.func_close().set(this, &App::on_close, &window);

			GraphicContext gc = window.get_gc();

			Font_Sprite font_sprite(gc, "ClanFont", &app_resources);

			// Set the gui named font
			FontDescription clanlib_font_desc;
			clanlib_font_desc.set_typeface_name("ClanLib Font");
			gui.register_font(font_sprite, clanlib_font_desc);

			Label label(&window);
			label.set_geometry(Rect(10, 160, 330, 180));
			label.set_text("Click the button");
			main_label = &label;

			PushButton button(&window);
			button.set_geometry(Rect(10, 10, 400, 100));
			button.func_clicked().set(this, &App::on_button_clicked, &button);
			button.set_class_name("redtext");
			button.set_text("Button Normal");

			LineEdit lineedit1(&window);
			lineedit1.set_geometry(Rect(20, 300, 700, 380));
			lineedit1.set_class_name("greentext");
			lineedit1.set_text("Select, Click and Edit me :)"); 

			gui.exec();
		}
		catch (Exception e)
		{
			ConsoleWindow console("Console");
			Console::write_line(e.message);
			console.display_close_message();
		}

		return 0;
	}
Beispiel #2
0
    int main(const std::vector<std::string> &args)
    {
        GUIManager gui;

        GUIWindowManagerSystem wm;
        gui.set_window_manager(wm);
        gui.add_resources(clan::XMLResourceDocument("../../../Resources/GUIThemeAero/resources.xml"));
        gui.add_theme("../../../Resources/GUIThemeAero/theme.css");
        DisplayWindowDescription win_desc;
        win_desc.set_allow_resize(true);
        win_desc.set_title("Button WM System Test Application");
        win_desc.set_position(Rect(200, 200, 540, 440), false);

        Window window(&gui, win_desc);
        window.func_close().set(this, &App::on_close, &window);

        PushButton button(&window);
        button.set_geometry(Rect(10, 10, 160, 50));
        button.func_clicked().set(this, &App::on_button_clicked, &button);
        button.set_text("Button Normal");

        PushButton button_disabled(&window);
        button_disabled.set_geometry(Rect(10, 60, 160, 100));
        button_disabled.func_clicked().set(this, &App::on_button_clicked, &button_disabled);
        button_disabled.set_text("Button Disabled");
        button_disabled.set_enabled(false);

        label = new Label(&window);
        label->set_geometry(Rect(10, 160, 330, 180));
        label->set_text("Click the buttons");

        gui.exec();

        return 0;
    }
Beispiel #3
0
	int main(const std::vector<std::string> &args)
	{
		ConsoleWindow console("Console");

		try
		{

			DisplayCache resources;
			resources.load("../../../Resources/GUIThemeLuna/resources.xml");

			GUIManager gui;

			GUIWindowManagerSystem wm;
			gui.set_window_manager(wm);

			GUIThemeDefault theme;
			theme.set_resources(resources);
			gui.set_theme(theme);
			gui.set_css_document("../../../Resources/GUIThemeLuna/theme.css");

			DisplayWindowDescription win_desc;
			win_desc.set_allow_resize(true);
			win_desc.set_title("CheckBox test app.");
			win_desc.set_position(Rect(200,200,600,600), false);
			Window root(&gui, win_desc);			
			root.func_close().set(this, &App::on_close, &root); 

			CheckBox checkbox1(&root);
			checkbox1.set_geometry(Rect(20, 20, 200, 40));
			checkbox1.set_text("CheckBox 1");

			gui.exec();
		}
		catch (Exception e)
		{
 			Console::write_line(e.message);
			console.display_close_message();
		}

		return 0;
	}
Beispiel #4
0
	int main(const std::vector<std::string> &args)
	{
		try
		{
			DisplayWindowDescription desc;
			desc.set_title("Custom Component");
			desc.set_size(Size(1024, 768), true);
			DisplayWindow displaywindow(desc);

			Slot slotWindowClose = displaywindow.sig_window_close().connect(this, &App::on_close);

			DisplayCache resources("../../../Resources/GUIThemeAero/resources.xml");

			GUIWindowManagerTexture wm(displaywindow);

			GUIThemeDefault theme;
			theme.set_resources(resources);

			GUIManager gui;
			gui.set_window_manager(wm);
			gui.set_theme(theme); 
			gui.set_css_document("../../../Resources/GUIThemeAero/theme.css");

			CustomComponent comp1(Rect(10, 10, 400, 200), &gui, Colorf::beige);
//			CustomComponent comp2(Rect(20, 210, 500, 400), &gui, Colorf::green);
//			CustomComponent comp3(Rect(50, 20, 600, 300), &gui, Colorf::blue);
			CustomComponent comp3(Rect(87, 200, 600, 300), &gui, Colorf::blue);
//			CustomComponent comp3(Rect(88, 200, 600, 300), &gui, Colorf::blue);

			gui.exec();
		}
		catch (Exception e)
		{
			ConsoleWindow console("Console");
			Console::write_line(e.message);
			console.display_close_message();
		}

		return 0;
	}
Beispiel #5
0
	int main(const std::vector<std::string> &args)
	{
		GUIWindowManagerSystem wm;

		GUIManager gui;
		gui.set_window_manager(wm);

		gui.add_theme("../../../Resources/GUIThemeAero/theme.css");
		//gui.add_theme("theme.css");

		gui.add_resources(clan::XMLResourceDocument("../../../Resources/GUIThemeAero/resources.xml"));
		//gui.add_resources(clan::XMLResourceDocument("resources.xml"));

		GUITopLevelDescription window_desc;
		window_desc.set_allow_resize(true);
		window_desc.set_size(Size(600, 600), false);
		Window window(&gui, window_desc);
//			window.set_id_name("mainmenu");
		window.func_close().set(this, &App::on_close, &window);

		GUILayoutCorners layout;
		window.set_layout(layout);

		window.create_components("dialog.xml");

		FPSLabel fps_label(&window);
		fps_label.set_geometry(Rect(10, 10, 100, 40));

		while (!gui.get_exit_flag())
		{
			gui.process_messages(0);
			window.request_repaint();
		}

		return gui.get_exit_code();
	}
Beispiel #6
0
	int main(const std::vector<std::string> &args)
	{
		ConsoleWindow console("Console");

		try
		{
			DisplayCache resources;
			resources.load("../../../Resources/GUIThemeLuna/resources.xml");
			
			GUIManager gui;

			GUIWindowManagerSystem wm;
			gui.set_window_manager(wm);

			GUIThemeDefault theme;
			theme.set_resources(resources);

			gui.set_theme(theme);
			gui.set_css_document("../../../Resources/GUIThemeLuna/theme.css");

			DisplayWindowDescription win_desc;
			win_desc.set_allow_resize(true);
			win_desc.set_title("Label test app."); 
			win_desc.set_position(Rect(200,200,600,700), false);
			Window root(&gui, win_desc);			
			root.func_close().set(this, &App::on_close, &root);
   
			Tab tab(&root);
			tab.set_geometry(Rect(Point(50,20),Size(280,360)));

			// tab 1
			TabPage *tab_page_1 = tab.add_page("foo");
			//tab_page_1->set_geometry(Rect(Point(0,0),Size(230,300)));
			//tab.add_page("foo", "foo", &tab_page_1);

			Label label_p1(tab_page_1);
			label_p1.set_geometry(Rect(Point(10,10),Size(130,20)));
			label_p1.set_text("tab page 1");

			PushButton btn_p1(tab_page_1);
			btn_p1.set_geometry(Rect(Point(10,30),Size(130,20)));
			btn_p1.set_text("Button Foo");

			// tab 2
			TabPage *tab_page_2 = tab.add_page("bar");
			//tab_page_2->set_geometry(Rect(Point(0,0),Size(230,300)));
			//tab.add_page("bar", "tab with really long name", &tab_page_2);
 
			Label label_p2(tab_page_2);
			label_p2.set_geometry(Rect(Point(10,10),Size(130,20)));
			label_p2.set_text("tab page 2");

			PushButton btn_p2(tab_page_2);
			btn_p2.set_geometry(Rect(Point(10,30),Size(80,26)));
			btn_p2.set_text("Button Bar");

			// tab 3
			TabPage *tab_page_3 = tab.add_page("p3");
			//tab_page_3->set_geometry(Rect(Point(0,0),Size(230,300)));
			//tab.add_page("p3", "p3", &tab_page_3);

			gui.exec();
		}
		catch (Exception e)
		{
 			Console::write_line(e.message);
			console.display_close_message();
		} 

		return 0;
	}
Beispiel #7
0
	int main(const std::vector<std::string> &args)
	{
		try
		{
			GUIManager gui;

			DisplayCache resources("../../../Resources/GUIThemeLuna/resources.xml");

			GUIWindowManagerSystem wm;
			gui.set_window_manager(wm);

			GUIThemeDefault theme;
			theme.set_resources(resources);
			gui.set_theme(theme); 
			//gui.set_css_document("theme.css");
			gui.set_css_document("../../../Resources/GUIThemeLuna/theme.css");

			DisplayWindowDescription win_desc;
			win_desc.set_allow_resize(true);
			win_desc.set_title("Button WM System Test Application");
			win_desc.set_position(RectPS(200, 200, 320, 240), false);
			Window window(&gui, win_desc);
			window.func_close().set(this, &App::on_close, &window);
	
			PushButton button(&window);
			button.set_geometry(RectPS(10, 10, 160, 40));
			button.set_text("Button 1");

			PushButton button2(&window);
			button2.set_geometry(RectPS(10, 50, 160, 40));
			button2.set_text("Button 2");
			button2.set_enabled(false);

			PushButton button3(&window);
			button3.set_geometry(RectPS(10, 90, 160, 40));
			button3.set_text("Button 3");
 
			CheckBox check1(&window);
			check1.set_geometry(RectPS(10, 130, 160, 21));
			check1.set_text("Check Box 1");

			CheckBox check2(&window);
			check2.set_geometry(RectPS(10, 160, 160, 21));
			check2.set_text("Check Box 2");
			check2.set_enabled(false);

			CheckBox check3(&window);
			check3.set_geometry(RectPS(10, 190, 160, 21));
			check3.set_text("Check Box 3");

			gui.exec();
		}
		catch (Exception e)
		{
			ConsoleWindow console("Console");
			Console::write_line(e.message);
			console.display_close_message();
		}

		return 0;
	}
Beispiel #8
0
	int main(const std::vector<std::string> &args)
	{
		ConsoleWindow console("Console");

		try
		{
			DisplayWindowDescription displaywindow_desc;
			displaywindow_desc.set_allow_resize(true);
			displaywindow_desc.set_title("Button WM Texture Test Application");
			displaywindow_desc.set_size(Size(640, 480), true);

			DisplayWindow displaywindow(displaywindow_desc);

//			GUIWindowManagerTexture wm(displaywindow);
			GUIWindowManagerSystem wm;

			GUIManager gui;
			gui.set_window_manager(wm);

//			DisplayCache resources("../../../Resources/GUIThemeLuna/resources.xml");
			DisplayCache resources("resources.xml");

			GUIThemeDefault theme;
			theme.set_resources(resources);
			gui.set_theme(theme);
//			gui.set_css_document("../../../Resources/GUIThemeLuna/theme.css");
			gui.set_css_document("theme.css");

			Window window(&gui, GUITopLevelDescription(Rect(200, 200, 540, 440), false));
			window.func_close().set(this, &App::on_close, &window);

			PushButton button(&window);
			button.set_geometry(Rect(10, 10, 160, 50));
			button.func_clicked().set(this, &App::on_button_clicked, &button);
			button.set_text("Button Normal");

			PushButton button_disabled(&window);
			button_disabled.set_geometry(Rect(10, 60, 160, 100));
			button_disabled.func_clicked().set(this, &App::on_button_clicked, &button_disabled);
			button_disabled.set_text("Button Disabled");
			button_disabled.set_enabled(false);

			PushButton button_ugly_flat(&window);
			button_ugly_flat.set_geometry(Rect(170, 110, 330, 150));
			button_ugly_flat.func_clicked().set(this, &App::on_button_clicked, &button_ugly_flat);
			button_ugly_flat.set_flat(true);
			button_ugly_flat.set_class_name("ugly");
			button_ugly_flat.set_text("Button Ugly Flat");

			PushButton button_ugly(&window);
			button_ugly.set_geometry(Rect(170, 10, 330, 50));
			button_ugly.func_clicked().set(this, &App::on_button_clicked, &button_ugly);
			button_ugly.set_flat(false);
			button_ugly.set_class_name("ugly");
			button_ugly.set_text("Button Ugly");

			PushButton button_ugly_disabled(&window);
			button_ugly_disabled.set_geometry(Rect(170, 60, 330, 100));
			button_ugly_disabled.func_clicked().set(this, &App::on_button_clicked, &button_ugly_disabled);
			button_ugly_disabled.set_class_name("ugly");
			button_ugly_disabled.set_text("Button Ugly Disabled");
			button_ugly_disabled.set_enabled(false);

			label = new Label(&window);
			label->set_geometry(Rect(10, 160, 330, 180));
			label->set_text("Click the buttons");

			gui.exec();
		}
		catch (Exception e)
		{
			Console::write_line(e.message);
			console.display_close_message();
		}

		return 0;
	}
Beispiel #9
0
	int main(const std::vector<std::string> &args)
	{
		GUIManager gui;

		GUIWindowManagerSystem wm;
		gui.set_window_manager(wm); 
		gui.add_theme("../../../Resources/GUIThemeAero/theme.css");
		gui.add_resources(clan::XMLResourceDocument("../../../Resources/GUIThemeAero/resources.xml"));
 
		DisplayWindowDescription win_desc;
		win_desc.set_allow_resize(true);
		win_desc.set_title("Popup Menu test app.");
		win_desc.set_drop_shadow(false);
		win_desc.set_size(Size(600,600), false);
		Window root(&gui, win_desc);			
		root.func_close().set(this, &App::on_close, &root); 

		MenuBar menubar(&root);
		menubar.set_geometry(Rect(0,0,400,24));

		PopupMenu menu_file;
		menu_file.insert_item("New");
		menu_file.insert_item("Open");
		menu_file.insert_item("Save");
		menu_file.insert_item("Exit");
		menubar.add_menu("File", menu_file);

		PopupMenu menu_edit;
		menu_edit.insert_item("Undo");
		menu_edit.insert_item("Redo");
		menu_edit.insert_separator();
		menu_edit.insert_item("Cut");
		menu_edit.insert_item("Copy");
		menu_edit.insert_separator();
		PopupMenuItem item_submenu = menu_edit.insert_item("Submenu");
		menu_edit.insert_separator();
		menu_edit.insert_item("Paste");
		menu_edit.insert_item("Delete");
		menu_edit.insert_separator();
		menu_edit.insert_item("Select All");

		PopupMenu menu_submenu;
		menu_submenu.insert_item("foo");
		menu_submenu.insert_item("bar");
		menu_submenu.insert_item("foobar");
		item_submenu.set_submenu(menu_submenu);

 		menubar.add_menu("Edit", menu_edit);

		PushButton button1(&root);
		button1.set_geometry(Rect(20, 100, 200, 125));
		button1.set_text("Click for pop-up menu");

		button1.func_clicked().set(this, &App::on_button1_clicked, &button1);

		ComboBox combobox1(&root);
		combobox1.set_geometry(Rect(20, 140, 200, 162));
		combobox1.set_popup_menu(menu_edit);
		combobox1.set_editable(false);

		gui.exec();

		return 0;
	}