1998-05-20 14:12:05 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2001-04-21 16:03:10 +00:00
|
|
|
// Name: msw/settings.cpp
|
2001-12-30 22:34:36 +00:00
|
|
|
// Purpose: wxSystemSettingsNative implementation for MSW
|
1998-05-20 14:12:05 +00:00
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 04/01/98
|
|
|
|
// RCS-ID: $Id$
|
2003-03-17 11:23:28 +00:00
|
|
|
// Copyright: (c) Julian Smart
|
2004-05-23 20:53:33 +00:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 14:12:05 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2001-04-21 16:03:10 +00:00
|
|
|
// ============================================================================
|
|
|
|
// declarations
|
|
|
|
// ============================================================================
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// headers
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
1998-05-20 14:12:05 +00:00
|
|
|
// For compilers that support precompilation, includes "wx.h".
|
|
|
|
#include "wx/wxprec.h"
|
|
|
|
|
|
|
|
#ifdef __BORLANDC__
|
2001-12-30 22:34:36 +00:00
|
|
|
#pragma hdrstop
|
1998-05-20 14:12:05 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef WX_PRECOMP
|
2002-01-28 22:37:48 +00:00
|
|
|
#include "wx/utils.h"
|
2001-04-21 16:03:10 +00:00
|
|
|
#include "wx/gdicmn.h"
|
1998-05-20 14:12:05 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "wx/settings.h"
|
2001-12-30 22:34:36 +00:00
|
|
|
|
1998-05-20 14:12:05 +00:00
|
|
|
#include "wx/msw/private.h"
|
2001-12-30 22:34:36 +00:00
|
|
|
|
2002-03-13 16:44:45 +00:00
|
|
|
#ifndef SPI_GETFLATMENU
|
|
|
|
#define SPI_GETFLATMENU 0x1022
|
|
|
|
#endif
|
|
|
|
|
2001-05-08 22:28:44 +00:00
|
|
|
#include "wx/module.h"
|
2001-06-29 10:58:59 +00:00
|
|
|
#include "wx/fontutil.h"
|
1998-05-20 14:12:05 +00:00
|
|
|
|
2003-11-18 21:25:44 +00:00
|
|
|
#ifdef __WXWINCE__ // for SM_CXCURSOR and SM_CYCURSOR
|
|
|
|
#include "wx/msw/wince/missing.h"
|
|
|
|
#endif // __WXWINCE__
|
|
|
|
|
2001-04-21 16:03:10 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// private classes
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2001-12-30 22:34:36 +00:00
|
|
|
// the module which is used to clean up wxSystemSettingsNative data (this is a
|
2001-04-21 16:03:10 +00:00
|
|
|
// singleton class so it can't be done in the dtor)
|
|
|
|
class wxSystemSettingsModule : public wxModule
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual bool OnInit();
|
|
|
|
virtual void OnExit();
|
|
|
|
|
|
|
|
private:
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxSystemSettingsModule)
|
|
|
|
};
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// global data
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2001-12-30 22:34:36 +00:00
|
|
|
// the font returned by GetFont(wxSYS_DEFAULT_GUI_FONT): it is created when
|
|
|
|
// GetFont() is called for the first time and deleted by wxSystemSettingsModule
|
2001-04-21 16:03:10 +00:00
|
|
|
static wxFont *gs_fontDefault = NULL;
|
|
|
|
|
|
|
|
// ============================================================================
|
|
|
|
// implementation
|
|
|
|
// ============================================================================
|
|
|
|
|
2001-12-30 22:34:36 +00:00
|
|
|
// TODO: see ::SystemParametersInfo for all sorts of Windows settings.
|
|
|
|
// Different args are required depending on the id. How does this differ
|
|
|
|
// from GetSystemMetric, and should it? Perhaps call it GetSystemParameter
|
|
|
|
// and pass an optional void* arg to get further info.
|
|
|
|
// Should also have SetSystemParameter.
|
|
|
|
// Also implement WM_WININICHANGE (NT) / WM_SETTINGCHANGE (Win95)
|
|
|
|
|
2001-04-21 16:03:10 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxSystemSettingsModule
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
IMPLEMENT_DYNAMIC_CLASS(wxSystemSettingsModule, wxModule)
|
|
|
|
|
|
|
|
bool wxSystemSettingsModule::OnInit()
|
|
|
|
{
|
2004-09-04 01:53:42 +00:00
|
|
|
return true;
|
2001-04-21 16:03:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void wxSystemSettingsModule::OnExit()
|
|
|
|
{
|
|
|
|
delete gs_fontDefault;
|
2001-07-11 10:07:06 +00:00
|
|
|
gs_fontDefault = NULL;
|
2001-04-21 16:03:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2001-12-30 22:34:36 +00:00
|
|
|
// wxSystemSettingsNative
|
2001-04-21 16:03:10 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2001-12-30 22:34:36 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// colours
|
|
|
|
// ----------------------------------------------------------------------------
|
1998-05-20 14:12:05 +00:00
|
|
|
|
2001-12-30 22:34:36 +00:00
|
|
|
wxColour wxSystemSettingsNative::GetColour(wxSystemColour index)
|
1998-05-20 14:12:05 +00:00
|
|
|
{
|
2002-01-28 01:38:39 +00:00
|
|
|
// we use 0 as the default value just to avoid compiler warnings, as there
|
|
|
|
// is no invalid colour value we use hasCol as the real indicator of
|
|
|
|
// whether colSys was initialized or not
|
|
|
|
COLORREF colSys = 0;
|
2004-09-04 01:53:42 +00:00
|
|
|
bool hasCol = false;
|
2002-01-28 01:38:39 +00:00
|
|
|
|
|
|
|
// the default colours for the entries after BTNHIGHLIGHT
|
|
|
|
static const COLORREF s_defaultSysColors[] =
|
|
|
|
{
|
|
|
|
0x000000, // 3DDKSHADOW
|
|
|
|
0xdfdfdf, // 3DLIGHT
|
|
|
|
0x000000, // INFOTEXT
|
|
|
|
0xe1ffff, // INFOBK
|
|
|
|
|
|
|
|
0, // filler - no std colour with this index
|
|
|
|
|
|
|
|
// TODO: please fill in the standard values of those, I don't have them
|
|
|
|
0, // HOTLIGHT
|
|
|
|
0, // GRADIENTACTIVECAPTION
|
|
|
|
0, // GRADIENTINACTIVECAPTION
|
|
|
|
0, // MENU
|
|
|
|
0, // MENUBAR (unused)
|
|
|
|
};
|
|
|
|
|
|
|
|
if ( index == wxSYS_COLOUR_LISTBOX )
|
|
|
|
{
|
|
|
|
// there is no standard colour with this index, map to another one
|
|
|
|
index = wxSYS_COLOUR_WINDOW;
|
|
|
|
}
|
|
|
|
else if ( index > wxSYS_COLOUR_BTNHIGHLIGHT )
|
|
|
|
{
|
|
|
|
// the indices before BTNHIGHLIGHT are understood by GetSysColor() in
|
|
|
|
// all Windows version, for the other ones we have to check
|
|
|
|
bool useDefault;
|
|
|
|
|
|
|
|
int verMaj, verMin;
|
|
|
|
wxGetOsVersion(&verMaj, &verMin);
|
|
|
|
if ( verMaj < 4 )
|
|
|
|
{
|
|
|
|
// NT 3.5
|
2004-09-04 01:53:42 +00:00
|
|
|
useDefault = true;
|
2002-01-28 01:38:39 +00:00
|
|
|
}
|
|
|
|
else if ( verMaj == 4 )
|
|
|
|
{
|
|
|
|
// Win95/NT 4.0
|
|
|
|
useDefault = index > wxSYS_COLOUR_INFOBK;
|
|
|
|
}
|
|
|
|
else if ( verMaj == 5 && verMin == 0 )
|
|
|
|
{
|
|
|
|
// Win98/Win2K
|
|
|
|
useDefault = index > wxSYS_COLOUR_GRADIENTINACTIVECAPTION;
|
|
|
|
}
|
|
|
|
else // >= 5.1
|
|
|
|
{
|
|
|
|
// 5.1 is Windows XP
|
2004-09-04 01:53:42 +00:00
|
|
|
useDefault = false;
|
|
|
|
// Determine if we are using flat menus, only then allow wxSYS_COLOUR_MENUBAR
|
|
|
|
if ( index == wxSYS_COLOUR_MENUBAR )
|
|
|
|
{
|
|
|
|
BOOL isFlat ;
|
|
|
|
if ( SystemParametersInfo( SPI_GETFLATMENU , 0 ,&isFlat, 0 ) )
|
|
|
|
{
|
|
|
|
if ( !isFlat )
|
|
|
|
index = wxSYS_COLOUR_MENU ;
|
|
|
|
}
|
|
|
|
}
|
2002-03-13 16:44:45 +00:00
|
|
|
}
|
2002-01-28 01:38:39 +00:00
|
|
|
|
|
|
|
if ( useDefault )
|
|
|
|
{
|
|
|
|
// special handling for MENUBAR colour: we use this in wxToolBar
|
|
|
|
// and wxStatusBar to have correct bg colour under Windows XP
|
|
|
|
// (which uses COLOR_MENUBAR for them) but they should still look
|
|
|
|
// correctly under previous Windows versions as well
|
|
|
|
if ( index == wxSYS_COLOUR_MENUBAR )
|
|
|
|
{
|
|
|
|
index = wxSYS_COLOUR_3DFACE;
|
|
|
|
}
|
|
|
|
else // replace with default colour
|
|
|
|
{
|
2002-07-05 16:45:15 +00:00
|
|
|
unsigned int n = index - wxSYS_COLOUR_BTNHIGHLIGHT;
|
2002-01-28 01:38:39 +00:00
|
|
|
|
|
|
|
wxASSERT_MSG( n < WXSIZEOF(s_defaultSysColors),
|
|
|
|
_T("forgot tp update the default colours array") );
|
|
|
|
|
|
|
|
colSys = s_defaultSysColors[n];
|
2004-09-04 01:53:42 +00:00
|
|
|
hasCol = true;
|
2002-01-28 01:38:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( !hasCol )
|
|
|
|
{
|
2003-07-18 14:12:53 +00:00
|
|
|
#ifdef __WXWINCE__
|
|
|
|
colSys = ::GetSysColor(index|SYS_COLOR_INDEX_FLAG);
|
|
|
|
#else
|
2002-01-28 01:38:39 +00:00
|
|
|
colSys = ::GetSysColor(index);
|
2003-07-18 14:12:53 +00:00
|
|
|
#endif
|
2002-01-28 01:38:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return wxRGBToColour(colSys);
|
1998-05-20 14:12:05 +00:00
|
|
|
}
|
|
|
|
|
2001-12-30 22:34:36 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// fonts
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2001-06-29 10:58:59 +00:00
|
|
|
wxFont wxCreateFontFromStockObject(int index)
|
1998-05-20 14:12:05 +00:00
|
|
|
{
|
2001-04-21 16:03:10 +00:00
|
|
|
wxFont font;
|
|
|
|
|
2000-02-15 22:10:08 +00:00
|
|
|
HFONT hFont = (HFONT) ::GetStockObject(index);
|
2001-04-21 16:03:10 +00:00
|
|
|
if ( hFont )
|
2000-02-15 22:10:08 +00:00
|
|
|
{
|
|
|
|
LOGFONT lf;
|
|
|
|
if ( ::GetObject(hFont, sizeof(LOGFONT), &lf) != 0 )
|
|
|
|
{
|
2001-06-29 10:58:59 +00:00
|
|
|
wxNativeFontInfo info;
|
|
|
|
info.lf = lf;
|
2005-05-22 14:07:32 +00:00
|
|
|
#ifndef __WXWINCE__
|
2005-05-22 13:04:23 +00:00
|
|
|
// We want Windows 2000 or later to have new fonts even MS Shell Dlg
|
|
|
|
// is returned as default GUI font for compatibility
|
|
|
|
int verMaj;
|
|
|
|
if(index == DEFAULT_GUI_FONT && wxGetOsVersion(&verMaj) == wxWINDOWS_NT && verMaj >= 5)
|
|
|
|
wxStrcpy(info.lf.lfFaceName, wxT("MS Shell Dlg 2"));
|
2005-05-22 14:07:32 +00:00
|
|
|
#endif
|
2001-06-29 10:58:59 +00:00
|
|
|
// Under MicroWindows we pass the HFONT as well
|
|
|
|
// because it's hard to convert HFONT -> LOGFONT -> HFONT
|
|
|
|
// It's OK to delete stock objects, the delete will be ignored.
|
|
|
|
#ifdef __WXMICROWIN__
|
|
|
|
font.Create(info, (WXHFONT) hFont);
|
|
|
|
#else
|
|
|
|
font.Create(info);
|
|
|
|
#endif
|
2000-02-15 22:10:08 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-04-21 16:03:10 +00:00
|
|
|
wxFAIL_MSG( _T("failed to get LOGFONT") );
|
2000-02-15 22:10:08 +00:00
|
|
|
}
|
|
|
|
}
|
2001-04-21 16:03:10 +00:00
|
|
|
else // GetStockObject() failed
|
|
|
|
{
|
|
|
|
wxFAIL_MSG( _T("stock font not found") );
|
|
|
|
}
|
2001-12-30 22:34:36 +00:00
|
|
|
|
2001-06-29 10:58:59 +00:00
|
|
|
return font;
|
|
|
|
}
|
|
|
|
|
2001-12-30 22:34:36 +00:00
|
|
|
wxFont wxSystemSettingsNative::GetFont(wxSystemFont index)
|
2001-06-29 10:58:59 +00:00
|
|
|
{
|
2004-04-04 12:55:18 +00:00
|
|
|
#ifdef __WXWINCE__
|
|
|
|
// under CE only a single SYSTEM_FONT exists
|
|
|
|
index;
|
|
|
|
|
|
|
|
if ( !gs_fontDefault )
|
|
|
|
{
|
|
|
|
gs_fontDefault = new wxFont(wxCreateFontFromStockObject(SYSTEM_FONT));
|
|
|
|
}
|
|
|
|
|
|
|
|
return *gs_fontDefault;
|
|
|
|
#else // !__WXWINCE__
|
2005-01-04 19:43:04 +00:00
|
|
|
// wxWindow ctor calls GetFont(wxSYS_DEFAULT_GUI_FONT) so we're
|
2004-04-01 00:09:48 +00:00
|
|
|
// called fairly often -- this is why we cache this particular font
|
|
|
|
const bool isDefaultRequested = index == wxSYS_DEFAULT_GUI_FONT;
|
|
|
|
if ( isDefaultRequested )
|
2001-06-29 10:58:59 +00:00
|
|
|
{
|
2004-04-01 00:09:48 +00:00
|
|
|
if ( gs_fontDefault )
|
|
|
|
return *gs_fontDefault;
|
2001-06-29 10:58:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
wxFont font = wxCreateFontFromStockObject(index);
|
2001-04-21 16:03:10 +00:00
|
|
|
|
|
|
|
if ( isDefaultRequested )
|
2000-02-15 22:10:08 +00:00
|
|
|
{
|
2001-04-21 16:03:10 +00:00
|
|
|
// if we got here it means we hadn't cached it yet - do now
|
|
|
|
gs_fontDefault = new wxFont(font);
|
2000-02-15 22:10:08 +00:00
|
|
|
}
|
2001-04-21 16:03:10 +00:00
|
|
|
|
|
|
|
return font;
|
2004-04-04 12:55:18 +00:00
|
|
|
#endif // __WXWINCE__/!__WXWINCE__
|
1998-05-20 14:12:05 +00:00
|
|
|
}
|
|
|
|
|
2001-12-30 22:34:36 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// system metrics/features
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// TODO: some of the "metrics" clearly should be features now that we have
|
|
|
|
// HasFeature()!
|
|
|
|
|
|
|
|
// the conversion table from wxSystemMetric enum to GetSystemMetrics() param
|
|
|
|
//
|
|
|
|
// if the constant is not defined, put -1 in the table to indicate that it is
|
|
|
|
// unknown
|
|
|
|
static const int gs_metricsMap[] =
|
1998-05-20 14:12:05 +00:00
|
|
|
{
|
2002-01-05 22:48:25 +00:00
|
|
|
-1, // wxSystemMetric enums start at 1, so give a dummy value for pos 0.
|
2003-07-11 21:50:07 +00:00
|
|
|
#if defined(__WIN32__) && !defined(__WXWINCE__)
|
2001-12-30 22:34:36 +00:00
|
|
|
SM_CMOUSEBUTTONS,
|
|
|
|
#else
|
|
|
|
-1,
|
1998-05-20 14:12:05 +00:00
|
|
|
#endif
|
|
|
|
|
2001-12-30 22:34:36 +00:00
|
|
|
SM_CXBORDER,
|
|
|
|
SM_CYBORDER,
|
|
|
|
SM_CXCURSOR,
|
|
|
|
SM_CYCURSOR,
|
|
|
|
SM_CXDOUBLECLK,
|
|
|
|
SM_CYDOUBLECLK,
|
1999-01-07 08:43:47 +00:00
|
|
|
#if defined(__WIN32__) && defined(SM_CXDRAG)
|
2001-12-30 22:34:36 +00:00
|
|
|
SM_CXDRAG,
|
|
|
|
SM_CYDRAG,
|
|
|
|
SM_CXEDGE,
|
|
|
|
SM_CYEDGE,
|
|
|
|
#else
|
2003-07-11 21:50:07 +00:00
|
|
|
-1, -1, -1, -1,
|
1998-05-20 14:12:05 +00:00
|
|
|
#endif
|
2001-12-30 22:34:36 +00:00
|
|
|
SM_CXHSCROLL,
|
|
|
|
SM_CYHSCROLL,
|
2003-07-11 21:50:07 +00:00
|
|
|
#ifdef SM_CXHTHUMB
|
2001-12-30 22:34:36 +00:00
|
|
|
SM_CXHTHUMB,
|
2003-07-11 21:50:07 +00:00
|
|
|
#else
|
|
|
|
-1,
|
|
|
|
#endif
|
2001-12-30 22:34:36 +00:00
|
|
|
SM_CXICON,
|
|
|
|
SM_CYICON,
|
|
|
|
SM_CXICONSPACING,
|
|
|
|
SM_CYICONSPACING,
|
2003-07-11 21:50:07 +00:00
|
|
|
#ifdef SM_CXHTHUMB
|
2001-12-30 22:34:36 +00:00
|
|
|
SM_CXMIN,
|
|
|
|
SM_CYMIN,
|
2003-07-11 21:50:07 +00:00
|
|
|
#else
|
|
|
|
-1, -1,
|
|
|
|
#endif
|
2001-12-30 22:34:36 +00:00
|
|
|
SM_CXSCREEN,
|
|
|
|
SM_CYSCREEN,
|
1999-01-07 08:43:47 +00:00
|
|
|
|
|
|
|
#if defined(__WIN32__) && defined(SM_CXSIZEFRAME)
|
2001-12-30 22:34:36 +00:00
|
|
|
SM_CXSIZEFRAME,
|
|
|
|
SM_CYSIZEFRAME,
|
|
|
|
SM_CXSMICON,
|
|
|
|
SM_CYSMICON,
|
|
|
|
#else
|
2003-07-11 21:50:07 +00:00
|
|
|
-1, -1, -1, -1,
|
1998-05-20 14:12:05 +00:00
|
|
|
#endif
|
2001-12-30 22:34:36 +00:00
|
|
|
SM_CYHSCROLL,
|
|
|
|
SM_CXVSCROLL,
|
|
|
|
SM_CXVSCROLL,
|
|
|
|
SM_CYVSCROLL,
|
2003-07-11 21:50:07 +00:00
|
|
|
#ifdef SM_CYVTHUMB
|
2001-12-30 22:34:36 +00:00
|
|
|
SM_CYVTHUMB,
|
2003-07-11 21:50:07 +00:00
|
|
|
#else
|
|
|
|
-1,
|
|
|
|
#endif
|
2001-12-30 22:34:36 +00:00
|
|
|
SM_CYCAPTION,
|
|
|
|
SM_CYMENU,
|
1999-01-07 08:43:47 +00:00
|
|
|
#if defined(__WIN32__) && defined(SM_NETWORK)
|
2001-12-30 22:34:36 +00:00
|
|
|
SM_NETWORK,
|
|
|
|
#else
|
|
|
|
-1,
|
1998-05-20 14:12:05 +00:00
|
|
|
#endif
|
2003-07-11 21:50:07 +00:00
|
|
|
#ifdef SM_PENWINDOWS
|
2001-12-30 22:34:36 +00:00
|
|
|
SM_PENWINDOWS,
|
2003-07-11 21:50:07 +00:00
|
|
|
#else
|
|
|
|
-1,
|
|
|
|
#endif
|
1999-01-07 08:43:47 +00:00
|
|
|
#if defined(__WIN32__) && defined(SM_SHOWSOUNDS)
|
2001-12-30 22:34:36 +00:00
|
|
|
SM_SHOWSOUNDS,
|
|
|
|
#else
|
|
|
|
-1,
|
1998-05-20 14:12:05 +00:00
|
|
|
#endif
|
2003-07-11 21:50:07 +00:00
|
|
|
#ifdef SM_SWAPBUTTON
|
2001-12-30 22:34:36 +00:00
|
|
|
SM_SWAPBUTTON,
|
2003-07-11 21:50:07 +00:00
|
|
|
#else
|
|
|
|
-1
|
|
|
|
#endif
|
2001-12-30 22:34:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Get a system metric, e.g. scrollbar size
|
2005-03-07 17:38:31 +00:00
|
|
|
int wxSystemSettingsNative::GetMetric(wxSystemMetric index, wxWindow* WXUNUSED(win))
|
2001-12-30 22:34:36 +00:00
|
|
|
{
|
|
|
|
#ifdef __WXMICROWIN__
|
|
|
|
// TODO: probably use wxUniv themes functionality
|
|
|
|
return 0;
|
|
|
|
#else // !__WXMICROWIN__
|
2002-03-09 16:54:42 +00:00
|
|
|
wxCHECK_MSG( index > 0 && (size_t)index < WXSIZEOF(gs_metricsMap), 0,
|
|
|
|
_T("invalid metric") );
|
2001-12-30 22:34:36 +00:00
|
|
|
|
|
|
|
int indexMSW = gs_metricsMap[index];
|
|
|
|
if ( indexMSW == -1 )
|
|
|
|
{
|
|
|
|
// not supported under current system
|
2004-09-29 21:56:22 +00:00
|
|
|
return -1;
|
2000-02-15 22:10:08 +00:00
|
|
|
}
|
2001-12-30 22:34:36 +00:00
|
|
|
|
|
|
|
int rc = ::GetSystemMetrics(indexMSW);
|
|
|
|
if ( index == wxSYS_NETWORK_PRESENT )
|
|
|
|
{
|
|
|
|
// only the last bit is significant according to the MSDN
|
|
|
|
rc &= 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
#endif // __WXMICROWIN__/!__WXMICROWIN__
|
1998-05-20 14:12:05 +00:00
|
|
|
}
|
|
|
|
|
2001-12-30 22:34:36 +00:00
|
|
|
bool wxSystemSettingsNative::HasFeature(wxSystemFeature index)
|
2001-10-30 23:30:04 +00:00
|
|
|
{
|
2001-12-30 22:34:36 +00:00
|
|
|
switch ( index )
|
2001-10-30 23:30:04 +00:00
|
|
|
{
|
2001-12-30 22:34:36 +00:00
|
|
|
case wxSYS_CAN_ICONIZE_FRAME:
|
2001-10-30 23:30:04 +00:00
|
|
|
case wxSYS_CAN_DRAW_FRAME_DECORATIONS:
|
2004-09-04 01:53:42 +00:00
|
|
|
return true;
|
2001-12-30 22:34:36 +00:00
|
|
|
|
2001-10-30 23:30:04 +00:00
|
|
|
default:
|
2001-12-30 22:34:36 +00:00
|
|
|
wxFAIL_MSG( _T("unknown system feature") );
|
|
|
|
|
2004-09-04 01:53:42 +00:00
|
|
|
return false;
|
2001-10-30 23:30:04 +00:00
|
|
|
}
|
|
|
|
}
|
2004-04-01 00:09:48 +00:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// function from wx/msw/wrapcctl.h: there is really no other place for it...
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#if wxUSE_LISTCTRL || wxUSE_TREECTRL
|
|
|
|
|
|
|
|
extern wxFont wxGetCCDefaultFont()
|
|
|
|
{
|
|
|
|
#ifndef __WXWINCE__
|
|
|
|
// under the systems enumerated below (anything released after Win98), the
|
|
|
|
// default font used for the common controls seems to be the desktop font
|
|
|
|
// which is also used for the icon titles and not the stock default GUI
|
|
|
|
// font
|
|
|
|
bool useIconFont;
|
|
|
|
int verMaj, verMin;
|
|
|
|
switch ( wxGetOsVersion(&verMaj, &verMin) )
|
|
|
|
{
|
|
|
|
case wxWIN95:
|
|
|
|
// 4.10 is Win98
|
2005-04-19 13:27:52 +00:00
|
|
|
useIconFont = verMaj == 4 && verMin >= 10;
|
2004-04-01 00:09:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case wxWINDOWS_NT:
|
|
|
|
// 5.0 is Win2k
|
|
|
|
useIconFont = verMaj >= 5;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
useIconFont = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( useIconFont )
|
|
|
|
{
|
|
|
|
LOGFONT lf;
|
|
|
|
if ( ::SystemParametersInfo
|
|
|
|
(
|
|
|
|
SPI_GETICONTITLELOGFONT,
|
|
|
|
sizeof(lf),
|
|
|
|
&lf,
|
|
|
|
0
|
|
|
|
) )
|
|
|
|
{
|
|
|
|
return wxFont(wxCreateFontFromLogFont(&lf));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
wxLogLastError(_T("SystemParametersInfo(SPI_GETICONTITLELOGFONT"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif // __WXWINCE__
|
|
|
|
|
|
|
|
// fall back to the default font for the normal controls
|
|
|
|
return wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // wxUSE_LISTCTRL || wxUSE_TREECTRL
|