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 "gl_headers.h" // Must come before anything using GL stuff
26
27#include "printout_base.h"
28
29BasePrintout::BasePrintout(const std::string& title)
30 : wxPrintout(title), m_pages(1), m_margin_x(100), m_margin_y(100) {}
31
32bool BasePrintout::HasPage(int page) { return page > 0 && page <= m_pages; }
33
34bool BasePrintout::OnBeginDocument(int startPage, int endPage) {
35 if (!wxPrintout::OnBeginDocument(startPage, endPage)) return false;
36 return true;
37}
38
39void BasePrintout::GetPageInfo(int* minPage, int* maxPage, int* selPageFrom,
40 int* selPageTo) {
41 *minPage = 1;
42 *maxPage = m_pages;
43 *selPageFrom = 1;
44 *selPageTo = m_pages;
45}
46
47bool BasePrintout::OnPrintPage(int page) {
48 wxDC* dc = GetDC();
49 if (dc && page <= m_pages) {
50 DrawPage(dc, page);
51 return true;
52 } else
53 return false;
54}
virtual void DrawPage(wxDC *dc, int page)=0
Called by the print framework to draw the page.
Platform independent GL includes.
Print support abstract base class.