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