Committed William Osborne's wxPalmOS port

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29996 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2004-10-19 13:40:30 +00:00
parent 698b34facd
commit ffecfa5aeb
260 changed files with 40716 additions and 44 deletions

130
src/palmos/ownerdrw.cpp Normal file
View File

@@ -0,0 +1,130 @@
///////////////////////////////////////////////////////////////////////////////
// Name: palmos/ownerdrw.cpp
// Purpose: implementation of wxOwnerDrawn class
// Author: William Osborne
// Modified by:
// Created: 10/13/04
// RCS-ID: $Id:
// Copyright: (c) William Osborne
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/window.h"
#include "wx/font.h"
#include "wx/bitmap.h"
#include "wx/dcmemory.h"
#include "wx/menu.h"
#include "wx/utils.h"
#endif
#include "wx/settings.h"
#include "wx/ownerdrw.h"
#include "wx/menuitem.h"
#include "wx/fontutil.h"
#include "wx/module.h"
#if wxUSE_OWNER_DRAWN
class wxMSWSystemMenuFontModule : public wxModule
{
public:
virtual bool OnInit()
{
ms_systemMenuFont = new wxFont;
#if defined(__WXMSW__) && defined(__WIN32__) && defined(SM_CXMENUCHECK)
NONCLIENTMETRICS nm;
nm.cbSize = sizeof(NONCLIENTMETRICS);
SystemParametersInfo(SPI_GETNONCLIENTMETRICS,0,&nm,0);
ms_systemMenuButtonWidth = nm.iMenuHeight;
ms_systemMenuHeight = nm.iMenuHeight;
// create menu font
wxNativeFontInfo info;
memcpy(&info.lf, &nm.lfMenuFont, sizeof(LOGFONT));
ms_systemMenuFont->Create(info);
#endif
return true;
}
virtual void OnExit()
{
delete ms_systemMenuFont;
ms_systemMenuFont = NULL;
}
static wxFont* ms_systemMenuFont;
static int ms_systemMenuButtonWidth; // windows clean install default
static int ms_systemMenuHeight; // windows clean install default
private:
DECLARE_DYNAMIC_CLASS(wxMSWSystemMenuFontModule)
};
// these static variables are by the wxMSWSystemMenuFontModule object
// and reflect the system settings returned by the Win32 API's
// SystemParametersInfo() call.
wxFont* wxMSWSystemMenuFontModule::ms_systemMenuFont = NULL;
int wxMSWSystemMenuFontModule::ms_systemMenuButtonWidth = 18; // windows clean install default
int wxMSWSystemMenuFontModule::ms_systemMenuHeight = 18; // windows clean install default
IMPLEMENT_DYNAMIC_CLASS(wxMSWSystemMenuFontModule, wxModule)
// ============================================================================
// implementation of wxOwnerDrawn class
// ============================================================================
// ctor
// ----
wxOwnerDrawn::wxOwnerDrawn(const wxString& str,
bool bCheckable, bool bMenuItem)
: m_strName(str)
{
}
// these items will be set during the first invocation of the c'tor,
// because the values will be determined by checking the system settings,
// which is a chunk of code
size_t wxOwnerDrawn::ms_nDefaultMarginWidth = 0;
size_t wxOwnerDrawn::ms_nLastMarginWidth = 0;
// drawing
// -------
// get size of the item
// The item size includes the menu string, the accel string,
// the bitmap and size for a submenu expansion arrow...
bool wxOwnerDrawn::OnMeasureItem(size_t *pwidth, size_t *pheight)
{
return false;
}
// draw the item
bool wxOwnerDrawn::OnDrawItem(wxDC& dc,
const wxRect& rc,
wxODAction act,
wxODStatus st)
{
return false;
}
#endif // wxUSE_OWNER_DRAWN