OpenCPN Partial API docs
Loading...
Searching...
No Matches
printout_base.cpp
Go to the documentation of this file.
1/***************************************************************************
2 * Copyright (C) 2010 by David S. Register *
3 * Copyright (C) 2025 by NoCodeHummel *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, see <https://www.gnu.org/licenses/>. *
17 **************************************************************************/
18
25#include "ocpn_frame.h"
26#include "printout_base.h"
27
28BasePrintout::BasePrintout(const std::string& title)
29 : wxPrintout(title), m_pages(1), m_margin_x(100), m_margin_y(100) {}
30
31bool BasePrintout::HasPage(int page) { return page > 0 && page <= m_pages; }
32
33bool BasePrintout::OnBeginDocument(int startPage, int endPage) {
34 if (!wxPrintout::OnBeginDocument(startPage, endPage)) return false;
35 return true;
36}
37
38void BasePrintout::GetPageInfo(int* minPage, int* maxPage, int* selPageFrom,
39 int* selPageTo) {
40 *minPage = 1;
41 *maxPage = m_pages;
42 *selPageFrom = 1;
43 *selPageTo = m_pages;
44}
45
46bool BasePrintout::OnPrintPage(int page) {
47 wxDC* dc = GetDC();
48 if (dc && page <= m_pages) {
49 DrawPage(dc, page);
50 return true;
51 } else
52 return false;
53}
virtual void DrawPage(wxDC *dc, int page)=0
Called by the print framework to draw the page.
OpenCPN top window.
Print support abstract base class.