]> git.saurik.com Git - wxWidgets.git/blob - src/palmos/ownerdrw.cpp
Committing in .
[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 #endif
28
29 #include "wx/ownerdrw.h"
30 #include "wx/menuitem.h"
31 #include "wx/fontutil.h"
32 #include "wx/module.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 delete ms_systemMenuFont;
49 ms_systemMenuFont = NULL;
50 }
51
52 static wxFont* ms_systemMenuFont;
53 static int ms_systemMenuButtonWidth; // windows clean install default
54 static int ms_systemMenuHeight; // windows clean install default
55 private:
56 DECLARE_DYNAMIC_CLASS(wxMSWSystemMenuFontModule)
57 };
58
59 // these static variables are by the wxMSWSystemMenuFontModule object
60 // and reflect the system settings returned by the Win32 API's
61 // SystemParametersInfo() call.
62
63 wxFont* wxMSWSystemMenuFontModule::ms_systemMenuFont = NULL;
64 int wxMSWSystemMenuFontModule::ms_systemMenuButtonWidth = 18; // windows clean install default
65 int wxMSWSystemMenuFontModule::ms_systemMenuHeight = 18; // windows clean install default
66
67 IMPLEMENT_DYNAMIC_CLASS(wxMSWSystemMenuFontModule, wxModule)
68
69 // ============================================================================
70 // implementation of wxOwnerDrawn class
71 // ============================================================================
72
73 // ctor
74 // ----
75 wxOwnerDrawn::wxOwnerDrawn(const wxString& str,
76 bool bCheckable, bool bMenuItem)
77 : m_strName(str)
78 {
79 }
80
81
82 // these items will be set during the first invocation of the c'tor,
83 // because the values will be determined by checking the system settings,
84 // which is a chunk of code
85 size_t wxOwnerDrawn::ms_nDefaultMarginWidth = 0;
86 size_t wxOwnerDrawn::ms_nLastMarginWidth = 0;
87
88
89 // drawing
90 // -------
91
92 // get size of the item
93 // The item size includes the menu string, the accel string,
94 // the bitmap and size for a submenu expansion arrow...
95 bool wxOwnerDrawn::OnMeasureItem(size_t *pwidth, size_t *pheight)
96 {
97 return false;
98 }
99
100 // draw the item
101 bool wxOwnerDrawn::OnDrawItem(wxDC& dc,
102 const wxRect& rc,
103 wxODAction act,
104 wxODStatus st)
105 {
106 return false;
107 }
108
109
110 #endif // wxUSE_OWNER_DRAWN