| 13 | wxEND_EVENT_TABLE() |
| 14 | |
| 15 | DemodLabelDialog::DemodLabelDialog(wxWindow * parent, wxWindowID id, const wxString & title, |
| 16 | DemodulatorInstancePtr demod, const wxPoint & position, |
| 17 | const wxSize & size, long style) : |
| 18 | wxDialog(parent, id, title, position, size, style) { |
| 19 | |
| 20 | wxString labelStr; |
| 21 | |
| 22 | //by construction, is always != nullptr |
| 23 | activeDemod = demod; |
| 24 | |
| 25 | labelStr = activeDemod->getDemodulatorUserLabel(); |
| 26 | |
| 27 | if (labelStr.empty()) { |
| 28 | //propose a default value... |
| 29 | labelStr = activeDemod->getDemodulatorType(); |
| 30 | } |
| 31 | |
| 32 | |
| 33 | dialogText = new wxTextCtrl(this, wxID_LABEL_INPUT, labelStr, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER); |
| 34 | dialogText->SetFont(wxFont(15, wxFONTFAMILY_TELETYPE, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD)); |
| 35 | |
| 36 | // Set the textControl width to the [title + 100%] or the [content +100%], |
| 37 | // whichever's the greater. |
| 38 | int textCtrlX = dialogText->GetTextExtent(labelStr).GetWidth(); |
| 39 | int titleX = this->GetTextExtent(title).GetWidth(); |
| 40 | dialogText->SetMinSize(wxSize(max(int(2.0 * titleX), int(2.0 * textCtrlX)), -1)); |
| 41 | |
| 42 | auto* dialogsizer = new wxBoxSizer(wxALL); |
| 43 | dialogsizer->Add(dialogText, wxSizerFlags(1).Expand().Border(wxALL, 5)); |
| 44 | SetSizerAndFit(dialogsizer); |
| 45 | Centre(); |
| 46 | |
| 47 | dialogText->SetSelection(-1, -1); |
| 48 | } |
| 49 | |
| 50 | |
| 51 | void DemodLabelDialog::OnChar(wxKeyEvent& event) { |
nothing calls this directly
no test coverage detected