LibreOffice Module vcl (master)  1
wincomp.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #ifndef INCLUDED_VCL_INC_WIN_WINCOMP_HXX
21 #define INCLUDED_VCL_INC_WIN_WINCOMP_HXX
22 
23 #include <string.h>
24 
25 
26 // Adjustments for TypeChecking
27 
28 inline HPEN SelectPen( HDC hDC, HPEN hPen )
29 {
30  return static_cast<HPEN>(SelectObject( hDC, static_cast<HGDIOBJ>(hPen) ));
31 }
32 
33 inline void DeletePen( HPEN hPen )
34 {
35  DeleteObject( static_cast<HGDIOBJ>(hPen) );
36 }
37 
38 inline HPEN GetStockPen( int nObject )
39 {
40  return static_cast<HPEN>(GetStockObject( nObject ));
41 }
42 
43 inline HBRUSH SelectBrush( HDC hDC, HBRUSH hBrush )
44 {
45  return static_cast<HBRUSH>(SelectObject( hDC, static_cast<HGDIOBJ>(hBrush) ));
46 }
47 
48 inline void DeleteBrush( HBRUSH hBrush )
49 {
50  DeleteObject( static_cast<HGDIOBJ>(hBrush) );
51 }
52 
53 inline HBRUSH GetStockBrush( int nObject )
54 {
55  return static_cast<HBRUSH>(GetStockObject( nObject ));
56 }
57 
58 inline HFONT SelectFont( HDC hDC, HFONT hFont )
59 {
60  return static_cast<HFONT>(SelectObject( hDC, static_cast<HGDIOBJ>(hFont) ));
61 }
62 
63 inline void DeleteFont( HFONT hFont )
64 {
65  DeleteObject( static_cast<HGDIOBJ>(hFont) );
66 }
67 
68 inline HFONT GetStockFont( int nObject )
69 {
70  return static_cast<HFONT>(GetStockObject( nObject ));
71 }
72 
73 inline HBITMAP SelectBitmap( HDC hDC, HBITMAP hBitmap )
74 {
75  return static_cast<HBITMAP>(SelectObject( hDC, static_cast<HGDIOBJ>(hBitmap) ));
76 }
77 
78 inline void DeleteBitmap( HBITMAP hBitmap )
79 {
80  DeleteObject( static_cast<HGDIOBJ>(hBitmap) );
81 }
82 
83 inline void DeleteRegion( HRGN hRegion )
84 {
85  DeleteObject( static_cast<HGDIOBJ>(hRegion) );
86 }
87 
88 inline HPALETTE GetStockPalette( int nObject )
89 {
90  return static_cast<HPALETTE>(GetStockObject( nObject ));
91 }
92 
93 inline void DeletePalette( HPALETTE hPalette )
94 {
95  DeleteObject( static_cast<HGDIOBJ>(hPalette) );
96 }
97 
98 inline void SetWindowStyle( HWND hWnd, DWORD nStyle )
99 {
100  SetWindowLongPtrW( hWnd, GWL_STYLE, nStyle );
101 }
102 
103 inline DWORD GetWindowStyle( HWND hWnd )
104 {
105  return GetWindowLongPtrW( hWnd, GWL_STYLE );
106 }
107 
108 inline void SetWindowExStyle( HWND hWnd, DWORD nStyle )
109 {
110  SetWindowLongPtrW( hWnd, GWL_EXSTYLE, nStyle );
111 }
112 
113 inline DWORD GetWindowExStyle( HWND hWnd )
114 {
115  return GetWindowLongPtrW( hWnd, GWL_EXSTYLE );
116 }
117 
118 inline BOOL IsMinimized( HWND hWnd )
119 {
120  return IsIconic( hWnd );
121 }
122 
123 inline BOOL IsMaximized( HWND hWnd )
124 {
125  return IsZoomed( hWnd );
126 }
127 
128 inline void SetWindowFont( HWND hWnd, HFONT hFont, BOOL bRedraw )
129 {
130  SendMessageW( hWnd, WM_SETFONT, reinterpret_cast<WPARAM>(hFont), MAKELPARAM(static_cast<UINT>(bRedraw),0) );
131 }
132 
133 inline HFONT GetWindowFont( HWND hWnd )
134 {
135  return reinterpret_cast<HFONT>(SendMessageW( hWnd, WM_GETFONT, 0, 0 ));
136 }
137 
138 inline void SetClassCursor( HWND hWnd, HCURSOR hCursor )
139 {
140  SetClassLongPtr( hWnd, GCLP_HCURSOR, reinterpret_cast<LONG_PTR>(hCursor) );
141 }
142 
143 inline HCURSOR GetClassCursor( HWND hWnd )
144 {
145  return reinterpret_cast<HCURSOR>(GetClassLongPtr( hWnd, GCLP_HCURSOR ));
146 }
147 
148 inline void SetClassIcon( HWND hWnd, HICON hIcon )
149 {
150  SetClassLongPtr( hWnd, GCLP_HICON, reinterpret_cast<LONG_PTR>(hIcon) );
151 }
152 
153 inline HICON GetClassIcon( HWND hWnd )
154 {
155  return reinterpret_cast<HICON>(GetClassLongPtr( hWnd, GCLP_HICON ));
156 }
157 
158 inline HBRUSH SetClassBrush( HWND hWnd, HBRUSH hBrush )
159 {
160  return reinterpret_cast<HBRUSH>(SetClassLongPtr( hWnd, GCLP_HBRBACKGROUND, reinterpret_cast<LONG_PTR>(hBrush) ));
161 }
162 
163 inline HBRUSH GetClassBrush( HWND hWnd )
164 {
165  return reinterpret_cast<HBRUSH>(GetClassLongPtr( hWnd, GCLP_HBRBACKGROUND ));
166 }
167 
168 inline HINSTANCE GetWindowInstance( HWND hWnd )
169 {
170  return reinterpret_cast<HINSTANCE>(GetWindowLongPtrW( hWnd, GWLP_HINSTANCE ));
171 }
172 
173 
174 #define MOUSEZ_CLASSNAME L"MouseZ" // wheel window class
175 #define MOUSEZ_TITLE L"Magellan MSWHEEL" // wheel window title
176 
177 #define MSH_WHEELMODULE_CLASS (MOUSEZ_CLASSNAME)
178 #define MSH_WHEELMODULE_TITLE (MOUSEZ_TITLE)
179 
180 #define MSH_SCROLL_LINES L"MSH_SCROLL_LINES_MSG"
181 
182 #ifndef WHEEL_DELTA
183 #define WHEEL_DELTA 120
184 #endif
185 #ifndef WM_MOUSEWHEEL
186 #define WM_MOUSEWHEEL 0x020A
187 #endif
188 #ifndef SPI_GETWHEELSCROLLLINES
189 #define SPI_GETWHEELSCROLLLINES 104
190 #endif
191 #ifndef SPI_SETWHEELSCROLLLINES
192 #define SPI_SETWHEELSCROLLLINES 105
193 #endif
194 #ifndef WHEEL_PAGESCROLL
195 #define WHEEL_PAGESCROLL (UINT_MAX)
196 #endif
197 
198 
199 // - 5.0 extensions -
200 
201 #ifndef COLOR_GRADIENTACTIVECAPTION
202 #define COLOR_GRADIENTACTIVECAPTION 27
203 #endif
204 #ifndef COLOR_GRADIENTINACTIVECAPTION
205 #define COLOR_GRADIENTINACTIVECAPTION 28
206 #endif
207 
208 #ifndef SPI_GETFLATMENU
209 #define SPI_GETFLATMENU 0x1022
210 #endif
211 #ifndef COLOR_MENUBAR
212 #define COLOR_MENUBAR 30
213 #endif
214 #ifndef COLOR_MENUHILIGHT
215 #define COLOR_MENUHILIGHT 29
216 #endif
217 
218 #ifndef CS_DROPSHADOW
219 #define CS_DROPSHADOW 0x00020000
220 #endif
221 
222 // MT 12/03: From winuser.h, only needed in salframe.cxx
223 // Better change salframe.cxx to include winuser.h
224 
225 #define WS_EX_LAYERED 0x00080000
226 
227 #ifndef WM_UNICHAR
228 #define WM_UNICHAR 0x0109
229 #define UNICODE_NOCHAR 0xFFFF
230 #endif
231 
232 #endif // INCLUDED_VCL_INC_WIN_WINCOMP_HXX
233 
234 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
HCURSOR GetClassCursor(HWND hWnd)
Definition: wincomp.hxx:143
void DeleteBitmap(HBITMAP hBitmap)
Definition: wincomp.hxx:78
void SetClassIcon(HWND hWnd, HICON hIcon)
Definition: wincomp.hxx:148
void DeletePalette(HPALETTE hPalette)
Definition: wincomp.hxx:93
HBITMAP SelectBitmap(HDC hDC, HBITMAP hBitmap)
Definition: wincomp.hxx:73
HFONT GetStockFont(int nObject)
Definition: wincomp.hxx:68
HINSTANCE GetWindowInstance(HWND hWnd)
Definition: wincomp.hxx:168
HPEN SelectPen(HDC hDC, HPEN hPen)
Definition: wincomp.hxx:28
const wchar_t *typedef BOOL
void DeleteRegion(HRGN hRegion)
Definition: wincomp.hxx:83
void SetWindowExStyle(HWND hWnd, DWORD nStyle)
Definition: wincomp.hxx:108
BOOL IsMinimized(HWND hWnd)
Definition: wincomp.hxx:118
DWORD GetWindowStyle(HWND hWnd)
Definition: wincomp.hxx:103
BOOL IsMaximized(HWND hWnd)
Definition: wincomp.hxx:123
void SetWindowFont(HWND hWnd, HFONT hFont, BOOL bRedraw)
Definition: wincomp.hxx:128
void SetWindowStyle(HWND hWnd, DWORD nStyle)
Definition: wincomp.hxx:98
HBRUSH SetClassBrush(HWND hWnd, HBRUSH hBrush)
Definition: wincomp.hxx:158
void DeleteFont(HFONT hFont)
Definition: wincomp.hxx:63
void SetClassCursor(HWND hWnd, HCURSOR hCursor)
Definition: wincomp.hxx:138
HBRUSH GetClassBrush(HWND hWnd)
Definition: wincomp.hxx:163
HFONT GetWindowFont(HWND hWnd)
Definition: wincomp.hxx:133
HBRUSH SelectBrush(HDC hDC, HBRUSH hBrush)
Definition: wincomp.hxx:43
void DeletePen(HPEN hPen)
Definition: wincomp.hxx:33
HICON GetClassIcon(HWND hWnd)
Definition: wincomp.hxx:153
HFONT SelectFont(HDC hDC, HFONT hFont)
Definition: wincomp.hxx:58
void DeleteBrush(HBRUSH hBrush)
Definition: wincomp.hxx:48
HPALETTE GetStockPalette(int nObject)
Definition: wincomp.hxx:88
HBRUSH GetStockBrush(int nObject)
Definition: wincomp.hxx:53
HPEN GetStockPen(int nObject)
Definition: wincomp.hxx:38
DWORD GetWindowExStyle(HWND hWnd)
Definition: wincomp.hxx:113