wxMaxima
LabelCell.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-2018 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 LABELCELL_H
24 #define LABELCELL_H
25 
26 #include "TextCell.h"
27 
33 class LabelCell final : public TextCell
34 {
35 public:
37  LabelCell(GroupCell *group,
38  Configuration **config, wxString automaticLabel, TextStyle style = TS_MAIN_PROMPT);
39  LabelCell(GroupCell *group, const LabelCell &cell);
40  std::unique_ptr<Cell> Copy(GroupCell *group) const override;
41  const CellTypeInfo &GetInfo() override;
42 
43  void Recalculate(AFontSize fontsize) override;
44  void Draw(wxPoint point) override;
45  bool NeedsRecalculation(AFontSize fontSize) const override;
46  void SetStyle(TextStyle style) override;
47  wxString ToString() const override;
49  void SetUserDefinedLabel(const wxString &userDefinedLabel);
51  wxString GetXMLFlags() const override;
52  void UpdateDisplayedText() override;
53  const wxString &GetAltCopyText() const override;
54  void SetAltCopyText(const wxString &WXUNUSED(text)) override;
55  wxString ToXML() const override;
56 
57 private:
58 //** Large objects (48 bytes)
59 //**
61  wxString m_userDefinedLabel;
62 
63 //** 2-byte objects (2 bytes)
64 //**
65  AFontSize m_fontSize_scaledToFit = {};
66 
67 //** 1-byte objects (1 byte)
68 //**
69  Configuration::showLabels m_labelChoice_Last = {};
70 
71 //** Bitfield objects (0 bytes)
72 //**
73  void InitBitFields()
74  { // Keep the initialization order below same as the order
75  // of bit fields in this class!
76  }
77 
78  TextIndex GetLabelIndex() const;
79 };
80 
81 #endif // LABELCELL_H
TextCell
Definition: TextCell.h:36
LabelCell::Draw
void Draw(wxPoint point) override
Definition: LabelCell.cpp:54
TextStyle
TextStyle
Definition: TextStyle.h:307
LabelCell::NeedsRecalculation
bool NeedsRecalculation(AFontSize fontSize) const override
True, if something that affects the cell size has changed.
Definition: LabelCell.cpp:103
LabelCell::UpdateDisplayedText
void UpdateDisplayedText() override
The text we actually display depends on many factors, unfortunately.
Definition: LabelCell.cpp:119
LabelCell
Definition: LabelCell.h:33
LabelCell::Copy
std::unique_ptr< Cell > Copy(GroupCell *group) const override
LabelCell::SetUserDefinedLabel
void SetUserDefinedLabel(const wxString &userDefinedLabel)
Set the automatic label maxima has assigned the current equation.
Definition: LabelCell.cpp:97
LabelCell::SetStyle
void SetStyle(TextStyle style) override
Sets the TextStyle of this cell.
Definition: LabelCell.cpp:201
LabelCell::Recalculate
void Recalculate(AFontSize fontsize) override
Definition: LabelCell.cpp:224
LabelCell::GetXMLFlags
wxString GetXMLFlags() const override
Returns the XML flags this cell needs in wxMathML.
Definition: LabelCell.cpp:216
LabelCell::ToXML
wxString ToXML() const override
Convert this cell to a representation fit for saving in a .wxmx file.
Definition: LabelCell.cpp:153
LabelCell::GetAltCopyText
const wxString & GetAltCopyText() const override
Get the text set using SetAltCopyText - may be empty.
Definition: LabelCell.cpp:298
LabelCell::LabelCell
LabelCell(GroupCell *group, Configuration **config, wxString automaticLabel, TextStyle style=TS_MAIN_PROMPT)
The constructor for cell that, if displayed, means that something is amiss.
Definition: LabelCell.cpp:34
AFontSize
Definition: FontAttribs.h:97
LabelCell::ToString
wxString ToString() const override
Returns the cell's representation as a string.
Definition: LabelCell.cpp:211
Configuration
Definition: Configuration.h:83
LabelCell::GetInfo
const CellTypeInfo & GetInfo() override
Returns the information about this cell's type.
GroupCell
Definition: GroupCell.h:68
CellTypeInfo
A class that carries information about the type of a cell.
Definition: Cell.h:90