void osdUpdate() { if (state.mode & SM_PLAY) { AG_ButtonTextS(view.playButton, "Pause"); } else { AG_ButtonTextS(view.playButton, "Play"); } if (state.mode & SM_RECORD) { AG_ButtonTextS(view.recordButton, "Pause"); } else { AG_ButtonTextS(view.recordButton, "Record"); } }
/* Set the label text (format string). */ void AG_ButtonText(AG_Button *bu, const char *fmt, ...) { char s[AG_LABEL_MAX]; va_list ap; va_start(ap, fmt); Vsnprintf(s, sizeof(s), fmt, ap); va_end(ap); AG_ButtonTextS(bu, s); }
static void SelectedItem(AG_Event *event) { AG_Tlist *tl = AG_SELF(); AG_UCombo *com = AG_PTR(1); AG_TlistItem *it; AG_ObjectLock(com); AG_ObjectLock(tl); if ((it = AG_TlistSelectedItem(tl)) != NULL) { it->selected++; AG_ButtonTextS(com->button, it->text); AG_PostEvent(NULL, com, "ucombo-selected", "%p", it); } Collapse(com); AG_ObjectUnlock(tl); AG_ObjectUnlock(com); }
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; }
void AG_ComboSetButtonText(AG_Combo *com, const char *text) { AG_ButtonTextS(com->button, text); }