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 #pragma once
21 
22 #include <string.h>
23 
24 
25 // Adjustments for TypeChecking
26 
27 inline HPEN SelectPen( HDC hDC, HPEN hPen )
28 {
29  return static_cast<HPEN>(SelectObject( hDC, static_cast<HGDIOBJ>(hPen) ));
30 }
31 
32 inline void DeletePen( HPEN hPen )
33 {
34  DeleteObject( static_cast<HGDIOBJ>(hPen) );
35 }
36 
37 inline HPEN GetStockPen( int nObject )
38 {
39  return static_cast<HPEN>(GetStockObject( nObject ));
40 }
41 
42 inline HBRUSH SelectBrush( HDC hDC, HBRUSH hBrush )
43 {
44  return static_cast<HBRUSH>(SelectObject( hDC, static_cast<HGDIOBJ>(hBrush) ));
45 }
46 
47 inline void DeleteBrush( HBRUSH hBrush )
48 {
49  DeleteObject( static_cast<HGDIOBJ>(hBrush) );
50 }
51 
52 inline HBRUSH GetStockBrush( int nObject )
53 {
54  return static_cast<HBRUSH>(GetStockObject( nObject ));
55 }
56 
57 inline HFONT SelectFont( HDC hDC, HFONT hFont )
58 {
59  return static_cast<HFONT>(SelectObject( hDC, static_cast<HGDIOBJ>(hFont) ));
60 }
61 
62 inline void DeleteFont( HFONT hFont )
63 {
64  DeleteObject( static_cast<HGDIOBJ>(hFont) );
65 }
66 
67 inline HFONT GetStockFont( int nObject )
68 {
69  return static_cast<HFONT>(GetStockObject( nObject ));
70 }
71 
72 inline HBITMAP SelectBitmap( HDC hDC, HBITMAP hBitmap )
73 {
74  return static_cast<HBITMAP>(SelectObject( hDC, static_cast<HGDIOBJ>(hBitmap) ));
75 }
76 
77 inline void DeleteBitmap( HBITMAP hBitmap )
78 {
79  DeleteObject( static_cast<HGDIOBJ>(hBitmap) );
80 }
81 
82 inline void DeleteRegion( HRGN hRegion )
83 {
84  DeleteObject( static_cast<HGDIOBJ>(hRegion) );
85 }
86 
87 inline HPALETTE GetStockPalette( int nObject )
88 {
89  return static_cast<HPALETTE>(GetStockObject( nObject ));
90 }
91 
92 inline void DeletePalette( HPALETTE hPalette )
93 {
94  DeleteObject( static_cast<HGDIOBJ>(hPalette) );
95 }
96 
97 inline void SetWindowStyle( HWND hWnd, DWORD nStyle )
98 {
99  SetWindowLongPtrW( hWnd, GWL_STYLE, nStyle );
100 }
101 
102 inline DWORD GetWindowStyle( HWND hWnd )
103 {
104  return GetWindowLongPtrW( hWnd, GWL_STYLE );
105 }
106 
107 inline void SetWindowExStyle( HWND hWnd, DWORD nStyle )
108 {
109  SetWindowLongPtrW( hWnd, GWL_EXSTYLE, nStyle );
110 }
111 
112 inline DWORD GetWindowExStyle( HWND hWnd )
113 {
114  return GetWindowLongPtrW( hWnd, GWL_EXSTYLE );
115 }
116 
117 inline BOOL IsMinimized( HWND hWnd )
118 {
119  return IsIconic( hWnd );
120 }
121 
122 inline BOOL IsMaximized( HWND hWnd )
123 {
124  return IsZoomed( hWnd );
125 }
126 
127 inline void SetWindowFont( HWND hWnd, HFONT hFont, BOOL bRedraw )
128 {
129  SendMessageW( hWnd, WM_SETFONT, reinterpret_cast<WPARAM>(hFont), MAKELPARAM(static_cast<UINT>(bRedraw),0) );
130 }
131 
132 inline HFONT GetWindowFont( HWND hWnd )
133 {
134  return reinterpret_cast<HFONT>(SendMessageW( hWnd, WM_GETFONT, 0, 0 ));
135 }
136 
137 inline void SetClassCursor( HWND hWnd, HCURSOR hCursor )
138 {
139  SetClassLongPtr( hWnd, GCLP_HCURSOR, reinterpret_cast<LONG_PTR>(hCursor) );
140 }
141 
142 inline HCURSOR GetClassCursor( HWND hWnd )
143 {
144  return reinterpret_cast<HCURSOR>(GetClassLongPtr( hWnd, GCLP_HCURSOR ));
145 }
146 
147 inline void SetClassIcon( HWND hWnd, HICON hIcon )
148 {
149  SetClassLongPtr( hWnd, GCLP_HICON, reinterpret_cast<LONG_PTR>(hIcon) );
150 }
151 
152 inline HICON GetClassIcon( HWND hWnd )
153 {
154  return reinterpret_cast<HICON>(GetClassLongPtr( hWnd, GCLP_HICON ));
155 }
156 
157 inline HBRUSH SetClassBrush( HWND hWnd, HBRUSH hBrush )
158 {
159  return reinterpret_cast<HBRUSH>(SetClassLongPtr( hWnd, GCLP_HBRBACKGROUND, reinterpret_cast<LONG_PTR>(hBrush) ));
160 }
161 
162 inline HBRUSH GetClassBrush( HWND hWnd )
163 {
164  return reinterpret_cast<HBRUSH>(GetClassLongPtr( hWnd, GCLP_HBRBACKGROUND ));
165 }
166 
167 inline HINSTANCE GetWindowInstance( HWND hWnd )
168 {
169  return reinterpret_cast<HINSTANCE>(GetWindowLongPtrW( hWnd, GWLP_HINSTANCE ));
170 }
171 
172 
173 #define MOUSEZ_CLASSNAME L"MouseZ" // wheel window class
174 #define MOUSEZ_TITLE L"Magellan MSWHEEL" // wheel window title
175 
176 #define MSH_WHEELMODULE_CLASS (MOUSEZ_CLASSNAME)
177 #define MSH_WHEELMODULE_TITLE (MOUSEZ_TITLE)
178 
179 #define MSH_SCROLL_LINES L"MSH_SCROLL_LINES_MSG"
180 
181 #ifndef WHEEL_DELTA
182 #define WHEEL_DELTA 120
183 #endif
184 #ifndef WM_MOUSEWHEEL
185 #define WM_MOUSEWHEEL 0x020A
186 #endif
187 #ifndef SPI_GETWHEELSCROLLLINES
188 #define SPI_GETWHEELSCROLLLINES 104
189 #endif
190 #ifndef SPI_SETWHEELSCROLLLINES
191 #define SPI_SETWHEELSCROLLLINES 105
192 #endif
193 #ifndef WHEEL_PAGESCROLL
194 #define WHEEL_PAGESCROLL (UINT_MAX)
195 #endif
196 
197 
198 // - 5.0 extensions -
199 
200 #ifndef COLOR_GRADIENTACTIVECAPTION
201 #define COLOR_GRADIENTACTIVECAPTION 27
202 #endif
203 #ifndef COLOR_GRADIENTINACTIVECAPTION
204 #define COLOR_GRADIENTINACTIVECAPTION 28
205 #endif
206 
207 #ifndef SPI_GETFLATMENU
208 #define SPI_GETFLATMENU 0x1022
209 #endif
210 #ifndef COLOR_MENUBAR
211 #define COLOR_MENUBAR 30
212 #endif
213 #ifndef COLOR_MENUHILIGHT
214 #define COLOR_MENUHILIGHT 29
215 #endif
216 
217 #ifndef CS_DROPSHADOW
218 #define CS_DROPSHADOW 0x00020000
219 #endif
220 
221 // MT 12/03: From winuser.h, only needed in salframe.cxx
222 // Better change salframe.cxx to include winuser.h
223 
224 #define WS_EX_LAYERED 0x00080000
225 
226 #ifndef WM_UNICHAR
227 #define WM_UNICHAR 0x0109
228 #define UNICODE_NOCHAR 0xFFFF
229 #endif
230 
231 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
HCURSOR GetClassCursor(HWND hWnd)
Definition: wincomp.hxx:142
void DeleteBitmap(HBITMAP hBitmap)
Definition: wincomp.hxx:77
void SetClassIcon(HWND hWnd, HICON hIcon)
Definition: wincomp.hxx:147
void DeletePalette(HPALETTE hPalette)
Definition: wincomp.hxx:92
HBITMAP SelectBitmap(HDC hDC, HBITMAP hBitmap)
Definition: wincomp.hxx:72
HFONT GetStockFont(int nObject)
Definition: wincomp.hxx:67
HINSTANCE GetWindowInstance(HWND hWnd)
Definition: wincomp.hxx:167
HPEN SelectPen(HDC hDC, HPEN hPen)
Definition: wincomp.hxx:27
const wchar_t *typedef BOOL
void DeleteRegion(HRGN hRegion)
Definition: wincomp.hxx:82
void SetWindowExStyle(HWND hWnd, DWORD nStyle)
Definition: wincomp.hxx:107
BOOL IsMinimized(HWND hWnd)
Definition: wincomp.hxx:117
DWORD GetWindowStyle(HWND hWnd)
Definition: wincomp.hxx:102
BOOL IsMaximized(HWND hWnd)
Definition: wincomp.hxx:122
void SetWindowFont(HWND hWnd, HFONT hFont, BOOL bRedraw)
Definition: wincomp.hxx:127
void SetWindowStyle(HWND hWnd, DWORD nStyle)
Definition: wincomp.hxx:97
HBRUSH SetClassBrush(HWND hWnd, HBRUSH hBrush)
Definition: wincomp.hxx:157
void DeleteFont(HFONT hFont)
Definition: wincomp.hxx:62
void SetClassCursor(HWND hWnd, HCURSOR hCursor)
Definition: wincomp.hxx:137
HBRUSH GetClassBrush(HWND hWnd)
Definition: wincomp.hxx:162
HFONT GetWindowFont(HWND hWnd)
Definition: wincomp.hxx:132
HBRUSH SelectBrush(HDC hDC, HBRUSH hBrush)
Definition: wincomp.hxx:42
void DeletePen(HPEN hPen)
Definition: wincomp.hxx:32
HICON GetClassIcon(HWND hWnd)
Definition: wincomp.hxx:152
HFONT SelectFont(HDC hDC, HFONT hFont)
Definition: wincomp.hxx:57
void DeleteBrush(HBRUSH hBrush)
Definition: wincomp.hxx:47
HPALETTE GetStockPalette(int nObject)
Definition: wincomp.hxx:87
HBRUSH GetStockBrush(int nObject)
Definition: wincomp.hxx:52
HPEN GetStockPen(int nObject)
Definition: wincomp.hxx:37
DWORD GetWindowExStyle(HWND hWnd)
Definition: wincomp.hxx:112