wxMaxima
IntCell.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) 2004-2015 Andrej Vodopivec <andrej.vodopivec@gmail.com>
4 // Copyright (C) 2014-2016 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 
30 #ifndef INTCELL_H
31 #define INTCELL_H
32 
33 #include "Cell.h"
34 
39 class IntCell final : public Cell
40 {
41 public:
42  IntCell(GroupCell *group, Configuration **config,
43  std::unique_ptr<Cell> &&base, std::unique_ptr<Cell> &&under,
44  std::unique_ptr<Cell> &&over, std::unique_ptr<Cell> &&var);
45  IntCell(GroupCell *group, Configuration **config,
46  std::unique_ptr<Cell> &&base, std::unique_ptr<Cell> &&var);
47  IntCell(GroupCell *group, const IntCell &cell);
48  std::unique_ptr<Cell> Copy(GroupCell *group) const override;
49  const CellTypeInfo &GetInfo() override;
50 
51  int GetInnerCellCount() const override { return 9; }
52  // cppcheck-suppress objectIndex
53  Cell *GetInnerCell(int index) const override { return (&m_open)[index].get(); }
54 
55  void Recalculate(AFontSize fontsize) override;
56 
57  void Draw(wxPoint point) override;
58 
59  enum IntegralType : int8_t
60  {
63  };
64 
66  void SetIntStyle(IntegralType style) { m_intStyle = style; }
67 
68  wxString ToMathML() const override;
69  wxString ToMatlab() const override;
70  wxString ToOMML() const override;
71  wxString ToString() const override;
72  wxString ToTeX() const override;
73  wxString ToXML() const override;
74 
75  bool BreakUp() override;
76  void SetNextToDraw(Cell *next) override;
77 
78 private:
79  void MakeBreakUpCells();
80 
81  // The pointers below point to inner cells and must be kept contiguous.
82  // ** This is the draw list order. All pointers must be the same:
83  // ** either Cell * or std::unique_ptr<Cell>. NO OTHER TYPES are allowed.
85  std::unique_ptr<Cell> m_open;
87  std::unique_ptr<Cell> m_base;
88  std::unique_ptr<Cell> m_comma1;
90  std::unique_ptr<Cell> m_var;
91  std::unique_ptr<Cell> m_comma2;
93  std::unique_ptr<Cell> m_under;
94  std::unique_ptr<Cell> m_comma3;
96  std::unique_ptr<Cell> m_over;
98  std::unique_ptr<Cell> m_close;
99  // The pointers above point to inner cells and must be kept contiguous.
100 
102  int m_signHeight = 35;
104  int m_signWidth = 18;
106  int m_signTop = m_signHeight / 2;
107 #if defined __WXMSW__
108  int m_charHeight = 12;
109  int m_charWidth = 12;
110 #endif
111 
113  IntegralType m_intStyle = INT_IDEF;
114 
115 //** Bitfield objects (0 bytes)
116 //**
117  void InitBitFields()
118  { // Keep the initialization order below same as the order
119  // of bit fields in this class!
120  }
121 };
122 
123 #endif // INTCELL_H
IntCell::ToOMML
wxString ToOMML() const override
Definition: IntCell.cpp:393
IntCell::GetInnerCellCount
int GetInnerCellCount() const override
The number of inner cells - for use by the iterators.
Definition: IntCell.h:51
Cell.h
IntCell
Definition: IntCell.h:39
IntCell::INT_DEF
@ INT_DEF
A definite integral, meaning an integral with limits.
Definition: IntCell.h:61
IntCell::INT_IDEF
@ INT_IDEF
An indefinite integral, meaning an integral without limits
Definition: IntCell.h:62
IntCell::ToMathML
wxString ToMathML() const override
Convert this cell to a representation fit for saving in a .wxmx file.
Definition: IntCell.cpp:365
IntCell::Copy
std::unique_ptr< Cell > Copy(GroupCell *group) const override
IntCell::IntegralType
IntegralType
Definition: IntCell.h:59
IntCell::ToString
wxString ToString() const override
Returns the cell's representation as a string.
Definition: IntCell.cpp:297
Cell
Definition: Cell.h:139
IntCell::BreakUp
bool BreakUp() override
Definition: IntCell.cpp:453
IntCell::ToXML
wxString ToXML() const override
Convert this cell to a representation fit for saving in a .wxmx file.
Definition: IntCell.cpp:418
AFontSize
Definition: FontAttribs.h:97
IntCell::ToTeX
wxString ToTeX() const override
Convert this cell to its LaTeX representation.
Definition: IntCell.cpp:345
IntCell::ToMatlab
wxString ToMatlab() const override
Convert this cell to its Matlab representation.
Definition: IntCell.cpp:322
IntCell::Recalculate
void Recalculate(AFontSize fontsize) override
Definition: IntCell.cpp:89
IntCell::GetInfo
const CellTypeInfo & GetInfo() override
Returns the information about this cell's type.
Configuration
Definition: Configuration.h:83
IntCell::GetInnerCell
Cell * GetInnerCell(int index) const override
Definition: IntCell.h:53
GroupCell
Definition: GroupCell.h:68
CellTypeInfo
A class that carries information about the type of a cell.
Definition: Cell.h:90
IntCell::SetNextToDraw
void SetNextToDraw(Cell *next) override
Definition: IntCell.cpp:484
IntCell::SetIntStyle
void SetIntStyle(IntegralType style)
Choose between definite and indefinite integrals.
Definition: IntCell.h:66