wxMaxima
ParenCell.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 PARENCELL_H
31 #define PARENCELL_H
32 
33 #include "Cell.h"
34 
49 class ParenCell final : public Cell
50 {
51 public:
52  ParenCell(GroupCell *group, Configuration **config, std::unique_ptr<Cell> &&inner);
53  ParenCell(GroupCell *group, const ParenCell &cell);
54  const CellTypeInfo &GetInfo() override;
55  std::unique_ptr<Cell> Copy(GroupCell *group) const override;
56 
57  int GetInnerCellCount() const override { return 3; }
58  // cppcheck-suppress objectIndex
59  Cell *GetInnerCell(int index) const override { return (&m_open)[index].get(); }
60 
61  Cell *GetInner() const { return m_innerCell.get(); }
62  void SetInner(std::unique_ptr<Cell> inner, CellType type = MC_TYPE_DEFAULT);
63 
64  void SetPrint(bool print) { m_print = print; }
65 
67  void Recalculate(AFontSize fontsize) override;
68 
69  void Draw(wxPoint point) override;
70 
71  bool BreakUp() override;
72 
73  wxString ToMathML() const override;
74  wxString ToMatlab() const override;
75  wxString ToOMML() const override;
76  wxString ToString() const override;
77  wxString ToTeX() const override;
78  wxString ToXML() const override;
79 
80  void SetNextToDraw(Cell *next) override;
81 
82 private:
83  void SetFont(AFontSize fontsize);
84 
85  // The pointers below point to inner cells and must be kept contiguous.
86  // ** This is the draw list order. All pointers must be the same:
87  // ** either Cell * or std::unique_ptr<Cell>. NO OTHER TYPES are allowed.
88  std::unique_ptr<Cell> m_open;
89  std::unique_ptr<Cell> m_innerCell;
90  std::unique_ptr<Cell> m_close;
91  // The pointers above point to inner cells and must be kept contiguous.
92 
95  int m_numberOfExtensions = 0;
96  int m_charWidth1 = 12, m_charHeight1 = 12;
97  int m_signWidth = 12, m_signHeight = 50;
98  int m_signTopHeight = 12, m_signBotHeight = 12, m_extendHeight = 12;
99 
100 //** Bitfield objects (1 bytes)
101 //**
102  void InitBitFields()
103  { // Keep the initialization order below same as the order
104  // of bit fields in this class!
105  m_print = true;
106  }
107  bool m_print : 1 /* InitBitFields */;
108 };
109 
110 #endif // PARENCELL_H
Cell.h
ParenCell::ToMathML
wxString ToMathML() const override
Convert this cell to a representation fit for saving in a .wxmx file.
Definition: ParenCell.cpp:432
ParenCell::SetNextToDraw
void SetNextToDraw(Cell *next) override
Definition: ParenCell.cpp:473
ParenCell::Copy
std::unique_ptr< Cell > Copy(GroupCell *group) const override
Configuration::ascii
@ ascii
Use ascii characters only.
Definition: Configuration.h:105
ParenCell::Recalculate
void Recalculate(AFontSize fontsize) override
Definition: ParenCell.cpp:134
ParenCell::GetInnerCellCount
int GetInnerCellCount() const override
The number of inner cells - for use by the iterators.
Definition: ParenCell.h:57
Cell
Definition: Cell.h:139
ParenCell::GetInnerCell
Cell * GetInnerCell(int index) const override
Definition: ParenCell.h:59
ParenCell::ToString
wxString ToString() const override
Returns the cell's representation as a string.
Definition: ParenCell.cpp:366
AFontSize
Definition: FontAttribs.h:97
CellType
CellType
Definition: Cell.h:63
ParenCell::BreakUp
bool BreakUp() override
Definition: ParenCell.cpp:456
ParenCell::ToXML
wxString ToXML() const override
Convert this cell to a representation fit for saving in a .wxmx file.
Definition: ParenCell.cpp:445
ParenCell::GetInfo
const CellTypeInfo & GetInfo() override
Returns the information about this cell's type.
Configuration
Definition: Configuration.h:83
ParenCell
Definition: ParenCell.h:49
ParenCell::ToMatlab
wxString ToMatlab() const override
Convert this cell to its Matlab representation.
Definition: ParenCell.cpp:382
ParenCell::ToTeX
wxString ToTeX() const override
Convert this cell to its LaTeX representation.
Definition: ParenCell.cpp:395
ParenCell::Draw
void Draw(wxPoint point) override
Definition: ParenCell.cpp:243
ParenCell::ToOMML
wxString ToOMML() const override
Definition: ParenCell.cpp:425
GroupCell
Definition: GroupCell.h:68
CellTypeInfo
A class that carries information about the type of a cell.
Definition: Cell.h:90
Configuration::drawMode
drawMode
Definition: Configuration.h:103