]> git.saurik.com Git - wxWidgets.git/blame - src/osx/carbon/gdiobj.cpp
use wxWindow::GetClientSize() instead of ::GetClientRect() in wxActiveXContainer...
[wxWidgets.git] / src / osx / carbon / gdiobj.cpp
CommitLineData
489468fe 1/////////////////////////////////////////////////////////////////////////////
524c47aa 2// Name: src/osx/carbon/gdiobj.cpp
489468fe
SC
3// Purpose: wxGDIObject class
4// Author: Stefan Csomor
5// Modified by:
6// Created: 1998-01-01
7// RCS-ID: $Id$
8// Copyright: (c) Stefan Csomor
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#include "wx/wxprec.h"
13
14#include "wx/gdiobj.h"
15
16#ifndef WX_PRECOMP
17 #include "wx/gdicmn.h"
18 #include "wx/module.h"
19#endif
20
21#include "wx/link.h"
1f0c8f31 22#include "wx/osx/private.h"
b2680ced 23#include "wx/font.h"
489468fe
SC
24
25// Linker will discard entire object file without this
26wxFORCE_LINK_THIS_MODULE(gdiobj)
27
28class wxStockGDIMac: public wxStockGDI, public wxModule
29{
30public:
31 virtual const wxFont* GetFont(Item item);
32
33 virtual bool OnInit();
34 virtual void OnExit();
35
36private:
37 typedef wxStockGDI super;
38 DECLARE_DYNAMIC_CLASS(wxStockGDIMac)
39};
40
41IMPLEMENT_DYNAMIC_CLASS(wxStockGDIMac, wxModule)
42
43bool wxStockGDIMac::OnInit()
44{
45 // Override default instance
46 ms_instance = this;
47 return true;
48}
49
50void wxStockGDIMac::OnExit()
51{
52}
53
b2680ced
SC
54extern wxFont* CreateNormalFont();
55extern wxFont* CreateSmallFont();
56
489468fe
SC
57const wxFont* wxStockGDIMac::GetFont(Item item)
58{
59 wxFont* font = static_cast<wxFont*>(ms_stockObject[item]);
60 if (font == NULL)
61 {
62 switch (item)
63 {
b2680ced 64#if wxOSX_USE_COCOA_OR_CARBON
489468fe
SC
65 case FONT_NORMAL:
66 font = new wxFont;
7ac5e1c9 67#if wxOSX_USE_ATSU_TEXT
489468fe 68 font->MacCreateFromThemeFont(kThemeSystemFont);
524c47aa
SC
69#else
70 font->MacCreateFromUIFont(kCTFontSystemFontType);
71#endif
489468fe
SC
72 break;
73 case FONT_SMALL:
74 font = new wxFont;
7ac5e1c9 75#if wxOSX_USE_ATSU_TEXT
489468fe 76 font->MacCreateFromThemeFont(kThemeSmallSystemFont);
524c47aa
SC
77#else
78 font->MacCreateFromUIFont(kCTFontSmallSystemFontType);
79#endif
489468fe 80 break;
b2680ced
SC
81#else
82 case FONT_NORMAL:
83 font = CreateNormalFont() ;
84 break;
85 case FONT_SMALL:
86 font = CreateSmallFont();
87 break;
88#endif
489468fe
SC
89 default:
90 font = const_cast<wxFont*>(super::GetFont(item));
91 break;
92 }
93 ms_stockObject[item] = font;
94 }
95 return font;
96}