]> git.sesse.net Git - vlc/blob - modules/gui/skins/gtk2/gtk2_font.h
fe73a8b453947055a739db7e1071a01a18bcb3b9
[vlc] / modules / gui / skins / gtk2 / gtk2_font.h
1 /*****************************************************************************
2  * gtk2_font.h: GTK2 implementation of the Font class
3  *****************************************************************************
4  * Copyright (C) 2003 VideoLAN
5  * $Id: gtk2_font.h,v 1.6 2003/04/21 22:12:37 asmax Exp $
6  *
7  * Authors: Cyril Deguet     <asmax@videolan.org>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111,
22  * USA.
23  *****************************************************************************/
24
25
26 #ifndef VLC_SKIN_GTK2_FONT
27 #define VLC_SKIN_GTK2_FONT
28
29 //--- GENERAL ---------------------------------------------------------------
30 #include <string>
31 using namespace std;
32
33 //--- GTK2 -----------------------------------------------------------------
34 #include <gdk/gdk.h>
35
36 //---------------------------------------------------------------------------
37 struct intf_thread_t;
38 class Graphics;
39
40 //---------------------------------------------------------------------------
41 class GTK2Font : SkinFont
42 {
43     private:
44         PangoContext  *Context;
45         PangoLayout   *Layout;
46         PangoFontDescription *FontDesc;
47
48         // Assign font to Device Context
49         virtual void AssignFont( Graphics *dest );
50
51         // Helper function
52         virtual void GenericPrint( Graphics *dest, string text, int x, int y,
53                                    int w, int h, int align, int color );
54
55     public:
56         // Constructor
57         GTK2Font( intf_thread_t *_p_intf, string fontname, int size, int color,
58                    int weight, bool italic, bool underline );
59
60         // Destructor
61         virtual ~GTK2Font();
62
63         // Get size of text
64         virtual void GetSize( string text, int &w, int &h );
65
66         // Draw text with boundaries
67         virtual void Print( Graphics *dest, string text, int x, int y, int w,
68                             int h, int align );
69
70         virtual void PrintColor( Graphics *dest, string text, int x, int y,
71                                  int w, int h, int align, int color );
72
73 };
74 //---------------------------------------------------------------------------
75
76 #endif