YAPOG  0.0.1
Yet Another Pokemon Online Game
Label.hpp
Go to the documentation of this file.
1 #ifndef YAPOG_LABEL_HPP
2 # define YAPOG_LABEL_HPP
3 
4 # include <SFML/Graphics/Color.hpp>
5 # include <SFML/Graphics/Text.hpp>
6 
8 # include "YAPOG/System/String.hpp"
10 
11 namespace yap
12 {
13  class YAPOG_LIB Label : public BaseWidget
14  {
16 
17  public:
18 
20  {
22  {
23  newContent = content;
24  }
25 
27  };
28 
29  Label ();
30  Label (String content);
31 
32  virtual ~Label ();
33  virtual bool IsFocusable () const;
34 
35  void SetText (const String& content);
36  void SetTextSize (uint size);
37  String GetText () const;
39  float GetCharWidth () const;
40  uint GetCharHeight () const;
41  Vector2 CharPos (uint pos) const;
42  uint Length () const;
43  virtual void SetDefaultColor (const sf::Color& color);
44  virtual void SetBackground (WidgetBackground& background);
45  private:
46  virtual void Refresh ();
47  virtual Vector2 HandleGetSize () const;
48 
49  virtual void HandleMove (const Vector2& offset);
50  virtual void HandleScale (const Vector2& factor);
51 
52  virtual void HandleDraw (IDrawingContext& context);
53 
54  virtual void HandleShow (bool isVisible);
55  virtual void HandleChangeColor (const sf::Color& color);
56 
57  virtual void HandleUpdate (const Time& dt);
58 
59 
61  sf::Text drawableText_;
62  bool isPosSet_;
63 
64  static const String DEFAULT_FONT;
65  };
66 } // namespace yap
67 
68 #endif /* YAPOG_LABEL_HPP! */