1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: palmos/ownerdrw.cpp
3 // Purpose: implementation of wxOwnerDrawn class
4 // Author: William Osborne
8 // Copyright: (c) William Osborne
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
13 #pragma implementation
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
24 #include "wx/window.h"
26 #include "wx/bitmap.h"
27 #include "wx/dcmemory.h"
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"
40 class wxMSWSystemMenuFontModule
: public wxModule
46 ms_systemMenuFont
= new wxFont
;
48 #if defined(__WXMSW__) && defined(__WIN32__) && defined(SM_CXMENUCHECK)
50 nm
.cbSize
= sizeof(NONCLIENTMETRICS
);
51 SystemParametersInfo(SPI_GETNONCLIENTMETRICS
,0,&nm
,0);
53 ms_systemMenuButtonWidth
= nm
.iMenuHeight
;
54 ms_systemMenuHeight
= nm
.iMenuHeight
;
57 wxNativeFontInfo info
;
58 memcpy(&info
.lf
, &nm
.lfMenuFont
, sizeof(LOGFONT
));
59 ms_systemMenuFont
->Create(info
);
67 delete ms_systemMenuFont
;
68 ms_systemMenuFont
= NULL
;
71 static wxFont
* ms_systemMenuFont
;
72 static int ms_systemMenuButtonWidth
; // windows clean install default
73 static int ms_systemMenuHeight
; // windows clean install default
75 DECLARE_DYNAMIC_CLASS(wxMSWSystemMenuFontModule
)
78 // these static variables are by the wxMSWSystemMenuFontModule object
79 // and reflect the system settings returned by the Win32 API's
80 // SystemParametersInfo() call.
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
86 IMPLEMENT_DYNAMIC_CLASS(wxMSWSystemMenuFontModule
, wxModule
)
88 // ============================================================================
89 // implementation of wxOwnerDrawn class
90 // ============================================================================
94 wxOwnerDrawn::wxOwnerDrawn(const wxString
& str
,
95 bool bCheckable
, bool bMenuItem
)
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;
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
)
120 bool wxOwnerDrawn::OnDrawItem(wxDC
& dc
,
129 #endif // wxUSE_OWNER_DRAWN