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