00001 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*- 00002 #ifndef __label_hh 00003 #define __label_hh 00004 00005 #include "widget.hh" 00006 00007 namespace otk { 00008 00009 class Label : public Widget { 00010 00011 public: 00012 00013 Label(Widget *parent); 00014 ~Label(); 00015 00016 inline const ustring &getText(void) const { return _text; } 00017 void setText(const ustring &text) { _text = text; _dirty = true; } 00018 00019 virtual void renderForeground(void); 00020 00021 virtual void update(); 00022 00023 void fitString(const std::string &str); 00024 void fitSize(int w, int h); 00025 00026 virtual void setStyle(RenderStyle *style); 00027 00028 private: 00029 //! Text to be displayed in the label 00030 ustring _text; 00031 //! The actual text being shown, may be a subset of _text 00032 ustring _drawtext; 00033 //! The drawing offset for the text 00034 int _drawx; 00035 }; 00036 00037 } 00038 00039 #endif