1 /**
2  *  Yudit Unicode Editor Source File
3  *
4  *  GNU Copyright (C) 1997-2006  Gaspar Sinai <gaspar@yudit.org>
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, version 2,
8  *  dated June 1991. See file COPYYING for details.
9  *
10  *  This program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *  GNU General Public License for more details.
14  *
15  *  You should have received a copy of the GNU General Public License
16  *  along with this program; if not, write to the Free Software
17  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */
19 
20 #ifndef SOpaqueLabel_h
21 #define SOpaqueLabel_h
22 
23 #include "swidget/SComponent.h"
24 #include "swidget/STextView.h"
25 #include "swidget/SIcon.h"
26 #include "stoolkit/STypes.h"
27 
28 class SOpaqueLabel : public SComponent
29 {
30 public:
31   SOpaqueLabel (const SString& string);
32   SOpaqueLabel (const SString& string, SIcon* icon);
33   virtual ~SOpaqueLabel ();
34 
35   virtual void redraw(SCanvas* w, int x, int y,
36      unsigned int width ,unsigned int height);
37 
38   virtual void resize (const SDimension& size);
39   virtual void move (const SLocation& loc);
40 
41   void setFont (const SString& font, double fontSize=0.0);
42   void setFontSize (double fontSize);
43 
44   void setForeground (const SColor& fg);
45   void setForeground (const SColor& lrfg, const SColor& rlfg);
46   virtual void setBackground (const SColor& bg);
47   virtual const SDimension& getPreferredSize ();
48 
49   const SColor& getBackground ();
50   const SColor& getForeground (bool lr);
51   void setIcon (SIcon* icon);
52   void setText (const SString& text);
53   void setAlignment (SAlignment alignment);
54 
55   STextView textView;
56 
57 private:
58   SAlignment     alignment;
59   void           processLabelText ();
60   virtual void   recalcSize ();
61   SIcon*         icon;
62 
63 };
64 
65 #endif /* SOpaqueLabel_h */
66