void MainWindow::play() { libvlc_media_player_play(media_player); playpause_button->SetLabel(wxT("Pause")); playpause_button->Enable(true); stop_button->Enable(true); timeline->Enable(true); }
void HandleCommand(wxCommandEvent& event) { event.Skip(); switch(event.GetId()) { case DID_STOP_EMU: m_btn_run->SetLabel("Run"); break; case DID_PAUSE_EMU: m_btn_run->SetLabel("Resume"); break; case DID_START_EMU: case DID_RESUME_EMU: m_btn_run->SetLabel("Pause"); break; case DID_EXIT_THR_SYSCALL: Emu.GetCPU().RemoveThread(((PPCThread*)event.GetClientData())->GetId()); break; } UpdateUI(); }
DbgEmuPanel(wxWindow* parent) : wxPanel(parent) { m_btn_run = new wxButton(this, wxID_ANY, "Run"); m_btn_run->Bind(wxEVT_BUTTON, &DbgEmuPanel::OnRun, this); m_btn_stop = new wxButton(this, wxID_ANY, "Stop"); m_btn_stop->Bind(wxEVT_BUTTON, &DbgEmuPanel::OnStop, this); m_btn_restart = new wxButton(this, wxID_ANY, "Restart"); m_btn_restart->Bind(wxEVT_BUTTON, &DbgEmuPanel::OnRestart, this); m_btn_capture_frame = new wxButton(this, wxID_ANY, "Capture frame"); m_btn_capture_frame->Bind(wxEVT_BUTTON, &DbgEmuPanel::OnCaptureFrame, this); wxBoxSizer* s_b_main = new wxBoxSizer(wxHORIZONTAL); s_b_main->Add(m_btn_run, wxSizerFlags().Border(wxALL, 5)); s_b_main->Add(m_btn_stop, wxSizerFlags().Border(wxALL, 5)); s_b_main->Add(new wxStaticLine(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL), 0, wxEXPAND); s_b_main->Add(m_btn_restart, wxSizerFlags().Border(wxALL, 5)); s_b_main->Add(m_btn_capture_frame, wxSizerFlags().Border(wxALL, 5)); SetSizerAndFit(s_b_main); Layout(); UpdateUI(); wxGetApp().Bind(wxEVT_DBG_COMMAND, &DbgEmuPanel::HandleCommand, this); }
void StreamerFrame::OnConnectionLost(wxSocketEvent& event){ connect->SetValue(false); connect->SetLable("Connect"); SetStatusText("Connection to server lost"); }
void StreamerFrame::OnConnectionEstablished(wxSocketEvent& event){ connect->SetValue(true); connect->SetLabel("Disconnect"); SetStatusText( "Connection Established" ); }
void UpdateUI() { const auto status = Emu.GetStatus(); if (m_last_status != status) { m_last_status = status; m_btn_run->Enable(status != system_state::stopped); m_btn_stop->Enable(status != system_state::stopped); m_btn_restart->Enable(!Emu.GetPath().empty()); m_btn_run->SetLabel(status == system_state::paused ? "Resume" : status == system_state::running ? "Pause" : "Run"); } }
void MainWindow::stop() { pause(); libvlc_media_player_stop(media_player); stop_button->Enable(false); setTimeline(0.0); timeline->Enable(false); }
void MyFrame::InitButtons() { m_copy = new wxButton(this, wxID_ANY, wxT("Process"), wxDefaultPosition, wxDefaultSize, 0); m_select_img = new wxButton(this, wxID_ANY, wxT("Executable..."), wxDefaultPosition, wxDefaultSize, 0); m_select_corefile = new wxButton(this, wxID_ANY, wxT("Core dump..."), wxDefaultPosition, wxDefaultSize, 0); m_reset = new wxButton(this, wxID_ANY, wxT("Clear"), wxDefaultPosition, wxDefaultSize, 0); m_copy->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(MyFrame::OnCopyClick), NULL, this); m_select_img->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(MyFrame::OnSelectExecutable), NULL, this); m_select_corefile->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(MyFrame::OnSelectCoreFile), NULL, this); m_reset->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(MyFrame::OnReset), NULL, this); }
void SjMyMusicConfigPage::UpdateButtons() { bool enable = GetSelFromDialog()!=NULL; if( m_configMenuButton ) { m_configMenuButton->Enable(enable); } if( m_removeButton ) { m_removeButton->Enable(enable); } if( m_updateButton ) { m_updateButton->SetLabel(wxString::Format(m_idxChanged? "* %s%s" : " %s%s ", _("Update music library"), SJ_BUTTON_MENU_ARROW)); } }
void HandleCommand(wxCommandEvent& event) { switch(event.GetId()) { case DID_STOP_EMU: m_btn_run->SetLabel("Run"); break; case DID_PAUSE_EMU: m_btn_run->SetLabel("Resume"); break; case DID_START_EMU: case DID_RESUME_EMU: m_btn_run->SetLabel("Pause"); break; } UpdateUI(); event.Skip(); }
void MyFrame::OnConnect(wxCommandEvent& event) { if ( event.IsChecked() ) { m_btnDynamic->Connect(wxID_ANY, wxEVT_BUTTON, wxCommandEventHandler(MyFrame::OnDynamic), NULL, this); Connect(Event_Dynamic, wxEVT_MENU, wxCommandEventHandler(MyFrame::OnDynamic)); } else // disconnect { m_btnDynamic->Disconnect(wxID_ANY, wxEVT_BUTTON, wxCommandEventHandler(MyFrame::OnDynamic), NULL, this); Disconnect(Event_Dynamic, wxEVT_MENU, wxCommandEventHandler(MyFrame::OnDynamic)); } UpdateDynamicStatus(event.IsChecked()); }
void StreamerFrame::OnConnectDisconnect(wxCommandEvent& event){ string connect_label = "Connect"; string disconnect_label = "Disconnect"; //we connect to the client //we first check the label of the btn if(connect->GetLabel() == connect_label){ client = new wxSocketClient(wxSOCKET_WAITALL); client->Connect(ip,0); }else if(connect->GetLabel() == disconnect_label){ //we will disconnect connect->SetValue(false); connect->SetLabel("Connect"); SetStatusText("Disconnected"); } }
DbgEmuPanel(wxWindow* parent) : wxPanel(parent) { m_btn_run = new wxButton(this, wxID_ANY, "Run"); m_btn_stop = new wxButton(this, wxID_ANY, "Stop"); m_btn_restart = new wxButton(this, wxID_ANY, "Restart"); wxBoxSizer& s_b_main = *new wxBoxSizer(wxHORIZONTAL); s_b_main.Add(m_btn_run, wxSizerFlags().Border(wxALL, 5)); s_b_main.Add(m_btn_stop, wxSizerFlags().Border(wxALL, 5)); s_b_main.Add(new wxStaticLine(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL), 0, wxEXPAND); s_b_main.Add(m_btn_restart, wxSizerFlags().Border(wxALL, 5)); SetSizerAndFit(&s_b_main); Layout(); UpdateUI(); Connect(m_btn_run->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(DbgEmuPanel::OnRun)); Connect(m_btn_stop->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(DbgEmuPanel::OnStop)); Connect(m_btn_restart->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(DbgEmuPanel::OnRestart)); m_app_connector.Connect(wxEVT_DBG_COMMAND, wxCommandEventHandler(DbgEmuPanel::HandleCommand), (wxObject*)0, this); }
void MyFrame::OnBind(wxCommandEvent& event) { if ( event.IsChecked() ) { // as we bind directly to the button, there is no need to use an id // here: the button will only ever get its own events m_btnDynamic->Bind(wxEVT_BUTTON, &MyFrame::OnDynamic, this); // but we do need the id for the menu command as the frame gets all of // them Bind(wxEVT_MENU, &MyFrame::OnDynamic, this, Event_Dynamic); } else // disconnect { m_btnDynamic->Unbind(wxEVT_BUTTON, &MyFrame::OnDynamic, this); Unbind(wxEVT_MENU, &MyFrame::OnDynamic, this, Event_Dynamic); } UpdateDynamicStatus(event.IsChecked()); }
MainFrame(const wxString& title) { wxXmlResource::Get()->LoadFrame(this, NULL, "Frame1"); m_buttonFindAll = XRCCTRL(*this, "m_buttonFindAll", wxButton); m_textCtrlRegex = XRCCTRL(*this, "m_textCtrlRegex", wxTextCtrl); m_textCtrlString = XRCCTRL(*this, "m_textCtrlString", wxTextCtrl); m_textCtrlFindAll = XRCCTRL(*this, "m_textCtrlFindAll", wxTextCtrl); m_textCtrlRegex->Bind(wxEVT_TEXT, [=](wxCommandEvent &event){ std::wstring a = m_textCtrlRegex->GetValue(); auto R = re::compile(a); if (R){ m_textCtrlRegex->SetBackgroundColour(wxColor(0,255,0)); m_textCtrlRegex->Refresh(); m_textCtrlFindAll->Clear(); m_textCtrlFindAll->Refresh(); } else{ m_textCtrlRegex->SetBackgroundColour(wxColor(255, 0, 0)); m_textCtrlRegex->Refresh(); m_textCtrlFindAll->Clear(); m_textCtrlFindAll->AppendText(std::to_string(re::getlasterror())); m_textCtrlFindAll->AppendText("\n"); m_textCtrlFindAll->AppendText(re::getlasterrorstr()); m_textCtrlFindAll->Refresh(); } } ); //------------------------------------------------------------------------------ m_buttonFindAll->Bind(wxEVT_COMMAND_BUTTON_CLICKED, [=](wxCommandEvent &event){ m_textCtrlFindAll->Clear(); std::wstring a = m_textCtrlRegex->GetValue(); auto R = re::compile(a); if (R){ std::wstring s = m_textCtrlString->GetValue(); auto v = R->findall(s); for (auto i = v.begin(); i < v.end(); i++){ m_textCtrlFindAll->AppendText(*i); m_textCtrlFindAll->AppendText("\n"); } } m_textCtrlFindAll->Refresh(); }); //------------------------------------------------------------------------------ }
void wxMiniApp::DoIt() { download_file(wxT("check.txt")); status->AppendText(wxT("\n")); status_text->SetLabel(wxT("Checking files...")); ifstream checkfile("check.txt"); string line; vector<string> files_list; if(checkfile.is_open()) { while(checkfile.good()) { getline(checkfile,line); files_list.push_back(line); } checkfile.close(); for(int i=0; i<files_list.size();i+=2) { // Check all the files wxString mystring1(files_list[i].c_str(), wxConvUTF8); wxString mystring2(files_list[i+1].c_str(), wxConvUTF8); check_file_integrity(mystring1, mystring2); } // Say something status_text->SetLabel(wxT("Update finished")); start_button->Enable(true); } else { // Do nothing if check.txt fails status_text->SetLabel(wxT("Error while updating")); } }
bool wxMiniApp::OnInit() { //update_server = "http://vengeance-rpg.com/updates/"; update_server = wxT("http://ofarts.rpgmaker.es/updater-test/"); local_path = wxT("./"); window = new wxFrame( NULL, -1, wxT("Vengeance RPG Online Updater"), wxDefaultPosition, wxSize( 400, 300) ); SetTopWindow( window ); GetTopWindow()->SetMinSize(wxSize(400,300)); GetTopWindow()->SetMaxSize(wxSize(400,300)); main_panel = new wxPanel(GetTopWindow(), wxID_ANY, wxPoint(0, 0), wxSize(400, 300)); wxImage::AddHandler(new wxPNGHandler); initialize_images(); // 134 height logo = new wxBitmapButton(main_panel, wxID_ANY, _img_vengeance, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE); status = new wxTextCtrl(main_panel, wxID_ANY, wxT(""), wxPoint(1,135), wxSize(389,100), wxTE_READONLY|wxTE_MULTILINE); status_text = new wxStaticText(main_panel, wxID_ANY, wxT("Conectando..."), wxPoint(15, 245), wxDefaultSize); start_button = new wxButton(main_panel, 21, wxT("Start Game"), wxPoint(210, 242), wxSize(80,20)); start_button->Enable(false); exit_button = new wxButton(main_panel, wxID_EXIT, wxT("Exit"), wxPoint(305, 242), wxSize(80,20)); Connect(21, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(wxMiniApp::launch_game) ); Connect(wxID_EXIT, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(wxMiniApp::OnClick) ); // show main frame GetTopWindow()->Show(); DoIt(); // enter the application's main loop return true; }
void DispFreq_NextNum(wxButton &but,wxCommandEvent&) { DispFreqs *tmp=(DispFreqs*)(but.GetClientData()); tmp->ShiftBy(tmp->GetLines()); }
void CreateArtificialDataOK(wxButton& calc,wxEvent &) { calc.SetClientData((char*)1); calc.GetParent()->Show(FALSE); }
void CreateArtificialDataCancel(wxButton& calc,wxEvent &) { calc.GetParent()->Show(FALSE); }
void PredictQUIT(wxButton& calc,wxEvent &) { calc.GetParent()->Show(FALSE); }
void MainWindow::pause() { libvlc_media_player_pause(media_player); playpause_button->SetLabel(wxT("Play")); }
void myGeneralButtonHandlerNoHide(wxButton& but,wxEvent &) { but.SetClientData((char*)1); }
void UpdateUI() { m_btn_run->Enable(!Emu.IsStopped()); m_btn_stop->Enable(!Emu.IsStopped()); m_btn_restart->Enable(!Emu.m_path.IsEmpty()); }
void UpdateUI() { m_btn_run->Enable(!Emu.IsStopped()); m_btn_stop->Enable(!Emu.IsStopped()); m_btn_restart->Enable(!Emu.GetPath().empty()); }
void myGeneralButtonHandler(wxButton& but,wxEvent &) { but.GetParent()->Show(FALSE); but.SetClientData((char*)1); }
NewMapDialog(wxWindow* parent, int game, int port, vector<Archive::mapdesc_t>& maps, Archive* archive) : wxDialog(parent, -1, "New Map") { // Setup dialog wxBoxSizer* msizer = new wxBoxSizer(wxVERTICAL); SetSizer(msizer); wxGridBagSizer* sizer = new wxGridBagSizer(4, 4); msizer->Add(sizer, 1, wxEXPAND|wxALL, 10); // Open selected game configuration if no map names are currently loaded if (theGameConfiguration->nMapNames() == 0) { string gname = theGameConfiguration->gameConfig(game).name; string pname = theGameConfiguration->portConfig(port).name; theGameConfiguration->openConfig(gname, pname); } // Check if the game configuration allows any map name int flags = 0; if (!theGameConfiguration->anyMapName()) flags = wxCB_READONLY; // Create map name combo box cbo_mapname = new wxComboBox(this, -1, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, flags); sizer->Add(new wxStaticText(this, -1, "Map Name:"), wxGBPosition(0, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL); sizer->Add(cbo_mapname, wxGBPosition(0, 1), wxDefaultSpan, wxEXPAND); // Limit map name length if necessary if (theGameConfiguration->anyMapName() && (!theGameConfiguration->allowLongNames() || (archive && archive->getType() != ARCHIVE_ZIP && archive->getType() != ARCHIVE_7Z && archive->getType() != ARCHIVE_FOLDER))) cbo_mapname->SetMaxLength(8); // Add possible map names to the combo box for (unsigned a = 0; a < theGameConfiguration->nMapNames(); a++) { // Check if map already exists string mapname = theGameConfiguration->mapName(a); bool exists = false; for (unsigned m = 0; m < maps.size(); m++) { if (S_CMPNOCASE(maps[m].name, mapname)) { exists = true; break; } } if (!exists) cbo_mapname->Append(mapname); } // Set inital map name selection if (theGameConfiguration->nMapNames() > 0) cbo_mapname->SetSelection(0); // Create map format combo box choice_mapformat = new wxChoice(this, -1); sizer->Add(new wxStaticText(this, -1, "Map Format:"), wxGBPosition(1, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL); sizer->Add(choice_mapformat, wxGBPosition(1, 1), wxDefaultSpan, wxEXPAND); // Add possible map formats to the combo box uint8_t default_format = MAP_UNKNOWN; if (! maps.empty()) default_format = maps[0].format; for (uint8_t map_type = 0; map_type < MAP_UNKNOWN; map_type++) { if (theGameConfiguration->mapFormatSupported(map_type, game, port)) { choice_mapformat->Append(MAP_TYPE_NAMES[map_type]); if (map_type == default_format) choice_mapformat->SetSelection(choice_mapformat->GetCount() - 1); } } // Default to the "best" supported format, the last one in the list if (choice_mapformat->GetSelection() == wxNOT_FOUND) choice_mapformat->SetSelection(choice_mapformat->GetCount() - 1); // Add dialog buttons wxBoxSizer* hbox = new wxBoxSizer(wxHORIZONTAL); msizer->Add(hbox, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 10); hbox->AddStretchSpacer(); btn_ok = new wxButton(this, -1, "OK"); hbox->Add(btn_ok, 0, wxEXPAND | wxRIGHT, 4); btn_cancel = new wxButton(this, -1, "Cancel"); hbox->Add(btn_cancel, 0, wxEXPAND); sizer->AddGrowableCol(1); // Bind events btn_ok->Bind(wxEVT_BUTTON, &NewMapDialog::onBtnOk, this); btn_cancel->Bind(wxEVT_BUTTON, &NewMapDialog::onBtnCancel, this); Layout(); msizer->Fit(this); CenterOnParent(); }
void ChangeDialogOK(wxButton& button,wxEvent &) { button.GetParent()->SetClientData((char*)1); button.GetParent()->Show(FALSE); }
void DispFreq_Next(wxButton &but,wxCommandEvent&) { ((DispFreqs*)(but.GetClientData()))->ShiftBy(1); }