nux-0.9.46

Nux/StaticText.h

Go to the documentation of this file.
00001 #ifndef STATICTEXT_H
00002 #define STATICTEXT_H
00003 
00004 
00005 namespace nux
00006 {
00007   class CairoGraphics;
00008   class StaticText: public View
00009   {
00010   public:
00011     StaticText (const TCHAR* text, NUX_FILE_LINE_PROTO);
00012 
00013     ~StaticText ();
00014 
00015 
00017 
00020     void SetSizeMatchText (bool size_match_text);
00021 
00023     bool GetSizeMatchText () const;
00024 
00025     void SetText (NString text);
00026     void SetTextColor (Color textColor);
00027     void SetFontName (const char *font_name);
00028     
00029     void GetTextSize (int &width, int &height, int clipping = 0);
00030 
00031     static void GetTextSize (const TCHAR* font, const TCHAR *char_str, int& width, int& height, int clipping = 0);
00032 
00033     void SetClipping (int clipping);
00034     int GetClipping () const;
00035 
00036     sigc::signal<void, StaticText*> sigTextChanged;
00037     sigc::signal<void, StaticText*> sigTextColorChanged;
00038 
00039   protected:
00040     void PreLayoutManagement ();
00041     long PostLayoutManagement (long layoutResult);
00042 
00043     long ProcessEvent (IEvent& event, long traverseInfo, long processEventInfo);
00044     void Draw (GraphicsEngine& gfxContext, bool forceDraw);
00045     void DrawContent (GraphicsEngine& gfxContext, bool forceDraw);
00046     void PostDraw (GraphicsEngine& gfxContext, bool forceDraw);
00047 
00048     NString _text;
00049     Color _textColor;
00050 
00051     CairoGraphics *_cairoGraphics;
00052     BaseTexture *_texture2D;
00053 
00054     int _pre_layout_width;
00055     int _pre_layout_height;
00056 
00057     bool _size_match_text;
00058 
00059     void DrawText (void* cairo_context, int width, int height, Color color);
00060 
00061     void UpdateTextRendering ();
00062 
00063     char *_font_string;
00064 
00065     int _clipping;
00066   };
00067 
00068 }
00069 
00070 #endif // STATICTEXT_H