예제 #1
0
static int
TestGUI(void *obj, AG_Window *win)
{
	char path[AG_PATHNAME_MAX];
	AG_TestInstance *ti = obj;
	AG_Box *box;
	AG_Textbox *tb;

	someString[0] = '\0';

	AG_GetString(agConfig, "load-path", path, sizeof(path));
	AG_LabelNew(win, 0, "load-path: %s", path);
	AG_GetString(agConfig, "save-path", path, sizeof(path));
	AG_LabelNew(win, 0, "save-path: %s", path);

	/* Tie some globals to the config settings */
	AG_BindInt(agConfig, "some-int", &someInt);
	AG_BindInt(agConfig, "some-bool", &someBool);
	AG_BindString(agConfig, "some-string", someString, sizeof(someString));
	AG_SetInt(agConfig, "some-int", 2345);

	/* Create some widgets */
	AG_NumericalNewInt(win, 0, NULL, "Some int: ", &someInt);
	AG_CheckboxNewInt(win, 0, "Some bool", &someBool);
	tb = AG_TextboxNew(win, AG_TEXTBOX_HFILL, "Some string: ");
	AG_TextboxBindUTF8(tb, someString, sizeof(someString));

	box = AG_BoxNewHoriz(win, AG_BOX_EXPAND);
	{
		AG_ButtonNewFn(box, 0, "Load configuration", LoadConfig, "%p", ti);
		AG_ButtonNewFn(box, 0, "Save configuration", SaveConfig, "%p", ti);
	}
	return (0);
}
예제 #2
0
AG_Textbox *AGOL_Settings::CreateExtraCmdParamsEntry(void *parent)
{
	AG_Textbox *ecptextbox;
	string      extraParams;

	ecptextbox = AG_TextboxNew(parent, AG_TEXTBOX_HFILL, NULL);

	// Read the ExtraParams option from the config file
	GuiConfig::Read("ExtraParams", extraParams);

	// Put the extra params into the textbox
	if(extraParams.size())
		AG_TextboxSetString(ecptextbox, extraParams.c_str());

	return ecptextbox;
}
예제 #3
0
static void ErrorPopup(char *message)
{
   AG_Window *win;
   win = AG_WindowNew(0);
   if(win == NULL) {
        if(message == NULL) return;
        XM7_DebugLog(XM7_LOG_INFO, "Error: %s.", message);
        return;
   } else {
      AG_VBox *vb;
      AG_Textbox *tb;
        XM7_DebugLog(XM7_LOG_INFO, "Error: %s.", message);
        vb = AG_VBoxNew(AGWIDGET(win), AG_HBOX_HFILL);
        if(message != NULL) tb = AG_TextboxNew(vb, AG_TEXTBOX_MULTILINE, "%s", message);
        AG_ButtonNewFn(AGWIDGET(vb), 0, gettext("Close"), OnPushCancel, NULL);
        AG_WindowShow(win);
   }
   
}