1 |
/******************************************************************************* |
= |
1 |
/******************************************************************************* |
2 |
* Copyright (c) 2000, 2005 IBM Corporation and others. |
|
2 |
* Copyright (c) 2000, 2005 IBM Corporation and others. |
3 |
* All rights reserved. This program and the accompanying materials |
|
3 |
* All rights reserved. This program and the accompanying materials |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
|
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
5 |
* which accompanies this distribution, and is available at |
|
5 |
* which accompanies this distribution, and is available at |
6 |
* http://www.eclipse.org/legal/epl-v10.html |
|
6 |
* http://www.eclipse.org/legal/epl-v10.html |
7 |
* |
|
7 |
* |
8 |
* Contributors: |
|
8 |
* Contributors: |
9 |
* IBM Corporation - initial API and implementation |
|
9 |
* IBM Corporation - initial API and implementation |
10 |
*******************************************************************************/ |
|
10 |
*******************************************************************************/ |
11 |
|
|
11 |
|
|
|
<> |
12 |
/******************************************************************************* |
|
|
|
13 |
* Additions/modifications to this source file by Oracle America, Inc. 2011 |
|
|
|
14 |
*******************************************************************************/ |
|
|
|
15 |
|
12 |
#pragma once |
= |
16 |
#pragma once |
13 |
//======================================================================================== |
|
17 |
//======================================================================================== |
14 |
#include "Callback.h" |
|
18 |
#include "Callback.h" |
15 |
#include "UGL_Error.h" |
|
19 |
#include "UGL_Error.h" |
16 |
//======================================================================================== |
|
20 |
//======================================================================================== |
17 |
|
|
21 |
|
18 |
#define WINDOW_CLASS_NAME _T("Window Class Name\0") |
|
22 |
#define WINDOW_CLASS_NAME _T("Window Class Name\0") |
19 |
#define UGL_DEVICE(handle) ((PUGL_Device)handle) |
|
23 |
#define UGL_DEVICE(handle) ((PUGL_Device)handle) |
20 |
#define UGL_DISPLAY(handle) ((PUGL_Display)handle) |
|
24 |
#define UGL_DISPLAY(handle) ((PUGL_Display)handle) |
21 |
|
|
25 |
|
22 |
/* creation constants used to distinguish between |
|
26 |
/* creation constants used to distinguish between |
23 |
* creating a shell and any other control. |
|
27 |
* creating a shell and any other control. |
24 |
*/ |
|
28 |
*/ |
25 |
#define UI_CREATE_SHELL (WM_APP + 1) |
|
29 |
#define UI_CREATE_SHELL (WM_APP + 1) |
26 |
#define UI_CREATE_CONTROL (WM_APP + 2) |
|
30 |
#define UI_CREATE_CONTROL (WM_APP + 2) |
27 |
#define UI_DESTROY_WINDOW (WM_APP + 3) |
|
31 |
#define UI_DESTROY_WINDOW (WM_APP + 3) |
28 |
/* |
|
32 |
/* |
29 |
* SetFocus(HWND) requires that it be called from the same thread |
|
33 |
* SetFocus(HWND) requires that it be called from the same thread |
30 |
* that the control was created from. |
|
34 |
* that the control was created from. |
31 |
* Therefore, we have to create our own message to send to the right |
|
35 |
* Therefore, we have to create our own message to send to the right |
32 |
* thread. |
|
36 |
* thread. |
33 |
*/ |
|
37 |
*/ |
34 |
#define UI_SET_FOCUS (WM_APP + 4) |
|
38 |
#define UI_SET_FOCUS (WM_APP + 4) |
35 |
#define UI_MOVE_ABOVE (WM_APP + 5) |
|
39 |
#define UI_MOVE_ABOVE (WM_APP + 5) |
36 |
#define UI_SET_VISIBLE (WM_APP + 6) |
|
40 |
#define UI_SET_VISIBLE (WM_APP + 6) |
37 |
#define UI_COMMAND_CHILD (WM_APP + 7) |
|
41 |
#define UI_COMMAND_CHILD (WM_APP + 7) |
38 |
#define UI_GET_MINIMUM_SIZE (WM_APP + 8) |
|
42 |
#define UI_GET_MINIMUM_SIZE (WM_APP + 8) |
39 |
#define UI_SET_BOUNDS (WM_APP + 9) |
|
43 |
#define UI_SET_BOUNDS (WM_APP + 9) |
40 |
#define UI_SCROLLBAR_ORIENTATION (WM_APP + 11) |
|
44 |
#define UI_SCROLLBAR_ORIENTATION (WM_APP + 11) |
41 |
#define UI_SCROLLABLE_GETINSETS (WM_APP + 12) |
|
45 |
#define UI_SCROLLABLE_GETINSETS (WM_APP + 12) |
42 |
#ifdef _WIN32_WCE |
|
46 |
#ifdef _WIN32_WCE |
43 |
#define UI_ADJUST_CHILD_BOUNDS (WM_APP + 13) |
|
47 |
#define UI_ADJUST_CHILD_BOUNDS (WM_APP + 13) |
44 |
#endif |
|
48 |
#endif |
45 |
|
|
49 |
|
46 |
#define UI_CREATE_MENUBAR (WM_APP + 14) |
|
50 |
#define UI_CREATE_MENUBAR (WM_APP + 14) |
47 |
#define UI_GETBACKGROUNDRGB (WM_APP + 15) |
|
51 |
#define UI_GETBACKGROUNDRGB (WM_APP + 15) |
48 |
#define UI_SET_ENABLED (WM_APP + 16) |
|
52 |
#define UI_SET_ENABLED (WM_APP + 16) |
49 |
#define UI_SETMULTIPLE (WM_APP + 17) |
|
53 |
#define UI_SETMULTIPLE (WM_APP + 17) |
50 |
#define UI_DRAWITEM (WM_APP + 18) |
|
54 |
#define UI_DRAWITEM (WM_APP + 18) |
51 |
#define UI_CREATE_POPUP (WM_APP + 19) |
|
55 |
#define UI_CREATE_POPUP (WM_APP + 19) |
52 |
#define UI_SHOW_POPUP (WM_APP + 20) |
|
56 |
#define UI_SHOW_POPUP (WM_APP + 20) |
53 |
|
|
57 |
|
54 |
#ifdef EANBLE_KEYBOARD_SCROLLING |
|
58 |
#ifdef EANBLE_KEYBOARD_SCROLLING |
55 |
#define UI_SCROLL_KEY (WM_APP + 21) // Passed to container classes when one of the |
|
59 |
#define UI_SCROLL_KEY (WM_APP + 21) // Passed to container classes when one of the |
56 |
#endif |
|
60 |
#endif |
57 |
// child widgets gets an arrow keypress |
|
61 |
// child widgets gets an arrow keypress |
58 |
#define UI_GETDC (WM_APP + 22) |
|
62 |
#define UI_GETDC (WM_APP + 22) |
59 |
|
|
63 |
|
60 |
// This message is sent to child widgets when a WM_NOTIFY |
|
64 |
// This message is sent to child widgets when a WM_NOTIFY |
61 |
// is recieved in the parent. The wParam and lParam are |
|
65 |
// is recieved in the parent. The wParam and lParam are |
62 |
// not modifed at all before sending. |
|
66 |
// not modifed at all before sending. |
63 |
#define UI_CHILD_NOTIFY (WM_APP + 23) |
|
67 |
#define UI_CHILD_NOTIFY (WM_APP + 23) |
64 |
|
|
68 |
|
65 |
#define UI_GETFOREGROUNDRGB (WM_APP + 24) |
|
69 |
#define UI_GETFOREGROUNDRGB (WM_APP + 24) |
66 |
#define UI_SETBACKGROUND (WM_APP + 25) |
|
70 |
#define UI_SETBACKGROUND (WM_APP + 25) |
67 |
#define UI_SETFOREGROUND (WM_APP + 26) |
|
71 |
#define UI_SETFOREGROUND (WM_APP + 26) |
68 |
#define UI_SETFONT (WM_APP + 27) |
|
72 |
#define UI_SETFONT (WM_APP + 27) |
69 |
|
|
73 |
|
70 |
#define UI_SETCALLBACKTARGET (WM_APP + 28) |
|
74 |
#define UI_SETCALLBACKTARGET (WM_APP + 28) |
71 |
|
|
75 |
|
72 |
#define UI_NOTIFY_TRAY (WM_APP + 29) |
|
76 |
#define UI_NOTIFY_TRAY (WM_APP + 29) |
73 |
|
|
77 |
|
74 |
struct UGL_Control; |
|
78 |
struct UGL_Control; |
75 |
struct UGL_Font; |
|
79 |
struct UGL_Font; |
76 |
struct UGL_MenuItem; |
|
80 |
struct UGL_MenuItem; |
77 |
|
|
81 |
|
78 |
typedef struct ControlList { |
|
82 |
typedef struct ControlList { |
79 |
struct UGL_Control* control; |
|
83 |
struct UGL_Control* control; |
80 |
struct ControlList* next; |
|
84 |
struct ControlList* next; |
81 |
} ControlList, *PControlList; |
|
85 |
} ControlList, *PControlList; |
82 |
|
|
86 |
|
83 |
typedef struct MenuList { |
|
87 |
typedef struct MenuList { |
84 |
UGL_Int menuHandle; |
|
88 |
UGL_Int menuHandle; |
85 |
HMENU hMenu; |
|
89 |
HMENU hMenu; |
86 |
struct MenuList* next; |
|
90 |
struct MenuList* next; |
87 |
} MenuList, *PMenuList; |
|
91 |
} MenuList, *PMenuList; |
88 |
//======================================================================================== |
|
92 |
//======================================================================================== |
89 |
|
|
93 |
|
90 |
typedef void (*DEVICE_DISPOSE)(UGL_Int handle, UGL_Error uglError); |
|
94 |
typedef void (*DEVICE_DISPOSE)(UGL_Int handle, UGL_Error uglError); |
91 |
|
|
95 |
|
92 |
typedef struct UGL_Device { |
|
96 |
typedef struct UGL_Device { |
93 |
DEVICE_DISPOSE device_dispose; |
|
97 |
DEVICE_DISPOSE device_dispose; |
94 |
} UGL_Device, *PUGL_Device; |
|
98 |
} UGL_Device, *PUGL_Device; |
95 |
//======================================================================================== |
|
99 |
//======================================================================================== |
96 |
|
|
100 |
|
97 |
typedef enum {DRAG_START, DRAGGING} DragState; |
|
101 |
typedef enum {DRAG_START, DRAGGING} DragState; |
98 |
|
|
102 |
|
99 |
typedef struct UGL_Display { |
|
103 |
typedef struct UGL_Display { |
100 |
UGL_Device ugl_device; |
|
104 |
UGL_Device ugl_device; |
101 |
|
|
105 |
|
102 |
CallbackLookup *callback_lookup; |
|
106 |
CallbackLookup *callback_lookup; |
103 |
int threadID; |
|
107 |
int threadID; |
104 |
int processID; |
|
108 |
int processID; |
105 |
HINSTANCE hInstance; |
|
109 |
HINSTANCE hInstance; |
106 |
HWND creation_hWnd; |
|
110 |
HWND creation_hWnd; |
107 |
|
|
111 |
|
108 |
struct UGL_Tray *tray; |
|
112 |
struct UGL_Tray *tray; |
109 |
|
|
113 |
|
110 |
struct UGL_MenuItem **menuItems; |
|
114 |
struct UGL_MenuItem **menuItems; |
111 |
int menuItemsLength; |
|
115 |
int menuItemsLength; |
112 |
// new for softkey. Because menuItemsLength does not decrement when menuitem is removed |
|
116 |
// new for softkey. Because menuItemsLength does not decrement when menuitem is removed |
113 |
int menuItemCount; |
|
117 |
int menuItemCount; |
114 |
|
|
118 |
|
115 |
// Cache the control default font because it is |
|
119 |
// Cache the control default font because it is |
116 |
// requested alot and needs to be cleaned up |
|
120 |
// requested alot and needs to be cleaned up |
117 |
// at the end. This font is not the same as the |
|
121 |
// at the end. This font is not the same as the |
118 |
// Device_GetSystemFont return value because the |
|
122 |
// Device_GetSystemFont return value because the |
119 |
// return value for that font is diposed in Java. |
|
123 |
// return value for that font is diposed in Java. |
120 |
struct UGL_Font* defaultControlFont; |
|
124 |
struct UGL_Font* defaultControlFont; |
121 |
|
|
125 |
|
122 |
/** |
|
126 |
/** |
123 |
* Used to keep track of KeyEvent data in Display.c |
|
127 |
* Used to keep track of KeyEvent data in Display.c |
124 |
*/ |
|
128 |
*/ |
125 |
int lastKey; |
|
129 |
int lastKey; |
126 |
int lastAscii; |
|
130 |
int lastAscii; |
127 |
BOOL lastVirtual; |
|
131 |
BOOL lastVirtual; |
128 |
BOOL lastNull; |
|
132 |
BOOL lastNull; |
129 |
BOOL lastDead; |
|
133 |
BOOL lastDead; |
|
|
-+ |
134 |
BOOL isEmulator; |
130 |
|
= |
135 |
|
131 |
// Fields used to track the current mouse drag state |
|
136 |
// Fields used to track the current mouse drag state |
132 |
HWND dragWindow; // The window being dragged. If this value is NULL |
|
137 |
HWND dragWindow; // The window being dragged. If this value is NULL |
133 |
// then the other two fields are meaningless |
|
138 |
// then the other two fields are meaningless |
134 |
RECT dragZone; // The area the mouse has to move out of to |
|
139 |
RECT dragZone; // The area the mouse has to move out of to |
135 |
// start a drag. The values are relative to the dragWindow |
|
140 |
// start a drag. The values are relative to the dragWindow |
136 |
UINT dragStartTime; // The time where the drag starts, even if the mouse |
|
141 |
UINT dragStartTime; // The time where the drag starts, even if the mouse |
137 |
// has not left the drag zone |
|
142 |
// has not left the drag zone |
138 |
DragState dragState; // The current dragging state. |
|
143 |
DragState dragState; // The current dragging state. |
139 |
|
|
144 |
|
140 |
|
|
145 |
|
141 |
HWND lastMouseWind; //last window with a MouseMove Event |
|
146 |
HWND lastMouseWind; //last window with a MouseMove Event |
142 |
|
|
147 |
|
143 |
// These two fields should not be referenced by any method outside |
|
148 |
// These two fields should not be referenced by any method outside |
144 |
// of Display_AddModalShell, Display_RemoveModalShell, Display_AddShell, |
|
149 |
// of Display_AddModalShell, Display_RemoveModalShell, Display_AddShell, |
145 |
// Display_RemoveShell and Display_EnableShell. |
|
150 |
// Display_RemoveShell and Display_EnableShell. |
146 |
PControlList modalShells; // Tracks the open modal dialogs |
|
151 |
PControlList modalShells; // Tracks the open modal dialogs |
147 |
PControlList enabledShells; // Tracks the shells which java thinks |
|
152 |
PControlList enabledShells; // Tracks the shells which java thinks |
148 |
// are enabled. |
|
153 |
// are enabled. |
149 |
|
|
154 |
|
150 |
// Place holder for expanded eSWT data. |
|
155 |
// Place holder for expanded eSWT data. |
151 |
void *expandedData; |
|
156 |
void *expandedData; |
152 |
|
|
157 |
|
153 |
// common control dll version numbers |
|
158 |
// common control dll version numbers |
154 |
int comCtrl32Major; |
|
159 |
int comCtrl32Major; |
155 |
int comCtrl32Minor; |
|
160 |
int comCtrl32Minor; |
156 |
|
|
161 |
|
157 |
// Tracks defined menus. |
|
162 |
// Tracks defined menus. |
158 |
PMenuList menus; |
|
163 |
PMenuList menus; |
159 |
// need to track active menu for HIDE event handling |
|
164 |
// need to track active menu for HIDE event handling |
160 |
struct UGL_Menu * activeMenu; |
|
165 |
struct UGL_Menu * activeMenu; |
161 |
|
|
166 |
|
162 |
// need to track active menu bar |
|
167 |
// need to track active menu bar |
163 |
struct UGL_Menu * activeMenuBar; |
|
168 |
struct UGL_Menu * activeMenuBar; |
164 |
|
|
169 |
|
165 |
// need to track active menu for active Shell |
|
170 |
// need to track active menu for active Shell |
166 |
struct UGL_Control * activeShell; |
|
171 |
struct UGL_Control * activeShell; |
167 |
|
|
172 |
|
168 |
|
|
173 |
|
169 |
} UGL_Display, *PUGL_Display; |
|
174 |
} UGL_Display, *PUGL_Display; |
170 |
//======================================================================================== |
|
175 |
//======================================================================================== |
171 |
|
|
176 |
|
172 |
/** |
|
177 |
/** |
173 |
* Used for Device_GetTypefaces() only |
|
178 |
* Used for Device_GetTypefaces() only |
174 |
*/ |
|
179 |
*/ |
175 |
typedef struct UGL_EnumFont { |
|
180 |
typedef struct UGL_EnumFont { |
176 |
int scalable; |
|
181 |
int scalable; |
177 |
UGL_StringArray results; |
|
182 |
UGL_StringArray results; |
178 |
int result_count; |
|
183 |
int result_count; |
179 |
int capacity; |
|
184 |
int capacity; |
180 |
BOOL variants; |
|
185 |
BOOL variants; |
181 |
} UGL_EnumFont, *PUGL_EnumFont; |
|
186 |
} UGL_EnumFont, *PUGL_EnumFont; |
182 |
|
|
187 |
|
183 |
struct UGL_Font* _Device_GetSystemFont(UGL_Error uglError); |
|
188 |
struct UGL_Font* _Device_GetSystemFont(UGL_Error uglError); |
184 |
|
|
189 |
|
185 |
/** |
|
190 |
/** |
186 |
* When a modal shell is added to the display all other visible shell's are disabled. When |
|
191 |
* When a modal shell is added to the display all other visible shell's are disabled. When |
187 |
* the last modal shell is removed from the display all shells that want to be enabled |
|
192 |
* the last modal shell is removed from the display all shells that want to be enabled |
188 |
* will be re-enabled |
|
193 |
* will be re-enabled |
189 |
*/ |
|
194 |
*/ |
190 |
|
|
195 |
|
191 |
void Display_UpdateModalShellVisibility(PUGL_Display display, struct UGL_Control* modalShell, BOOL visible, UGL_Error error); |
|
196 |
void Display_UpdateModalShellVisibility(PUGL_Display display, struct UGL_Control* modalShell, BOOL visible, UGL_Error error); |
192 |
|
|
197 |
|
193 |
/** |
|
198 |
/** |
194 |
* This method will track the new shell and manage it's enabled state |
|
199 |
* This method will track the new shell and manage it's enabled state |
195 |
* based on the current modal dialog. |
|
200 |
* based on the current modal dialog. |
196 |
*/ |
|
201 |
*/ |
197 |
void Display_AddShell(PUGL_Display display, struct UGL_Control* shell, UGL_Error error); |
|
202 |
void Display_AddShell(PUGL_Display display, struct UGL_Control* shell, UGL_Error error); |
198 |
|
|
203 |
|
199 |
/** |
|
204 |
/** |
200 |
* Stops tracking the specified shell. This should only be called |
|
205 |
* Stops tracking the specified shell. This should only be called |
201 |
* when a shell is being disposed. |
|
206 |
* when a shell is being disposed. |
202 |
*/ |
|
207 |
*/ |
203 |
void Display_RemoveShell(PUGL_Display display, struct UGL_Control* shell); |
|
208 |
void Display_RemoveShell(PUGL_Display display, struct UGL_Control* shell); |
204 |
|
|
209 |
|
205 |
/** |
|
210 |
/** |
206 |
* Returns TRUE if the shell needs to be updated with the new |
|
211 |
* Returns TRUE if the shell needs to be updated with the new |
207 |
* enabled status. It will return FALSE if the shell already has the |
|
212 |
* enabled status. It will return FALSE if the shell already has the |
208 |
* style specified. For example, If the this method is called to enable a shell while |
|
213 |
* style specified. For example, If the this method is called to enable a shell while |
209 |
* a modal dialog is visible it will return FALSE, since the shell must remain |
|
214 |
* a modal dialog is visible it will return FALSE, since the shell must remain |
210 |
* disabled while the dialog is visible, but when the dialog is hidden the desired |
|
215 |
* disabled while the dialog is visible, but when the dialog is hidden the desired |
211 |
* enabled state will be remembered and updated. |
|
216 |
* enabled state will be remembered and updated. |
212 |
*/ |
|
217 |
*/ |
213 |
BOOL Display_EnableShell(PUGL_Display display, struct UGL_Control* shell, BOOL enable); |
|
218 |
BOOL Display_EnableShell(PUGL_Display display, struct UGL_Control* shell, BOOL enable); |
214 |
|
|
219 |
|
215 |
void Display_AddMenuItem(struct UGL_MenuItem *menuItem); |
|
220 |
void Display_AddMenuItem(struct UGL_MenuItem *menuItem); |
216 |
|
|
221 |
|
217 |
struct UGL_MenuItem * Display_GetMenuItem(PUGL_Display display, int id); |
|
222 |
struct UGL_MenuItem * Display_GetMenuItem(PUGL_Display display, int id); |
218 |
|
|
223 |
|
219 |
void Display_RemoveMenuItem(struct UGL_MenuItem *menuItem); |
|
224 |
void Display_RemoveMenuItem(struct UGL_MenuItem *menuItem); |
220 |
|
|
225 |
|
221 |
#ifdef _WIN32_WCE |
|
226 |
#ifdef _WIN32_WCE |
222 |
|
|
227 |
|
223 |
//struct UGL_MenuItem * Display_FindMenuItem(PUGL_Display display, int index); |
|
228 |
//struct UGL_MenuItem * Display_FindMenuItem(PUGL_Display display, int index); |
224 |
struct UGL_MenuItem * Display_FindMenuItem(PUGL_Display display, HWND hwndCB, int index); |
|
229 |
struct UGL_MenuItem * Display_FindMenuItem(PUGL_Display display, HWND hwndCB, int index); |
225 |
|
|
230 |
|
226 |
//void Display_DecMenuItemIndex(PUGL_Display display, int start); |
|
231 |
//void Display_DecMenuItemIndex(PUGL_Display display, int start); |
227 |
void Display_DecMenuItemIndex(PUGL_Display display, HWND hwndCB, int start); |
|
232 |
void Display_DecMenuItemIndex(PUGL_Display display, HWND hwndCB, int start); |
228 |
|
|
233 |
|
229 |
//void Display_IncMenuItemIndex(PUGL_Display display, int start); |
|
234 |
//void Display_IncMenuItemIndex(PUGL_Display display, int start); |
230 |
void Display_IncMenuItemIndex(PUGL_Display display, HWND hwndCB, int start); |
|
235 |
void Display_IncMenuItemIndex(PUGL_Display display, HWND hwndCB, int start); |
231 |
|
|
236 |
|
232 |
#endif |
|
237 |
#endif |
233 |
|
|
238 |
|
234 |
int _Display_GetComCtrlMajorVersion(PUGL_Display display, UGL_Error uglError); |
|
239 |
int _Display_GetComCtrlMajorVersion(PUGL_Display display, UGL_Error uglError); |
235 |
//======================================================================================== |
|
240 |
//======================================================================================== |