-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhtmlayout_const.go
More file actions
393 lines (359 loc) · 14.7 KB
/
htmlayout_const.go
File metadata and controls
393 lines (359 loc) · 14.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
// Convert From htmlayout.h...
package gohl
// HTMLayout Notify Events
const (
HLN_CREATE_CONTROL = 0xAFF + 0x01
HLN_LOAD_DATA = 0xAFF + 0x02
HLN_CONTROL_CREATED = 0xAFF + 0x03
HLN_DATA_LOADED = 0xAFF + 0x04
HLN_DOCUMENT_COMPLETE = 0xAFF + 0x05
HLN_UPDATE_UI = 0xAFF + 0x06
HLN_DESTROY_CONTROL = 0xAFF + 0x07
HLN_ATTACH_BEHAVIOR = 0xAFF + 0x08
HLN_BEHAVIOR_CHANGED = 0xAFF + 0x09
HLN_DIALOG_CREATED = 0xAFF + 0x10
HLN_DIALOG_CLOSE_RQ = 0xAFF + 0x0A
HLN_DOCUMENT_LOADED = 0xAFF + 0x0B
)
// PhaseMask
const (
BUBBLING = 0 // bubbling (emersion) phase
SINKING = 0x08000 // capture (immersion) phase
HANDLED = 0x10000 // event already processed
)
// EventGroups
const (
HANDLE_INITIALIZATION = 0x0000 // attached/detached
HANDLE_MOUSE = 0x0001 // mouse events
HANDLE_KEY = 0x0002 // key events
HANDLE_FOCUS = 0x0004 // focus events
HANDLE_SCROLL = 0x0008 // scroll events
HANDLE_TIMER = 0x0010 // timer event
HANDLE_SIZE = 0x0020 // size changed event
HANDLE_DRAW = 0x0040 // drawing request (event)
HANDLE_DATA_ARRIVED = 0x080 // requested data has been delivered
HANDLE_BEHAVIOR_EVENT = 0x0100 // secondary, synthetic events
HANDLE_METHOD_CALL = 0x0200 // behavior specific methods
HANDLE_EXCHANGE = 0x1000 // system drag-n-drop
HANDLE_GESTURE = 0x2000 // touch input events
HANDLE_ALL = 0xFFFF // all of them
DISABLE_INITIALIZATION = 0x80000000 // disable INITIALIZATION events
)
// KeyboardStates
const (
CONTROL_KEY_PRESSED = 0x1
SHIFT_KEY_PRESSED = 0x2
ALT_KEY_PRESSED = 0x4
)
// InitializationEvents
const (
BEHAVIOR_DETACH = 0
BEHAVIOR_ATTACH = 1
)
// DraggingType
const (
NO_DRAGGING = 0
DRAGGING_MOVE = 1
DRAGGING_COPY = 2
)
// MouseButtons
const (
MAIN_MOUSE_BUTTON = 0x01 // aka left button
PROP_MOUSE_BUTTON = 0x02 // aka right button
MIDDLE_MOUSE_BUTTON = 0x04
X1_MOUSE_BUTTON = 0x08
X2_MOUSE_BUTTON = 0x10
)
// MouseEvents
const (
MOUSE_ENTER = 0
MOUSE_LEAVE = 1
MOUSE_MOVE = 2
MOUSE_UP = 3
MOUSE_DOWN = 4
MOUSE_DCLICK = 5
MOUSE_WHEEL = 6
MOUSE_TICK = 7 // mouse pressed ticks
MOUSE_IDLE = 8 // mouse stay idle for some time
DROP = 9 // item dropped, target is that dropped item
DRAG_ENTER = 0xA // drag arrived to the target element
DRAG_LEAVE = 0xB // drag left one of current drop targets
DRAG_REQUEST = 0xC // drag src notification before drag start
MOUSE_CLICK = 0xFF // mouse click event
DRAGGING = 0x100 // This flag is 'ORed' with MOUSE_* codes
)
// KeyEvents
const (
KEY_DOWN = 0
KEY_UP = 1
KEY_CHAR = 2
)
// FocusEvents
const (
FOCUS_LOST = 0
FOCUS_GOT = 1
)
// FocusCause
const (
BY_CODE = 0
BY_MOUSE = 1
BY_KEY_NEXT = 2
BY_KEY_PREV = 3
)
// ScrollEvents
const (
SCROLL_HOME = 0
SCROLL_END = 1
SCROLL_STEP_PLUS = 2
SCROLL_STEP_MINUS = 3
SCROLL_PAGE_PLUS = 4
SCROLL_PAGE_MINUS = 5
SCROLL_POS = 6
SCROLL_SLIDER_RELEASED = 7
)
// GestureCmd
const (
GESTURE_REQUEST = 0 // return true and fill flags if it will handle gestures
GESTURE_ZOOM = 1 // The zoom gesture
GESTURE_PAN = 2 // The pan gesture
GESTURE_ROTATE = 3 // The rotation gesture
GESTURE_TAP1 = 4 // The tap gesture
GESTURE_TAP2 = 5 // The two-finger tap gesture
)
// GestureState
const (
GESTURE_STATE_BEGIN = 1 // starts
GESTURE_STATE_INERTIA = 2 // events generated by inertia processor
GESTURE_STATE_END = 4 // end, last event of the gesture sequence
)
// GestureTypeFlags
const (
GESTURE_FLAG_ZOOM = 0x0001
GESTURE_FLAG_ROTATE = 0x0002
GESTURE_FLAG_PAN_VERTICAL = 0x0004
GESTURE_FLAG_PAN_HORIZONTAL = 0x0008
GESTURE_FLAG_TAP1 = 0x0010 // press & tap
GESTURE_FLAG_TAP2 = 0x0020 // two fingers tap
GESTURE_FLAG_PAN_WITH_GUTTER = 0x4000
GESTURE_FLAG_PAN_WITH_INERTIA = 0x8000
GESTURE_FLAGS_ALL = 0xFFFF
)
// DrawEvents
const (
DRAW_BACKGROUND = 0
DRAW_CONTENT = 1
DRAW_FOREGROUND = 2
)
// ExchangeEvents
const (
X_DRAG_ENTER = 0
X_DRAG_LEAVE = 1
X_DRAG = 2
X_DROP = 3
)
// ExchangeDataType
const (
EXF_UNDEFINED = 0
EXF_TEXT = 0x01 // FETCH_EXCHANGE_DATA will receive UTF8 encoded string - plain text
EXF_HTML = 0x02 // FETCH_EXCHANGE_DATA will receive UTF8 encoded string - html
EXF_HYPERLINK = 0x04 // FETCH_EXCHANGE_DATA will receive UTF8 encoded string with pair url\0caption
EXF_JSON = 0x08 // FETCH_EXCHANGE_DATA will receive UTF8 encoded string with JSON literal
EXF_FILE = 0x10 // FETCH_EXCHANGE_DATA will receive UTF8 encoded list of file names separated by nulls
)
// ExchangeCommands
const (
EXC_NONE = 0
EXC_COPY = 1
EXC_MOVE = 2
EXC_LINK = 4
)
// BehaviorEvents
const (
BUTTON_CLICK = 0 // click on button
BUTTON_PRESS = 1 // mouse down or key down in button
BUTTON_STATE_CHANGED = 2 // checkbox/radio/slider changed its state/value
EDIT_VALUE_CHANGING = 3 // before text change
EDIT_VALUE_CHANGED = 4 // after text change
SELECT_SELECTION_CHANGED = 5 // selection in <select> changed
SELECT_STATE_CHANGED = 6 // node in select expanded/collapsed, heTarget is the node
POPUP_REQUEST = 7 // request to show popup just received
POPUP_READY = 8 // popup element has been measured and ready to be shown on screen
POPUP_DISMISSED = 9 // popup element is closed
MENU_ITEM_ACTIVE = 0xA // menu item activated by mouse hover or by keyboard
MENU_ITEM_CLICK = 0xB // menu item click
CONTEXT_MENU_SETUP = 0xF // evt.he is a menu dom element that is about to be shown
CONTEXT_MENU_REQUEST = 0x10 // "right-click"
VISIUAL_STATUS_CHANGED = 0x11 // broadcast notification, sent to all elements of some container being shown or hidden
DISABLED_STATUS_CHANGED = 0x12 // broadcast notification, sent to all elements of some container that got new value of :disabled state
POPUP_DISMISSING = 0x13 // popup is about to be closed
HYPERLINK_CLICK = 0x80 // hyperlink click
TABLE_HEADER_CLICK = 0x81 // click on some cell in table header
TABLE_ROW_CLICK = 0x82 // click on data row in the table, target is the row
TABLE_ROW_DBL_CLICK = 0x83 // mouse dbl click on data row in the table, target is the row
ELEMENT_COLLAPSED = 0x90 // element was collapsed
ELEMENT_EXPANDED = 0x91 // element was expanded
ACTIVATE_CHILD = 0x92 // activate (select) child
DO_SWITCH_TAB = ACTIVATE_CHILD // command to switch tab programmatically
INIT_DATA_VIEW = 0x93 // request to virtual grid to initialize its view
ROWS_DATA_REQUEST = 0x94 // request from virtual grid to data source behavior to fill data in the table
UI_STATE_CHANGED = 0x95 // ui state changed, observers shall update their visual states
FORM_SUBMIT = 0x96 // behavior:form detected submission event
FORM_RESET = 0x97 // behavior:form detected reset event
DOCUMENT_COMPLETE = 0x98 // behavior:frame have complete document
HISTORY_PUSH = 0x99 // behavior:history stuff
HISTORY_DROP = 0x9A
HISTORY_PRIOR = 0x9B
HISTORY_NEXT = 0x9C
HISTORY_STATE_CHANGED = 0x9D // behavior:history notification - history stack has changed
CLOSE_POPUP = 0x9E // close popup request
REQUEST_TOOLTIP = 0x9F // request tooltip
ANIMATION = 0xA0 // animation started (reason=1) or ended(reason=0) on the element
FIRST_APPLICATION_EVENT_CODE = 0x100 // all custom event codes shall be greater than this number
)
// EventReason
const (
BY_MOUSE_CLICK = 0
BY_KEY_CLICK = 1
SYNTHESIZED = 2 // synthesized, programmatically generated
)
// EditChangedReason
const (
BY_INS_CHAR = 3 // single char insertion
BY_INS_CHARS = 4 // character range insertion, clipboard
BY_DEL_CHAR = 5 // single char deletion
BY_DEL_CHARS = 6 // character range deletion (selection)
)
// BehaviorMethodIdentifiers
const (
DO_CLICK = 0
GET_TEXT_VALUE = 1
SET_TEXT_VALUE = 2
TEXT_EDIT_GET_SELECTION = 3
TEXT_EDIT_SET_SELECTION = 4
)
// HLDOM_RESULT
const (
HLDOM_OK = 0
HLDOM_INVALID_HWND = 1
HLDOM_INVALID_HANDLE = 2
HLDOM_PASSIVE_HANDLE = 3
HLDOM_INVALID_PARAMETER = 4
HLDOM_OPERATION_FAILED = 5
HLDOM_OK_NOT_HANDLED = -1 // e.g. delayed
)
// HV_RESULT
const (
HV_OK = 0
HV_BAD_PARAMETER = 1
HV_INCOMPATIBLE_TYPE = 2
HV_OK_TRUE = 0xffffffff
)
// ElementStates
const (
STATE_LINK = 0x00000001 // selector :link, any element having href attribute
STATE_HOVER = 0x00000002 // selector :hover, element is under the cursor, mouse hover
STATE_ACTIVE = 0x00000004 // selector :active, element is activated, e.g. pressed
STATE_FOCUS = 0x00000008 // selector :focus, element is in focus
STATE_VISITED = 0x00000010 // selector :visited, aux flag - not used internally now
STATE_CURRENT = 0x00000020 // selector :current, current item in collection, e.g. current <option> in <select>
STATE_CHECKED = 0x00000040 // selector :checked, element is checked (or selected), e.g. check box or itme in multiselect
STATE_DISABLED = 0x00000080 // selector :disabled, element is disabled, behavior related flag
STATE_READONLY = 0x00000100 // selector :read-only, element is read-only, behavior related flag
STATE_EXPANDED = 0x00000200 // selector :expanded, element is in expanded state - nodes in tree view e.g. <options> in <select>
STATE_COLLAPSED = 0x00000400 // selector :collapsed, mutually exclusive with EXPANDED
STATE_INCOMPLETE = 0x00000800 // selector :incomplete, element has images (back/fore/bullet) requested but not delivered
STATE_ANIMATING = 0x00001000 // selector :animating, is currently animating
STATE_FOCUSABLE = 0x00002000 // selector :focusable, shall accept focus
STATE_ANCHOR = 0x00004000 // selector :anchor, first element in selection (<select miltiple>), STATE_CURRENT is the current
STATE_SYNTHETIC = 0x00008000 // selector :synthetic, synthesized DOM elements - e.g. all missed cells in tables (<td>) are getting this flag
STATE_OWNS_POPUP = 0x00010000 // selector :owns-popup, anchor(owner) element of visible popup
STATE_TABFOCUS = 0x00020000 // selector :tab-focus, element got focus by tab traversal. engine set it together with :focus
STATE_EMPTY = 0x00040000 // selector :empty - element is empty
STATE_BUSY = 0x00080000 // selector :busy, element is busy
STATE_DRAG_OVER = 0x00100000 // drag over the block that can accept it (so is current drop target)
STATE_DROP_TARGET = 0x00200000 // active drop target
STATE_MOVING = 0x00400000 // dragging/moving - the flag is set for the moving element (copy of the drag-source)
STATE_COPYING = 0x00800000 // dragging/copying - the flag is set for the copying element (copy of the drag-source)
STATE_DRAG_SOURCE = 0x00C00000 // is set in element that is being dragged
STATE_POPUP = 0x40000000 // this element is in popup state and presented to the user - out of flow now
STATE_PRESSED = 0x04000000 // pressed - close to active but has wider life span
STATE_HAS_CHILDREN = 0x02000000 // has more than one child
STATE_HAS_CHILD = 0x01000000 // has single child
STATE_IS_LTR = 0x20000000 // selector :ltr, the element or one of its nearest container has @dir and that dir has "ltr" value
STATE_IS_RTL = 0x10000000 // selector :rtl, the element or one of its nearest container has @dir and that dir has "rtl" value
)
// UpdateElementFlags
const (
RESET_STYLE_THIS = 0x20 // reset styles - this may require if you have styles dependent from attributes
RESET_STYLE_DEEP = 0x10 // use these flags after SetAttribute then
MEASURE_INPLACE = 0x0001 // use this flag if you do not expect any dimensional changes
MEASURE_DEEP = 0x0002 // use this flag if changes of some attributes/content may cause change of dimensions
REDRAW_NOW = 0x8000 // invoke ::UpdateWindow function after applying changes
)
// ElementAreas
const (
ROOT_RELATIVE = 0x01 // - or this flag if you want to get HTMLayout window relative coordinates
SELF_RELATIVE = 0x02 // - "or" this flag if you want to get coordinates relative to the origin
CONTAINER_RELATIVE = 0x03 // - position inside immediate container
VIEW_RELATIVE = 0x04 // - position relative to view - HTMLayout window
CONTENT_BOX = 0x00 // content (inner) box
PADDING_BOX = 0x10 // content + paddings
BORDER_BOX = 0x20 // content + paddings + border
MARGIN_BOX = 0x30 // content + paddings + border + margins
BACK_IMAGE_AREA = 0x40 // relative to content origin - location of background image (if it set no-repeat)
FORE_IMAGE_AREA = 0x50 // relative to content origin - location of foreground image (if it set no-repeat)
SCROLLABLE_AREA = 0x60 // scroll_area - scrollable area in content box
)
// ScrollFlags
const (
SCROLL_TO_TOP = 0x01
SCROLL_SMOOTH = 0x10
)
// HTMLayoutResourceType
const (
HLRT_DATA_HTML = 0
HLRT_DATA_IMAGE = 1
HLRT_DATA_STYLE = 2
HLRT_DATA_CURSOR = 3
HLRT_DATA_SCRIPT = 4
)
// HTMLayoutModes
const (
HLM_LAYOUT_ONLY = 0 // layout manager and renderer
HLM_SHOW_SELECTION = 1 // layout manager and renderer + text selection and WM_COPY
)
// CursorType
const (
CURSOR_ARROW = 0
CURSOR_IBEAM = 1
CURSOR_WAIT = 2
CURSOR_CROSS = 3
CURSOR_UPARROW = 4
CURSOR_SIZENWSE = 5
CURSOR_SIZENESW = 6
CURSOR_SIZEWE = 7
CURSOR_SIZENS = 8
CURSOR_SIZEALL = 9
CURSOR_NO = 10
CURSOR_APPSTARTING = 11
CURSOR_HELP = 12
CURSOR_HAND = 13
CURSOR_DRAG_MOVE = 14
CURSOR_DRAG_COPY = 15
)
// Constants
const (
HWND_TRY_DEFAULT = 0 // Create "default HTML control"
HWND_DISCARD_CREATION = 1 // Do not create any controls
LOAD_OK = 0 // Use default loader or outData/outDataSize if they are set
LOAD_DISCARD = 1 // Do not load resource at all
)
// Content insertion locations
const (
SIH_REPLACE_CONTENT = 0
SIH_INSERT_AT_START = 1
SIH_APPEND_AFTER_LAST = 2
SOH_REPLACE = 0
SOH_INSERT_BEFORE = 1
SOH_INSERT_AFTER = 2
)