1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
25 // Adjustments for TypeChecking
27 inline HPEN
SelectPen( HDC hDC
, HPEN hPen
)
29 return static_cast<HPEN
>(SelectObject( hDC
, static_cast<HGDIOBJ
>(hPen
) ));
32 inline void DeletePen( HPEN hPen
)
34 DeleteObject( static_cast<HGDIOBJ
>(hPen
) );
37 inline HPEN
GetStockPen( int nObject
)
39 return static_cast<HPEN
>(GetStockObject( nObject
));
42 inline HBRUSH
SelectBrush( HDC hDC
, HBRUSH hBrush
)
44 return static_cast<HBRUSH
>(SelectObject( hDC
, static_cast<HGDIOBJ
>(hBrush
) ));
47 inline void DeleteBrush( HBRUSH hBrush
)
49 DeleteObject( static_cast<HGDIOBJ
>(hBrush
) );
52 inline HBRUSH
GetStockBrush( int nObject
)
54 return static_cast<HBRUSH
>(GetStockObject( nObject
));
57 inline HFONT
SelectFont( HDC hDC
, HFONT hFont
)
59 return static_cast<HFONT
>(SelectObject( hDC
, static_cast<HGDIOBJ
>(hFont
) ));
62 inline void DeleteFont( HFONT hFont
)
64 DeleteObject( static_cast<HGDIOBJ
>(hFont
) );
67 inline HFONT
GetStockFont( int nObject
)
69 return static_cast<HFONT
>(GetStockObject( nObject
));
72 inline HBITMAP
SelectBitmap( HDC hDC
, HBITMAP hBitmap
)
74 return static_cast<HBITMAP
>(SelectObject( hDC
, static_cast<HGDIOBJ
>(hBitmap
) ));
77 inline void DeleteBitmap( HBITMAP hBitmap
)
79 DeleteObject( static_cast<HGDIOBJ
>(hBitmap
) );
82 inline void DeleteRegion( HRGN hRegion
)
84 DeleteObject( static_cast<HGDIOBJ
>(hRegion
) );
87 inline HPALETTE
GetStockPalette( int nObject
)
89 return static_cast<HPALETTE
>(GetStockObject( nObject
));
92 inline void DeletePalette( HPALETTE hPalette
)
94 DeleteObject( static_cast<HGDIOBJ
>(hPalette
) );
97 inline void SetWindowStyle( HWND hWnd
, DWORD nStyle
)
99 SetWindowLongPtrW( hWnd
, GWL_STYLE
, nStyle
);
102 inline DWORD
GetWindowStyle( HWND hWnd
)
104 return GetWindowLongPtrW( hWnd
, GWL_STYLE
);
107 inline void SetWindowExStyle( HWND hWnd
, DWORD nStyle
)
109 SetWindowLongPtrW( hWnd
, GWL_EXSTYLE
, nStyle
);
112 inline DWORD
GetWindowExStyle( HWND hWnd
)
114 return GetWindowLongPtrW( hWnd
, GWL_EXSTYLE
);
117 inline BOOL
IsMinimized( HWND hWnd
)
119 return IsIconic( hWnd
);
122 inline BOOL
IsMaximized( HWND hWnd
)
124 return IsZoomed( hWnd
);
127 inline void SetWindowFont( HWND hWnd
, HFONT hFont
, BOOL bRedraw
)
129 SendMessageW( hWnd
, WM_SETFONT
, reinterpret_cast<WPARAM
>(hFont
), MAKELPARAM(static_cast<UINT
>(bRedraw
),0) );
132 inline HFONT
GetWindowFont( HWND hWnd
)
134 return reinterpret_cast<HFONT
>(SendMessageW( hWnd
, WM_GETFONT
, 0, 0 ));
137 inline void SetClassCursor( HWND hWnd
, HCURSOR hCursor
)
139 SetClassLongPtr( hWnd
, GCLP_HCURSOR
, reinterpret_cast<LONG_PTR
>(hCursor
) );
142 inline HCURSOR
GetClassCursor( HWND hWnd
)
144 return reinterpret_cast<HCURSOR
>(GetClassLongPtr( hWnd
, GCLP_HCURSOR
));
147 inline void SetClassIcon( HWND hWnd
, HICON hIcon
)
149 SetClassLongPtr( hWnd
, GCLP_HICON
, reinterpret_cast<LONG_PTR
>(hIcon
) );
152 inline HICON
GetClassIcon( HWND hWnd
)
154 return reinterpret_cast<HICON
>(GetClassLongPtr( hWnd
, GCLP_HICON
));
157 inline HBRUSH
SetClassBrush( HWND hWnd
, HBRUSH hBrush
)
159 return reinterpret_cast<HBRUSH
>(SetClassLongPtr( hWnd
, GCLP_HBRBACKGROUND
, reinterpret_cast<LONG_PTR
>(hBrush
) ));
162 inline HBRUSH
GetClassBrush( HWND hWnd
)
164 return reinterpret_cast<HBRUSH
>(GetClassLongPtr( hWnd
, GCLP_HBRBACKGROUND
));
167 inline HINSTANCE
GetWindowInstance( HWND hWnd
)
169 return reinterpret_cast<HINSTANCE
>(GetWindowLongPtrW( hWnd
, GWLP_HINSTANCE
));
173 #define MOUSEZ_CLASSNAME L"MouseZ" // wheel window class
174 #define MOUSEZ_TITLE L"Magellan MSWHEEL" // wheel window title
176 #define MSH_WHEELMODULE_CLASS (MOUSEZ_CLASSNAME)
177 #define MSH_WHEELMODULE_TITLE (MOUSEZ_TITLE)
179 #define MSH_SCROLL_LINES L"MSH_SCROLL_LINES_MSG"
181 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */