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
27inline HPEN SelectPen( HDC hDC, HPEN hPen )
28{
29 return static_cast<HPEN>(SelectObject( hDC, static_cast<HGDIOBJ>(hPen) ));
30}
31
32inline void DeletePen( HPEN hPen )
33{
34 DeleteObject( static_cast<HGDIOBJ>(hPen) );
35}
36
37inline HPEN GetStockPen( int nObject )
38{
39 return static_cast<HPEN>(GetStockObject( nObject ));
40}
41
42inline HBRUSH SelectBrush( HDC hDC, HBRUSH hBrush )
43{
44 return static_cast<HBRUSH>(SelectObject( hDC, static_cast<HGDIOBJ>(hBrush) ));
45}
46
47inline void DeleteBrush( HBRUSH hBrush )
48{
49 DeleteObject( static_cast<HGDIOBJ>(hBrush) );
50}
51
52inline HBRUSH GetStockBrush( int nObject )
53{
54 return static_cast<HBRUSH>(GetStockObject( nObject ));
55}
56
57inline HFONT SelectFont( HDC hDC, HFONT hFont )
58{
59 return static_cast<HFONT>(SelectObject( hDC, static_cast<HGDIOBJ>(hFont) ));
60}
61
62inline void DeleteFont( HFONT hFont )
63{
64 DeleteObject( static_cast<HGDIOBJ>(hFont) );
65}
66
67inline HFONT GetStockFont( int nObject )
68{
69 return static_cast<HFONT>(GetStockObject( nObject ));
70}
71
72inline HBITMAP SelectBitmap( HDC hDC, HBITMAP hBitmap )
73{
74 return static_cast<HBITMAP>(SelectObject( hDC, static_cast<HGDIOBJ>(hBitmap) ));
75}
76
77inline void DeleteBitmap( HBITMAP hBitmap )
78{
79 DeleteObject( static_cast<HGDIOBJ>(hBitmap) );
80}
81
82inline void DeleteRegion( HRGN hRegion )
83{
84 DeleteObject( static_cast<HGDIOBJ>(hRegion) );
85}
86
87inline HPALETTE GetStockPalette( int nObject )
88{
89 return static_cast<HPALETTE>(GetStockObject( nObject ));
90}
91
92inline void DeletePalette( HPALETTE hPalette )
93{
94 DeleteObject( static_cast<HGDIOBJ>(hPalette) );
95}
96
97inline void SetWindowStyle( HWND hWnd, DWORD nStyle )
98{
99 SetWindowLongPtrW( hWnd, GWL_STYLE, nStyle );
100}
101
102inline DWORD GetWindowStyle( HWND hWnd )
103{
104 return GetWindowLongPtrW( hWnd, GWL_STYLE );
105}
106
107inline void SetWindowExStyle( HWND hWnd, DWORD nStyle )
108{
109 SetWindowLongPtrW( hWnd, GWL_EXSTYLE, nStyle );
110}
111
112inline DWORD GetWindowExStyle( HWND hWnd )
113{
114 return GetWindowLongPtrW( hWnd, GWL_EXSTYLE );
115}
116
117inline BOOL IsMinimized( HWND hWnd )
118{
119 return IsIconic( hWnd );
120}
121
122inline BOOL IsMaximized( HWND hWnd )
123{
124 return IsZoomed( hWnd );
125}
126
127inline 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
132inline HFONT GetWindowFont( HWND hWnd )
133{
134 return reinterpret_cast<HFONT>(SendMessageW( hWnd, WM_GETFONT, 0, 0 ));
135}
136
137inline void SetClassCursor( HWND hWnd, HCURSOR hCursor )
138{
139 SetClassLongPtr( hWnd, GCLP_HCURSOR, reinterpret_cast<LONG_PTR>(hCursor) );
140}
141
142inline HCURSOR GetClassCursor( HWND hWnd )
143{
144 return reinterpret_cast<HCURSOR>(GetClassLongPtr( hWnd, GCLP_HCURSOR ));
145}
146
147inline void SetClassIcon( HWND hWnd, HICON hIcon )
148{
149 SetClassLongPtr( hWnd, GCLP_HICON, reinterpret_cast<LONG_PTR>(hIcon) );
150}
151
152inline HICON GetClassIcon( HWND hWnd )
153{
154 return reinterpret_cast<HICON>(GetClassLongPtr( hWnd, GCLP_HICON ));
155}
156
157inline HBRUSH SetClassBrush( HWND hWnd, HBRUSH hBrush )
158{
159 return reinterpret_cast<HBRUSH>(SetClassLongPtr( hWnd, GCLP_HBRBACKGROUND, reinterpret_cast<LONG_PTR>(hBrush) ));
160}
161
162inline HBRUSH GetClassBrush( HWND hWnd )
163{
164 return reinterpret_cast<HBRUSH>(GetClassLongPtr( hWnd, GCLP_HBRBACKGROUND ));
165}
166
167inline 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: */
const wchar_t *typedef BOOL
void DeletePen(HPEN hPen)
Definition: wincomp.hxx:32
HICON GetClassIcon(HWND hWnd)
Definition: wincomp.hxx:152
HFONT GetStockFont(int nObject)
Definition: wincomp.hxx:67
HFONT SelectFont(HDC hDC, HFONT hFont)
Definition: wincomp.hxx:57
void SetClassCursor(HWND hWnd, HCURSOR hCursor)
Definition: wincomp.hxx:137
HBRUSH GetStockBrush(int nObject)
Definition: wincomp.hxx:52
HCURSOR GetClassCursor(HWND hWnd)
Definition: wincomp.hxx:142
void SetWindowExStyle(HWND hWnd, DWORD nStyle)
Definition: wincomp.hxx:107
void SetClassIcon(HWND hWnd, HICON hIcon)
Definition: wincomp.hxx:147
void DeleteFont(HFONT hFont)
Definition: wincomp.hxx:62
HPALETTE GetStockPalette(int nObject)
Definition: wincomp.hxx:87
HPEN SelectPen(HDC hDC, HPEN hPen)
Definition: wincomp.hxx:27
BOOL IsMinimized(HWND hWnd)
Definition: wincomp.hxx:117
void SetWindowFont(HWND hWnd, HFONT hFont, BOOL bRedraw)
Definition: wincomp.hxx:127
DWORD GetWindowExStyle(HWND hWnd)
Definition: wincomp.hxx:112
void SetWindowStyle(HWND hWnd, DWORD nStyle)
Definition: wincomp.hxx:97
HFONT GetWindowFont(HWND hWnd)
Definition: wincomp.hxx:132
void DeleteBitmap(HBITMAP hBitmap)
Definition: wincomp.hxx:77
HPEN GetStockPen(int nObject)
Definition: wincomp.hxx:37
void DeleteBrush(HBRUSH hBrush)
Definition: wincomp.hxx:47
HBRUSH GetClassBrush(HWND hWnd)
Definition: wincomp.hxx:162
void DeleteRegion(HRGN hRegion)
Definition: wincomp.hxx:82
BOOL IsMaximized(HWND hWnd)
Definition: wincomp.hxx:122
HBITMAP SelectBitmap(HDC hDC, HBITMAP hBitmap)
Definition: wincomp.hxx:72
HBRUSH SelectBrush(HDC hDC, HBRUSH hBrush)
Definition: wincomp.hxx:42
HINSTANCE GetWindowInstance(HWND hWnd)
Definition: wincomp.hxx:167
void DeletePalette(HPALETTE hPalette)
Definition: wincomp.hxx:92
HBRUSH SetClassBrush(HWND hWnd, HBRUSH hBrush)
Definition: wincomp.hxx:157
DWORD GetWindowStyle(HWND hWnd)
Definition: wincomp.hxx:102