void TruncSilenceDialog::UpdateUI() { wxWindow *pWnd; switch (mEffect->mProcessIndex) { case 0: pWnd = FindWindowById(ID_TRUNCATION_DURATION, this); pWnd->Enable(true); pWnd = FindWindowById(ID_COMPRESS_FACTOR, this); pWnd->Enable(false); break; case 1: pWnd = FindWindowById(ID_TRUNCATION_DURATION, this); pWnd->Enable(false); pWnd = FindWindowById(ID_COMPRESS_FACTOR, this); pWnd->Enable(true); } }
CGoToDlg::CGoToDlg(wxWindow* parent) // dialog constructor : AIModalDialog(parent, -1, _("Go To"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) { m_nChapter = 0; m_nVerse = 1; // This dialog function below is generated in wxDesigner, and defines the controls and sizers // for the dialog. The first parameter is the parent which should normally be "this". // The second and third parameters should both be TRUE to utilize the sizers and create the right // size dialog. GoToDlgFunc(this, TRUE, TRUE); // The declaration is: GoToDlgFunc( wxWindow *parent, bool call_fit, bool set_sizer ); bool bOK; bOK = gpApp->ReverseOkCancelButtonsForMac(this); bOK = bOK; // avoid warning m_pSpinCtrlChapter = (wxSpinCtrl*)FindWindowById(IDC_EDIT_CHAPTER); m_pSpinCtrlVerse = (wxSpinCtrl*)FindWindowById(IDC_EDIT_VERSE); }
void CFrame::DoUnfloatPage(int Id) { wxFrame * Win = (wxFrame*)FindWindowById(Id); if (!Win) return; wxWindow * Child = Win->GetChildren().Item(0)->GetData(); Child->Reparent(this); DoAddPage(Child, g_pCodeWindow->iNbAffiliation[Child->GetId() - IDM_LOG_WINDOW], false); Win->Destroy(); }
void TruncSilenceDialog::OnDurationChange(wxCommandEvent & event) { // We may even get called during the constructor. // This test saves us from calling unsafe functions. if( !IsShown() ) return; TransferDataFromWindow(); bool bOk = mEffect->mTruncLongestAllowedSilentMs > 0.9f ; pWarning->SetLabel( bOk ? wxT("") : _(" Duration must be at least 1 millisecond") ); wxWindow *pWnd; pWnd = FindWindowById( wxID_OK, this ); pWnd->Enable( bOk ); pWnd = FindWindowById( ID_EFFECT_PREVIEW, this ); pWnd->Enable( bOk ); }
/** * Create a new download window based on a list of content information * with flags whether to download them or not. * @param infos the list to search in */ NetworkContentDownloadStatusWindow() : cur_id(UINT32_MAX) { this->parent = FindWindowById(WC_NETWORK_WINDOW, 1); _network_content_client.AddCallback(this); _network_content_client.DownloadSelectedContent(this->total_files, this->total_bytes); this->InitNested(&_network_content_download_status_window_desc, 0); }
void mmCustomData::ClearSettings() const { for (const auto &field : m_fields) { //wxWindowID controlID = GetBaseID() + (wxWindowID)field.FIELDID; wxWindowID labelID = GetLabelID() + (wxWindowID)field.FIELDID; wxCheckBox* cb = (wxCheckBox*)FindWindowById(labelID); if (cb) cb->SetValue(false); } }
/** * Updates the original text of the OSK so when the 'parent' changes the * original and you press on cancel you won't get the 'old' original text * but the updated one. * @param parent window that just updated its orignal text * @param button widget number of parent's textbox to update */ void UpdateOSKOriginalText(const Window *parent, int button) { OskWindow *osk = dynamic_cast<OskWindow *>(FindWindowById(WC_OSK, 0)); if (osk == NULL || osk->parent != parent || osk->text_btn != button) return; free(osk->orig_str_buf); osk->orig_str_buf = stredup(osk->qs->text.buf); osk->SetDirty(); }
void SaveViewportBeforeSaveGame() { const Window *w = FindWindowById(WC_MAIN_WINDOW, 0); if (w != NULL) { _saved_scrollpos_x = w->viewport->scrollpos_x; _saved_scrollpos_y = w->viewport->scrollpos_y; _saved_scrollpos_zoom = w->viewport->zoom; } }
void lms_suiteFrame::OnShowModule(wxCommandEvent& event) { wxWindow *item = NULL; item = FindWindowById(event.GetId()); if(item) { panelsManager->GetPane(item).Show(); panelsManager->Update(); } }
void SCH_EDIT_FRAME::OnErc( wxCommandEvent& event ) { // See if it's already open... wxWindow* erc = FindWindowById( ID_DIALOG_ERC, this ); if( erc ) // Bring it to the top if already open. Dual monitor users need this. erc->Raise(); else InvokeDialogERC( this ); }
void CKadDlg::OnBnClickedUpdateNodeList(wxCommandEvent& WXUNUSED(evt)) { if ( wxMessageBox( wxString(_("Are you sure you want to download a new nodes.dat file?\n")) + _("Doing so will remove your current nodes and restart Kademlia connection.") , _("Continue?"), wxICON_EXCLAMATION | wxYES_NO, this) == wxYES ) { wxString strURL = dynamic_cast<wxTextCtrl*>(FindWindowById(IDC_NODESLISTURL))->GetValue(); thePrefs::SetKadNodesUrl(strURL); theApp->UpdateNotesDat(strURL); } }
const wxString DialEntryPanel::getEnteredText() { wxString phoneNumber; wxComboBox* pCtrl = dynamic_cast<wxComboBox*>(FindWindowById(IDR_DIAL_ENTRY_TEXT, this)); if (pCtrl) { phoneNumber = pCtrl->GetValue(); } return phoneNumber; }
void CDialogWarnHistory::OnCheck(wxCommandEvent &) { if(m_pButtonNO == NULL) { m_pButtonNO = FindWindowById(wxID_NO, this); } if(m_pButtonNO != NULL) { m_pButtonNO->Enable(!DontShowAgain()); } }
bool cbAuiNotebook::IsFocusStored(wxWindow* page) { wxWindow* win = FindWindowById(m_LastId); while (win) { if (win == page) return true; win = win->GetParent(); } return false; }
void TAdjuster::OnClick(wxCommandEvent& event) { if (pickers.find(event.GetId()) != pickers.end()) { TUniform* uniform = pickers[event.GetId()]; wxColour color = uniform->GetColor(); color = wxGetColourFromUser(this, color); uniform->SetColor(color); FindWindowById(event.GetId())->SetBackgroundColour(color); } event.Skip(); }
virtual void DrawWidget(const Rect &r, int widget) const { switch (widget) { case WID_S_LEFT: /* Draw the date */ SetDParam(0, ((DateTicks)_date * DAY_TICKS_DAY_LENGTH) + _date_fract); DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP + 2, STR_WHITE_DATE_WALLCLOCK_LONG, TC_FROMSTRING, SA_HOR_CENTER); break; case WID_S_RIGHT: { /* Draw company money, if any */ const Company *c = Company::GetIfValid(_local_company); if (c != NULL) { SetDParam(0, c->money); DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP + 2, STR_COMPANY_MONEY, TC_FROMSTRING, SA_HOR_CENTER); } break; } case WID_S_MIDDLE: /* Draw status bar */ if (this->saving) { // true when saving is active DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP + 2, STR_STATUSBAR_SAVING_GAME, TC_FROMSTRING, SA_HOR_CENTER); } else if (_do_autosave) { DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP + 2, STR_STATUSBAR_AUTOSAVE, TC_FROMSTRING, SA_HOR_CENTER); } else if (_pause_mode != PM_UNPAUSED) { DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP + 2, STR_STATUSBAR_PAUSED, TC_FROMSTRING, SA_HOR_CENTER); } else if (this->ticker_scroll < TICKER_STOP && FindWindowById(WC_NEWS_WINDOW, 0) == NULL && _statusbar_news_item != NULL && _statusbar_news_item->string_id != 0) { /* Draw the scrolling news text */ if (!DrawScrollingStatusText(_statusbar_news_item, this->ticker_scroll, r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP + 2, r.bottom)) { InvalidateWindowData(WC_STATUS_BAR, 0, SBI_NEWS_DELETED); if (Company::IsValidID(_local_company)) { /* This is the default text */ SetDParam(0, _local_company); DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP + 2, STR_STATUSBAR_COMPANY_NAME, TC_FROMSTRING, SA_HOR_CENTER); } } } else { if (Company::IsValidID(_local_company)) { /* This is the default text */ SetDParam(0, _local_company); DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP + 2, STR_STATUSBAR_COMPANY_NAME, TC_FROMSTRING, SA_HOR_CENTER); } } if (this->reminder_timeout > 0) { Dimension icon_size = GetSpriteSize(SPR_UNREAD_NEWS); DrawSprite(SPR_UNREAD_NEWS, PAL_NONE, r.right - WD_FRAMERECT_RIGHT - icon_size.width, r.top + WD_FRAMERECT_TOP + (int)(FONT_HEIGHT_NORMAL - icon_size.height) / 2); } break; } }
// Enables or disables the node connect button depending on the conents of the text fields void CKadDlg::OnFieldsChange(wxCommandEvent& WXUNUSED(evt)) { // These are the IDs of the search-fields int textfields[] = { ID_NODE_IP1, ID_NODE_IP2, ID_NODE_IP3, ID_NODE_IP4, ID_NODE_PORT}; bool enable = true; for ( uint16 i = 0; i < itemsof(textfields); i++ ) { enable &= !CastChild(textfields[i], wxTextCtrl)->GetValue().IsEmpty(); } // Enable the node connect button if all fields contain text FindWindowById(ID_NODECONNECT)->Enable( enable ); }
void CompareDlg::UpdateOkButton() { bool isValid = false; const wxString leftPath = m_leftPathCtrl->GetValue(); const wxString rightPath = m_rightPathCtrl->GetValue(); if (!leftPath.empty() && ! rightPath.empty()) { if (wxDirExists(leftPath) && wxDirExists(rightPath)) isValid = true; else if (wxFileExists(leftPath) && wxFileExists(rightPath)) isValid = true; } wxWindow* okButton = FindWindowById(wxID_OK); if (okButton) okButton->Enable(isValid); }
void wxCurlTransferDialog::OnPauseResume(wxCommandEvent &WXUNUSED(ev)) { wxASSERT(HasFlag(wxCTDS_CAN_PAUSE)); if (m_pThread->IsRunning()) { if (HandleCurlThreadError(m_pThread->Pause(), m_pThread)) { FindWindowById(PauseResumeButtonId)->SetLabel(wxS("Resume")); if (m_pSpeed) m_pSpeed->SetLabel(wxS("0 (transfer paused)")); } } else { if (HandleCurlThreadError(m_pThread->Resume(), m_pThread)) { FindWindowById(PauseResumeButtonId)->SetLabel(wxS("Pause")); } } }
void WizardStartPage::OnRadioSelected(wxCommandEvent &event) { wxWindow *win = FindWindowById(wxID_FORWARD, GetParent()); wxMessageDialog *dial; if (m_browseRadio->GetValue()) { win->SetLabel(wxT("Finish")); this->UpdateROMPathState(); m_filePicker1->Enable(true); return; } win->SetLabel(wxT("Next >")); win->Enable(true); m_filePicker1->Enable(false); }
void EnvironmentSettingsDlg::OnChooseColour(wxCommandEvent& event) { wxColourData data; wxWindow* sender = FindWindowById(event.GetId()); data.SetColour(sender->GetBackgroundColour()); wxColourDialog dlg(this, &data); PlaceWindow(&dlg); if (dlg.ShowModal() == wxID_OK) { wxColour colour = dlg.GetColourData().GetColour(); sender->SetBackgroundColour(colour); } }
void SGOglTextureEnvNBPage::OnButton(wxCommandEvent &event) { SGFixedGLState* glState = m_parent->GetGLState(); glState->SetTextureChanged(true); wxColour texEnvColor; int textureSelected = textureBox->GetSelection(); texEnvColor = wxGetColourFromUser(this, ToWxIntColor(glState->GetTexture(textureSelected)->texEnvColor)); glState->GetTexture(textureSelected)->texEnvColor = ToGLFPColor(texEnvColor); FindWindowById(event.GetId())->SetBackgroundColour(texEnvColor); wxGetApp().GetFrame()->SetCanvasMode(0); wxGetApp().GetFrame()->GetCanvas()->Update(); event.Skip(); }
/** * This method is responsible for setting everything up in the doc/view framework * and opening the request file for editing in a new notebook tab. * @param path Path to the filename being opened */ void HtMainFrame::DoOpenFile (const wxString &path) { wxDocManager *docm = wxGetApp().doc_manager.get(); // TODO: fazer as checagens no arquivo antes de tentar abrir. // Ex: verificar se ele pode ser aberto como leitura/escrita, se o usuário tem permissão etc. // check if the requested file ain't already open wxList &docs = docm->GetDocuments(); for (wxList::iterator i = docs.begin(); i != docs.end(); i++) { HexDoc *doc = dynamic_cast <HexDoc *> (*i); if (doc->GetFilename() == path) { // it's open already... focus it and we're done HexFrame *frame = static_cast<HexView *>(doc->GetFirstView())->GetFrame(); auto *nb = GetNotebook(); auto frmIdx = nb->FindPage(static_cast<wxWindow *>(frame)); if (frmIdx != wxNOT_FOUND) { nb->SetSelection(frmIdx); frame->SetFocus(); } return; } } // the view is created automatically when we create the doc HexDoc *doc = (HexDoc *)docm->CreateDocument(path, wxDOC_SILENT); if (doc) { HexView *view = (HexView *)doc->GetFirstView(); HexFrame *frame = new HexFrame(view, this, wxID_ANY, wxFileNameFromPath(path)); history.AddFileToHistory(path); #ifdef WXDEBUG DebugPanel *dbgPanel = dynamic_cast<DebugPanel *>(FindWindowById(HT_DebugPanel)); view->AddToDebugPanel(dbgPanel); #endif } else // TODO: melhorar essa mensagem de erro. wxMessageBox(wxString::Format("Não foi possível abrir o arquivo\n%s", path), "Erro", wxOK | wxICON_ERROR, this); }
virtual void OnMouseLoop() { Window *w2 = FindWindowById(this->parent_wnd_class, this->parent_wnd_num); if (w2 == NULL) { delete this; return; } if (this->click_delay != 0 && --this->click_delay == 0) { /* Make the dropdown "invisible", so it doesn't affect new window placement. * Also mark it dirty in case the callback deals with the screen. (e.g. screenshots). */ this->window_class = WC_INVALID; this->SetDirty(); w2->OnDropdownSelect(this->parent_button, this->selected_index); delete this; return; } if (this->drag_mode) { int item; if (!_left_button_clicked) { this->drag_mode = false; if (!this->GetDropDownItem(item)) { if (this->instant_close) delete this; return; } this->click_delay = 2; } else { if (_cursor.pos.y <= this->top + 2) { /* Cursor is above the list, set scroll up */ this->scrolling = -1; return; } else if (_cursor.pos.y >= this->top + this->height - 2) { /* Cursor is below list, set scroll down */ this->scrolling = 1; return; } if (!this->GetDropDownItem(item)) return; } if (this->selected_index != item) { this->selected_index = item; this->SetDirty(); } } }
void ExportFFmpegOptions::OnDeletePreset(wxCommandEvent& event) { wxComboBox *preset = dynamic_cast<wxComboBox*>(FindWindowById(FEPresetID,this)); wxString presetname = preset->GetValue(); wxString query = wxString::Format(_("Delete preset '%s'?"),presetname.c_str()); int action = wxMessageBox(query,_("Confirm Deletion"),wxYES_NO | wxCENTRE); if (action == wxNO) return; mPresets->DeletePreset(presetname); long index = preset->FindString(presetname); preset->SetValue(wxEmptyString); preset->Delete(index); mPresetNames->Remove(presetname); }
void CFrame::ToggleFloatWindow(int Id) { wxWindowID WinId = Id - IDM_FLOAT_LOG_WINDOW + IDM_LOG_WINDOW; if (GetNotebookPageFromId(WinId)) { DoFloatNotebookPage(WinId); bFloatWindow[WinId - IDM_LOG_WINDOW] = true; } else { if (FindWindowById(WinId)) DoUnfloatPage(WinId - IDM_LOG_WINDOW + IDM_LOG_WINDOW_PARENT); bFloatWindow[WinId - IDM_LOG_WINDOW] = false; } }
CRetranslationDlg::CRetranslationDlg(wxWindow* parent) // dialog constructor : AIModalDialog(parent, -1, _("Type Retranslation Text"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) { m_retranslation = _T(""); m_sourceText = _T(""); m_preContext = _T(""); m_follContext = _T(""); m_preContextSrc = _T(""); m_follContextSrc = _T(""); m_preContextTgt = _T(""); m_follContextTgt = _T(""); // This dialog function below is generated in wxDesigner, and defines the controls and sizers // for the dialog. The first parameter is the parent which should normally be "this". // The second and third parameters should both be TRUE to utilize the sizers and create the right // size dialog. pRetransSizer = RetranslationDlgFunc(this, TRUE, TRUE); // The declaration is: RetranslationDlgFunc( wxWindow *parent, bool call_fit, bool set_sizer ); bool bOK; bOK = gpApp->ReverseOkCancelButtonsForMac(this); bOK = bOK; // avoid warning // use pointers to dialog's controls and wxValidator for simple dialog data transfer pSrcPrecContextBox = (wxTextCtrl*)FindWindowById(IDC_EDIT_PRECONTEXT); //pSrcPrecContextBox->SetValidator(wxGenericValidator(&m_preContext)); // whm removed 21Nov11 pSrcTextToTransBox = (wxTextCtrl*)FindWindowById(IDC_EDIT_SOURCE_TEXT); //pSrcTextToTransBox->SetValidator(wxGenericValidator(&m_sourceText)); // whm removed 21Nov11 pRetransBox = (wxTextCtrl*)FindWindowById(IDC_EDIT_RETRANSLATION); //pRetransBox->SetValidator(wxGenericValidator(&m_retranslation)); // whm removed 21Nov11 pSrcFollContextBox = (wxTextCtrl*)FindWindowById(IDC_EDIT_FOLLCONTEXT); //pSrcFollContextBox->SetValidator(wxGenericValidator(&m_follContext)); // whm removed 21Nov11 }
void szViszioAddParam::OnSelectParam(wxCommandEvent &ev) { if ( ps->ShowModal() == wxID_OK ) { m_param = ps->g_data.m_param; wxStaticCast(FindWindowById(ID_TC_PARNAME), wxTextCtrl)->SetValue(wxString(m_param->GetName())); wxLogMessage(_T("par_add: ok (%s)"), wxString(m_param->GetName()).c_str()); } else { wxLogMessage(_T("par_add: cancel")); } }
/** * Are we ready to show another news item? * Only if nothing is in the newsticker and no newspaper is displayed */ static bool ReadyForNextItem() { const NewsItem *ni = _forced_news == NULL ? _current_news : _forced_news; if (ni == NULL) return true; /* Ticker message * Check if the status bar message is still being displayed? */ if (IsNewsTickerShown()) return false; /* Newspaper message, decrement duration counter */ if (NewsWindow::duration != 0) NewsWindow::duration--; /* neither newsticker nor newspaper are running */ return (NewsWindow::duration == 0 || FindWindowById(WC_NEWS_WINDOW, 0) == NULL); }
void StatDialog::SetDrawInfo(DrawInfo *draw) { wxButton *button = wxDynamicCast(FindWindowById(STAT_DRAW_BUTTON), wxButton); m_draw = draw; wxString bn; if (draw) bn = draw->GetName(); else bn = _T(""); button->SetLabel(bn); m_min_value_text->SetLabel(_T("")); m_max_value_text->SetLabel(_T("")); m_avg_value_text->SetLabel(_T("")); m_hsum_value_text->SetLabel(_T("")); }