OpenCPN Partial API docs
Loading...
Searching...
No Matches
text_ctrl_w_help.h
1/***************************************************************************
2 * Copyright (C) 2026 Alec Leamas *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, see <https://www.gnu.org/licenses/>. *
16 **************************************************************************/
17
22class TextCtrlWithHelp : public wxTextCtrl {
23public:
24 TextCtrlWithHelp(wxWindow* parent, const std::string& help_text);
25
27 void SetValue(const wxString& value) override;
28
30 void ChangeValue(const wxString& value) override;
31
33 void RestoreHelp() ;
34
36 void SetHelp(const std::string& help_text);
37
39 bool IsPristine() const { return !m_is_inited; }
40
41private:
42 const wxFont m_font;
43 bool m_is_inited;
44 std::string m_help;
45
46 void OnKeypress(wxCommandEvent& ev);
47
48};
A wxTextCtrl with an initial italics help text, removed when user starts typing.
void SetValue(const wxString &value) override
Ignored if pristine, use ChangeValue if need be.
void SetHelp(const std::string &help_text)
Set help text, enter pristine state.
void RestoreHelp()
Restore help text to initial value, enter pristine state.
bool IsPristine() const
Return true if user has not entered anything.
void ChangeValue(const wxString &value) override
Falsify pristine state.