Simple SFML GUI  0.2a
TextUpdater.hpp
1 #ifndef TEXTUPDATER_HPP
2 #define TEXTUPDATER_HPP
3 
4 #include <string>
5 #include <vector>
6 #include <algorithm>
7 
8 #include "GlobalTimer.hpp"
9 #include "HaveMargin.hpp"
10 #include "TextLine.hpp"
11 
12 class TextLabel;
13 
14 class TextUpdater :
15  public HaveMargin,
16  public GlobalTimer {
17 public:
18  friend TextLabel;
19 
20  void setTimeBreak(bool value);
21  void updateText();
22  void clear();
23 
24  enum class UpdateState {
25  Processing,
26  Continuing,
27  ContinueProcessing,
28  Processed,
29  Updated,
30  Halted
31  };
32 
33 private:
34  UpdateState updateState = UpdateState::Updated;
35  std::vector<TextLine>::iterator tmpLineIterator;
36  std::vector<sf::String>::iterator tmpSplittedIterator;
37  TextLine tmpDefaultLine;
38  sf::Text textReference;
39  std::wstring sub;
40  std::wstring line;
41  bool updateAgain = false;
42  bool updateBreak = false;
43  bool firstLine = false;
44  bool firstWord = false;
45  bool forceOnce = false;
46  bool autoResize = false;
47  bool autoResizeParentLimit = true;
48  bool timeBreak = true;
49  size_t minimumVisibleLines = 0;
50  float lastAreaHeight = 0.f;
51  float lastAreaWidth = 0.f;
52  float parentWidth = 0.f;
53  float lastLastAreaHeight = 0.f;
54  float lastLastAreaWidth = 0.f;
55  sf::Vector2f p;
56  sf::FloatRect relativeArea;
57  sf::FloatRect insideArea;
58  sf::FloatRect tmpArea;
59  std::vector<TextLine> tmpLines;
60  std::vector<TextLine> tmpWrapped;
61  std::vector<sf::String> tmpSplitted;
62 
63  bool timeHalt();
64  bool checkUpdateBreak();
65  void firstWordSplit();
66  void processingStart(bool debug);
67  void processingStart();
68  void splitLine();
69  bool wordHandle();
70  void updateTextInit();
71  void llaUpdate();
72  void lineEnd();
73 };
74 
75 #endif // TEXTUPDATER_HPP
Definition: TextLabel.hpp:26
Definition: GlobalTimer.hpp:15
Definition: TextUpdater.hpp:14
Definition: HaveMargin.hpp:14
Definition: TextLine.hpp:16