Whos responsibility is it to delete all the stuff used
to make dialogs, menus etc. Like:
EDIT: I screwed up the coloration, but you get the idea.
// ----------------------------------------------------------------------------
void wxKeyConfigPanel::BuildCtrls()
// ----------------------------------------------------------------------------
{
if (m_nBuildMode & wxKEYBINDER_USE_TREECTRL) {
// use a wxTreeCtrl to show the commands hierarchy
m_pCommandsTree = new wxTreeCtrl(this, wxKEYBINDER_COMMANDS_BOX_ID, wxDefaultPosition,
wxDefaultSize, wxTR_HAS_BUTTONS | wxSUNKEN_BORDER);
} else {
// use a combobox + a listbox
m_pCommandsList = newnew wxListBox(this, wxKEYBINDER_COMMANDS_BOX_ID, wxDefaultPosition,
wxDefaultSize, 0, NULL);
m_pCategories = new wxComboBox(this, wxKEYBINDER_CATEGORIES_ID,
wxEmptyString, wxDefaultPosition, wxDefaultSize,
0, NULL, wxCB_READONLY);
}
m_pKeyField = new wxKeyMonitorTextCtrl(this, wxKEYBINDER_KEY_FIELD_ID);
m_pBindings = new wxListBox(this, wxKEYBINDER_BINDINGS_BOX_ID);
m_pAssignBtn = new wxButton(this, wxKEYBINDER_ASSIGN_KEY_ID, wxT("&Add"));
m_pRemoveBtn = new wxButton(this, wxKEYBINDER_REMOVE_KEY_ID, wxT("&Remove"));
m_pRemoveAllBtn =new new wxButton(this, wxKEYBINDER_REMOVEALL_KEY_ID, wxT("Remove all"));
m_pCurrCmdField = newnew wxStaticText(this, -1, wxT(""), wxDefaultPosition,
wxSize(-1, 20), wxSIMPLE_BORDER | wxST_NO_AUTORESIZE | wxALIGN_CENTRE);
// we won't make it white because it must be clear to the user that this
// is not a text control...
m_pCurrCmdField->SetBackgroundColour(wxColour(200, 200, 200));
#ifdef __WXGTK__
m_pDescLabel = newnew wxTextCtrl(this, -1, wxT(""), wxDefaultPosition,
wxDefaultSize, wxTE_READONLY | wxTE_MULTILINE);
#else
m_pDescLabel =newnew wxStaticText(this, -1, wxT(""), wxDefaultPosition,
wxSize(-1, 40), wxSIMPLE_BORDER | wxST_NO_AUTORESIZE);
m_pDescLabel->SetBackgroundColour(wxColour(255, 255, 255));
#endif
// KEY PROFILES
// create the key profiles combobox & panel
m_bEnableKeyProfiles = TRUE;
// the style of a combobox must be set at the beginning:
// you cannot change the wxCB_READONLY flag presence later...
// VERY IMPORTANT: *NEVER* ADD THE CB_SORT STYLE:
// IT WOULD GIVE US GREAT PROBLEMS WHEN EDITING THE KEYPROFILE...
long style = (m_nBuildMode & wxKEYBINDER_ENABLE_PROFILE_EDITING) ? 0 : wxCB_READONLY;
m_pKeyProfiles = newnew wxComboBox(this, wxKEYBINDER_KEYPROFILES_ID,
wxEmptyString, wxDefaultPosition, wxDefaultSize,
0, NULL, style);
wxSizer *sizer = newnew wxBoxSizer(wxHORIZONTAL);
sizer->Add(m_pKeyProfiles, 6, wxGROW);
if (m_nBuildMode & wxKEYBINDER_SHOW_ADDREMOVE_PROFILE) {
// create the Add & remove profile buttons
sizer->Add(newnew wxButton(this, wxKEYBINDER_ADD_PROFILEBTN_ID, wxT("Add new")), 0,
wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5);
sizer->Add(newnew wxButton(this, wxKEYBINDER_REMOVE_PROFILEBTN_ID, wxT("Remove")), 0,
wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5);
}
m_pKeyProfilesSizer = newnew wxBoxSizer(wxVERTICAL);
m_pKeyProfilesSizer->Add(newnew wxStaticText(this, -1, wxT("Key profile:")), 0, wxGROW | wxALL, 5);
m_pKeyProfilesSizer->Add(sizer, 0, wxGROW | wxLEFT | wxRIGHT, 5);
m_pKeyProfilesSizer->Add(newnew wxStaticLine(this, -1), 0, wxGROW | wxALL, 5);
}