]> git.saurik.com Git - wxWidgets.git/blob - src/os2/gdiobj.cpp
Improved error handling.
[wxWidgets.git] / src / os2 / gdiobj.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/os2/gdiobj.cpp
3 // Purpose: wxGDIObject class
4 // Author: AUTHOR
5 // Modified by:
6 // Created: ??/??/98
7 // RCS-ID: $Id$
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #include "wx/wxprec.h"
13
14 #include "wx/gdiobj.h"
15 #include "wx/gdicmn.h"
16 #include "wx/font.h"
17
18 IMPLEMENT_DYNAMIC_CLASS(wxGDIObject, wxObject)
19
20 class wxStockGDIPM: public wxStockGDI
21 {
22 public:
23 wxStockGDIPM();
24
25 virtual const wxFont* GetFont(Item item);
26
27 private:
28 typedef wxStockGDI super;
29 };
30
31 static wxStockGDIPM gs_wxStockGDIPM_instance;
32
33 wxStockGDIPM::wxStockGDIPM()
34 {
35 // Override default instance
36 ms_instance = this;
37 }
38
39 const wxFont* wxStockGDIPM::GetFont(Item item)
40 {
41 wxFont* font = wx_static_cast(wxFont*, ms_stockObject[item]);
42 if (font == NULL)
43 {
44 const int fontSize = 12;
45 switch (item)
46 {
47 case FONT_NORMAL:
48 font = new wxFont(fontSize, wxMODERN, wxNORMAL, wxBOLD);
49 break;
50 case FONT_SMALL:
51 font = new wxFont(fontSize - 4, wxSWISS, wxNORMAL, wxNORMAL);
52 break;
53 default:
54 font = wx_const_cast(wxFont*, super::GetFont(item));
55 break;
56 }
57 ms_stockObject[item] = font;
58 }
59 return font;
60 }