/* * 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); }
AG_Window * RG_FillEdit(void *p, RG_Tileview *tv) { struct rg_fill_feature *f = p; AG_Window *win; AG_Box *box; win = AG_WindowNew(0); AG_WindowSetCaptionS(win, _("Fill/gradient")); { static const char *modes[] = { N_("Solid"), N_("Horizontal gradient"), N_("Vertical gradient"), N_("Circular gradient"), N_("Pixmap pattern"), NULL }; AG_RadioNewUint(win, AG_RADIO_HFILL, modes, &f->type); } box = AG_BoxNew(win, AG_BOX_VERT, AG_BOX_HFILL|AG_BOX_VFILL); { AG_HSVPal *hsv1, *hsv2; AG_Numerical *num; AG_Notebook *nb; AG_NotebookTab *ntab; nb = AG_NotebookNew(box, AG_NOTEBOOK_HFILL|AG_NOTEBOOK_VFILL); ntab = AG_NotebookAddTab(nb, _("Color A"), AG_BOX_VERT); { hsv1 = AG_HSVPalNew(ntab, AG_HSVPAL_EXPAND); AG_BindUint8(hsv1, "RGBAv", (Uint8 *)&f->f_gradient.c1); } ntab = AG_NotebookAddTab(nb, _("Color B"), AG_BOX_VERT); { hsv2 = AG_HSVPalNew(ntab, AG_HSVPAL_EXPAND); AG_BindUint8(hsv2, "RGBAv", (Uint8 *)&f->f_gradient.c2); } num = AG_NumericalNewUint8R(box, 0, NULL, _("Overall alpha: "), &f->alpha, 0, 255); AG_NumericalSetIncrement(num, 5); } return (win); }
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 }
static int TestGUI(void *obj, AG_Window *win) { M_Plotter *plt; AG_Pane *pane; AG_Numerical *num; AG_Box *box; int i; pane = AG_PaneNew(win, AG_PANE_HORIZ, AG_PANE_EXPAND); { /* Create our plotter widget */ plt = M_PlotterNew(pane->div[1], M_PLOTTER_EXPAND); /* * Create the velocity plot item. This is what our algorithm * computes. */ plVel = M_PlotNew(plt, M_PLOT_LINEAR); M_PlotSetLabel(plVel, "m/s"); M_PlotSetYoffs(plVel, -45); M_PlotSetScale(plVel, 0.0, 50.0); /* Create a label we will use to show the "case". */ plblCase = M_PlotLabelNew(plVel, M_LABEL_OVERLAY, 0, 16, "-"); /* Plot the derivative of the velocity (the acceleration). */ plAcc = M_PlotFromDerivative(plt, M_PLOT_LINEAR, plVel); M_PlotSetLabel(plAcc, "m/s^2"); M_PlotSetScale(plAcc, 0.0, 3000.0); /* Plot the derivative of the acceleration (the jerk). */ plJerk = M_PlotFromDerivative(plt, M_PLOT_LINEAR, plAcc); M_PlotSetLabel(plJerk, "m/s^3"); M_PlotSetScale(plJerk, 0.0, 100.0); M_PlotSetScale(plJerk, 0.0, 150000.0); M_PlotSetYoffs(plJerk, 70); } /* Allow the user to play with the parameters. */ box = AG_BoxNew(pane->div[0], AG_BOX_VERT, AG_BOX_EXPAND); { struct { const char *name; M_Real *f; double incr; } param[7] = { { "Jmax: ", &Jmax, 0.00001 }, { "Amax: ", &Amax, 0.0005 }, { "F: ", &F, 0.01 }, { "L: ", &L, 10.0 }, { "Ts tweak: ", &uTs, 1.0 }, { "Ta tweak: ", &uTa, 1.0 }, { "To tweak: ", &uTo, 1.0 }, }; for (i = 0; i < 7; i++) { num = AG_NumericalNewS(box, AG_NUMERICAL_HFILL, NULL, param[i].name); AG_BindDouble(num, "value", param[i].f); AG_SetDouble(num, "inc", param[i].incr); AG_SetEvent(num, "numerical-changed", GeneratePlot, "%p", plt); } AG_SeparatorNewHoriz(box); AG_LabelNewPolled(box, AG_LABEL_HFILL, "Aref: %lf", &Aref); AG_LabelNewPolled(box, AG_LABEL_HFILL, "v1: %lf", &v1); AG_LabelNewPolled(box, AG_LABEL_HFILL, "v2: %lf", &v2); AG_LabelNewPolled(box, AG_LABEL_HFILL, "v3: %lf", &v3); AG_LabelNewPolled(box, AG_LABEL_HFILL, "Ts: %lf", &Ts); AG_LabelNewPolled(box, AG_LABEL_HFILL, "Ta: %lf", &Ta); AG_LabelNewPolled(box, AG_LABEL_HFILL, "To: %lf", &To); AG_ButtonNewFn(box, AG_BUTTON_HFILL, "Generate", GeneratePlot, "%p", plt); } AG_SetEvent(win, "window-shown", GeneratePlot, "%p", plt); AG_WindowSetGeometryAlignedPct(win, AG_WINDOW_MC, 50, 30); return (0); }