示例#1
0
static void
Init(void *obj)
{
    AG_FileSelector *fs = obj;

    fs->flags = 0;
    fs->panel = NULL;
    fs->wSaved = 0;
    fs->hSaved = 0;
    fs->inTxt[0] = '\0';

    /* XXX TODO: Check for UTF-8 support in filesystem. */
    fs->tbox = AG_TextboxNewS(fs, AG_TEXTBOX_COMBO|AG_TEXTBOX_EXCL, NULL);
    AG_TextboxBindUTF8(fs->tbox, fs->inTxt, sizeof(fs->inTxt));

    fs->button = AG_ButtonNewS(fs, AG_BUTTON_STICKY, _("Browse..."));
    AG_ButtonSetPadding(fs->button, 1,1,1,1);
    AG_WidgetSetFocusable(fs->button, 0);

    fs->filedlg = Malloc(sizeof(AG_FileDlg));
    AG_ObjectInit(fs->filedlg, &agFileDlgClass);
    AG_Expand(fs->filedlg);

    AG_SetEvent(fs->button, "button-pushed", Expand, "%p", fs);
    AG_SetEvent(fs->filedlg, "file-chosen", FileChosen, "%p", fs);
    AG_SetEvent(fs->tbox, "textbox-return", Return, "%p", fs);
}
示例#2
0
文件: ui.c 项目: rkujawa/geirvarta
/*
 * 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);

}
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);
}
示例#4
0
文件: ucombo.c 项目: adsr/agar
static void
Init(void *obj)
{
	AG_UCombo *com = obj;

	WIDGET(com)->flags |= AG_WIDGET_UNFOCUSED_BUTTONUP|
	                      AG_WIDGET_TABLE_EMBEDDABLE;

	com->flags = 0;
	com->panel = NULL;
	com->wSaved = 0;
	com->hSaved = 0;
	com->wPreList = -1;
	com->hPreList = -1;

	com->button = AG_ButtonNewS(com, AG_BUTTON_STICKY, _("..."));
	AG_ButtonSetPadding(com->button, 0,0,0,0);
	AG_LabelSetPadding(com->button->lbl, 0,0,0,0);
	AG_WidgetSetFocusable(com->button, 0);
	
	com->list = Malloc(sizeof(AG_Tlist));
	AG_ObjectInit(com->list, &agTlistClass);
	AG_Expand(com->list);
	AG_WidgetForwardFocus(com, com->button);
	
	AG_SetEvent(com, "detached", OnDetach, NULL);
	AG_SetEvent(com->button, "button-pushed", Expand, "%p", com);
	AG_SetEvent(com->list, "tlist-changed", SelectedItem, "%p", com);

#ifdef AG_DEBUG
	AG_BindUint(com, "flags", &com->flags);
	AG_BindPointer(com, "list", (void *)&com->list);
	AG_BindPointer(com, "panel", (void *)&com->panel);
	AG_BindInt(com, "wSaved", &com->wSaved);
	AG_BindInt(com, "hSaved", &com->hSaved);
	AG_BindInt(com, "wPreList", &com->wPreList);
	AG_BindInt(com, "hPreList", &com->hPreList);
#endif
}
示例#5
0
void
agar_widget_expand (AG_Widget *widget)
{
  AG_Expand (widget);
}