static void update_playlisttable(AG_Event *event) { AG_Table *tbl = AG_SELF(); if(playlistData) { AG_TableBegin(tbl); do { if(playlistData->type == MPD_DATA_TYPE_SONG) printf("%i, %s\n", playlistData->song->id, playlistData->song->title); AG_TableAddRow(tbl, "%s:%s:%s:%i", playlistData->song->artist, playlistData->song->title, format_time(playlistData->song->time), playlistData->song->id); playlistData = mpd_data_get_next(playlistData); /*if(mpd_data_is_last(playlistData)) { printf("last\n"); }*/ } while(playlistData); AG_TableEnd(tbl); } }
void AGOL_About::OnLicensePrechg(AG_Event *event) { AG_Textbox *text = static_cast<AG_Textbox*>(AG_SELF()); // Store the cursor position before change LicenseCursorPos = AG_TextboxGetCursorPos(text); }
static void Return(AG_Event *event) { char text[AG_TEXTBOX_STRING_MAX]; AG_Textbox *tbox = AG_SELF(); AG_Combo *com = AG_PTR(1); AG_ObjectLock(com->list); AG_TextboxCopyString(tbox, text, sizeof(text)); if ((com->flags & AG_COMBO_ANY_TEXT) == 0) { AG_TlistItem *it; if (text[0] != '\0' && (it = AG_TlistSelectText(com->list, text)) != NULL) { AG_TextboxSetString(com->tbox, it->text); AG_PostEvent(NULL, com, "combo-selected", "%p", it); } else { AG_TlistDeselectAll(com->list); AG_TextboxSetString(com->tbox, ""); AG_PostEvent(NULL, com, "combo-text-unknown", "%s", text); } } else { AG_TlistDeselectAll(com->list); AG_PostEvent(NULL, com, "combo-text-entry", "%s", text); } AG_ObjectUnlock(com->list); }
/* Handle the "attached" event by starting our timer. */ static void Attached(AG_Event *event) { Animal *animal = AG_SELF(); AG_ScheduleTimeout(animal, &animal->time, 1000); }
/* todo: zrefaktoryzowac update_*table, bo moze wystarczy jedna funckcja? */ static void update_librarytable(AG_Event *event) { AG_Table *tbl = AG_SELF(); if(libraryData) { AG_TableBegin(tbl); do { if(libraryData->type == MPD_DATA_TYPE_SONG) { if(libraryData->song->file && libraryData->song->title && libraryData->song->artist ) { AG_TableAddRow(tbl, "%s:%s:%s:%s", libraryData->song->artist, libraryData->song->title, format_time(libraryData->song->time), libraryData->song->file); } } libraryData = mpd_data_get_next(libraryData); } while(libraryData); AG_TableEnd(tbl); } }
static void MouseButtonDown(AG_Event *event) { AG_GLView *glv = AG_SELF(); AG_WidgetFocus(glv); }
static void MouseButtonUp(AG_Event *event) { AG_HSVPal *pal = AG_SELF(); pal->state = AG_HSVPAL_SEL_NONE; }
static void OnFocusLoss(AG_Event *event) { AG_Slider *sl = AG_SELF(); AG_DelTimer(sl, &sl->moveTo); }
static void Bound(AG_Event *event) { AG_HSVPal *hsv = AG_SELF(); AG_Variable *V = AG_PTR(1); if (AG_VARIABLE_TYPE(V) == AG_VARIABLE_UINT32 && strcmp(V->name, "pixel") == 0) { #if 0 hsv->flags |= AG_HSVPAL_PIXEL; #endif UpdateHSVFromPixel(hsv, *(Uint32 *)V->data.p); } else if (strcmp(V->name, "RGBAv") == 0) { UpdateHSVFromRGBAv(hsv); } else if (strcmp(V->name, "RGBv") == 0) { UpdateHSVFromRGBv(hsv); } else if (strcmp(V->name, "pixel-format") == 0) { if (!(hsv->flags & AG_HSVPAL_FORCE_NOALPHA)) { AG_PixelFormat **pFormat = (AG_PixelFormat **)V->data.p; if ((*pFormat)->Amask != 0) { hsv->flags &= ~(AG_HSVPAL_NOALPHA); } else { hsv->flags |= AG_HSVPAL_NOALPHA; } } } AG_Redraw(hsv); }
static void KeyDown(AG_Event *event) { AG_Button *bu = AG_SELF(); AG_Variable *binding; void *pState; int keysym = AG_INT(1); if (AG_WidgetDisabled(bu)) return; if (keysym != AG_KEY_RETURN && /* TODO AG_Action */ keysym != AG_KEY_KP_ENTER && keysym != AG_KEY_SPACE) { return; } binding = AG_GetVariable(bu, "state", &pState); SetState(bu, binding, pState, 1); AG_PostEvent(NULL, bu, "button-pushed", "%i", 1); bu->flags |= AG_BUTTON_KEYDOWN; if (bu->flags & AG_BUTTON_REPEAT) { AG_DelTimer(bu, &bu->repeatTo); AG_AddTimer(bu, &bu->delayTo, agKbdDelay, ExpireDelay, "%i", agKbdRepeat); } AG_UnlockVariable(binding); }
static void MouseButtonUp(AG_Event *event) { AG_Button *bu = AG_SELF(); int button = AG_INT(1); AG_Variable *binding; void *pState; int x = AG_INT(2); int y = AG_INT(3); if (bu->flags & AG_BUTTON_REPEAT) { AG_DelTimer(bu, &bu->repeatTo); AG_DelTimer(bu, &bu->delayTo); return; } if (AG_WidgetDisabled(bu) || x < 0 || y < 0 || x > WIDGET(bu)->w || y > WIDGET(bu)->h) { return; } binding = AG_GetVariable(bu, "state", &pState); if (GetState(bu, binding, pState) && button == AG_MOUSE_LEFT && !(bu->flags & AG_BUTTON_STICKY)) { SetState(bu, binding, pState, 0); AG_PostEvent(NULL, bu, "button-pushed", "%i", 0); } AG_UnlockVariable(binding); }
static void MouseButtonDown(AG_Event *event) { AG_Button *bu = AG_SELF(); int button = AG_INT(1); AG_Variable *binding; void *pState; int newState; if (AG_WidgetDisabled(bu)) return; if (!AG_WidgetIsFocused(bu)) AG_WidgetFocus(bu); if (button != AG_MOUSE_LEFT) return; binding = AG_GetVariable(bu, "state", &pState); if (!(bu->flags & AG_BUTTON_STICKY)) { SetState(bu, binding, pState, 1); } else { newState = !GetState(bu, binding, pState); SetState(bu, binding, pState, newState); AG_PostEvent(NULL, bu, "button-pushed", "%i", newState); } AG_UnlockVariable(binding); if (bu->flags & AG_BUTTON_REPEAT) { AG_DelTimer(bu, &bu->repeatTo); AG_PostEvent(NULL, bu, "button-pushed", "%i", 1); AG_AddTimer(bu, &bu->delayTo, agMouseSpinDelay, ExpireDelay, "%i", agMouseSpinIval); } }
static void MouseButtonDown(AG_Event *event) { AG_Textbox *tb = AG_SELF(); AG_WidgetFocus(tb); AG_ForwardEvent(NULL, tb->ed, event); }
static void FileMenu_BootMode(AG_Event *event) { AG_Menu *self = (AG_Menu *)AG_SELF(); AG_MenuItem *item = (AG_MenuItem *)AG_SENDER(); AG_Window *w; AG_Button *btn[3]; AG_Box *box; AG_Box *box2; char *label; AG_Label *lbl; w = AG_WindowNew(AG_WINDOW_NOMINIMIZE | AG_WINDOW_NOMAXIMIZE | FILEDIALOG_WINDOW_DEFAULT); AG_WindowSetMinSize(w, 230, 80); label = gettext("Select mode (Notice: If select , reboot.)"); AG_WindowSetMinSize(w, 230, 80); box = AG_BoxNewHorizNS(w, AG_BOX_HFILL); AG_WidgetSetSize(box, 230, 32); lbl = AG_LabelNew(AGWIDGET(box), AG_LABEL_EXPAND, "%s", label); box = AG_BoxNewVert(w, AG_BOX_HFILL); AG_WidgetSetSize(box, 230, 32); box2 = AG_BoxNewHoriz(box, 0); btn[0] = AG_ButtonNewFn (AGWIDGET(box2), 0, gettext("BASIC"), SetBootMode, "%i", FALSE); box2 = AG_BoxNewVert(box, 0); btn[1] = AG_ButtonNewFn (AGWIDGET(box2), 0, gettext("DOS"), SetBootMode, "%i", TRUE); box2 = AG_BoxNewVert(box, 0); btn[2] = AG_ButtonNewFn (AGWIDGET(box2), 0, gettext("Cancel"), OnPushCancel, NULL); AG_ActionFn(AGWIDGET(w), "window-close", OnPushCancel, NULL); AG_WindowSetCaption(w, gettext("Boot Mode")); AG_WindowShow(w); }
static void MouseMotion(AG_Event *event) { AG_HSVPal *pal = AG_SELF(); int x = AG_INT(1); int y = AG_INT(2); switch (pal->state) { case AG_HSVPAL_SEL_NONE: break; case AG_HSVPAL_SEL_H: UpdateHue(pal, x - pal->circle.x, y - pal->circle.y); break; case AG_HSVPAL_SEL_SV: UpdateSV(pal, x, y); break; case AG_HSVPAL_SEL_A: UpdateAlpha(pal, x); break; default: break; } }
static void WidgetMoved(AG_Event *event) { AG_GLView *glv = AG_SELF(); glv->flags |= AG_GLVIEW_RESHAPE; }
static void OnChangeTotalVolume(AG_Event *event) { AG_Slider *self = (AG_Slider *)AG_SELF(); struct gui_sound *cfg = AG_PTR(1); if(cfg == NULL) return; SetTotalVolume(cfg->iTotalVolume); }
/* Keystroke event handler */ static void KeyUp(AG_Event *event) { formaText *my = (formaText*)AG_SELF(); int keysym = AG_INT(1); /* ... */ }
static void OnShow(AG_Event *event) { AG_Button *bu = AG_SELF(); if ((bu->flags & AG_BUTTON_EXCL) == 0) AG_RedrawOnChange(bu, 100, "state"); }
/* * Example of an event handler function. Event handlers use a stack of * arguments. Both AG_SetEvent() and AG_PostEvent() can push arguments * onto this stack. */ static void Die(AG_Event *event) { Animal *animal = AG_SELF(); AG_Object *killer = AG_SENDER(); printf("%s: killed by %s!\n", AGOBJECT(animal)->name, killer->name); }
/* Delay/repeat timer callbacks for AG_BUTTON_REPEAT */ static Uint32 ExpireRepeat(AG_Timer *to, AG_Event *event) { AG_Button *bu = AG_SELF(); AG_PostEvent(NULL, bu, "button-pushed", "%i", 1); return (to->ival); }
/* Keystroke event handler */ static void KeyDown(AG_Event *event) { formaText *my = (formaText*)AG_SELF(); int keysym = AG_INT(1); printf("Keystroke: 0x%x\n", keysym); }
void MapMoveFunction(AG_Event *event) { void *p=AG_SELF(); int cursorX=AG_INT(1); int cursorY=AG_INT(2); };
static Uint32 ExpireDelay(AG_Timer *to, AG_Event *event) { AG_Button *bu = AG_SELF(); int repeatIval = AG_INT(1); AG_AddTimer(bu, &bu->repeatTo, repeatIval, ExpireRepeat, NULL); return (0); }
static void XM7_DbgMMRDrawFn(AG_Event *event) { XM7_SDLView *view = (XM7_SDLView *)AG_SELF(); struct XM7_DbgMMRDump *p = (struct XM7_DbgMMRDump *)AG_PTR(1); BOOL forceredraw = AG_INT(2); if(p == NULL) return; XM7_ConsoleUpdate(view, p->cons, forceredraw); }
/* Mouse motion event handler */ static void MouseMotion(AG_Event *event) { formaText *my = (formaText*)AG_SELF(); int x = AG_INT(1); int y = AG_INT(2); /* ... */ }
static void OnAttach(AG_Event *event) { AG_HSVPal *pal = AG_SELF(); pal->pixel = AG_MapPixelRGBA(agSurfaceFmt, 0,0,0,255); pal->color = AG_ColorRGBA(0,0,0,255); AG_BindPointer(pal, "pixel-format", (void *)&agSurfaceFmt); }
static void OnChangeVolume(AG_Event *event) { AG_Slider *self = (AG_Slider *)AG_SELF(); struct gui_sound *cfg = AG_PTR(1); if(cfg == NULL) return; SetSoundVolume2(cfg->uChSeparation, cfg->nFMVolume, cfg->nPSGVolume, cfg->nBeepVolume, cfg->nCMTVolume, cfg->nWaveVolume); }
/* Mouse click event handler */ static void MouseButtonUp(AG_Event *event) { formaText *my = (formaText*)AG_SELF(); int button = AG_INT(1); int x = AG_INT(2); int y = AG_INT(3); /* ... */ }
static void OnDetach(AG_Event *event) { AG_UCombo *com = AG_SELF(); if (com->panel != NULL) { AG_ObjectDetach(com->list); AG_ObjectDetach(com->panel); com->panel = NULL; } }