]>
Commit | Line | Data |
---|---|---|
ffecfa5a | 1 | /////////////////////////////////////////////////////////////////////////////// |
e2731512 | 2 | // Name: src/palmos/ownerdrw.cpp |
ffecfa5a | 3 | // Purpose: implementation of wxOwnerDrawn class |
e2731512 | 4 | // Author: William Osborne - minimal working wxPalmOS port |
ffecfa5a JS |
5 | // Modified by: |
6 | // Created: 10/13/04 | |
e2731512 | 7 | // RCS-ID: $Id$ |
ffecfa5a JS |
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; | |
ffecfa5a JS |
47 | return true; |
48 | } | |
49 | ||
50 | virtual void OnExit() | |
51 | { | |
52 | delete ms_systemMenuFont; | |
53 | ms_systemMenuFont = NULL; | |
54 | } | |
55 | ||
56 | static wxFont* ms_systemMenuFont; | |
57 | static int ms_systemMenuButtonWidth; // windows clean install default | |
58 | static int ms_systemMenuHeight; // windows clean install default | |
59 | private: | |
60 | DECLARE_DYNAMIC_CLASS(wxMSWSystemMenuFontModule) | |
61 | }; | |
62 | ||
63 | // these static variables are by the wxMSWSystemMenuFontModule object | |
64 | // and reflect the system settings returned by the Win32 API's | |
65 | // SystemParametersInfo() call. | |
66 | ||
67 | wxFont* wxMSWSystemMenuFontModule::ms_systemMenuFont = NULL; | |
68 | int wxMSWSystemMenuFontModule::ms_systemMenuButtonWidth = 18; // windows clean install default | |
69 | int wxMSWSystemMenuFontModule::ms_systemMenuHeight = 18; // windows clean install default | |
70 | ||
71 | IMPLEMENT_DYNAMIC_CLASS(wxMSWSystemMenuFontModule, wxModule) | |
72 | ||
73 | // ============================================================================ | |
74 | // implementation of wxOwnerDrawn class | |
75 | // ============================================================================ | |
76 | ||
77 | // ctor | |
78 | // ---- | |
79 | wxOwnerDrawn::wxOwnerDrawn(const wxString& str, | |
80 | bool bCheckable, bool bMenuItem) | |
81 | : m_strName(str) | |
82 | { | |
83 | } | |
84 | ||
85 | ||
86 | // these items will be set during the first invocation of the c'tor, | |
87 | // because the values will be determined by checking the system settings, | |
88 | // which is a chunk of code | |
89 | size_t wxOwnerDrawn::ms_nDefaultMarginWidth = 0; | |
90 | size_t wxOwnerDrawn::ms_nLastMarginWidth = 0; | |
91 | ||
92 | ||
93 | // drawing | |
94 | // ------- | |
95 | ||
96 | // get size of the item | |
97 | // The item size includes the menu string, the accel string, | |
98 | // the bitmap and size for a submenu expansion arrow... | |
99 | bool wxOwnerDrawn::OnMeasureItem(size_t *pwidth, size_t *pheight) | |
100 | { | |
101 | return false; | |
102 | } | |
103 | ||
104 | // draw the item | |
105 | bool wxOwnerDrawn::OnDrawItem(wxDC& dc, | |
106 | const wxRect& rc, | |
107 | wxODAction act, | |
108 | wxODStatus st) | |
109 | { | |
110 | return false; | |
111 | } | |
112 | ||
113 | ||
114 | #endif // wxUSE_OWNER_DRAWN | |
115 |