xref: /trunk/main/vcl/inc/win/wincomp.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _SV_WINCOMP_HXX
29 #define _SV_WINCOMP_HXX
30 
31 #ifndef _STRING_H
32 #include <string.h>
33 #endif
34 
35 // ----------
36 // - Strict -
37 // ----------
38 
39 // Anpassungen fuer TypeChecking
40 
41 inline HPEN SelectPen( HDC hDC, HPEN hPen )
42 {
43 	return (HPEN)SelectObject( hDC, (HGDIOBJ)hPen );
44 }
45 
46 inline void DeletePen( HPEN hPen )
47 {
48 	DeleteObject( (HGDIOBJ)hPen );
49 }
50 
51 inline HPEN GetStockPen( int nObject )
52 {
53 	return (HPEN)GetStockObject( nObject );
54 }
55 
56 inline HBRUSH SelectBrush( HDC hDC, HBRUSH hBrush )
57 {
58 	return (HBRUSH)SelectObject( hDC, (HGDIOBJ)hBrush );
59 }
60 
61 inline void DeleteBrush( HBRUSH hBrush )
62 {
63 	DeleteObject( (HGDIOBJ)hBrush );
64 }
65 
66 inline HBRUSH GetStockBrush( int nObject )
67 {
68 	return (HBRUSH)GetStockObject( nObject );
69 }
70 
71 inline HFONT SelectFont( HDC hDC, HFONT hFont )
72 {
73 	return (HFONT)SelectObject( hDC, (HGDIOBJ)hFont );
74 }
75 
76 inline void DeleteFont( HFONT hFont )
77 {
78 	DeleteObject( (HGDIOBJ)hFont );
79 }
80 
81 inline HFONT GetStockFont( int nObject )
82 {
83 	return (HFONT)GetStockObject( nObject );
84 }
85 
86 inline HBITMAP SelectBitmap( HDC hDC, HBITMAP hBitmap )
87 {
88 	return (HBITMAP)SelectObject( hDC, (HGDIOBJ)hBitmap );
89 }
90 
91 inline void DeleteBitmap( HBITMAP hBitmap )
92 {
93 	DeleteObject( (HGDIOBJ)hBitmap );
94 }
95 
96 inline void DeleteRegion( HRGN hRegion )
97 {
98 	DeleteObject( (HGDIOBJ)hRegion );
99 }
100 
101 inline HPALETTE GetStockPalette( int nObject )
102 {
103 	return (HPALETTE)GetStockObject( nObject );
104 }
105 
106 inline void DeletePalette( HPALETTE hPalette )
107 {
108 	DeleteObject( (HGDIOBJ)hPalette );
109 }
110 
111 inline void SetWindowStyle( HWND hWnd, DWORD nStyle )
112 {
113 	SetWindowLong( hWnd, GWL_STYLE, nStyle );
114 }
115 
116 inline DWORD GetWindowStyle( HWND hWnd )
117 {
118 	return GetWindowLong( hWnd, GWL_STYLE );
119 }
120 
121 inline void SetWindowExStyle( HWND hWnd, DWORD nStyle )
122 {
123 	SetWindowLong( hWnd, GWL_EXSTYLE, nStyle );
124 }
125 
126 inline DWORD GetWindowExStyle( HWND hWnd )
127 {
128 	return GetWindowLong( hWnd, GWL_EXSTYLE );
129 }
130 
131 inline BOOL IsMinimized( HWND hWnd )
132 {
133 	return IsIconic( hWnd );
134 }
135 
136 inline BOOL IsMaximized( HWND hWnd )
137 {
138 	return IsZoomed( hWnd );
139 }
140 
141 inline void SetWindowFont( HWND hWnd, HFONT hFont, BOOL bRedraw )
142 {
143 	SendMessage( hWnd, WM_SETFONT, (WPARAM)hFont, MAKELPARAM((UINT)bRedraw,0) );
144 }
145 
146 inline HFONT GetWindowFont( HWND hWnd )
147 {
148 	return (HFONT)(UINT)SendMessage( hWnd, WM_GETFONT, 0, 0 );
149 }
150 
151 inline void SetClassCursor( HWND hWnd, HCURSOR hCursor )
152 {
153 	SetClassLong( hWnd, GCL_HCURSOR, (DWORD)hCursor );
154 }
155 
156 inline HCURSOR GetClassCursor( HWND hWnd )
157 {
158 	return (HCURSOR)GetClassLong( hWnd, GCL_HCURSOR );
159 }
160 
161 inline void SetClassIcon( HWND hWnd, HICON hIcon )
162 {
163 	SetClassLong( hWnd, GCL_HICON, (DWORD)hIcon );
164 }
165 
166 inline HICON GetClassIcon( HWND hWnd )
167 {
168 	return (HICON)GetClassLong( hWnd, GCL_HICON );
169 }
170 
171 inline HBRUSH SetClassBrush( HWND hWnd, HBRUSH hBrush )
172 {
173 	return (HBRUSH)SetClassLong( hWnd, GCL_HBRBACKGROUND, (DWORD)hBrush );
174 }
175 
176 inline HBRUSH GetClassBrush( HWND hWnd )
177 {
178 	return (HBRUSH)GetClassLong( hWnd, GCL_HBRBACKGROUND );
179 }
180 
181 inline HINSTANCE GetWindowInstance( HWND hWnd )
182 {
183 	return (HINSTANCE)GetWindowLong( hWnd, GWL_HINSTANCE );
184 }
185 
186 // ------------------------
187 // - ZMouse Erweiterungen -
188 // ------------------------
189 
190 #define MSH_MOUSEWHEEL "MSWHEEL_ROLLMSG"
191 
192 #define MOUSEZ_CLASSNAME  "MouseZ"            // wheel window class
193 #define MOUSEZ_TITLE	  "Magellan MSWHEEL"  // wheel window title
194 
195 #define MSH_WHEELMODULE_CLASS (MOUSEZ_CLASSNAME)
196 #define MSH_WHEELMODULE_TITLE (MOUSEZ_TITLE)
197 
198 #define MSH_SCROLL_LINES "MSH_SCROLL_LINES_MSG"
199 
200 #ifndef WHEEL_DELTA
201 #define WHEEL_DELTA 				120
202 #endif
203 #ifndef WM_MOUSEWHEEL
204 #define WM_MOUSEWHEEL				0x020A
205 #endif
206 #ifndef SPI_GETWHEELSCROLLLINES
207 #define SPI_GETWHEELSCROLLLINES		104
208 #endif
209 #ifndef SPI_SETWHEELSCROLLLINES
210 #define SPI_SETWHEELSCROLLLINES		105
211 #endif
212 #ifndef WHEEL_PAGESCROLL
213 #define WHEEL_PAGESCROLL			(UINT_MAX)
214 #endif
215 
216 
217 // -----------------------------
218 // - SystemAgent Erweiterungen -
219 // -----------------------------
220 
221 #define ENABLE_AGENT			1
222 #define DISABLE_AGENT			2
223 #define GET_AGENT_STATUS		3
224 typedef int (APIENTRY* SysAgt_Enable_PROC)( int );
225 
226 // ---------------------
227 // - 5.0-Erweiterungen -
228 // ---------------------
229 
230 #ifndef COLOR_GRADIENTACTIVECAPTION
231 #define COLOR_GRADIENTACTIVECAPTION 	27
232 #endif
233 #ifndef COLOR_GRADIENTINACTIVECAPTION
234 #define COLOR_GRADIENTINACTIVECAPTION	28
235 #endif
236 
237 #ifndef SPI_GETFLATMENU
238 #define SPI_GETFLATMENU     0x1022
239 #endif
240 #ifndef COLOR_MENUBAR
241 #define COLOR_MENUBAR       30
242 #endif
243 #ifndef COLOR_MENUHILIGHT
244 #define COLOR_MENUHILIGHT   29
245 #endif
246 
247 #ifndef CS_DROPSHADOW
248 #define CS_DROPSHADOW       0x00020000
249 #endif
250 
251 // -------------------------------------------------------
252 // MT 12/03: From winuser.h, only needed in salframe.cxx
253 // Better change salframe.cxx to include winuser.h
254 // -------------------------------------------------------
255 
256 #define WS_EX_LAYERED           0x00080000
257 
258 #ifndef WM_UNICHAR
259 #define WM_UNICHAR              0x0109
260 #define UNICODE_NOCHAR          0xFFFF
261 #endif
262 
263 #endif // _SV_WINCOMP_HXX
264