/* * Set up main window, draw it. */ void ui_main() { mainwin = AG_WindowNew(AG_WINDOW_PLAIN); plpane = AG_PaneNew(mainwin, AG_PANE_VERT, 0); AG_Expand(plpane); { AG_LabelNew(plpane->div[0], 0, "Playlist"); playlisttable = AG_TableNewPolled(plpane->div[0], AG_TABLE_EXPAND, update_playlisttable, NULL); AG_TableSizeHint(playlisttable, 200, 15); AG_SetInt(playlisttable->hbar, "max", 0); /* HURR jak wylaczyc scrollbar? //AG_TableAddCol(playlisttable, "id", "<foo>", NULL); */ AG_TableAddCol(playlisttable, "Artist", "<some lengthy artist name>", NULL); AG_TableAddCol(playlisttable, "Title", NULL, NULL); AG_TableAddCol(playlisttable, "Length", "<9999:99>", NULL); /*AG_TableSetRowDblClickFn(playlisttable, handle_ui_events, "%i,%p", UI_CMD_PLAY_ID, playlisttable ); */ AG_TableSetRowDblClickFn(playlisttable, handle_ui_events, "%i", UI_CMD_PLAY_ID ); //jak to samo klawiatura osiagnac?*/ //AG_SetEvent(playlisttable, "window-keydown", keyboard_handler, NULL); } { AG_LabelNew(plpane->div[1], 0, "Library"); librarytable = AG_TableNewPolled(plpane->div[1], AG_TABLE_EXPAND, update_librarytable, NULL); AG_SetInt(librarytable->hbar, "max", 0); /* HURR jak wylaczyc scrollbar? */ AG_TableAddCol(librarytable, "Artist", "<some lengthy artist name>", NULL); AG_TableAddCol(librarytable, "Title", NULL, NULL); AG_TableAddCol(librarytable, "Length", "<9999:99>", NULL); AG_TableSetRowDblClickFn(librarytable, handle_ui_events, "%i", UI_CMD_PLAYLIST_ADD ); } artistlbl = AG_LabelNewPolled(mainwin, 0, "Artist: %s", &artistBuf); titlelbl = AG_LabelNewPolled(mainwin, 0, "Title: %s", &titleBuf); buttonbox = AG_BoxNew(mainwin, AG_BOX_HORIZ, 0); AG_ExpandHoriz(buttonbox); { prevbutton = AG_ButtonNewFn(buttonbox, 0, "|<", handle_ui_events, "%i", UI_CMD_PREV); stopbutton = AG_ButtonNewFn(buttonbox, 0, "[]", handle_ui_events, "%i", UI_CMD_STOP); pausebutton = AG_ButtonNewFn(buttonbox, 0, "||", handle_ui_events, "%i", UI_CMD_PAUSE); playbutton = AG_ButtonNewFn(buttonbox, 0, ">", handle_ui_events, "%i", UI_CMD_PLAY); nextbutton = AG_ButtonNewFn(buttonbox, 0, ">|", handle_ui_events, "%i", UI_CMD_NEXT); } statuslbl = AG_LabelNewPolled(mainwin, 0, "Status: %s", &statusBuf); AG_WindowMaximize(mainwin); AG_WindowShow(mainwin); }
static void MaximizeWindow(AG_Event *event) { AG_Titlebar *tbar = AG_PTR(1); AG_Window *win = tbar->win; AG_ObjectLock(win); if (win->flags & AG_WINDOW_MAXIMIZED) { AG_WindowUnmaximize(win); } else { AG_WindowMaximize(win); } AG_ObjectUnlock(win); }
MenuDeathmatchMaps::MenuDeathmatchMaps(){ AG_WindowMaximize(win); AG_WindowSetPadding(win, MENU_OFFSET, MENU_OFFSET, MENU_OFFSET, MENU_OFFSET); // nadpis createHeading("Deathmatch maps"); file_dlg_ = AG_FileDlgNew(win, AG_FILEDLG_LOAD); AG_Expand(file_dlg_); AG_FileDlgSetDirectory(file_dlg_, map_path); AG_FileDlgAddType(file_dlg_, "Bombic map XML", TIXML_FILE_EXTENSION, handlerCheckMap, 0); AG_FileDlgCancelAction(file_dlg_, handlerBack, 0); AG_SpacerNewHoriz(win); }
void OptionsState::enter() { int screenWidth = graphicsEngine->getScreenWidth(); int screenHeight = graphicsEngine->getScreenHeight(); int halfScreenWidth = screenWidth / 2; int halfScreenHeight = screenHeight / 2; AG_Window *win = AG_WindowNew(AG_WINDOW_PLAIN|AG_WINDOW_DENYFOCUS); AG_WindowShow(win); AG_WindowMaximize(win); interfaceManager->addWindow(win); // create options window AG_Window *optionWindow = AG_WindowNewNamed(AG_WINDOW_NOBUTTONS, "OptionWindow"); AG_WindowSetCaption(optionWindow, "Options"); AG_WindowSetGeometry(optionWindow, halfScreenWidth - 85, halfScreenHeight - 85, 170, 170); // alignment AG_VBox *box = AG_VBoxNew(optionWindow, 0); // create list of resolutions Point pt; pt.x = 1024; pt.y = 768; mRes.push_back(pt); pt.x = 800; pt.y = 600; mRes.push_back(pt); pt.x = 1280; pt.y = 1024; mRes.push_back(pt); pt.x = 1440; pt.y = 900; mRes.push_back(pt); // add selection box for resolution selectionBox = AG_UComboNew(box, 0); AG_ExpandHoriz(selectionBox); AG_UComboSizeHint(selectionBox, "Resolution", mRes.size()); // loop through all the resolutions for (unsigned int i = 0; i < mRes.size(); ++i) { std::stringstream str; str << mRes[i].x << " x " << mRes[i].y; AG_TlistAddPtr(selectionBox->list, NULL, str.str().c_str(), &mRes[i]); } AG_TlistSelect(selectionBox->list, AG_TlistFirstItem(selectionBox->list)); AG_SetEvent(selectionBox, "ucombo-selected", selected_resolution, NULL); std::stringstream fs; fs << "Fullscreen: " << mFullscreen; logger->logDebug(fs.str()); // add checkbox for fullscreen AG_CheckboxNewInt(box, 0, "Fullscreen", &mFullscreen); // add checkbox for hardware acceleration AG_CheckboxNewInt(box, 0, "OpenGL", &mOpenGL); // add radio for languages const char *languages[] = { "English", "Portugues", "Espa\xc3\xb1ol", NULL}; AG_RadioNewInt(box, 0, languages, &mLangs); AG_HBox *hbox = AG_HBoxNew(box, 0); // add button to apply AG_ButtonNewFn(hbox, 0, "Apply", apply_options, "%p%p%p", &mOpenGL, &mFullscreen, &mLangs); // add button to cancel AG_ButtonNewFn(hbox, 0, "Cancel", cancel_options, 0); AG_WindowShow(optionWindow); interfaceManager->addWindow(optionWindow); }