Beispiel #1
0
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);
}
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);
}