aboutsummaryrefslogtreecommitdiff
path: root/src/libui_sdl/libui/test/page8.c
blob: 7d85556048d5c4a9394741957cff42e1c51326fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// 22 december 2015
#include "test.h"

static void onListFonts(uiButton *b, void *data)
{
	uiDrawFontFamilies *ff;
	char *this;
	int i, n;

	uiMultilineEntrySetText(uiMultilineEntry(data), "");
	ff = uiDrawListFontFamilies();
	n = uiDrawFontFamiliesNumFamilies(ff);
	for (i = 0; i < n; i++) {
		this = uiDrawFontFamiliesFamily(ff, i);
		uiMultilineEntryAppend(uiMultilineEntry(data), this);
		uiMultilineEntryAppend(uiMultilineEntry(data), "\n");
		uiFreeText(this);
	}
	uiDrawFreeFontFamilies(ff);
}

uiBox *makePage8(void)
{
	uiBox *page8;
	uiGroup *group;
	uiBox *vbox;
	uiMultilineEntry *me;
	uiButton *button;

	page8 = newHorizontalBox();

	group = newGroup("Font Families");
	uiBoxAppend(page8, uiControl(group), 1);

	vbox = newVerticalBox();
	uiGroupSetChild(group, uiControl(vbox));

	me = uiNewMultilineEntry();
	uiBoxAppend(vbox, uiControl(me), 1);

	button = uiNewButton("List Font Families");
	uiButtonOnClicked(button, onListFonts, me);
	uiBoxAppend(vbox, uiControl(button), 0);

	return page8;
}