]> git.saurik.com Git - wxWidgets.git/blame - src/os2/gdiobj.cpp
Improved error handling.
[wxWidgets.git] / src / os2 / gdiobj.cpp
CommitLineData
0e320a79 1/////////////////////////////////////////////////////////////////////////////
f6630099 2// Name: src/os2/gdiobj.cpp
0e320a79
DW
3// Purpose: wxGDIObject class
4// Author: AUTHOR
5// Modified by:
6// Created: ??/??/98
7// RCS-ID: $Id$
8// Copyright: (c) AUTHOR
f6630099 9// Licence: wxWindows licence
0e320a79
DW
10/////////////////////////////////////////////////////////////////////////////
11
0371a691 12#include "wx/wxprec.h"
0e320a79
DW
13
14#include "wx/gdiobj.h"
f516d986 15#include "wx/gdicmn.h"
f6630099 16#include "wx/font.h"
0e320a79 17
0e320a79 18IMPLEMENT_DYNAMIC_CLASS(wxGDIObject, wxObject)
0e320a79 19
f516d986
VZ
20class wxStockGDIPM: public wxStockGDI
21{
22public:
23 wxStockGDIPM();
24
25 virtual const wxFont* GetFont(Item item);
26
27private:
28 typedef wxStockGDI super;
29};
30
31static wxStockGDIPM gs_wxStockGDIPM_instance;
32
33wxStockGDIPM::wxStockGDIPM()
34{
35 // Override default instance
36 ms_instance = this;
37}
38
39const 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}