OpenCPN Partial API docs
Loading...
Searching...
No Matches
tty_scroll.h
Go to the documentation of this file.
1/***************************************************************************
2 * Copyright (C) 2013 by David S. Register *
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, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 ***************************************************************************
19 */
20
21#ifndef __TTYSCROLL_H__
22#define __TTYSCROLL_H__
23
24#include <deque>
25
26#include <wx/scrolwin.h>
27#include <wx/textctrl.h>
28
35class TtyScroll : public wxScrolledWindow {
36public:
45 TtyScroll(wxWindow* parent, int n_lines, wxTextCtrl& filter);
46
47 virtual ~TtyScroll() = default;
48
54 virtual void Add(const wxString& line);
55
57 void Pause(bool pause) { m_is_paused = pause; }
58
63 void Copy(bool n183);
64
65protected:
66 wxCoord m_line_height; // the height of one line on screen
67 size_t m_n_lines; // the number of lines we draw
68
69 std::deque<wxString> m_lines;
70 wxTextCtrl& m_filter;
71 bool m_is_paused;
72
73 virtual void OnDraw(wxDC& dc);
74 void OnSize(wxSizeEvent& event);
75};
76
77#endif
Scrolled TTY-like window for logging, etc.
Definition tty_scroll.h:35
void Pause(bool pause)
Set the window to ignore Add() or not depending on pause.
Definition tty_scroll.h:57
void Copy(bool n183)
Copy visible content to clipboard.
virtual void Add(const wxString &line)
Add a line to bottom of window, typically discarding top-most line.