Пример #1
0
AG_Box *AGOL_About::CreateLicenseBox(void *parent)
{
	AG_Box     *lbox;
	AG_Textbox *text;

	lbox = AG_BoxNewVert(parent, AG_BOX_EXPAND);
	AG_LabelNewS(lbox, 0, "License");
	lbox = AG_BoxNewHoriz(lbox, AG_BOX_EXPAND);
	AG_BoxSetPadding(lbox, 5);
	AG_BoxSetSpacing(lbox, 5);

#if !AG_VERSION_ATLEAST(1,4,2)
	text = AG_TextboxNewS(lbox, AG_TEXTBOX_MULTILINE | AG_TEXTBOX_EXPAND, "");
#else
	text = AG_TextboxNewS(lbox, AG_TEXTBOX_READONLY | AG_TEXTBOX_MULTILINE | AG_TEXTBOX_EXPAND, "");
#endif

	AG_TextboxSetWordWrap(text, true);

	AG_TextboxSetString(text, license.c_str());

#if !AG_VERSION_ATLEAST(1,4,2)
	AG_SetEvent(text, "textbox-prechg", EventReceiver, "%p",
		RegisterEventHandler((EVENT_FUNC_PTR)&AGOL_About::OnLicensePrechg));

	AG_SetEvent(text, "textbox-postchg", EventReceiver, "%p",
		RegisterEventHandler((EVENT_FUNC_PTR)&AGOL_About::OnLicensePostchg));
#else
	AG_TextboxSetCursorPos(text, 0);
#endif

	return lbox;
}
Пример #2
0
AG_Box *AGOL_About::CreateLicenseBox(void *parent)
{
	AG_Box     *lbox;
	AG_Textbox *text;

	lbox = AG_BoxNewVert(parent, AG_BOX_EXPAND);
	AG_LabelNewS(lbox, 0, "License");
	lbox = AG_BoxNewHoriz(lbox, AG_BOX_EXPAND);
	AG_BoxSetPadding(lbox, 5);
	AG_BoxSetSpacing(lbox, 5);

	text = AG_TextboxNewS(lbox, AG_TEXTBOX_MULTILINE | AG_TEXTBOX_EXPAND, "");
	AG_TextboxSetWordWrap(text, true);

	AG_TextboxSetString(text,
			"This program is free software; you can redistribute it"
			" and/or modify it under the terms of the GNU General"
			" Public License as published by the Free Software"
			" Foundation; either version 2 of the License, or (at your"
			" option) any later version.\n\n"
			"This program is distributed in the hope that it will be"
			" useful, but WITHOUT ANY WARRANTY; without even the"
			" implied warranty of MERCHANTABILITY or FITNESS FOR"
			" A PARTICULAR PURPOSE.  See the GNU General Public"
			" License for more details.");

	return lbox;
}
Пример #3
0
AG_Textbox *
AG_TextboxNewS(void *parent, Uint flags, const char *label)
{
	AG_Textbox *tb;

	tb = Malloc(sizeof(AG_Textbox));
	AG_ObjectInit(tb, &agTextboxClass);

	if (flags & AG_TEXTBOX_HFILL)
		AG_ExpandHoriz(tb);
	if (flags & AG_TEXTBOX_VFILL)
		AG_ExpandVert(tb);
	if (flags & AG_TEXTBOX_READONLY) {
		AG_WidgetDisable(tb);
		AG_WidgetDisable(tb->ed);
	}
	if (flags & AG_TEXTBOX_PASSWORD)
		tb->ed->flags |= AG_EDITABLE_PASSWORD;
	if (flags & AG_TEXTBOX_ABANDON_FOCUS)
		tb->ed->flags |= AG_EDITABLE_ABANDON_FOCUS;
	if (flags & AG_TEXTBOX_INT_ONLY)
		tb->ed->flags |= AG_EDITABLE_INT_ONLY;
	if (flags & AG_TEXTBOX_FLT_ONLY)
		tb->ed->flags |= AG_EDITABLE_FLT_ONLY;
	if (flags & AG_TEXTBOX_CATCH_TAB) {
		WIDGET(tb)->flags |= AG_WIDGET_CATCH_TAB;
		WIDGET(tb->ed)->flags |= AG_WIDGET_CATCH_TAB;
	}
	if (flags & AG_TEXTBOX_NOEMACS)
		tb->ed->flags |= AG_EDITABLE_NOEMACS;
	if (flags & AG_TEXTBOX_NOWORDSEEK)
		tb->ed->flags |= AG_EDITABLE_NOWORDSEEK;
	if (flags & AG_TEXTBOX_NOLATIN1)
		tb->ed->flags |= AG_EDITABLE_NOLATIN1;
	
	if (flags & AG_TEXTBOX_MULTILINE) {
		tb->ed->flags |= AG_EDITABLE_MULTILINE;

		tb->vBar = AG_ScrollbarNew(tb, AG_SCROLLBAR_VERT,
		    AG_SCROLLBAR_AUTOHIDE);
		AG_BindInt(tb->vBar, "value", &tb->ed->y);
		AG_BindInt(tb->vBar, "max", &tb->ed->yMax);
		AG_BindInt(tb->vBar, "visible", &tb->ed->yVis);
		AG_SetEvent(tb->vBar, "scrollbar-drag-begin", BeginScrollbarDrag, "%p", tb);
		AG_SetEvent(tb->vBar, "scrollbar-drag-end", EndScrollbarDrag, "%p", tb);
	}
	
	AG_TextboxSetStatic(tb, (flags & AG_TEXTBOX_STATIC));
	AG_TextboxSetWordWrap(tb, (flags & AG_TEXTBOX_WORDWRAP));

	tb->flags |= flags;
	if (label != NULL) {
		tb->lbl = AG_LabelNewS(tb, 0, label);
		AG_LabelSetPadding(tb->lbl, -1, 10, -1, -1);
	}
	AG_ObjectAttach(parent, tb);
	return (tb);
}