wxMaxima
LongNumberCell.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 LONGNUMBERCELL_H
24 #define LONGNUMBERCELL_H
25 
26 #include "TextCell.h"
27 
32 class LongNumberCell final : public TextCell
33 {
34 public:
36  LongNumberCell(GroupCell *group, Configuration **config, const wxString &number);
37  LongNumberCell(GroupCell *group, const LongNumberCell &cell);
38  std::unique_ptr<Cell> Copy(GroupCell *group) const override;
39  const CellTypeInfo &GetInfo() override;
40 
41  void Recalculate(AFontSize fontsize) override;
42  void Draw(wxPoint point) override;
43  bool NeedsRecalculation(AFontSize fontSize) const override;
44  void SetStyle(TextStyle style) override;
45  bool BreakUp() override;
46  void SetNextToDraw(Cell *next) override;
47  int GetInnerCellCount() const override { if(m_innerCell) return 1; else return 0; }
48  // cppcheck-suppress objectIndex
49  Cell *GetInnerCell(int index) const override { return (&m_innerCell)[index].get(); }
50 
51 protected:
52  virtual void UpdateDisplayedText() override;
53 private:
54  //** Large objects (144 bytes)
55  //**
57  wxString m_numStart;
59  std::unique_ptr<Cell> m_innerCell;
61  wxString m_ellipsis;
63  wxString m_numEnd;
64 
65  //** 4-byte objects (12 bytes)
66  //**
67  int m_numStartWidth = 0;
68  int m_ellipsisWidth = 0;
70  int m_displayedDigits_old = -1;
71  bool m_showAllDigits_old = false;
72  bool m_linebreaksInLongLines_old = true;
73 
74  //** Bitfield objects (0 bytes)
75  //**
76  void InitBitFields()
77  { // Keep the initialization order below same as the order
78  // of bit fields in this class!
79  }
80 };
81 
82 #endif // LONGNUMBERCELL_H
LongNumberCell::LongNumberCell
LongNumberCell(GroupCell *group, Configuration **config, const wxString &number)
The constructor for cell that, if displayed, means that something is amiss.
Definition: LongNumberCell.cpp:36
LongNumberCell::BreakUp
bool BreakUp() override
Definition: LongNumberCell.cpp:183
TextCell
Definition: TextCell.h:36
TextStyle
TextStyle
Definition: TextStyle.h:307
LongNumberCell::GetInnerCell
Cell * GetInnerCell(int index) const override
Definition: LongNumberCell.h:49
LongNumberCell::Draw
void Draw(wxPoint point) override
Definition: LongNumberCell.cpp:143
LongNumberCell::SetNextToDraw
void SetNextToDraw(Cell *next) override
Definition: LongNumberCell.cpp:220
LongNumberCell::SetStyle
void SetStyle(TextStyle style) override
Sets the TextStyle of this cell.
Definition: LongNumberCell.cpp:85
Cell
Definition: Cell.h:139
LongNumberCell::GetInnerCellCount
int GetInnerCellCount() const override
The number of inner cells - for use by the iterators.
Definition: LongNumberCell.h:47
LongNumberCell
Definition: LongNumberCell.h:32
AFontSize
Definition: FontAttribs.h:97
LongNumberCell::GetInfo
const CellTypeInfo & GetInfo() override
Returns the information about this cell's type.
LongNumberCell::NeedsRecalculation
bool NeedsRecalculation(AFontSize fontSize) const override
True, if something that affects the cell size has changed.
Definition: LongNumberCell.cpp:77
Configuration
Definition: Configuration.h:83
LongNumberCell::Recalculate
void Recalculate(AFontSize fontsize) override
Definition: LongNumberCell.cpp:91
GroupCell
Definition: GroupCell.h:68
CellTypeInfo
A class that carries information about the type of a cell.
Definition: Cell.h:90
LongNumberCell::UpdateDisplayedText
virtual void UpdateDisplayedText() override
The text we actually display depends on many factors, unfortunately.
Definition: LongNumberCell.cpp:54
LongNumberCell::Copy
std::unique_ptr< Cell > Copy(GroupCell *group) const override