예제 #1
0
파일: textbox.c 프로젝트: adsr/agar
/* Set the textbox label (format string). */
void
AG_TextboxSetLabel(AG_Textbox *tb, const char *fmt, ...)
{
	char *s;
	va_list ap;

	va_start(ap, fmt);
	Vasprintf(&s, fmt, ap);
	va_end(ap);
	AG_TextboxSetLabelS(tb, s);
	Free(s);
}
예제 #2
0
AG_FileSelector *
AG_FileSelectorNew(void *parent, Uint flags, const char *label)
{
    AG_FileSelector *fs;

    fs = Malloc(sizeof(AG_FileSelector));
    AG_ObjectInit(fs, &agFileSelectorClass);
    fs->flags |= flags;

    if (label != NULL) {
        AG_TextboxSetLabelS(fs->tbox, label);
    }
    if (flags & AG_FILE_SELECTOR_HFILL) {
        AG_ExpandHoriz(fs);
    }
    if (flags & AG_FILE_SELECTOR_VFILL) {
        AG_ExpandVert(fs);
    }

    AG_ObjectAttach(parent, fs);
    return (fs);
}
예제 #3
0
파일: combo.c 프로젝트: adsr/agar
AG_Combo *
AG_ComboNewS(void *parent, Uint flags, const char *label)
{
	AG_Combo *com;

	com = Malloc(sizeof(AG_Combo));
	AG_ObjectInit(com, &agComboClass);
	com->flags |= flags;

	if (label != NULL) {
		AG_TextboxSetLabelS(com->tbox, label);
	}
	if (flags & AG_COMBO_ANY_TEXT) { AG_WidgetDisable(com->tbox); }
	if (flags & AG_COMBO_TREE) { com->list->flags |= AG_TLIST_TREE; }
	if (flags & AG_COMBO_POLL) { com->list->flags |= AG_TLIST_POLL; }
	if (flags & AG_COMBO_SCROLLTOSEL) {
		com->list->flags |= AG_TLIST_SCROLLTOSEL;
	}
	if (flags & AG_COMBO_HFILL) { AG_ExpandHoriz(com); }
	if (flags & AG_COMBO_VFILL) { AG_ExpandVert(com); }
	
	AG_ObjectAttach(parent, com);
	return (com);
}