| 1 |
#include <ClanLib/core.h> |
| 2 |
#include <ClanLib/gui.h> |
| 3 |
#include <ClanLib/guistylesilver.h> |
| 4 |
#include <ClanLib/application.h> |
| 5 |
#include <ClanLib/display.h> |
| 6 |
#include <ClanLib/gl.h> |
| 7 |
|
| 8 |
// An about dialog |
| 9 |
class AboutDialog : public CL_Window |
| 10 |
{ |
| 11 |
public: |
| 12 |
AboutDialog(CL_Component *parent) : |
| 13 |
CL_Window( |
| 14 |
CL_Rect(300, 200, 425, 300), |
| 15 |
"About", |
| 16 |
CL_Window::close_button | CL_Window::maximize_button | CL_Window::minimize_button | CL_Window::help_button, |
| 17 |
parent), |
| 18 |
label( |
| 19 |
CL_Point(20, 10), |
| 20 |
"GUI Example 1.0", |
| 21 |
get_client_area()), |
| 22 |
button( |
| 23 |
CL_Rect(20, 40, 100, 60), |
| 24 |
"Okay", |
| 25 |
get_client_area()) |
| 26 |
{ |
| 27 |
slot_quit = button.sig_clicked().connect((CL_Component *) this, &CL_Component::quit); |
| 28 |
} |
| 29 |
|
| 30 |
private: |
| 31 |
CL_Label label; |
| 32 |
CL_Button button; |
| 33 |
CL_Slot slot_quit; |
| 34 |
}; |
| 35 |
|
| 36 |
// The main application |
| 37 |
class App : public CL_ClanApplication |
| 38 |
{ |
| 39 |
public: |
| 40 |
bool quit; |
| 41 |
|
| 42 |
CL_GUIManager *gui; |
| 43 |
CL_StyleManager *style; |
| 44 |
|
| 45 |
CL_ListBox *listbox; |
| 46 |
CL_Label *label_scroll1; |
| 47 |
CL_Label *label_scroll2; |
| 48 |
CL_Label *label_radio; |
| 49 |
CL_Label *label_fps; |
| 50 |
CL_ProgressBar *progress_x; |
| 51 |
CL_ProgressBar *progress_y; |
| 52 |
CL_Frame *frame1; |
| 53 |
CL_Button *button_quit; |
| 54 |
CL_Button *button_disabled; |
| 55 |
CL_Button *button_about; |
| 56 |
CL_Button *button_message1; |
| 57 |
CL_Button *button_file; |
| 58 |
CL_InputBox *input1; |
| 59 |
CL_InputBox *input2; |
| 60 |
CL_CheckBox *checkbox; |
| 61 |
CL_CheckBox *checkbox_disabled1; |
| 62 |
CL_CheckBox *checkbox_disabled2; |
| 63 |
CL_Button *button_bitmap; |
| 64 |
CL_Button *button_bitmap_disabled; |
| 65 |
CL_Frame *frame2; |
| 66 |
CL_Button *button_add; |
| 67 |
CL_Button *button_remove; |
| 68 |
CL_Frame *frame3; |
| 69 |
CL_Frame *frame4; |
| 70 |
CL_ScrollBar *scrollbar1; |
| 71 |
CL_ScrollBar *scrollbar2; |
| 72 |
CL_ScrollBar *scrollbar3; |
| 73 |
CL_ScrollBar *scrollbar4; |
| 74 |
CL_ScrollBar *scrollbar5; |
| 75 |
CL_ScrollBar *scrollbar6; |
| 76 |
CL_ScrollBar *scrollbar7; |
| 77 |
CL_Button *button_bitmap2; |
| 78 |
CL_Label *label_rightclick; |
| 79 |
CL_RadioButton *r1; |
| 80 |
CL_RadioButton *r2; |
| 81 |
CL_RadioButton *r3; |
| 82 |
CL_RadioButton *r4; |
| 83 |
CL_Menu *menu; |
| 84 |
CL_Menu *popup_menu; |
| 85 |
CL_TreeView *treeview; |
| 86 |
CL_FramerateCounter *fps; |
| 87 |
|
| 88 |
int main(int argc, char** argv) |
| 89 |
{ |
| 90 |
// Create a console window for text-output if not available |
| 91 |
CL_ConsoleWindow console("Console"); |
| 92 |
console.redirect_stdio(); |
| 93 |
|
| 94 |
try |
| 95 |
{ |
| 96 |
std::cout << "This example shows how to create components dynamically" << std::endl; |
| 97 |
std::cout << "(without using .gui files)" << std::endl; |
| 98 |
std::cout << std::endl; |
| 99 |
|
| 100 |
CL_SetupCore setup_core; |
| 101 |
CL_SetupDisplay setup_disp; |
| 102 |
CL_SetupGL setup_gl; |
| 103 |
CL_SetupGUI setup_gui; |
| 104 |
|
| 105 |
CL_DisplayWindow window("GUITest example", 640, 480); |
| 106 |
|
| 107 |
// Create the GUI using the default style |
| 108 |
CL_ResourceManager gui_resources("../../Resources/GUIStyleSilver/gui.xml", false); |
| 109 |
style = new CL_StyleManager_Silver(&gui_resources); |
| 110 |
gui = new CL_GUIManager(style); |
| 111 |
|
| 112 |
// Load some extra resources |
| 113 |
CL_ResourceManager resources("resources.xml", false); |
| 114 |
|
| 115 |
// Create the menus |
| 116 |
create_menus(); |
| 117 |
popup_menu = 0; |
| 118 |
|
| 119 |
// set menu icon |
| 120 |
CL_MenuItem_Silver *item_save_style = static_cast<CL_MenuItem_Silver *>(menu->get_item("File/Save")->get_style()); |
| 121 |
item_save_style->set_icon( new CL_Surface("icon_save", &resources), true ); |
| 122 |
|
| 123 |
// Create some standard buttons (with tab-id) |
| 124 |
frame1 = new CL_Frame(CL_Rect(10, 30, 113, 193), gui); |
| 125 |
button_quit = new CL_Button(CL_Rect(10, 10, 93, 33), "Quit", frame1); |
| 126 |
button_disabled = new CL_Button(CL_Rect(10, 40, 93, 63), "Disabled", frame1); |
| 127 |
button_disabled->enable(false); |
| 128 |
button_about = new CL_Button(CL_Rect(10, 70, 93, 93), "About", frame1); |
| 129 |
button_message1 = new CL_Button(CL_Rect(10, 100, 93, 123), "Message 1", frame1); |
| 130 |
button_file = new CL_Button(CL_Rect(10, 130, 93, 153), "Open File", frame1); |
| 131 |
|
| 132 |
button_quit->set_tab_id(0); |
| 133 |
button_about->set_tab_id(1); |
| 134 |
button_message1->set_tab_id(2); |
| 135 |
button_file->set_tab_id(3); |
| 136 |
|
| 137 |
// Create inputboxes |
| 138 |
input1 = new CL_InputBox(CL_Rect(140, 30, 280, 0), "Input here", gui); |
| 139 |
input2 = new CL_InputBox(CL_Rect(140, 60, 280, 0), "Disabled input here", gui); |
| 140 |
input2->enable(false); |
| 141 |
|
| 142 |
// Create checkboxes |
| 143 |
checkbox = new CL_CheckBox(CL_Point(140, 90), "Check this out", gui); |
| 144 |
checkbox_disabled1 = new CL_CheckBox(CL_Point(140, 110), "Disabled check", gui); |
| 145 |
checkbox_disabled1->enable(false); |
| 146 |
checkbox_disabled2 = new CL_CheckBox(CL_Point(140, 130), "Disabled check", gui); |
| 147 |
checkbox_disabled2->set_checked(); |
| 148 |
checkbox_disabled2->enable(false); |
| 149 |
|
| 150 |
// Create progressbars |
| 151 |
progress_x = new CL_ProgressBar(CL_Rect(300, 30, 440, 50), 640, gui); |
| 152 |
progress_y = new CL_ProgressBar(CL_Rect(300, 60, 440, 80), 480, gui); |
| 153 |
|
| 154 |
// Create some bitmapped buttons |
| 155 |
CL_Surface surface_up("button_surface1", &resources); |
| 156 |
CL_Surface surface_highlighted("button_surface2", &resources); |
| 157 |
CL_Surface surface_down("button_surface3", &resources); |
| 158 |
CL_Surface surface_disabled("button_surface4", &resources); |
| 159 |
|
| 160 |
button_bitmap = new CL_Button(CL_Point(140, 150), "", gui); |
| 161 |
CL_Button_Silver *button_bitmap_style = (CL_Button_Silver *)button_bitmap->get_style(); |
| 162 |
button_bitmap_style->set_surface_up(&surface_up); |
| 163 |
button_bitmap_style->set_surface_down(&surface_down); |
| 164 |
button_bitmap_style->set_surface_highlighted(&surface_highlighted); |
| 165 |
button_bitmap->find_preferred_size(); |
| 166 |
|
| 167 |
button_bitmap_disabled = new CL_Button(CL_Point(205, 150), "", gui); |
| 168 |
button_bitmap_disabled->enable(false); |
| 169 |
CL_Button_Silver *button_bitmap_disabled_style = (CL_Button_Silver *)button_bitmap_disabled->get_style(); |
| 170 |
button_bitmap_disabled_style->set_surface_up(&surface_up); |
| 171 |
button_bitmap_disabled_style->set_surface_disabled(&surface_disabled); |
| 172 |
button_bitmap_disabled->find_preferred_size(); |
| 173 |
|
| 174 |
// Create a listbox and some extras |
| 175 |
frame2 = new CL_Frame(CL_Rect(10, 200, 200, 468), gui); |
| 176 |
button_add = new CL_Button(CL_Rect(10, 10, 180, 29), "Add item", frame2); |
| 177 |
button_remove = new CL_Button(CL_Rect(10, 29, 180, 48), "Remove item", frame2); |
| 178 |
|
| 179 |
listbox = new CL_ListBox(CL_Rect(10, 48, 180, 256), frame2); |
| 180 |
// listbox->set_multi_selection(); |
| 181 |
|
| 182 |
// Add some dummy data to the listbox |
| 183 |
for(int i=0; i<20; i++) |
| 184 |
{ |
| 185 |
std::string str = CL_String::format("ListItem %1...", i + 1); |
| 186 |
listbox->insert_item(str); |
| 187 |
} |
| 188 |
|
| 189 |
// Create some scrollbars |
| 190 |
frame3 = new CL_Frame(CL_Rect(210, 200, 450, 468), gui); |
| 191 |
frame4 = new CL_Frame(CL_Rect(10, 10, 450-210-10, 468-180-30), frame3); |
| 192 |
scrollbar1 = new CL_ScrollBar(CL_Rect(10, 10, 28, 218), 1, 1, 0, frame4); |
| 193 |
scrollbar2 = new CL_ScrollBar(CL_Rect(40, 10, 58, 218), 1, 2, 0, frame4); |
| 194 |
scrollbar3 = new CL_ScrollBar(CL_Rect(70, 10, 88, 218), 1, 3, 0, frame4); |
| 195 |
scrollbar4 = new CL_ScrollBar(CL_Rect(100, 10, 118, 218), 1, 10, 0, frame4); |
| 196 |
scrollbar5 = new CL_ScrollBar(CL_Rect(130, 10, 148, 218), 1, 100, 0, frame4); |
| 197 |
scrollbar6 = new CL_ScrollBar(CL_Rect(160, 10, 178, 218), 100, 1000, 0, frame4); |
| 198 |
scrollbar7 = new CL_ScrollBar(CL_Rect(10, 220, 180, 238), 1, 10, 1, frame4); |
| 199 |
scrollbar6->set_tracking(false); |
| 200 |
label_scroll1 = new CL_Label(CL_Point(190, 30), "100 ", frame4); |
| 201 |
label_scroll2 = new CL_Label(CL_Point(190, 50), "100 ", frame4); |
| 202 |
|
| 203 |
// Create a treeview |
| 204 |
treeview = new CL_TreeView(CL_Rect(500, 90, 630, 470), gui); |
| 205 |
CL_TreeItem *item1 = treeview->insert_item("Item 1"); |
| 206 |
CL_TreeItem *item11 = item1->get_node()->insert_item("Item 1-1"); |
| 207 |
CL_TreeItem *item2 = treeview->insert_item("Item 2"); |
| 208 |
CL_TreeItem *item21 = item2->get_node()->insert_item("Item 2-1"); |
| 209 |
CL_TreeItem *item211 = item21->get_node()->insert_item("Item 2-1-1"); |
| 210 |
CL_TreeItem *item212 = item21->get_node()->insert_item("Item 2-1-2"); |
| 211 |
|
| 212 |
/* CL_TreeView treeview(CL_Rect(500, 90, 630, 470), gui); |
| 213 |
CL_Button treebutton("Item 2", NULL, gui->get_style_manager()); // Create a button as a treeitem to show off :) |
| 214 |
CL_TreeNode *node1 = treeview.insert_item("Item 1"); |
| 215 |
node1->insert_item("Item 1-1"); |
| 216 |
CL_TreeNode *node2 = treeview.insert_item(&treebutton); |
| 217 |
CL_TreeNode *node21 = node2->insert_item("Item 2-1"); |
| 218 |
node21->insert_item("Item 2-1-1"); |
| 219 |
node21->insert_item("Item 2-1-2"); |
| 220 |
*/ |
| 221 |
label_rightclick = new CL_Label(CL_Point(500, 40), "Right click for popup", gui); |
| 222 |
|
| 223 |
label_fps = new CL_Label(CL_Rect(500, 60, 700, 75), "", gui); |
| 224 |
/* |
| 225 |
button_bitmap2 = new CL_Button("", &surface_up, &surface_down, &surface_disabled, &surface_highlighted, NULL, style); |
| 226 |
popup = new CL_PopupMenu(CL_Rect(500, 90, 600, 470), NULL, style); |
| 227 |
subpopup = new CL_PopupMenu(CL_Rect(500, 90, 600, 470), NULL, style); |
| 228 |
popup->insert_item("Open File..."); |
| 229 |
popup->insert_item("Save File"); |
| 230 |
popup->insert_item("About", subpopup); |
| 231 |
popup->insert_item(button_bitmap2, false); |
| 232 |
popup->insert_item("Quit"); |
| 233 |
subpopup->insert_item("ClanLib"); |
| 234 |
subpopup->insert_item("This GUI Example"); |
| 235 |
*/ |
| 236 |
// Create some radiobuttons |
| 237 |
CL_RadioGroup radio; |
| 238 |
r1 = new CL_RadioButton(CL_Point(300, 90), "Radio 1", gui); |
| 239 |
r2 = new CL_RadioButton(CL_Point(300, 110), "Radio 2", gui); |
| 240 |
r3 = new CL_RadioButton(CL_Point(300, 130), "Radio 3", gui); |
| 241 |
radio.add(r1); |
| 242 |
radio.add(r2); |
| 243 |
radio.add(r3); |
| 244 |
label_radio = new CL_Label(CL_Point(350, 160), "No radiobutton selected", gui); |
| 245 |
|
| 246 |
// Background draw (needed for modal dialogs) |
| 247 |
CL_Slot slot_paint = gui->sig_paint().connect(this, &App::on_paint); |
| 248 |
|
| 249 |
// Mouse movement |
| 250 |
CL_Slot slot_mouse_move = CL_Mouse::sig_move().connect(this, &App::on_mouse_move); |
| 251 |
|
| 252 |
// Quit |
| 253 |
CL_Slot slot_quit = button_quit->sig_clicked().connect(this, &App::on_quit); |
| 254 |
CL_Slot slot_window_quit = window.sig_window_close().connect(this, &App::on_quit); |
| 255 |
CL_Slot slot_menu_quit = menu->get_node("File/Quit")->sig_clicked().connect(this, &App::on_quit); |
| 256 |
|
| 257 |
// Radio button selection changed |
| 258 |
CL_Slot slot_radio = radio.sig_selection_changed().connect(this, &App::on_radio); |
| 259 |
|
| 260 |
// Show some about information (in a custom dialog) |
| 261 |
CL_Slot slot_about = button_about->sig_clicked().connect(this, &App::on_about); |
| 262 |
|
| 263 |
// Show a messagebox |
| 264 |
CL_Slot slot_message1 = button_message1->sig_clicked().connect(this, &App::on_message); |
| 265 |
|
| 266 |
// Show a filedialog |
| 267 |
CL_Slot slot_file = button_file->sig_clicked().connect(this, &App::on_file); |
| 268 |
|
| 269 |
// Add an item to the listbox |
| 270 |
CL_Slot slot_add_item = button_add->sig_clicked().connect(this, &App::on_add_item); |
| 271 |
|
| 272 |
// Remove selected items from listbox |
| 273 |
CL_Slot slot_remove_item = button_remove->sig_clicked().connect(this, &App::on_remove_item); |
| 274 |
|
| 275 |
// Display scroll values |
| 276 |
CL_Slot slot_scroll_moved = scrollbar6->sig_slider_moved().connect(this, &App::on_scroll_moved); |
| 277 |
CL_Slot slot_scroll_changed = scrollbar6->sig_value_changed().connect(this, &App::on_scroll_changed); |
| 278 |
|
| 279 |
// Open a popupmenu when rightclicking label |
| 280 |
CL_Slot slot_rightclick = label_rightclick->sig_mouse_down().connect(this, &App::on_rightclick_label); |
| 281 |
|
| 282 |
// menu->raise(); opt_submenu->raise(); |
| 283 |
// bg_submenu->raise(); selector_submenu->raise(); |
| 284 |
|
| 285 |
fps = new CL_FramerateCounter; |
| 286 |
|
| 287 |
quit = false; |
| 288 |
|
| 289 |
// Why the heck do I need to draw the GUI once before things start appearing?? |
| 290 |
// - mbn 2nd nov 2003 |
| 291 |
gui->show(); |
| 292 |
|
| 293 |
// Main loop |
| 294 |
while (!quit) |
| 295 |
{ |
| 296 |
if (gui->get_update_trigger()->get_flag()) |
| 297 |
{ |
| 298 |
gui->get_update_trigger()->reset(); |
| 299 |
gui->show(); |
| 300 |
CL_Display::flip(); |
| 301 |
} |
| 302 |
|
| 303 |
CL_System::keep_alive(); |
| 304 |
} |
| 305 |
|
| 306 |
delete gui; |
| 307 |
delete style; |
| 308 |
delete fps; |
| 309 |
/* |
| 310 |
CL_SetupGL::deinit(); |
| 311 |
CL_SetupGUI::deinit(); |
| 312 |
CL_SetupDisplay::deinit(); |
| 313 |
CL_SetupCore::deinit(); |
| 314 |
*/ |
| 315 |
} |
| 316 |
catch (CL_Error e) |
| 317 |
{ |
| 318 |
std::cout << e.message.c_str() << std::endl; |
| 319 |
|
| 320 |
// Display console close message and wait for a key |
| 321 |
console.display_close_message(); |
| 322 |
} |
| 323 |
|
| 324 |
return 0; |
| 325 |
} |
| 326 |
|
| 327 |
void on_paint() |
| 328 |
{ |
| 329 |
label_fps->set_text(fps->get_fps()); |
| 330 |
|
| 331 |
CL_Display::clear(CL_Color(240, 242, 244)); |
| 332 |
} |
| 333 |
|
| 334 |
void on_mouse_move(const CL_InputEvent &key) |
| 335 |
{ |
| 336 |
progress_x->set_progress(key.mouse_pos.x); |
| 337 |
progress_y->set_progress(key.mouse_pos.y); |
| 338 |
} |
| 339 |
|
| 340 |
void on_rightclick_label(const CL_InputEvent &key) |
| 341 |
{ |
| 342 |
// Create a menu |
| 343 |
if( popup_menu == 0 ) |
| 344 |
{ |
| 345 |
popup_menu = new CL_Menu(CL_Point(CL_Mouse::get_x(), CL_Mouse::get_y()), gui); |
| 346 |
popup_menu->set_vertical(true); |
| 347 |
popup_menu->set_root_collapsing(true); |
| 348 |
popup_menu->create_item("New"); |
| 349 |
popup_menu->create_item("Open"); |
| 350 |
popup_menu->create_item("Save"); |
| 351 |
popup_menu->create_item("Save As..."); |
| 352 |
popup_menu->create_item("Sub"); |
| 353 |
popup_menu->create_item("Sub/menu"); |
| 354 |
popup_menu->create_item("Sub/items"); |
| 355 |
} |
| 356 |
else |
| 357 |
{ |
| 358 |
popup_menu->set_position(CL_Mouse::get_x(), CL_Mouse::get_y()); |
| 359 |
popup_menu->show(); |
| 360 |
} |
| 361 |
} |
| 362 |
|
| 363 |
void on_radio(CL_RadioButton *button) |
| 364 |
{ |
| 365 |
label_radio->set_text(button->get_text()); |
| 366 |
} |
| 367 |
|
| 368 |
void on_about() |
| 369 |
{ |
| 370 |
AboutDialog about(gui); |
| 371 |
about.run(); |
| 372 |
} |
| 373 |
|
| 374 |
void on_scroll_moved(int value) |
| 375 |
{ |
| 376 |
label_scroll1->set_text(value); |
| 377 |
} |
| 378 |
|
| 379 |
void on_scroll_changed(int value) |
| 380 |
{ |
| 381 |
label_scroll2->set_text(value); |
| 382 |
} |
| 383 |
|
| 384 |
void on_message() |
| 385 |
{ |
| 386 |
CL_MessageBox::info( |
| 387 |
"Message for the user", |
| 388 |
"This is a sample message...", |
| 389 |
"Yes", "I don't know", "No", |
| 390 |
gui); |
| 391 |
} |
| 392 |
|
| 393 |
void on_quit() |
| 394 |
{ |
| 395 |
quit = true; |
| 396 |
} |
| 397 |
|
| 398 |
void on_remove_item() |
| 399 |
{ |
| 400 |
int item = listbox->get_current_item(); |
| 401 |
|
| 402 |
// If someone didn't select anything, just remove the first item from the list. |
| 403 |
if (item < 0) |
| 404 |
item = 0; |
| 405 |
|
| 406 |
listbox->remove_item(item); |
| 407 |
} |
| 408 |
|
| 409 |
void on_add_item() |
| 410 |
{ |
| 411 |
std::string str = CL_String::format("New item %1", listbox->get_count() + 1); |
| 412 |
listbox->insert_item(str); |
| 413 |
} |
| 414 |
|
| 415 |
void on_file() |
| 416 |
{ |
| 417 |
std::string filename = CL_FileDialog::open("", "*.cpp", gui); |
| 418 |
if(filename != "") |
| 419 |
CL_MessageBox::info("You selected a filename", filename, gui); |
| 420 |
} |
| 421 |
|
| 422 |
void create_menus() |
| 423 |
{ |
| 424 |
// - - - - - File - - - - - |
| 425 |
menu = new CL_Menu( CL_Point(0,0), gui, style); |
| 426 |
menu->create_item("File/New"); |
| 427 |
menu->create_item("File/Open"); |
| 428 |
menu->create_item("File/Save"); |
| 429 |
menu->create_item("File/Save As..."); |
| 430 |
menu->create_item("File/Quit"); |
| 431 |
|
| 432 |
// - - - - - Localized - - - - - |
| 433 |
menu->create_item("Localized/Expression/imbored", "Localized/ClanSpeak/dumdidumdum"); |
| 434 |
menu->create_item("Localized/Expression/reconnect", "Localized/ClanSpeak/DOOM DE DOOM"); |
| 435 |
menu->create_item("Localized/Expression/yousuck", "Localized/ClanSpeak/Ermn"); |
| 436 |
|
| 437 |
// - - - - - Widgets - - - - - |
| 438 |
|
| 439 |
// buttons |
| 440 |
CL_MenuNode *button_node1 = menu->create_node("Widgets/Button/node_1"); |
| 441 |
CL_MenuNode *button_node2 = menu->create_node("Widgets/Button/node_2"); |
| 442 |
button_node1->set_close_on_click(false); |
| 443 |
button_node2->set_close_on_click(false); |
| 444 |
CL_Button *menu_button = new CL_Button( "Hello, World!", button_node1 ); |
| 445 |
CL_Button *menu_button2 = new CL_Button( "dumdidum", button_node2); |
| 446 |
|
| 447 |
// Listbox |
| 448 |
CL_MenuNode *list_node = menu->create_node("Widgets/ListBox/node_1"); |
| 449 |
list_node->set_close_on_click(false); |
| 450 |
CL_ListBox *menu_list = new CL_ListBox( CL_Rect(17,0,140,50), list_node ); |
| 451 |
menu_list->insert_item(std::string("dumdidumdum")); |
| 452 |
menu_list->insert_item(std::string("doom de doom")); |
| 453 |
|
| 454 |
// Scrollbar |
| 455 |
CL_MenuNode *scroll_node = menu->create_node("Widgets/ScrollBar/node_1"); |
| 456 |
CL_ScrollBar *scrollbar = new CL_ScrollBar(CL_Rect(30, 13, 200, 28), 1, 100, 1, scroll_node); |
| 457 |
scroll_node->set_close_on_click(false); |
| 458 |
|
| 459 |
// - - - - - Tests - - - - - |
| 460 |
|
| 461 |
menu->create_toggle_item("Tests/toggling item"); |
| 462 |
menu->create_toggle_item("Tests/disabled toggle")->enable(false); |
| 463 |
menu->create_item("Tests/disabled")->enable(false); |
| 464 |
menu->create_item("Tests/no close")->set_close_on_click(false); |
| 465 |
|
| 466 |
menu->create_item("Tests/Disabled Menu/item 1"); |
| 467 |
menu->create_item("Tests/Disabled Menu/item 2"); |
| 468 |
menu->create_item("Tests/Disabled Menu/Submenu/item 1"); |
| 469 |
menu->create_item("Tests/Disabled Menu/Submenu2/item 2"); |
| 470 |
menu->get_node("Tests/Disabled Menu")->enable(false); |
| 471 |
} |
| 472 |
} app; |