1 | //menus.xrc
|
---|
2 | <object class="wxMenuItem" name="ID_TABCONTEXT_RENAME">
|
---|
3 | <label>Re&name</label>
|
---|
4 | </object>
|
---|
5 |
|
---|
6 | //state.cpp
|
---|
7 | void CState::SetTitle(wxString newName)
|
---|
8 | {
|
---|
9 | m_title = newName;
|
---|
10 | }
|
---|
11 |
|
---|
12 |
|
---|
13 | //context_control.cpp
|
---|
14 | void CContextControl::OnTabContextRename(wxCommandEvent& event)
|
---|
15 | {
|
---|
16 | CInputDialog dlg;
|
---|
17 | if (!dlg.Create(this, _("Rename Tab"), _("Please enter new name for the tab:")))
|
---|
18 | return;
|
---|
19 | if (dlg.ShowModal() != wxID_OK)
|
---|
20 | return;
|
---|
21 |
|
---|
22 | for (size_t j = 0; j < m_context_controls.size(); j++) {
|
---|
23 |
|
---|
24 | if (m_context_controls[j].tab_index != m_right_clicked_tab)
|
---|
25 | continue;
|
---|
26 |
|
---|
27 | m_context_controls[j].pState->SetTitle(dlg.GetValue());
|
---|
28 |
|
---|
29 | CContextControl::_context_controls* controls = GetControlsFromState(m_context_controls[j].pState);
|
---|
30 | m_tabs->SetPageText(controls->tab_index, controls->pState->GetTitle());
|
---|
31 |
|
---|
32 | break;
|
---|
33 | }
|
---|
34 | }
|
---|