]> git.saurik.com Git - wxWidgets.git/blob - src/palmos/ownerdrw.cpp
first stab at supporting custom renderers
[wxWidgets.git] / src / palmos / ownerdrw.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/palmos/ownerdrw.cpp
3 // Purpose: implementation of wxOwnerDrawn class
4 // Author: William Osborne - minimal working wxPalmOS port
5 // Modified by:
6 // Created: 10/13/04
7 // RCS-ID: $Id$
8 // Copyright: (c) William Osborne
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 // For compilers that support precompilation, includes "wx.h".
13 #include "wx/wxprec.h"
14
15 #ifdef __BORLANDC__
16 #pragma hdrstop
17 #endif
18
19 #ifndef WX_PRECOMP
20 #include "wx/window.h"
21 #include "wx/font.h"
22 #include "wx/bitmap.h"
23 #include "wx/dcmemory.h"
24 #include "wx/menu.h"
25 #include "wx/utils.h"
26 #include "wx/settings.h"
27 #include "wx/menuitem.h"
28 #include "wx/module.h"
29 #endif
30
31 #include "wx/ownerdrw.h"
32 #include "wx/fontutil.h"
33
34 #if wxUSE_OWNER_DRAWN
35
36 class wxMSWSystemMenuFontModule : public wxModule
37 {
38 public:
39
40 virtual bool OnInit()
41 {
42 ms_systemMenuFont = new wxFont;
43 return true;
44 }
45
46 virtual void OnExit()
47 {
48 wxDELETE(ms_systemMenuFont);
49 }
50
51 static wxFont* ms_systemMenuFont;
52 static int ms_systemMenuButtonWidth; // windows clean install default
53 static int ms_systemMenuHeight; // windows clean install default
54 private:
55 DECLARE_DYNAMIC_CLASS(wxMSWSystemMenuFontModule)
56 };
57
58 // these static variables are by the wxMSWSystemMenuFontModule object
59 // and reflect the system settings returned by the Win32 API's
60 // SystemParametersInfo() call.
61
62 wxFont* wxMSWSystemMenuFontModule::ms_systemMenuFont = NULL;
63 int wxMSWSystemMenuFontModule::ms_systemMenuButtonWidth = 18; // windows clean install default
64 int wxMSWSystemMenuFontModule::ms_systemMenuHeight = 18; // windows clean install default
65
66 IMPLEMENT_DYNAMIC_CLASS(wxMSWSystemMenuFontModule, wxModule)
67
68 // ============================================================================
69 // implementation of wxOwnerDrawn class
70 // ============================================================================
71
72 // ctor
73 // ----
74 wxOwnerDrawn::wxOwnerDrawn(const wxString& str,
75 bool bCheckable, bool bMenuItem)
76 : m_strName(str)
77 {
78 }
79
80
81 // these items will be set during the first invocation of the c'tor,
82 // because the values will be determined by checking the system settings,
83 // which is a chunk of code
84 size_t wxOwnerDrawn::ms_nDefaultMarginWidth = 0;
85 size_t wxOwnerDrawn::ms_nLastMarginWidth = 0;
86
87
88 // drawing
89 // -------
90
91 // get size of the item
92 // The item size includes the menu string, the accel string,
93 // the bitmap and size for a submenu expansion arrow...
94 bool wxOwnerDrawn::OnMeasureItem(size_t *pwidth, size_t *pheight)
95 {
96 return false;
97 }
98
99 // draw the item
100 bool wxOwnerDrawn::OnDrawItem(wxDC& dc,
101 const wxRect& rc,
102 wxODAction act,
103 wxODStatus st)
104 {
105 return false;
106 }
107
108
109 #endif // wxUSE_OWNER_DRAWN