#include "PreferencesPanel.h" PreferencesPanel::PreferencesPanel(KissCount* kiss, wxUI *parent) : wxPanel(&(*parent)), _kiss(kiss), _wxUI(parent) { wxBoxSizer *vbox = new wxBoxSizer(wxVERTICAL); //wxBoxSizer *hbox = new wxBoxSizer(wxHORIZONTAL); wxStaticBox* staticUser, *staticAccount, *staticCategories; User* user = _kiss->GetUser(); wxGridBagSizer *gridBagSizer; wxStaticText* label; wxButton* buttonChangeName, *buttonChangePassword; wxStaticBoxSizer * staticBoxSizer; wxTextCtrl* name; SetSizer(vbox); staticUser = new wxStaticBox(this, -1, _("User")); staticAccount = new wxStaticBox(this, -1, _("Accounts")); staticCategories = new wxStaticBox(this, -1, _("Categories")); // User staticBoxSizer = new wxStaticBoxSizer (staticUser, wxVERTICAL); gridBagSizer = new wxGridBagSizer(10, 10); staticBoxSizer->Add(gridBagSizer); label = new wxStaticText(this, -1, _("Name")); gridBagSizer->Add(label, wxGBPosition(0, 0)); name = new wxTextCtrl(this, -1, user->_name); gridBagSizer->Add(name, wxGBPosition(0, 1)); buttonChangeName = new wxButton(this, -1, _("Change Name")); buttonChangePassword = new wxButton(this, -1, _("Change Password")); gridBagSizer->Add(buttonChangeName, wxGBPosition(1, 0)); gridBagSizer->Add(buttonChangePassword, wxGBPosition(1, 1)); vbox->Add(staticBoxSizer); vbox->Add(-1, 20); // Account staticBoxSizer = new wxStaticBoxSizer (staticAccount, wxVERTICAL); _accountGrid = new wxGrid(this, -1); LoadAccounts(user); staticBoxSizer->Add(_accountGrid); vbox->Add(staticBoxSizer); vbox->Add(-1, 20); // Categories staticBoxSizer = new wxStaticBoxSizer (staticCategories, wxVERTICAL); _categoriesGrid = new wxGrid(this, -1); staticBoxSizer->Add(_categoriesGrid); vbox->Add(staticBoxSizer); Fit(); SetMinSize(GetSize()); Hide(); } void PreferencesPanel::LoadAccounts(User* user) { _accountGrid->CreateGrid(0, 5); _accountGrid->SetRowLabelSize(0); _accountGrid->SetColLabelValue(0, _("Name")); _accountGrid->SetColLabelValue(1, _("Number")); _accountGrid->SetColLabelValue(2, _("Shared")); _accountGrid->SetColLabelValue(3, _("Default")); _accountGrid->SetColLabelValue(4, _("")); }