]> git.saurik.com Git - wxWidgets.git/blame - include/wx/qt/font.h
new wxTreeCtrl files
[wxWidgets.git] / include / wx / qt / font.h
CommitLineData
7c78e7c7
RR
1/////////////////////////////////////////////////////////////////////////////
2// Name: font.h
01b2eeec
KB
3// Purpose: wxFont class
4// Author: AUTHOR
5// Modified by:
6// Created: ??/??/98
7// RCS-ID: $Id$
8// Copyright: (c) AUTHOR
7c78e7c7
RR
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
01b2eeec
KB
12#ifndef _WX_FONT_H_
13#define _WX_FONT_H_
7c78e7c7
RR
14
15#ifdef __GNUG__
01b2eeec 16#pragma interface "font.h"
7c78e7c7
RR
17#endif
18
7c78e7c7
RR
19#include "wx/gdiobj.h"
20
01b2eeec 21class WXDLLEXPORT wxFont;
7c78e7c7 22
01b2eeec
KB
23class WXDLLEXPORT wxFontRefData: public wxGDIRefData
24{
25 friend class WXDLLEXPORT wxFont;
26public:
27 wxFontRefData();
28 ~wxFontRefData();
29protected:
30 int m_pointSize;
31 int m_family;
32 int m_style;
33 int m_weight;
34 bool m_underlined;
35 wxString m_faceName;
36/* TODO: implementation
37 WXHFONT m_hFont;
38*/
39};
7c78e7c7 40
01b2eeec 41#define M_FONTDATA ((wxFontRefData *)m_refData)
7c78e7c7 42
01b2eeec 43WXDLLEXPORT_DATA(extern const char*) wxEmptyString;
7c78e7c7 44
01b2eeec
KB
45// Font
46class WXDLLEXPORT wxFont: public wxGDIObject
7c78e7c7
RR
47{
48 DECLARE_DYNAMIC_CLASS(wxFont)
01b2eeec
KB
49public:
50 wxFont();
51 wxFont(int pointSize, int family, int style, int weight, bool underlined = FALSE, const wxString& faceName = wxEmptyString);
52 inline wxFont(const wxFont& font) { Ref(font); }
53 inline wxFont(const wxFont* font) { if (font) Ref(*font); }
54
55 ~wxFont();
56
57 bool Create(int pointSize, int family, int style, int weight, bool underlined = FALSE, const wxString& faceName = wxEmptyString);
58
59 virtual bool Ok() const { return (m_refData != NULL) ; }
60
61 inline int GetPointSize() const { return M_FONTDATA->m_pointSize; }
62 inline int GetFamily() const { return M_FONTDATA->m_family; }
63 inline int GetStyle() const { return M_FONTDATA->m_style; }
64 inline int GetWeight() const { return M_FONTDATA->m_weight; }
65 wxString GetFamilyString() const ;
66 wxString GetFaceName() const ;
67 wxString GetStyleString() const ;
68 wxString GetWeightString() const ;
69 inline bool GetUnderlined() const { return M_FONTDATA->m_underlined; }
70
71 void SetPointSize(int pointSize);
72 void SetFamily(int family);
73 void SetStyle(int style);
74 void SetWeight(int weight);
75 void SetFaceName(const wxString& faceName);
76 void SetUnderlined(bool underlined);
77
78 inline wxFont& operator = (const wxFont& font) { if (*this == font) return (*this); Ref(font); return *this; }
79 inline bool operator == (const wxFont& font) { return m_refData == font.m_refData; }
80 inline bool operator != (const wxFont& font) { return m_refData != font.m_refData; }
81
82 // Implementation
83protected:
84 void Unshare();
7c78e7c7
RR
85};
86
01b2eeec
KB
87#endif
88 // _WX_FONT_H_