wxMaxima
Loading...
Searching...
No Matches
ImgCellBase.h
1// -*- mode: c++; c-file-style: "linux"; c-basic-offset: 2; indent-tabs-mode: nil -*-
2//
3// Copyright (C) 2004-2015 Andrej Vodopivec <andrej.vodopivec@gmail.com>
4// (C) 2014-2015 Gunter Königsmann <wxMaxima@physikbuch.de>
5//
6// This program is free software; you can redistribute it and/or modify
7// it under the terms of the GNU General Public License as published by
8// the Free Software Foundation; either version 2 of the License, or
9// (at your option) any later version.
10//
11// This program is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14// GNU General Public License for more details.
15//
16//
17// You should have received a copy of the GNU General Public License
18// along with this program; if not, write to the Free Software
19// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20//
21// SPDX-License-Identifier: GPL-2.0+
22
23#ifndef IMGCELLBASE_H
24#define IMGCELLBASE_H
25
26#include <memory>
27#include "Cell.h"
28#include <wx/image.h>
29#include "Image.h"
30
31#include <wx/filesys.h>
32#include <wx/fs_arc.h>
33
34/* ! The base class of ImgCell and Animation
35
36 Images and animation share most of the functionality with each other => we
37 can generate a class ImgCellBase that allows us to create pointers that both
38 can point to an ImgCell and an Animation and that can use the methods common
39 to both
40*/
41class ImgCellBase : public Cell
42{
43public:
45
46 virtual std::unique_ptr<Cell> Copy(GroupCell *group) const override = 0;
47 virtual const CellTypeInfo &GetInfo() override = 0;
48 virtual ~ImgCellBase() override;
49
52
54 virtual wxString GnuplotSource() const override = 0;
55
57 virtual void SetPPI(int ppi) = 0;
58 virtual int GetPPI() const = 0;
59 virtual size_t GetOriginalWidth() const = 0;
60 virtual size_t GetOriginalHeight() const = 0;
61
62 virtual void TallyImageLoadFailures(int &dataUnavailable,
63 int &decodeFailed) const override = 0;
64
66 virtual bool CanExportSVG() const = 0;
67
68 friend class AnimationCell;
69
78 virtual wxSize ToImageFile(wxString filename) = 0;
79
85 virtual void ClearCache() override = 0;
86
87 virtual const wxString GetToolTip(wxPoint point) const override = 0;
88
90 virtual bool CopyToClipboard() const override = 0;
91
93 virtual wxString GetExtension() const = 0;
94
95 virtual wxCoord GetMaxWidth() const = 0;
96 virtual wxCoord GetHeightList() const override = 0;
97 virtual void SetMaxWidth(wxCoord width) = 0;
98 virtual void SetMaxHeight(wxCoord height) = 0;
99
100 virtual void Recalculate(const AFontSize fontsize) const override = 0;
101
102 virtual void Draw(wxDC *dc, wxDC *antialiassingDC) override = 0;
103
104protected:
110 void DrawImageBackdrop(wxDC *dc, const wxRect &rect) const;
111
112public:
113
114 virtual wxString ToMatlab() const override = 0;
115 virtual wxString ToRTF() const override = 0;
116 virtual wxString ToString() const override = 0;
117 virtual wxString ToTeX() const override = 0;
118 virtual wxString ToXML() const override = 0;
119
120 virtual bool CanPopOut() const override = 0;
121};
122
123#endif // IMGCELLBASE_H
The definition of the base class of all cells the worksheet consists of.
This file declares the class Image.
int group
Neighbouring sections of the same group aren't separated.
Definition: ToolBarSections.cpp:45
A Type-Safe Fixed-Point Font Size.
Definition: FontAttribs.h:99
Definition: AnimationCell.h:46
A class that carries information about the type of a cell.
Definition: Cell.h:93
The base class all cell types the worksheet can consist of are derived from.
Definition: Cell.h:148
The configuration storage for the current worksheet.
Definition: Configuration.h:101
A cell grouping input (and, if there is one, also the output) cell to a foldable item.
Definition: GroupCell.h:88
Definition: ImgCellBase.h:42
ImgCellBase & operator=(const ImgCellBase &)=delete
This class can be derived from wxAccessible which has no copy constructor.
void DrawImageBackdrop(wxDC *dc, const wxRect &rect) const
Fills the rectangle an image is about to be drawn into with the backdrop for its transparent parts,...
Definition: ImgCellBase.cpp:46
virtual wxString GetExtension() const =0
Returns the file name extension that matches the image type.
virtual wxSize ToImageFile(wxString filename)=0
Writes the image to a file.
virtual const CellTypeInfo & GetInfo() override=0
Returns the information about this cell's type.
virtual wxString ToXML() const override=0
Convert this cell to a representation fit for saving in a .wxmx file.
virtual wxString ToRTF() const override=0
Returns the cell's representation as RTF.
virtual const wxString GetToolTip(wxPoint point) const override=0
Returns the ToolTip this cell provides at a given point.
virtual wxString ToString() const override=0
Returns the cell's representation as a string.
virtual wxString GnuplotSource() const override=0
The name of the file with gnuplot commands that created this file.
virtual void SetPPI(int ppi)=0
Set the image's resolution.
virtual void Recalculate(const AFontSize fontsize) const override=0
Recalculate the size of the cell and the difference between top and center.
virtual wxString ToMatlab() const override=0
Convert this cell to its Matlab representation.
virtual wxString ToTeX() const override=0
Convert this cell to its LaTeX representation.
virtual bool CanExportSVG() const =0
Can this image be exported in SVG format?
virtual wxCoord GetHeightList() const override=0
Returns the total height of this line.
virtual void Draw(wxDC *dc, wxDC *antialiassingDC) override=0
Pass 3 (Paint): Renders the cell using pre-calculated coordinates.
virtual std::unique_ptr< Cell > Copy(GroupCell *group) const override=0
Create a copy of this cell.
virtual bool CopyToClipboard() const override=0
Copies the cell to the system's clipboard.
virtual void ClearCache() override=0
Removes the cached scaled image from memory.
virtual bool CanPopOut() const override=0
Can this cell be popped out interactively in gnuplot?