本文整理汇总了C++中Profile::GetSerializedMap方法的典型用法代码示例。如果您正苦于以下问题:C++ Profile::GetSerializedMap方法的具体用法?C++ Profile::GetSerializedMap怎么用?C++ Profile::GetSerializedMap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Profile
的用法示例。
在下文中一共展示了Profile::GetSerializedMap方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: profile_editor
ProfileManager::ProfileManager(wxWindow* parent)
: wxDialog(parent, -1, "Profile Manager", wxDefaultPosition,
wxSize(kDialogWidth, kDialogHeight)), current_profile_(0, "", "") {
// Setup the listbox
item_lb_ = new wxListBox(this, -1, wxDefaultPosition);
// Setup buttons and the button panel
wxPanel* btn_panel = new wxPanel(this);
wxBoxSizer* ver_sizer = new wxBoxSizer(wxVERTICAL);
wxButton* new_profile_btn = new wxButton(btn_panel, -1, "New");
new_profile_btn->Bind(wxEVT_BUTTON, [=](wxCommandEvent&) {
ProfileEditor profile_editor(this, Profile::Profile(-1, "", ""));
if (profile_editor.ShowModal() == wxID_OK) {
Profile profile = profile_editor.GetProfile();
database_.AddProfile(profile.GetName(), profile.GetSerializedMap());
UpdateListBox();
}
});
wxButton* edit_profile_btn = new wxButton(btn_panel, -1, "Edit");
edit_profile_btn->Bind(wxEVT_BUTTON, [=](wxCommandEvent&) {
int sel = item_lb_->GetSelection();
if (sel != -1) {
Profile* profile = static_cast<Profile*>(item_lb_->GetClientData(sel));
ProfileEditor profile_editor(this, *profile);
if (profile_editor.ShowModal() == wxID_OK) {
Profile profile = profile_editor.GetProfile();
// Remove the old profile
database_.RemoveProfile(profile.GetId());
database_.AddProfile(profile.GetName(), profile.GetSerializedMap());
UpdateListBox();
}
}
});
wxButton* removeProfileBtn = new wxButton(btn_panel, -1, "Remove");
removeProfileBtn->Bind(wxEVT_BUTTON, [=](wxCommandEvent&) {
int sel = item_lb_->GetSelection();
if (sel != -1) {
Profile* profile = static_cast<Profile*>(item_lb_->GetClientData(sel));
database_.RemoveProfile(profile->GetId());
item_lb_->Delete(sel);
delete profile;
}
});
ver_sizer->Add(new_profile_btn, 0, wxBOTTOM, 5);
ver_sizer->Add(edit_profile_btn, 0, wxBOTTOM, 5);
ver_sizer->Add(removeProfileBtn, 0);
btn_panel->SetSizer(ver_sizer);
wxBoxSizer* upper_hor_sizer = new wxBoxSizer(wxHORIZONTAL);
upper_hor_sizer->Add(item_lb_, 1, wxEXPAND | wxALL, 10);
upper_hor_sizer->Add(btn_panel, 0, wxALL, 10);
// Setup ok/cancel button panel
wxPanel* bottom_btn_panel = new wxPanel(this);
wxButton* ok_btn = new wxButton(bottom_btn_panel, -1, "OK");
ok_btn->Bind(wxEVT_BUTTON, [=](wxCommandEvent&) {
Profile* profile;
int sel = item_lb_->GetSelection();
if (sel != -1) {
profile = static_cast<Profile*>(item_lb_->GetClientData(sel));
current_profile_ = *profile;
}
EndModal(wxID_OK);
Destroy();
});
wxButton* cancel_btn = new wxButton(bottom_btn_panel, -1, "Cancel");
cancel_btn->Bind(wxEVT_BUTTON, [=](wxCommandEvent&) {
EndModal(wxID_CANCEL);
Destroy();
});
wxBoxSizer* bottom_hor_sizer = new wxBoxSizer(wxHORIZONTAL);
bottom_hor_sizer->Add(ok_btn, 0, wxALL, 10);
bottom_hor_sizer->Add(cancel_btn, 0, wxALL, 10);
bottom_btn_panel->SetSizer(bottom_hor_sizer);
// Setup the outermost vertical layout/sizer
wxBoxSizer* super_sizer = new wxBoxSizer(wxVERTICAL);
super_sizer->Add(upper_hor_sizer, 1, wxEXPAND);
super_sizer->Add(bottom_btn_panel, 0);
//.........这里部分代码省略.........