本文整理汇总了C++中wxThreadEvent::GetId方法的典型用法代码示例。如果您正苦于以下问题:C++ wxThreadEvent::GetId方法的具体用法?C++ wxThreadEvent::GetId怎么用?C++ wxThreadEvent::GetId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxThreadEvent
的用法示例。
在下文中一共展示了wxThreadEvent::GetId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnThread
// update gui
void NetPlayDialog::OnThread(wxThreadEvent& event)
{
if (m_is_hosting && m_host_label && g_TraversalClient)
{
UpdateHostLabel();
}
// player list
m_playerids.clear();
std::string tmps;
netplay_client->GetPlayerList(tmps, m_playerids);
wxString selection;
if (m_player_lbox->GetSelection() != wxNOT_FOUND)
selection = m_player_lbox->GetString(m_player_lbox->GetSelection());
m_player_lbox->Clear();
std::istringstream ss(tmps);
while (std::getline(ss, tmps))
m_player_lbox->Append(StrToWxStr(tmps));
// remove ping from selection string, in case it has changed
selection.erase(selection.rfind('|') + 1);
if (!selection.empty())
{
for (unsigned int i = 0; i < m_player_lbox->GetCount(); ++i)
{
if (selection == m_player_lbox->GetString(i).substr(0, selection.length()))
{
m_player_lbox->SetSelection(i);
break;
}
}
}
// flash window in taskbar when someone joins if window isn't active
static u8 numPlayers = 1;
if (netplay_server != nullptr && numPlayers < m_playerids.size() && !HasFocus())
{
RequestUserAttention();
}
numPlayers = m_playerids.size();
switch (event.GetId())
{
case NP_GUI_EVT_CHANGE_GAME:
// update selected game :/
{
m_selected_game = WxStrToStr(event.GetString());
wxString button_label = event.GetString();
m_game_btn->SetLabel(button_label.Prepend(_(" Game : ")));
}
break;
case NP_GUI_EVT_START_GAME:
// client start game :/
{
netplay_client->StartGame(FindGame());
}
break;
case NP_GUI_EVT_STOP_GAME:
// client stop game
{
netplay_client->StopGame();
}
break;
}
// chat messages
while (chat_msgs.Size())
{
std::string s;
chat_msgs.Pop(s);
// PanicAlert("message: %s", s.c_str());
m_chat_text->AppendText(StrToWxStr(s).Append('\n'));
}
}
示例2: OnThread
// update gui
void NetPlayDialog::OnThread(wxThreadEvent& event)
{
if (m_is_hosting && m_host_label && g_TraversalClient)
{
UpdateHostLabel();
}
// player list
m_playerids.clear();
std::string tmps;
netplay_client->GetPlayerList(tmps, m_playerids);
wxString selection;
if (m_player_lbox->GetSelection() != wxNOT_FOUND)
selection = m_player_lbox->GetString(m_player_lbox->GetSelection());
m_player_lbox->Clear();
std::istringstream ss(tmps);
while (std::getline(ss, tmps))
m_player_lbox->Append(StrToWxStr(tmps));
// remove ping from selection string, in case it has changed
selection.erase(selection.rfind('|') + 1);
if (!selection.empty())
{
for (unsigned int i = 0; i < m_player_lbox->GetCount(); ++i)
{
if (selection == m_player_lbox->GetString(i).substr(0, selection.length()))
{
m_player_lbox->SetSelection(i);
break;
}
}
}
// flash window in taskbar when someone joins if window isn't active
static u8 numPlayers = 1;
if (netplay_server != nullptr && numPlayers < m_playerids.size() && !HasFocus())
{
RequestUserAttention();
}
numPlayers = m_playerids.size();
switch (event.GetId())
{
case NP_GUI_EVT_CHANGE_GAME:
// update selected game :/
{
m_selected_game = WxStrToStr(event.GetString());
wxString button_label = event.GetString();
m_game_btn->SetLabel(button_label.Prepend(_(" Game : ")));
}
break;
case NP_GUI_EVT_START_GAME:
// client start game :/
{
netplay_client->StartGame(FindCurrentGame());
std::string msg = "Starting game";
AddChatMessage(ChatMessageType::Info, msg);
}
break;
case NP_GUI_EVT_STOP_GAME:
// client stop game
{
std::string msg = "Stopping game";
AddChatMessage(ChatMessageType::Info, msg);
}
break;
case NP_GUI_EVT_DISPLAY_MD5_DIALOG:
{
m_MD5_dialog = new MD5Dialog(this, netplay_server, netplay_client->GetPlayers(),
event.GetString().ToStdString());
m_MD5_dialog->Show();
}
break;
case NP_GUI_EVT_MD5_PROGRESS:
{
if (m_MD5_dialog == nullptr || m_MD5_dialog->IsBeingDeleted())
break;
std::pair<int, int> payload = event.GetPayload<std::pair<int, int>>();
m_MD5_dialog->SetProgress(payload.first, payload.second);
}
break;
case NP_GUI_EVT_MD5_RESULT:
{
if (m_MD5_dialog == nullptr || m_MD5_dialog->IsBeingDeleted())
break;
std::pair<int, std::string> payload = event.GetPayload<std::pair<int, std::string>>();
m_MD5_dialog->SetResult(payload.first, payload.second);
}
break;
case NP_GUI_EVT_PAD_BUFFER_CHANGE:
{
std::string msg = StringFromFormat("Buffer size: %d", m_pad_buffer);
//.........这里部分代码省略.........