]>
git.saurik.com Git - wxWidgets.git/blob - src/msw/settings.cpp
1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "settings.h"
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
28 #include "wx/gdicmn.h"
31 #include "wx/settings.h"
32 #include "wx/window.h"
33 #include "wx/msw/private.h"
35 // TODO: see ::SystemParametersInfo for all sorts of Windows settings.
36 // Different args are required depending on the id. How does this differ
37 // from GetSystemMetric, and should it? Perhaps call it GetSystemParameter
38 // and pass an optional void* arg to get further info.
39 // Should also have SetSystemParameter.
40 // Also implement WM_WININICHANGE (NT) / WM_SETTINGCHANGE (Win95)
42 wxColour
wxSystemSettings::GetSystemColour(int index
)
44 COLORREF ref
= ::GetSysColor(index
);
45 wxColour
col(GetRValue(ref
), GetGValue(ref
), GetBValue(ref
));
49 wxFont
wxSystemSettings::GetSystemFont(int index
)
51 HFONT hFont
= (HFONT
) ::GetStockObject(index
);
52 if ( hFont
!= (HFONT
) NULL
)
55 if ( ::GetObject(hFont
, sizeof(LOGFONT
), &lf
) != 0 )
58 return wxCreateFontFromLogFont(&lf
);
71 // Get a system metric, e.g. scrollbar size
72 int wxSystemSettings::GetSystemMetric(int index
)
77 case wxSYS_MOUSE_BUTTONS
:
78 return ::GetSystemMetrics(SM_CMOUSEBUTTONS
);
82 return ::GetSystemMetrics(SM_CXBORDER
);
84 return ::GetSystemMetrics(SM_CYBORDER
);
86 return ::GetSystemMetrics(SM_CXCURSOR
);
88 return ::GetSystemMetrics(SM_CYCURSOR
);
90 return ::GetSystemMetrics(SM_CXDOUBLECLK
);
92 return ::GetSystemMetrics(SM_CYDOUBLECLK
);
93 #if defined(__WIN32__) && defined(SM_CXDRAG)
95 return ::GetSystemMetrics(SM_CXDRAG
);
97 return ::GetSystemMetrics(SM_CYDRAG
);
99 return ::GetSystemMetrics(SM_CXEDGE
);
101 return ::GetSystemMetrics(SM_CYEDGE
);
103 case wxSYS_HSCROLL_ARROW_X
:
104 return ::GetSystemMetrics(SM_CXHSCROLL
);
105 case wxSYS_HSCROLL_ARROW_Y
:
106 return ::GetSystemMetrics(SM_CYHSCROLL
);
108 return ::GetSystemMetrics(SM_CXHTHUMB
);
110 return ::GetSystemMetrics(SM_CXICON
);
112 return ::GetSystemMetrics(SM_CYICON
);
113 case wxSYS_ICONSPACING_X
:
114 return ::GetSystemMetrics(SM_CXICONSPACING
);
115 case wxSYS_ICONSPACING_Y
:
116 return ::GetSystemMetrics(SM_CYICONSPACING
);
117 case wxSYS_WINDOWMIN_X
:
118 return ::GetSystemMetrics(SM_CXMIN
);
119 case wxSYS_WINDOWMIN_Y
:
120 return ::GetSystemMetrics(SM_CYMIN
);
122 return ::GetSystemMetrics(SM_CXSCREEN
);
124 return ::GetSystemMetrics(SM_CYSCREEN
);
126 #if defined(__WIN32__) && defined(SM_CXSIZEFRAME)
127 case wxSYS_FRAMESIZE_X
:
128 return ::GetSystemMetrics(SM_CXSIZEFRAME
);
129 case wxSYS_FRAMESIZE_Y
:
130 return ::GetSystemMetrics(SM_CYSIZEFRAME
);
131 case wxSYS_SMALLICON_X
:
132 return ::GetSystemMetrics(SM_CXSMICON
);
133 case wxSYS_SMALLICON_Y
:
134 return ::GetSystemMetrics(SM_CYSMICON
);
136 case wxSYS_HSCROLL_Y
:
137 return ::GetSystemMetrics(SM_CYHSCROLL
);
138 case wxSYS_VSCROLL_X
:
139 return ::GetSystemMetrics(SM_CXVSCROLL
);
140 case wxSYS_VSCROLL_ARROW_X
:
141 return ::GetSystemMetrics(SM_CXVSCROLL
);
142 case wxSYS_VSCROLL_ARROW_Y
:
143 return ::GetSystemMetrics(SM_CYVSCROLL
);
145 return ::GetSystemMetrics(SM_CYVTHUMB
);
146 case wxSYS_CAPTION_Y
:
147 return ::GetSystemMetrics(SM_CYCAPTION
);
149 return ::GetSystemMetrics(SM_CYMENU
);
150 #if defined(__WIN32__) && defined(SM_NETWORK)
151 case wxSYS_NETWORK_PRESENT
:
152 return ::GetSystemMetrics(SM_NETWORK
) & 0x0001;
154 case wxSYS_PENWINDOWS_PRESENT
:
155 return ::GetSystemMetrics(SM_PENWINDOWS
);
156 #if defined(__WIN32__) && defined(SM_SHOWSOUNDS)
157 case wxSYS_SHOW_SOUNDS
:
158 return ::GetSystemMetrics(SM_SHOWSOUNDS
);
160 case wxSYS_SWAP_BUTTONS
:
161 return ::GetSystemMetrics(SM_SWAPBUTTON
);