本文整理汇总了C++中GitEntry::GetGitCommandsEntries方法的典型用法代码示例。如果您正苦于以下问题:C++ GitEntry::GetGitCommandsEntries方法的具体用法?C++ GitEntry::GetGitCommandsEntries怎么用?C++ GitEntry::GetGitCommandsEntries使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GitEntry
的用法示例。
在下文中一共展示了GitEntry::GetGitCommandsEntries方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoOnDropdown
void GitConsole::DoOnDropdown(wxAuiToolBarEvent& e, const wxString& commandName, int id)
{
if(!e.IsDropDownClicked()) {
e.Skip();
return;
}
GitEntry data;
{
clConfig conf("git.conf");
conf.ReadItem(&data);
} // Force conf out of scope, else its dtor clobbers the GitConsole::OnDropDownMenuEvent Save()
GitCommandsEntries& ce = data.GetGitCommandsEntries(commandName);
vGitLabelCommands_t entries = ce.GetCommands();
int lastUsed = ce.GetLastUsedCommandIndex();
wxArrayString arr;
wxMenu menu;
for(size_t n = 0; n < entries.size(); ++n) {
wxMenuItem* item = menu.AppendRadioItem(n, entries.at(n).label);
item->Check(n == (size_t)lastUsed);
arr.Add(entries.at(n).command);
}
menu.Bind(wxEVT_COMMAND_MENU_SELECTED,
wxCommandEventHandler(GitConsole::OnDropDownMenuEvent),
this,
0,
arr.GetCount(),
new GitCommandData(arr, commandName, id));
wxAuiToolBar* auibar = dynamic_cast<wxAuiToolBar*>(e.GetEventObject());
if(auibar) {
clAuiToolStickness ts(auibar, e.GetToolId());
wxRect rect = auibar->GetToolRect(e.GetId());
wxPoint pt = auibar->ClientToScreen(rect.GetBottomLeft());
pt = ScreenToClient(pt);
PopupMenu(&menu, pt);
}
menu.Unbind(wxEVT_COMMAND_MENU_SELECTED,
wxCommandEventHandler(GitConsole::OnDropDownMenuEvent),
this,
0,
arr.GetCount(),
new GitCommandData(arr, commandName, id));
}
示例2: OnDropDownMenuEvent
void GitConsole::OnDropDownMenuEvent(wxCommandEvent& event)
{
int id = event.GetId();
GitCommandData* userdata = static_cast<GitCommandData*>(event.GetEventUserData());
wxCHECK_RET((int)userdata->arr.GetCount() > event.GetId(), "Out-of-range ID");
event.SetString(userdata->arr.Item(id));
event.SetId(userdata->id);
wxPostEvent(m_git, event); // We've now populated the event object with useful data, so get GitPlugin to process it
clConfig conf("git.conf");
GitEntry data;
conf.ReadItem(&data);
GitCommandsEntries& ce = data.GetGitCommandsEntries(userdata->name);
ce.SetLastUsedCommandIndex(id);
conf.WriteItem(&data);
conf.Save();
}