MCPcopy Create free account
hub / github.com/ALTaleX531/OpenGlass / SelectionDialog

Method SelectionDialog

OpenGlassGUI/MainFrame.Core.cpp:31–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29 {
30 public:
31 SelectionDialog(wxWindow* parent, bool isAdmin)
32 : wxDialog(parent, wxID_ANY, L"Aero Glass for Win10+", wxDefaultPosition, wxDefaultSize)
33 {
34 if (isAdmin)
35 {
36 SetTitle(GetTitle() + L" (Administrator)");
37 }
38 SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_FRAMEBK));
39 wxBoxSizer* mainSizer = new wxBoxSizer(wxVERTICAL);
40
41 // Header area
42 wxBoxSizer* headerSizer = new wxBoxSizer(wxHORIZONTAL);
43 wxStaticBitmap* icon = new wxStaticBitmap(this, wxID_ANY, wxArtProvider::GetBitmap(wxART_INFORMATION, wxART_MESSAGE_BOX));
44 headerSizer->Add(icon, 0, wxALL | wxALIGN_TOP, 20);
45
46 wxBoxSizer* textSizer = new wxBoxSizer(wxVERTICAL);
47 wxStaticText* title = new wxStaticText(this, wxID_ANY, L"Select Configuration Scope");
48 wxFont font = title->GetFont();
49 font.SetWeight(wxFONTWEIGHT_BOLD);
50 font.SetPointSize(font.GetPointSize() + 2);
51 title->SetFont(font);
52
53 wxStaticText* subtitle = new wxStaticText(this, wxID_ANY, L"Whose settings would you like to modify?");
54
55 textSizer->Add(title, 0, wxBOTTOM, 5);
56 textSizer->Add(subtitle, 0, wxBOTTOM, 0);
57 headerSizer->Add(textSizer, 1, wxALL | wxALIGN_CENTER_VERTICAL, 20);
58
59 mainSizer->Add(headerSizer, 0, wxEXPAND | wxALL, 0);
60 mainSizer->Add(new wxStaticLine(this), 0, wxEXPAND | wxLEFT | wxRIGHT, 0);
61
62 // Buttons
63 wxBoxSizer* contentSizer = new wxBoxSizer(wxVERTICAL);
64
65 auto* btnUser = new wxCommandLinkButton(this, wxID_NO, L"Current User", L"Modify settings for the current user (HKCU)");
66 auto* btnSystem = new wxCommandLinkButton(this, wxID_YES, L"System-wide", L"Modify global settings (HKLM)");
67
68 if (!isAdmin)
69 {
70 btnSystem->SetNote(L"Requires Administrator privileges (Not detected)");
71 btnSystem->Disable();
72 }
73
74 contentSizer->Add(btnUser, 0, wxEXPAND | wxBOTTOM, 10);
75 contentSizer->Add(btnSystem, 0, wxEXPAND | wxBOTTOM, 0);
76
77 mainSizer->Add(contentSizer, 1, wxEXPAND | wxALL, 20);
78
79 // Bottom cancel
80 wxBoxSizer* dlgBtns = new wxBoxSizer(wxHORIZONTAL);
81 dlgBtns->AddStretchSpacer();
82 dlgBtns->Add(new wxButton(this, wxID_CANCEL, L"Cancel"), 0, wxALL, 0);
83
84 mainSizer->Add(dlgBtns, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 10);
85
86 SetSizerAndFit(mainSizer);
87 Centre();
88

Callers

nothing calls this directly

Calls 1

AddMethod · 0.45

Tested by

no test coverage detected