MCPcopy Create free account
hub / github.com/TypesettingTools/Aegisub / OptionBrowse

Method OptionBrowse

src/preferences_base.cpp:197–227  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

195}
196
197void OptionPage::OptionBrowse(wxFlexGridSizer *flex, const wxString &name, const char *opt_name, wxControl *enabler, bool do_enable) {
198 parent->AddChangeableOption(opt_name);
199 const auto opt = OPT_GET(opt_name);
200
201 if (opt->GetType() != agi::OptionType::String)
202 throw agi::InternalError("Option must be agi::OptionType::String for BrowseButton.");
203
204 auto text = new wxTextCtrl(this, -1 , to_wx(opt->GetString()));
205 text->SetMinSize(wxSize(160, -1));
206 text->Bind(wxEVT_TEXT, StringUpdater(opt_name, parent));
207
208 auto browse = new wxButton(this, -1, _("Browse..."));
209 browse->Bind(wxEVT_BUTTON, std::bind(browse_button, text));
210
211 auto button_sizer = new wxBoxSizer(wxHORIZONTAL);
212 button_sizer->Add(text, wxSizerFlags(1).Expand());
213 button_sizer->Add(browse, wxSizerFlags().Expand());
214
215 Add(flex, name, button_sizer);
216
217 if (enabler) {
218 if (do_enable) {
219 EnableIfChecked(enabler, text);
220 EnableIfChecked(enabler, browse);
221 }
222 else {
223 DisableIfChecked(enabler, text);
224 DisableIfChecked(enabler, browse);
225 }
226 }
227}
228
229void OptionPage::OptionFont(wxSizer *sizer, std::string opt_prefix) {
230 const auto face_opt = OPT_GET(opt_prefix + "Font Face");

Callers 3

InterfaceFunction · 0.80
BackupFunction · 0.80
Advanced_AudioFunction · 0.80

Calls 5

AddChangeableOptionMethod · 0.80
BindMethod · 0.80
to_wxFunction · 0.70
GetTypeMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected