Пример #1
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;
    }
Пример #2
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();
	}
Пример #3
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;
	}