]>
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
)
46 case wxSYS_COLOUR_LISTBOX
:
51 COLORREF ref
= ::GetSysColor(index
);
52 wxColour
col(GetRValue(ref
), GetGValue(ref
), GetBValue(ref
));
58 wxFont
wxSystemSettings::GetSystemFont(int index
)
60 HFONT hFont
= (HFONT
) ::GetStockObject(index
);
61 if ( hFont
!= (HFONT
) NULL
)
64 if ( ::GetObject(hFont
, sizeof(LOGFONT
), &lf
) != 0 )
67 return wxCreateFontFromLogFont(&lf
);
80 // Get a system metric, e.g. scrollbar size
81 int wxSystemSettings::GetSystemMetric(int index
)
86 case wxSYS_MOUSE_BUTTONS
:
87 return ::GetSystemMetrics(SM_CMOUSEBUTTONS
);
91 return ::GetSystemMetrics(SM_CXBORDER
);
93 return ::GetSystemMetrics(SM_CYBORDER
);
95 return ::GetSystemMetrics(SM_CXCURSOR
);
97 return ::GetSystemMetrics(SM_CYCURSOR
);
99 return ::GetSystemMetrics(SM_CXDOUBLECLK
);
101 return ::GetSystemMetrics(SM_CYDOUBLECLK
);
102 #if defined(__WIN32__) && defined(SM_CXDRAG)
104 return ::GetSystemMetrics(SM_CXDRAG
);
106 return ::GetSystemMetrics(SM_CYDRAG
);
108 return ::GetSystemMetrics(SM_CXEDGE
);
110 return ::GetSystemMetrics(SM_CYEDGE
);
112 case wxSYS_HSCROLL_ARROW_X
:
113 return ::GetSystemMetrics(SM_CXHSCROLL
);
114 case wxSYS_HSCROLL_ARROW_Y
:
115 return ::GetSystemMetrics(SM_CYHSCROLL
);
117 return ::GetSystemMetrics(SM_CXHTHUMB
);
119 return ::GetSystemMetrics(SM_CXICON
);
121 return ::GetSystemMetrics(SM_CYICON
);
122 case wxSYS_ICONSPACING_X
:
123 return ::GetSystemMetrics(SM_CXICONSPACING
);
124 case wxSYS_ICONSPACING_Y
:
125 return ::GetSystemMetrics(SM_CYICONSPACING
);
126 case wxSYS_WINDOWMIN_X
:
127 return ::GetSystemMetrics(SM_CXMIN
);
128 case wxSYS_WINDOWMIN_Y
:
129 return ::GetSystemMetrics(SM_CYMIN
);
131 return ::GetSystemMetrics(SM_CXSCREEN
);
133 return ::GetSystemMetrics(SM_CYSCREEN
);
135 #if defined(__WIN32__) && defined(SM_CXSIZEFRAME)
136 case wxSYS_FRAMESIZE_X
:
137 return ::GetSystemMetrics(SM_CXSIZEFRAME
);
138 case wxSYS_FRAMESIZE_Y
:
139 return ::GetSystemMetrics(SM_CYSIZEFRAME
);
140 case wxSYS_SMALLICON_X
:
141 return ::GetSystemMetrics(SM_CXSMICON
);
142 case wxSYS_SMALLICON_Y
:
143 return ::GetSystemMetrics(SM_CYSMICON
);
145 case wxSYS_HSCROLL_Y
:
146 return ::GetSystemMetrics(SM_CYHSCROLL
);
147 case wxSYS_VSCROLL_X
:
148 return ::GetSystemMetrics(SM_CXVSCROLL
);
149 case wxSYS_VSCROLL_ARROW_X
:
150 return ::GetSystemMetrics(SM_CXVSCROLL
);
151 case wxSYS_VSCROLL_ARROW_Y
:
152 return ::GetSystemMetrics(SM_CYVSCROLL
);
154 return ::GetSystemMetrics(SM_CYVTHUMB
);
155 case wxSYS_CAPTION_Y
:
156 return ::GetSystemMetrics(SM_CYCAPTION
);
158 return ::GetSystemMetrics(SM_CYMENU
);
159 #if defined(__WIN32__) && defined(SM_NETWORK)
160 case wxSYS_NETWORK_PRESENT
:
161 return ::GetSystemMetrics(SM_NETWORK
) & 0x0001;
163 case wxSYS_PENWINDOWS_PRESENT
:
164 return ::GetSystemMetrics(SM_PENWINDOWS
);
165 #if defined(__WIN32__) && defined(SM_SHOWSOUNDS)
166 case wxSYS_SHOW_SOUNDS
:
167 return ::GetSystemMetrics(SM_SHOWSOUNDS
);
169 case wxSYS_SWAP_BUTTONS
:
170 return ::GetSystemMetrics(SM_SWAPBUTTON
);