static void Init(void *obj) { AG_Titlebar *tbar = obj; AG_Box *box = obj; WIDGET(tbar)->flags |= AG_WIDGET_HFILL| AG_WIDGET_UNFOCUSED_BUTTONUP; AG_BoxSetType(box, AG_BOX_HORIZ); AG_BoxSetPadding(&tbar->hb, 3); AG_BoxSetSpacing(&tbar->hb, 1); tbar->flags = 0; tbar->pressed = 0; tbar->win = NULL; tbar->maximize_btn = NULL; tbar->minimize_btn = NULL; tbar->close_btn = NULL; tbar->label = AG_LabelNewS(tbar, AG_LABEL_HFILL|AG_LABEL_NOMINSIZE, _("Untitled")); AG_LabelSizeHint(tbar->label, 1, "X"); AG_LabelSetPadding(tbar->label, 5,5,2,2); AG_SetEvent(tbar, "mouse-button-down", MouseButtonDown, NULL); AG_SetEvent(tbar, "mouse-button-up", MouseButtonUp, NULL); }
AG_Box *AGOL_About::CreateLicenseBox(void *parent) { AG_Box *lbox; AG_Textbox *text; lbox = AG_BoxNewVert(parent, AG_BOX_EXPAND); AG_LabelNewS(lbox, 0, "License"); lbox = AG_BoxNewHoriz(lbox, AG_BOX_EXPAND); AG_BoxSetPadding(lbox, 5); AG_BoxSetSpacing(lbox, 5); #if !AG_VERSION_ATLEAST(1,4,2) text = AG_TextboxNewS(lbox, AG_TEXTBOX_MULTILINE | AG_TEXTBOX_EXPAND, ""); #else text = AG_TextboxNewS(lbox, AG_TEXTBOX_READONLY | AG_TEXTBOX_MULTILINE | AG_TEXTBOX_EXPAND, ""); #endif AG_TextboxSetWordWrap(text, true); AG_TextboxSetString(text, license.c_str()); #if !AG_VERSION_ATLEAST(1,4,2) AG_SetEvent(text, "textbox-prechg", EventReceiver, "%p", RegisterEventHandler((EVENT_FUNC_PTR)&AGOL_About::OnLicensePrechg)); AG_SetEvent(text, "textbox-postchg", EventReceiver, "%p", RegisterEventHandler((EVENT_FUNC_PTR)&AGOL_About::OnLicensePostchg)); #else AG_TextboxSetCursorPos(text, 0); #endif return lbox; }
AG_Box *AGOL_About::CreateLicenseBox(void *parent) { AG_Box *lbox; AG_Textbox *text; lbox = AG_BoxNewVert(parent, AG_BOX_EXPAND); AG_LabelNewS(lbox, 0, "License"); lbox = AG_BoxNewHoriz(lbox, AG_BOX_EXPAND); AG_BoxSetPadding(lbox, 5); AG_BoxSetSpacing(lbox, 5); text = AG_TextboxNewS(lbox, AG_TEXTBOX_MULTILINE | AG_TEXTBOX_EXPAND, ""); AG_TextboxSetWordWrap(text, true); AG_TextboxSetString(text, "This program is free software; you can redistribute it" " and/or modify it under the terms of the GNU General" " Public License as published by the Free Software" " Foundation; either version 2 of the License, or (at your" " option) any later version.\n\n" "This program is distributed in the hope that it will be" " useful, but WITHOUT ANY WARRANTY; without even the" " implied warranty of MERCHANTABILITY or FITNESS FOR" " A PARTICULAR PURPOSE. See the GNU General Public" " License for more details."); return lbox; }
static int TestGUI(void *obj, AG_Window *win) { AG_FileDlg *fd; AG_DirDlg *dd; AG_FileType *ft[3]; AG_Box *box; AG_Notebook *nb; AG_NotebookTab *ntab; int i; nb = AG_NotebookNew(win, AG_NOTEBOOK_EXPAND); ntab = AG_NotebookAdd(nb, "Load file", AG_BOX_VERT); { /* Create the file loader widget. */ fd = AG_FileDlgNew(ntab, AG_FILEDLG_EXPAND); /* Set some default directory. */ if (strcmp(DATADIR, "NONE") != 0) { AG_FileDlgSetDirectoryMRU(fd, "images-dir", DATADIR); } else { AG_FileDlgSetDirectoryMRU(fd, "images-dir", "."); } /* Set some default filename. */ AG_FileDlgSetFilenameS(fd, "agar.bmp"); /* * Register the loader functions. We can assign a set of user * specified options to specific types as well. */ ft[0] = AG_FileDlgAddType(fd, "Windows Bitmap", "*.bmp", LoadImage, "%p", win); ft[1] = AG_FileDlgAddType(fd, "JPEG image", "*.jpg,*.jpeg", LoadImage, "%p", win); ft[2] = AG_FileDlgAddType(fd, "Portable Network Graphics", "*.png", LoadImage, "%p", win); for (i = 0; i < 3; i++) AG_FileOptionNewBool(ft[i], "Inverted", "invert", 0); /* * As different file types are selected, FileDlg may create * widgets for type specific options. We specify where those * widgets will be created here. */ box = AG_BoxNewVert(ntab, AG_BOX_HFILL|AG_BOX_FRAME); AG_BoxSetPadding(box, 10); AG_FileDlgSetOptionContainer(fd, box); } ntab = AG_NotebookAdd(nb, "Select directory", AG_BOX_VERT); { /* Create the directory selector widget. */ dd = AG_DirDlgNew(ntab, AG_DIRDLG_EXPAND); /* Set some default directory. */ AG_DirDlgSetDirectoryMRU(dd, "images-dir", "./Images"); } AG_WindowSetPosition(win, AG_WINDOW_MIDDLE_LEFT, 0); return (0); }
AG_Box *AGOL_Settings::CreateTopOptionsBox(void *parent) { AG_Box *tbox = AG_BoxNewHoriz(parent, AG_BOX_HFILL | AG_BOX_HOMOGENOUS); AG_BoxSetPadding(tbox, 0); AG_BoxSetSpacing(tbox, 0); return tbox; }
ODA_GuiOptionsBox *AGOL_Settings::CreateGuiOptionsBox(void *parent) { char drvList[128]; AG_Box *vdbox; ODA_GuiOptionsBox *gbox = new ODA_GuiOptionsBox; gbox->optionsBox = AG_BoxNewVert(parent, AG_BOX_FRAME); AG_LabelNewS(gbox->optionsBox, 0, "Gui Options"); gbox->optionsBox = AG_BoxNewVert(gbox->optionsBox, AG_BOX_EXPAND); AG_BoxSetPadding(gbox->optionsBox, 5); AG_BoxSetSpacing(gbox->optionsBox, 5); // Video Driver Option vdbox = AG_BoxNewHoriz(gbox->optionsBox, AG_BOX_HFILL); AG_BoxSetPadding(vdbox, 0); AG_BoxSetSpacing(vdbox, 0); gbox->driverLabel = AG_LabelNewS(vdbox, 0, "Video Driver: "); gbox->driverCombo = AG_UComboNew(vdbox, AG_UCOMBO_HFILL); AG_UComboSizeHint(gbox->driverCombo, "XXXXXXXXXXXX", 3); AG_ListDriverNames(drvList, 128); if(strlen(drvList) > 0) { size_t oldpos = 0; size_t pos = 0; while(pos != string::npos) { AG_TlistItem *item; pos = string(drvList).find(' ', oldpos); item = AG_TlistAdd(gbox->driverCombo->list, NULL, string(drvList).substr(oldpos, pos - oldpos).c_str()); if(string(item->text) == string(agDriverOps->name)) AG_ButtonTextS(gbox->driverCombo->button, item->text); oldpos = pos + 1; } } // End - Video Driver Option return gbox; }
static void Init(void *obj) { AG_Statusbar *sbar = obj; AG_Box *box = obj; AG_BoxSetType(box, AG_BOX_VERT); AG_BoxSetPadding(box, 2); AG_BoxSetSpacing(box, 1); sbar->flags = 0; sbar->nlabels = 0; }
AG_Box *AGOL_Settings::CreateExtraCmdParamsBox(void *parent) { AG_Box *ecpbox; ecpbox = AG_BoxNewVert(parent, AG_BOX_HFILL | AG_BOX_FRAME); AG_LabelNewS(ecpbox, 0, "Extra command line arguments"); ecpbox = AG_BoxNewHoriz(ecpbox, AG_BOX_HFILL); AG_BoxSetPadding(ecpbox, 5); AG_BoxSetSpacing(ecpbox, 5); return ecpbox; }
AG_Box *AGOL_Settings::CreateWadDirConfigBox(void *parent) { AG_Box *wdbox; wdbox = AG_BoxNewVert(parent, AG_BOX_FRAME); AG_LabelNewS(wdbox, 0, "Wad Directories"); wdbox = AG_BoxNewHoriz(wdbox, 0); AG_BoxSetPadding(wdbox, 5); AG_BoxSetSpacing(wdbox, 5); return wdbox; }
AG_Box *AGOL_Settings::CreateOdamexPathBox(void *parent) { AG_Box *opbox; opbox = AG_BoxNewVert(parent, AG_BOX_HFILL | AG_BOX_FRAME); AG_LabelNewS(opbox, 0, "Odamex Path"); opbox = AG_BoxNewHoriz(opbox, AG_BOX_HFILL); AG_BoxSetPadding(opbox, 5); AG_BoxSetSpacing(opbox, 5); return opbox; }
static void Init(void *obj) { AG_MPane *mp = obj; int i; AG_BoxSetType(&mp->box, AG_BOX_VERT); AG_BoxSetPadding(&mp->box, 0); AG_BoxSetSpacing(&mp->box, 0); for (i = 0; i < 4; i++) { mp->panes[i] = AG_BoxNew(NULL, AG_BOX_VERT, AG_BOX_FRAME); AG_BoxSetSpacing(mp->panes[i], 0); AG_BoxSetPadding(mp->panes[i], 0); } mp->flags = 0; mp->npanes = 0; #ifdef AG_DEBUG AG_BindUint(mp, "flags", &mp->flags); AG_BindUint(mp, "layout", &mp->layout); AG_BindUint(mp, "npanes", &mp->npanes); #endif }
AG_Box *AGOL_About::CreateDevBox(void *parent) { AG_Box *dbox; AG_Label *label; dbox = AG_BoxNewVert(parent, AG_BOX_HFILL); AG_LabelNewS(dbox, 0, "Developed by"); dbox = AG_BoxNewHoriz(dbox, AG_BOX_EXPAND); AG_BoxSetPadding(dbox, 5); AG_BoxSetSpacing(dbox, 5); dbox = AG_BoxNewHoriz(dbox, AG_BOX_FRAME | AG_BOX_EXPAND); label = AG_LabelNewS(dbox, AG_LABEL_EXPAND, "Michael Wood (mailto:[email protected])\n" "Russell Rice (mailto:[email protected])"); AG_LabelJustify(label, AG_TEXT_CENTER); return dbox; }
ODA_SrvOptionsBox *AGOL_Settings::CreateSrvOptionsBox(void *parent) { ODA_SrvOptionsBox *obox = new ODA_SrvOptionsBox; obox->optionsBox = AG_BoxNewVert(parent, AG_BOX_FRAME); AG_LabelNewS(obox->optionsBox, 0, "Masters and Servers"); obox->optionsBox = AG_BoxNewVert(obox->optionsBox, AG_BOX_EXPAND); AG_BoxSetPadding(obox->optionsBox, 5); AG_BoxSetSpacing(obox->optionsBox, 5); obox->masterOnStartCheck = AG_CheckboxNewInt(obox->optionsBox, 0, "Get Master List on application start", &MasterOnStart); obox->showBlockedCheck = AG_CheckboxNewInt(obox->optionsBox, 0, "Show blocked servers", &ShowBlocked); // Read the options. If they are not set they will be 0. GuiConfig::Read("MasterOnStart", MasterOnStart); GuiConfig::Read("ShowBlockedServers", ShowBlocked); // Read the timeout options. If they are not set use a default value of 500ms. if(GuiConfig::Read("MasterTimeout", MasterTimeout) || MasterTimeout <= 0) MasterTimeout = 500; if(GuiConfig::Read("ServerTimeout", ServerTimeout) || ServerTimeout <= 0) ServerTimeout = 500; obox->masterTimeoutSpin = AG_NumericalNewUint(obox->optionsBox, 0, NULL, "Master Timeout (ms)", &MasterTimeout); AG_NumericalSetRangeInt(obox->masterTimeoutSpin, 1, 5000); obox->serverTimeoutSpin = AG_NumericalNewUint(obox->optionsBox, 0, NULL, "Server Timeout (ms)", &ServerTimeout); AG_NumericalSetRangeInt(obox->serverTimeoutSpin, 1, 5000); return obox; }
MenuOptions::MenuOptions(): speed_(CONFIG->speed()), visible_presumption_(CONFIG->visible_presumption()), fullscreen_(CONFIG->fullscreen()), sound_(CONFIG->sound()){ AG_Box * item; // nadpis createHeading("Options"); // jazyk item = createItem("Language"); // TODO u combo // klavesy item = createItem("Controls"); AG_SetEvent(item, "window-mousebuttondown", MenuOptionsControls::create, 0); // rychlost hry item = createItemHoriz("Game speed"); AG_AddEvent(items_.back(), "window-keydown", handlerIntItem, "%p,%i,%i", &speed_, CONFIG_SPEED_MIN, CONFIG_SPEED_MAX); AG_NumericalNewIntR(item, 0, 0, 0, &speed_, CONFIG_SPEED_MIN, CONFIG_SPEED_MAX); // viditelna presumpce item = createItemHoriz("Explosion presumptions"); AG_AddEvent(items_.back(), "window-keydown", handlerBoolItem, "%p", &visible_presumption_); item = AG_BoxNewHoriz(item, AG_BOX_HOMOGENOUS | AG_BOX_HFILL); AG_BoxSetPadding(item, 0); AG_SpacerNewVert(item); AG_CheckboxNewInt(item, 0, " ", &visible_presumption_); // fullscreen item = createItemHoriz("Play in fullscreen"); AG_AddEvent(items_.back(), "window-keydown", handlerBoolItem, "%p", &fullscreen_); item = AG_BoxNewHoriz(item, AG_BOX_HOMOGENOUS | AG_BOX_HFILL); AG_BoxSetPadding(item, 0); AG_SpacerNewVert(item); AG_CheckboxNewInt(item, 0, " ", &fullscreen_); // zvuk item = createItemHoriz("Sound enabled"); AG_AddEvent(items_.back(), "window-keydown", handlerBoolItem, "%p", &sound_); item = AG_BoxNewHoriz(item, AG_BOX_HOMOGENOUS | AG_BOX_HFILL); AG_BoxSetPadding(item, 0); AG_SpacerNewVert(item); AG_CheckboxNewInt(item, 0, " ", &sound_); // back item = createItem("Save"); AG_SetEvent(item, "window-mousebuttondown", handlerBack, 0); AG_SpacerNewHoriz(win); }