GUI-FreeRDP/settings.c

91 lines
3.1 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* settings.c
*
* Created on: 6 июл. 2022 г.
* Author: alexander
*/
#include <iup.h>
#include <stdlib.h>
#include <stdbool.h>
#include "settings.h"
#include "arguments.h"
static int settingsClose(Ihandle *bt_close)
{
IupSetAttribute(IupGetDialog(bt_close), "SIMULATEMODAL", "OFF");
IupHide(IupGetDialog(bt_close));
return IUP_DEFAULT;
}
static int settingsSave(Ihandle *self)
{
return IUP_DEFAULT;
}
static int settingsTglMultimonitor(Ihandle *self)
{
settingsToggleEnable(PARAMETER_MULTIMONITOR);
return IUP_DEFAULT;
}
static int settingsTglFullscreen(Ihandle *self)
{
settingsToggleEnable(PARAMETER_FULLSCREEN);
return IUP_DEFAULT;
}
int settingsWindow(Ihandle *self)
{
Ihandle *dlg;
Ihandle *vBoxMain, *hBoxToggles, *hSettingsBoxButtons;
Ihandle *btnSettingsClose, *btnSettingsSave;
Ihandle *tglMultimonitor, *tglFullscreen;
tglMultimonitor = IupToggle("Мультиэкран", NULL);
IupSetAttribute(tglMultimonitor, "VALUE", (settingsGetEnable(PARAMETER_MULTIMONITOR) ? "ON" : "OFF"));
IupSetAttribute(tglMultimonitor, "NAME", "SETTINGS_MULTIMONITOR");
tglFullscreen = IupToggle("На весь экран", NULL);
IupSetAttribute(tglFullscreen, "NAME", "SETTINGS_FULLSCREEN");
IupSetAttribute(tglFullscreen, "VALUE", (settingsGetEnable(PARAMETER_FULLSCREEN) ? "ON" : "OFF"));
hBoxToggles = IupHbox(IupFill(), tglFullscreen, tglMultimonitor, IupFill(), NULL);
IupSetAttribute(hBoxToggles, "GAP", "10");
IupSetAttribute(hBoxToggles, "MARGIN", "10x10");
btnSettingsSave = IupButton("Сохранить", NULL);
IupSetAttribute(btnSettingsSave, "NAME", "SETTIGS_SAVE");
btnSettingsClose = IupButton("Закрыть", NULL);
IupSetHandle("SETTIGS_CLOSE", btnSettingsClose);
IupSetAttribute(btnSettingsClose, "NAME", "SETTIGS_CLOSE");
hSettingsBoxButtons = IupHbox(IupFill(), btnSettingsClose, btnSettingsSave, IupFill(), NULL);
IupSetAttribute(hSettingsBoxButtons, "ALIGNMENT", "ACENTER:ACENTER");
IupSetAttribute(hSettingsBoxButtons, "GAP", "10");
IupSetAttribute(hSettingsBoxButtons, "MARGIN", "10x10");
vBoxMain = IupVbox(hBoxToggles, hSettingsBoxButtons, NULL);
dlg = IupDialog(vBoxMain);
IupSetAttribute(dlg, "TITLE", "Настройки");
IupSetAttribute(dlg, "ICON", "icon");
IupSetAttribute(dlg, "DIALOGFRAME", "ON");
IupSetAttribute(dlg, "SIMULATEMODAL", "ON");
IupSetAttribute(dlg, "DEFAULTESC", "SETTIGS_CLOSE");
IupSetAttribute(dlg, "TOPMOST", "YES");
IupSetAttribute(dlg, "BRINGFRONT", "YES");
IupSetAttribute(dlg, "NAME", "SETTINGS_WINDOW");
IupSetCallback(dlg, "CLOSE_CB", (Icallback) settingsClose);
// IupSetAttribute(dlg, "RESIZE", "NO");
IupSetCallback(btnSettingsClose, "ACTION", (Icallback) settingsClose);
IupSetCallback(btnSettingsSave, "ACTION", (Icallback) settingsSave);
IupSetCallback(tglFullscreen, "ACTION", (Icallback) settingsTglFullscreen);
IupSetCallback(tglMultimonitor, "ACTION", (Icallback) settingsTglMultimonitor);
IupShowXY(dlg, IUP_CURRENT, IUP_CURRENT);
return IUP_DEFAULT;
}