本文整理汇总了C++中History::getHistory方法的典型用法代码示例。如果您正苦于以下问题:C++ History::getHistory方法的具体用法?C++ History::getHistory怎么用?C++ History::getHistory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类History
的用法示例。
在下文中一共展示了History::getHistory方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wxs
Frame::Frame(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &position, const wxSize& size, long style)
: wxFrame(parent, id, title, position, size, style)
{
WxPanel1 = new wxPanel(this, -1, wxPoint(-5, 9), wxSize(360, 83));
(void) new wxStaticText(WxPanel1, -1, wxT("IP Adress:"), wxPoint(9, 0), wxDefaultSize);
(void) new wxStaticText(WxPanel1, -1, wxT("Port:"), wxPoint(231, 0), wxDefaultSize);
(void) new wxStaticText(WxPanel1, -1, wxT("Tibia Version:"), wxPoint(288, 0));
wxArrayString arrayStringFor_ip;
vector<string>z;
z = h.getHistory();
for(int i = 0; i < int(z.size()); i++){
wxString wxs(z[i].c_str(), wxConvUTF8);
arrayStringFor_ip.Add(wxs);
}
ip = new wxComboBox(WxPanel1, -1, wxT(""), wxPoint(11, 17), wxSize(214, 21), arrayStringFor_ip);
wxArrayString arrayStringFor_clients;
arrayStringFor_clients.Add(wxT("Auto"));
for(int i = 0; i < int(sizeof(adresses)/sizeof(adresses[0])); i++){
wxString wxs(adresses[i][0].insert(1, ".").c_str(), wxConvUTF8);
arrayStringFor_clients.Add(wxs);
}
host = new wxSpinCtrl(WxPanel1, wxID_ANY, wxT("7171"), wxPoint(232, 17), wxSize(55, 21), wxSP_ARROW_KEYS, 1000, 9999, 7171);
clients = new wxComboBox(WxPanel1, -1, wxT("Auto"), wxPoint(289, 17), wxSize(54, 21), arrayStringFor_clients, wxCB_READONLY);
(void) new wxButton(WxPanel1, BUTTON_CHANGE_IP, wxT("Change IP"), wxPoint(81, 40), wxSize(87, 31));
Connect(BUTTON_CHANGE_IP, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(Frame::FrameClickEvents));
(void) new wxButton(WxPanel1, BUTTON_ADD_TO_TRAY, wxT("Add to Tray"), wxPoint(170, 40), wxSize(87, 31));
(void) new wxButton(WxPanel1, wxID_EXIT, wxT("Exit"), wxPoint(259, 40), wxSize(87, 31));
sb = new wxStatusBar(this, -1);
wxMenuBar *menubar = new wxMenuBar();
wxMenu *file = new wxMenu;
file->Append(MENU_CLEAR_HISTORY, wxT("Clear History"));
file->AppendSeparator();
file->Append(wxID_EXIT, wxT("Exit"));
menubar->Append(file, wxT("File"));
wxMenu *help = new wxMenu;
help->Append(MENU_INFO, wxT("Info"));
menubar->Append(help, wxT("Help"));
SetMenuBar(menubar);
trayIcon = new TrayIcon(this);
wxIcon icon(Self_Frame_XPM);
if(!trayIcon->SetIcon(icon, wxT("IP Changer")))
wxMessageBox(wxT("Could not set icon."));
SetStatusBar(sb);
SetTitle(wxT("IP Changer"));
SetIcon(Self_Frame_XPM);
SetSize(8,8,362,147);
Center();
}
示例2: guiChangeIP
void guiChangeIP(Frame *frame, int eventId){
Change c;
HANDLE tibia = c.getTibiaProcess();
if(!tibia){
frame->sb->SetStatusText(wxT("Tibia process not found!"),0);
if(eventId == MENU_CHANGE_IP)
sendDialog(wxT("Tibia process not found!"), wxOK | wxICON_ERROR);
CloseHandle(tibia);
return;
}
std::string sip = std::string(frame->ip->GetValue().mb_str());
int sport = frame->host->GetValue();
std::string client = std::string(frame->clients->GetValue().mb_str());
if(sip == ""){
frame->sb->SetStatusText(wxT("IP adress not found!"),0);
if(eventId == MENU_CHANGE_IP)
sendDialog(wxT("IP adress not found!"), wxOK | wxICON_ERROR);
return;
}
size_t found = sip.find(":");
if(found != string::npos){
sport = atoi(sip.substr(found+1, sip.size()).c_str());
sip = sip.substr(0, found);
frame->ip->SetValue(sip);
frame->host->SetValue(sport);
}
if(client != "Auto"){
std::string s ="";
s += client.at(1);
if(s == ".")
client = client.erase(1,1);
}
bool ret = c.changeIP(sip, sport, client);
if(ret){
frame->sb->SetStatusText(wxT("IP Changed!"),0);
if(eventId == MENU_CHANGE_IP)
sendDialog(wxT("IP Changed!"), wxOK);
}else{
frame->sb->SetStatusText(wxT("IP not Changed!"),0);
if(eventId == MENU_CHANGE_IP)
sendDialog(wxT("IP not Changed!"), wxOK | wxICON_ERROR);
return;
}
char buf[4];
itoa(sport, buf, 10);
std::string save;
save += sip + ":" + buf;
h.saveHistory(save);
frame->ip->Clear();
vector<string>z;
z = h.getHistory();
for(int i = 0; i < int(z.size()); i++){
wxString wxs(z[i].c_str(), wxConvUTF8);
frame->ip->Append(wxs);
}
std::string tmp = z[0].substr(0, z[0].size()-5);
wxString last(tmp.c_str(), wxConvUTF8);
frame->ip->SetValue(last);
}