void wxExToolBar::AddControls(bool realize) { AddTool(wxID_NEW); AddTool(wxID_OPEN); AddTool(wxID_SAVE); AddTool(wxID_PRINT); AddTool(wxID_UNDO); AddTool(wxID_REDO); AddTool(wxID_FIND); if (wxExProcess::GetShell() != nullptr) { AddTool(wxID_EXECUTE); } SetToolDropDown(wxID_FIND, true); SetToolDropDown(wxID_OPEN, true); Bind(wxEVT_AUITOOLBAR_TOOL_DROPDOWN, [=](wxAuiToolBarEvent& event) { if (!PrepDropDown(this, event)) return; FindPopupMenu(this, wxExFindReplaceData::Get()->GetFindStrings(), GetPoint(this, event)); SetToolSticky(event.GetId(), false);}, wxID_FIND); Bind(wxEVT_AUITOOLBAR_TOOL_DROPDOWN, [=](wxAuiToolBarEvent& event) { if (!PrepDropDown(this, event)) return; m_Frame->GetFileHistory().PopupMenu(this, ID_CLEAR_FILES, GetPoint(this, event)); SetToolSticky(event.GetId(), false);}, wxID_OPEN); if (realize) Realize(); }
void wxGISToolBar::AddCommand(wxGISCommand* pCmd) { switch(pCmd->GetKind()) { case enumGISCommandMenu: return; case enumGISCommandSeparator: case enumGISCommandCheck: case enumGISCommandRadio: case enumGISCommandNormal: { wxBitmap Bitmap = pCmd->GetBitmap(); if(!Bitmap.IsOk()) Bitmap = wxBitmap(tool_16_xpm); AddTool(pCmd->GetID(), wxStripMenuCodes(pCmd->GetCaption()), Bitmap, wxBitmap(), (wxItemKind)pCmd->GetKind(), pCmd->GetTooltip(), pCmd->GetMessage(), NULL); } break; case enumGISCommandDropDown: { wxBitmap Bitmap = pCmd->GetBitmap(); if(!Bitmap.IsOk()) Bitmap = wxBitmap(tool_16_xpm); AddTool(pCmd->GetID(), wxStripMenuCodes(pCmd->GetCaption()), Bitmap, wxBitmap(), (wxItemKind)enumGISCommandNormal, pCmd->GetTooltip(), pCmd->GetMessage(), NULL); SetToolDropDown(pCmd->GetID(), true); } break; case enumGISCommandControl: { IToolControl* pToolCtrl = dynamic_cast<IToolControl*>(pCmd); if(pToolCtrl) { IToolBarControl* pToolBarControl = pToolCtrl->GetControl(); wxControl* pControl = dynamic_cast<wxControl*>(pToolBarControl); if(pControl) { if(pToolCtrl->HasToolLabel()) { wxString sToolLabel = pToolCtrl->GetToolLabel(); AddLabel(wxID_ANY, sToolLabel, sToolLabel.Len() * 5); } pControl->Reparent(this); AddControl(pControl); //add ctrl to remove map m_RemControlMap[m_CommandArray.size()] = pToolBarControl; } else return; } else return; } break; default: return; } wxGISCommandBar::AddCommand(pCmd); Realize(); }