void ForeignMenuConnection::add_sub_menu() { if (_sub_menu) { AutoRef<Menu> app_menu(_handler->get_app_menu()); (*app_menu)->add_sub(_sub_menu); } }
ForeignMenuConnection::~ForeignMenuConnection() { if (_opaque != NamedPipe::INVALID_CONNECTION) { NamedPipe::destroy_connection(_opaque); } if (_handler) { AutoRef<Menu> app_menu(_handler->get_app_menu()); (*app_menu)->remove_sub(_sub_menu); _handler->update_menu(); _handler->clear_menu_items(_opaque); } if (_sub_menu) { _sub_menu->unref(); } }
void app_run() { char ch; while(1) { app_menu(); ch=getch(); switch(ch) { case '1': front_push(); break; case '2': back_push(); break; case '3': front_pop(); break; case '4': back_pop(); break; case '5': return; } system("pause"); } }
void app_run() { char ch; while(1) { app_menu(); ch=getch(); switch(ch) { case '1': manager_insert(); break; case '2': manager_printall(); break; case '3': manager_Search(); break; case '4': manager_Dele(); break; case '5': manager_Modify(); break; case '6': return; } system("pause"); } }
basic_building& simulation::create_building(WINDOW* scr) { /* * The base of this code will eventually become the building editor * and the idea behind it will form the general procedure for editing * objects * * Meaning it will be split into (template) functions */ //create our form for input generic_form values_form(scr); keypad (scr, TRUE); //add the input fields values_form.add_field("Enter the width: ", false); values_form.add_field("Enter the height: ", false); values_form.add_field("Enter the name: ", true); values_form.add_field("Enter the desc:", true); //give the form control and fill fields values_form.fill_form(); status_message = "(q) Quit (s) Switch Solid State (c) Set Appearance"; //create the basic building basic_building* new_building = new basic_building(values_form.get_str_input(0), values_form.get_str_input(1), 0, 0, values_form.get_int_input(0), values_form.get_int_input(1)); //create a derived window of scr that can fit our new building WINDOW* building_scr = derwin(scr, new_building->get_length(), new_building->get_width(), 2, 0); //print some console messages console_print("New building printed to screen"); console_print("Building name: " + new_building->get_name()); //while we are not done editing the building //aka main loop int c = 0; //print the building to the derived window new_building->print_building(building_scr); //update our screen update_parent_child(scr, building_scr); wmove(building_scr, 0, 0); keypad(building_scr, TRUE); //refresh the derived window int cursor_x = 0; int cursor_y = 0; wrefresh(building_scr); //create a generic_menu object because switch statements don't allow //declarations within them generic_menu app_menu(scr); //might as well fill it in up here, so it doesn't clutter up down there app_menu.add_choice("#", 0); app_menu.add_choice("+", 1); app_menu.add_choice("_", 2); app_menu.add_choice(" ", 3); app_menu.set_pos(2, new_building->get_width() + 1); while((c = wgetch(building_scr)) != 'q') { getyx(building_scr, cursor_y, cursor_x); switch (c) { case KEY_UP: wmove(building_scr, cursor_y - 1, cursor_x); print_tile_info(scr, new_building->get_tile(cursor_y - 1, cursor_x)); update_parent_child(scr, building_scr); break; case KEY_DOWN: wmove(building_scr, cursor_y + 1, cursor_x); print_tile_info(scr, new_building->get_tile(cursor_y + 1, cursor_x)); update_parent_child(scr, building_scr); break; case KEY_LEFT: wmove(building_scr, cursor_y, cursor_x - 1); print_tile_info(scr, new_building->get_tile(cursor_y, cursor_x - 1)); update_parent_child(scr, building_scr); break; case KEY_RIGHT: wmove(building_scr, cursor_y, cursor_x + 1); print_tile_info(scr, new_building->get_tile(cursor_y, cursor_x + 1)); update_parent_child(scr, building_scr); break; case 's': //switch solidity state of the tile new_building->get_tile(cursor_y, cursor_x)->set_solid (!new_building->get_tile(cursor_y, cursor_x)->is_solid()); print_tile_info(scr, new_building->get_tile(cursor_y, cursor_x)); break; case 'c': c = app_menu.get_choice(); switch (c) { case 0: new_building->get_tile(cursor_y, cursor_x)->set_app('#'); break; case 1: new_building->get_tile(cursor_y, cursor_x)->set_app('+'); break; case 2: new_building->get_tile(cursor_y, cursor_x)->set_app('_'); break; case 4: new_building->get_tile(cursor_y, cursor_x)->set_app(' '); break; } new_building->print_building(building_scr); print_tile_info(scr, new_building->get_tile(cursor_y, cursor_x)); } update_parent_child(scr, building_scr); } }
void setup_main_window( application_t* app ) { // INIT ONCE all this stuff! INITCOMMONCONTROLSEX control_info = { sizeof(INITCOMMONCONTROLSEX), 0x0000FFFF }; ::InitCommonControlsEx(&control_info); WNDCLASSW wc; const wchar_t* window_class(L"adobe_begin_main_window"); wc.style = CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = main_window_proc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = ::GetModuleHandle(NULL); wc.hIcon = LoadIcon(wc.hInstance, MAKEINTRESOURCE(RES_APP_ICON)); wc.hCursor = LoadCursor(0, IDC_ARROW); wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); wc.lpszMenuName = window_class; wc.lpszClassName = window_class; RegisterClassW(&wc); HWND root_window = ::CreateWindowExW(WS_EX_WINDOWEDGE | WS_EX_DLGMODALFRAME | WS_EX_COMPOSITED, window_class, L"Adobe Begin", WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU, 10, 10, 640, 480, NULL, ::CreateMenu(), ::GetModuleHandle(NULL), NULL); if (root_window == NULL) throw std::runtime_error("Could not open main window"); ::ShowWindow(root_window, SW_NORMAL); ::DragAcceptFiles(root_window, TRUE); ::SetWindowLongPtrA(root_window, GWLP_USERDATA, hackery::cast<LONG>(app)); // setup the menu system HMENU menu_bar(::GetMenu(root_window)); HMENU app_menu(::CreatePopupMenu()); HMENU view_options_menu(::CreatePopupMenu()); HMENU localization_menu(::CreatePopupMenu()); ::AppendMenu(app_menu, MF_STRING, ADOBE_ABOUT, _T("&About Adobe Begin")); ::AppendMenu(app_menu, MF_SEPARATOR, 0, NULL); ::AppendMenu(app_menu, MF_STRING, ADOBE_QUIT, _T("&Quit Adobe Begin")); ::AppendMenu(view_options_menu, MF_STRING, ADOBE_REFRESH_VIEW, _T("&Refresh View")); ::AppendMenu(view_options_menu, MF_STRING, ADOBE_REFRESH_SHEET, _T("R&efresh Sheet")); ::AppendMenu(view_options_menu, MF_SEPARATOR, 0, NULL); ::AppendMenu(view_options_menu, MF_STRING, ADOBE_NORMAL_DIALOG_SIZE, _T("&Normal Dialog Size")); ::AppendMenu(view_options_menu, MF_STRING, ADOBE_SMALL_DIALOG_SIZE, _T("&Small Dialog Size")); ::AppendMenu(view_options_menu, MF_STRING, ADOBE_MINI_DIALOG_SIZE, _T("&Mini Dialog Size")); ::AppendMenu(view_options_menu, MF_SEPARATOR, 0, NULL); ::AppendMenu(view_options_menu, MF_STRING, ADOBE_SHOW_WIDGET_FRAMES, _T("&Show Widget Frames")); ::AppendMenu(view_options_menu, MF_STRING, ADOBE_CLEAR_WIDGET_FRAMES, _T("&Clear Widget Frames")); ::AppendMenu(view_options_menu, MF_SEPARATOR, 0, NULL); ::AppendMenu(view_options_menu, MF_STRING, ADOBE_SERIALIZE_WIDGETS, _T("&Serialize Widgets")); ::AppendMenu(view_options_menu, MF_SEPARATOR, 0, NULL); ::AppendMenu(view_options_menu, MF_STRING, ADOBE_RUN_MODAL, _T("&Run Modal")); ::AppendMenu(localization_menu, MF_STRING, ADOBE_LOCALIZATION_ENUS, _T("&Standard English (en-us)")); ::AppendMenu(localization_menu, MF_STRING, ADOBE_LOCALIZATION_DEDE, _T("&German (de-de)")); ::AppendMenu(localization_menu, MF_STRING, ADOBE_LOCALIZATION_JAJP, _T("&Japanese (ja-jp)")); ::AppendMenu(localization_menu, MF_STRING, ADOBE_LOCALIZATION_KOKR, _T("&Korean (ko-kr)")); ::AppendMenu(localization_menu, MF_STRING, ADOBE_LOCALIZATION_PGPG, _T("&Pig Latin (pg-pg)")); ::AppendMenu(menu_bar, MF_POPUP, hackery::cast<UINT_PTR>(app_menu), _T("&Adobe Begin")); ::AppendMenu(menu_bar, MF_POPUP, hackery::cast<UINT_PTR>(view_options_menu), _T("&View Options")); ::AppendMenu(menu_bar, MF_POPUP, hackery::cast<UINT_PTR>(localization_menu), _T("&Localization")); ::DrawMenuBar(root_window); // set root in display adobe::get_main_display().set_root(root_window); }