MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / createThemeTab

Method createThemeTab

source/ui/controls/optionsView.cpp:50–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48}
49
50void OptionsView::createThemeTab() {
51 std::shared_ptr<ImGuiLayout> model = std::make_shared<ImGuiLayout>();
52 std::shared_ptr<LayoutSection> section = model->addSection(Msg::OPTIONSVIEW_TITLE_DISPLAY);
53
54 std::vector<ComboboxItem> themes;
55 themes.push_back(ComboboxItem(getTranslation(Msg::OPTIONSVIEW_THEME_DARK), B("Dark")));
56 themes.push_back(ComboboxItem(getTranslation(Msg::OPTIONSVIEW_THEME_LIGHT), B("Light")));
57 themes.push_back(ComboboxItem(getTranslation(Msg::OPTIONSVIEW_THEME_CLASSIC), B("Classic")));
58
59 themeControl = section->addComboboxRow(Msg::OPTIONSVIEW_THEME_LABEL, Msg::OPTIONSVIEW_THEME_HELP, themes);
60 themeControl->setWidth((int)GlobalSettings::scaleFloatUIAndFont(150));
61
62 themeControl->setSelectionStringValue(GlobalSettings::getTheme());
63 themeControl->onChange = [this]() {
64 GlobalSettings::setTheme(this->themeControl->getSelectionStringValue());
65 GlobalSettings::saveConfig();
66 };
67
68 std::vector<ComboboxItem> fontScales;
69 fontScales.push_back(ComboboxItem(B("50%"), 50));
70 fontScales.push_back(ComboboxItem(B("75%"), 75));
71 fontScales.push_back(ComboboxItem(B("100%"), 100));
72 fontScales.push_back(ComboboxItem(B("125%"), 125));
73 fontScales.push_back(ComboboxItem(B("150%"), 150));
74 fontScales.push_back(ComboboxItem(B("200%"), 200));
75 std::shared_ptr<LayoutComboboxControl> fontScale = section->addComboboxRow(Msg::OPTIONSVIEW_DEFAULT_FONT_SCALE_LABEL, Msg::OPTIONSVIEW_DEFAULT_FONT_SCALE_HELP, fontScales);
76 fontScale->setWidth((int)GlobalSettings::scaleFloatUIAndFont(150));
77 fontScale->setSelectionIntValue((int)(GlobalSettings::fontScale * 100+.5f));
78 fontScale->onChange = [fontScale]() {
79 runAfterFrame([fontScale]() {
80 GlobalSettings::setFontScale(fontScale->getSelectionIntValue() / 100.0f);
81 GlobalSettings::saveConfig();
82 GlobalSettings::restartUI = true;
83 GlobalSettings::startUpArgs.runOnRestartUI = []() {
84 gotoView(VIEW_OPTIONS, B("Display"));
85 };
86 return false;
87 });
88 };
89
90 BString name;
91 if (GlobalSettings::hasIconsFont()) {
92 name += OPTION_DISPLAY_ICON;
93 name += " ";
94 }
95 name += getTranslation(Msg::OPTIONSVIEW_TITLE_DISPLAY);
96 addTab(name, name, model, [](bool buttonPressed, BaseViewTab& tab) {
97 });
98}
99
100void OptionsView::createGeneralTab() {
101 std::shared_ptr<ImGuiLayout> model = std::make_shared<ImGuiLayout>();

Callers

nothing calls this directly

Calls 13

ComboboxItemClass · 0.85
getTranslationFunction · 0.85
BFunction · 0.85
runAfterFrameFunction · 0.85
gotoViewFunction · 0.85
addSectionMethod · 0.80
addComboboxRowMethod · 0.80
setWidthMethod · 0.80
setSelectionIntValueMethod · 0.80
getSelectionIntValueMethod · 0.80

Tested by

no test coverage detected