~unity-team/compiz/plugins-main-trunk.fix_wrong_window_move_expo

« back to all changes in this revision

Viewing changes to text/include/text/text.h

  • Committer: David Barth
  • Date: 2011-03-29 16:36:40 UTC
  • Revision ID: david.barth@canonical.com-20110329163640-fpen5qsoo0lbjode
initial import from compiz-plugins-main_0.9.4git20110322.orig.tar.gz

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * text.h - adds text image support to compiz.
 
3
 * Copyright: (C) 2006 Patrick Niklaus
 
4
 *
 
5
 * This program is free software; you can redistribute it and/or
 
6
 * modify it under the terms of the GNU General Public License
 
7
 * as published by the Free Software Foundation; either version 2
 
8
 * of the License, or (at your option) any later version.
 
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., 51 Franklin Street, Fifth Floor,
 
18
 * Boston, MA  02110-1301, USA.
 
19
 *
 
20
 */
 
21
 
 
22
#ifndef _COMPIZ_TEXT_H
 
23
#define _COMPIZ_TEXT_H
 
24
 
 
25
#define COMPIZ_TEXT_ABI 20090905
 
26
 
 
27
class CompText
 
28
{
 
29
    public:
 
30
        /**
 
31
         * Flags to be passed into the flags field of CompTextAttrib
 
32
         */
 
33
        typedef enum {
 
34
            StyleBold      = (1 << 0), /**< render the text in bold */
 
35
            StyleItalic    = (1 << 1), /**< render the text italic */
 
36
            Ellipsized     = (1 << 2), /**< ellipsize the text if the
 
37
                                            specified maximum size is
 
38
                                            too small */
 
39
            WithBackground = (1 << 3), /**< render a rounded rectangle as
 
40
                                            background behind the text */
 
41
            NoAutoBinding  = (1 << 4) /**< do not automatically bind the
 
42
                                           rendered text pixmap to a texture */
 
43
        } Flags;
 
44
 
 
45
        typedef struct {
 
46
            const char     *family;    /**< font family */
 
47
            int            size;       /**< font size in points */
 
48
            unsigned short color[4];   /**< font color (RGBA) */
 
49
 
 
50
            unsigned int   flags;      /**< rendering flags, see above */
 
51
 
 
52
            int            maxWidth;   /**< maximum width of the
 
53
                                            generated pixmap */
 
54
            int            maxHeight;  /**< maximum height of the
 
55
                                            generated pixmap */
 
56
 
 
57
            int            bgHMargin;  /**< horizontal margin in pixels
 
58
                                            (offset of text into background) */
 
59
            int            bgVMargin;  /**< vertical margin */
 
60
            unsigned short bgColor[4]; /**< background color (RGBA) */
 
61
        } Attrib;
 
62
 
 
63
        CompText ();
 
64
        ~CompText();
 
65
 
 
66
        bool renderText (CompString   text,
 
67
                         const Attrib &attrib);
 
68
 
 
69
 
 
70
        bool renderWindowTitle (Window       window,
 
71
                                bool         renderViewportNumber,
 
72
                                const Attrib &attrib);
 
73
 
 
74
        void clear ();
 
75
 
 
76
        Pixmap getPixmap ();
 
77
        int getWidth () const;
 
78
        int getHeight () const;
 
79
 
 
80
        void draw (float x,
 
81
                   float y,
 
82
                   float alpha) const;
 
83
 
 
84
    private:
 
85
        int width;
 
86
        int height;
 
87
 
 
88
        Pixmap          pixmap;
 
89
        GLTexture::List texture;
 
90
};
 
91
 
 
92
#endif