xref: /aoo4110/main/sal/inc/systools/win32/user9x.h (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #pragma once
25 
26 #ifndef _WINDOWS_
27 #include <windows.h>
28 #endif
29 
30 #ifdef __cplusplus
31 extern "C"{
32 #endif
33 
34 //------------------------------------------------------------------------
35 // undefine the macros defined in the winuser.h file in order to avoid
36 // warnings because of multiple defines
37 //------------------------------------------------------------------------
38 
39 #ifdef SendMessageW
40 #undef SendMessageW
41 #endif
42 
43 #ifdef CreateWindowExW
44 #undef CreateWindowExW
45 #endif
46 
47 #ifdef RegisterClassExW
48 #undef RegisterClassExW
49 #endif
50 
51 #ifdef UnregisterClassW
52 #undef UnregisterClassW
53 #endif
54 
55 #ifdef RegisterClipboardFormatW
56 #undef RegisterClipboardFormatW
57 #endif
58 
59 #ifdef GetClipboardFormatNameW
60 #undef GetClipboardFormatNameW
61 #endif
62 
63 #ifdef SetWindowTextW
64 #undef SetWindowTextW
65 #endif
66 
67 #ifdef GetWindowTextW
68 #undef GetWindowTextW
69 #endif
70 
71 #ifdef InsertMenuItemW
72 #undef InsertMenuItemW
73 #endif
74 
75 #ifndef DrawTextW
76 #undef DrawTextW
77 #endif
78 
79 //------------------------------------------------------------------------
80 // defines
81 //------------------------------------------------------------------------
82 
83 #define USER9X_API extern
84 
85 //------------------------------------------------------------------------
86 // declare function pointers to the appropriate user32 functions
87 //------------------------------------------------------------------------
88 
89 USER9X_API LRESULT ( WINAPI * lpfnSendMessageW) (
90 	HWND hWnd,		// handle to the destination window
91 	UINT Msg,		// message
92 	WPARAM wParam,	// first message parameter
93 	LPARAM lParam	// second message parameter
94 );
95 
96 USER9X_API HWND ( WINAPI * lpfnCreateWindowExW ) (
97 	DWORD dwExStyle,      // extended window style
98 	LPCWSTR lpClassName,  // registered class name
99 	LPCWSTR lpWindowName, // window name
100 	DWORD dwStyle,        // window style
101 	int x,                // horizontal position of window
102 	int y,                // vertical position of window
103 	int nWidth,           // window width
104 	int nHeight,          // window height
105 	HWND hWndParent,      // handle to parent or owner window
106 	HMENU hMenu,          // menu handle or child identifier
107 	HINSTANCE hInstance,  // handle to application instance
108 	LPVOID lpParam        // window-creation data
109 );
110 
111 USER9X_API ATOM ( WINAPI * lpfnRegisterClassExW ) (
112 	CONST WNDCLASSEXW* lpwcx // class data
113 );
114 
115 USER9X_API BOOL ( WINAPI * lpfnUnregisterClassW ) (
116 	LPCWSTR lpClassName, // class name
117 	HINSTANCE hInstance	 // handle to application instance
118 );
119 
120 USER9X_API UINT (WINAPI * lpfnRegisterClipboardFormatW) (
121 	LPCWSTR lpszFormat // name of new format
122 );
123 
124 USER9X_API int ( WINAPI * lpfnGetClipboardFormatNameW ) (
125 	UINT   format,			// clipboard format to retrieve
126 	LPWSTR lpszFormatName,	// format name
127 	int    cchMaxCount		// length of format name buffer
128 );
129 
130 USER9X_API BOOL ( WINAPI * lpfnSetWindowTextW ) (
131 	HWND hWnd,
132     LPCWSTR lpString
133 );
134 
135 USER9X_API int ( WINAPI * lpfnGetWindowTextW ) (
136     HWND hWnd,			// handle to the window or control
137 	LPWSTR lpString,	// text buffer
138 	int    nMaxCount		// length of text buffer
139 );
140 
141 USER9X_API BOOL ( WINAPI * lpfnInsertMenuItemW ) (
142     HMENU hMenu,            // handle to menu
143     UINT uItem,             // identifier or position
144     BOOL fByPosition,       // meaning of uItem
145     LPCMENUITEMINFOW lpmii  // menu item information
146 );
147 
148 USER9X_API int ( WINAPI * lpfnDrawTextW ) (
149   HDC hDC,          // handle to DC
150   LPCWSTR lpString, // text to draw
151   int nCount,       // text length
152   LPRECT lpRect,    // formatting dimensions
153   UINT uFormat      // text-drawing options
154 );
155 
156 USER9X_API BOOL ( WINAPI * lpfnDrawStateW ) (
157   HDC hdc,                     // handle to device context
158   HBRUSH hbr,                  // handle to brush
159   DRAWSTATEPROC lpOutputFunc,  // callback function
160   LPARAM lData,                // image information
161   WPARAM wData,                // more image information
162   int x,                       // horizontal location
163   int y,                       // vertical location
164   int cx,                      // image width
165   int cy,                      // image height
166   UINT fuFlags                 // image type and state
167 );
168 
169 //------------------------------------------------------------------------
170 // redefine the above undefined macros so that the preprocessor replaces
171 // all occurrences of this macros with our function pointer
172 //------------------------------------------------------------------------
173 
174 #define SendMessageW				lpfnSendMessageW
175 #define CreateWindowExW				lpfnCreateWindowExW
176 #define RegisterClassExW			lpfnRegisterClassExW
177 #define UnregisterClassW			lpfnUnregisterClassW
178 #define RegisterClipboardFormatW	lpfnRegisterClipboardFormatW
179 #define GetClipboardFormatNameW		lpfnGetClipboardFormatNameW
180 #define SetWindowTextW				lpfnSetWindowTextW
181 #define GetWindowTextW              lpfnGetWindowTextW
182 #define InsertMenuItemW				lpfnInsertMenuItemW
183 #define DrawTextW                   lpfnDrawTextW
184 #define DrawStateW                  lpfnDrawStateW
185 
186 #ifdef __cplusplus
187 }
188 #endif
189