wxMaxima
Loading...
Searching...
No Matches
Screenshot.h
Go to the documentation of this file.
1// -*- mode: c++; c-file-style: "linux"; c-basic-offset: 2; indent-tabs-mode: nil -*-
2//
3// Copyright (C) 2026 Gunter Königsmann <wxMaxima@physikbuch.de>
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, write to the Free Software
17// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18//
19// SPDX-License-Identifier: GPL-2.0+
20
37#ifndef WXM_SCREENSHOT_H
38#define WXM_SCREENSHOT_H
39
40#include <wx/arrstr.h>
41#include <wx/confbase.h>
42#include <wx/gdicmn.h>
43#include <wx/image.h>
44#include <wx/string.h>
45#include <optional>
46
47namespace wxm {
48
51 enum class Kind {
52 Window,
53 Worksheet,
56 Cells,
57 Pane,
58 Config
59 };
60 Kind kind = Kind::Window;
62 wxString pane;
64 int page = 0;
65};
66
72 bool setSidebars = false;
74 wxArrayString sidebars;
76 wxSize size = wxDefaultSize;
78 int sidebarWidth = 0;
79};
80
92std::optional<ScreenshotScene> ReadScreenshotScene(const wxConfigBase &config);
93
98std::optional<ScreenshotTarget> ParseScreenshotTarget(const wxString &text);
99
104wxImage ScreenRect(const wxRect &rect);
105
111wxImage TrimToContent(const wxImage &image, int padding);
112
113} // namespace wxm
114
115#endif // WXM_SCREENSHOT_H
wxImage ScreenRect(const wxRect &rect)
What the screen shows inside rect (screen coordinates)
Definition: Screenshot.cpp:65
wxImage TrimToContent(const wxImage &image, int padding)
The image cropped to everything that isn't its background, plus padding.
Definition: Screenshot.cpp:79
std::optional< ScreenshotTarget > ParseScreenshotTarget(const wxString &text)
Reads the value of Screenshot/show.
Definition: Screenshot.cpp:34
std::optional< ScreenshotScene > ReadScreenshotScene(const wxConfigBase &config)
Reads a scene's [Screenshot] group.
Definition: Screenshot.cpp:110
Everything a scene's [Screenshot] group asks for.
Definition: Screenshot.h:68
int sidebarWidth
The minimum width of each sidebar shown; 0: leave it as it is.
Definition: Screenshot.h:78
wxSize size
The size of the main window, or of the dialog shown; default: unchanged.
Definition: Screenshot.h:76
bool setSidebars
True if the scene names its sidebars (all others are hidden)
Definition: Screenshot.h:72
ScreenshotTarget target
What is shown and saved.
Definition: Screenshot.h:70
wxArrayString sidebars
The AUI pane names of the sidebars to show.
Definition: Screenshot.h:74
What –screenshot-of asks to be shown and captured.
Definition: Screenshot.h:50
Kind
Definition: Screenshot.h:51
@ Worksheet
The worksheet window only ("worksheet")
@ Cells
The worksheet's cells: the worksheet window cropped to what is drawn in it, without the cursor ("cell...
@ Pane
A sidebar, by its AUI pane name ("pane:<name>")
@ Window
The whole main window ("window", the default)
@ Config
A page of the configuration dialog ("config:<page>")
int page
The page's index for Kind::Config.
Definition: Screenshot.h:64
wxString pane
The pane's name for Kind::Pane.
Definition: Screenshot.h:62