Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/macosx/classes/apple/laf/JRSUIConstants.java
38829 views
1
/*
2
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation. Oracle designates this
8
* particular file as subject to the "Classpath" exception as provided
9
* by Oracle in the LICENSE file that accompanied this code.
10
*
11
* This code is distributed in the hope that it will be useful, but WITHOUT
12
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
* version 2 for more details (a copy is included in the LICENSE file that
15
* accompanied this code).
16
*
17
* You should have received a copy of the GNU General Public License version
18
* 2 along with this work; if not, write to the Free Software Foundation,
19
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
*
21
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
* or visit www.oracle.com if you need additional information or have any
23
* questions.
24
*/
25
26
package apple.laf;
27
28
import java.lang.reflect.Field;
29
import java.nio.ByteBuffer;
30
31
import java.lang.annotation.Native;
32
33
public final class JRSUIConstants {
34
35
/**
36
* There is no way to get width of focus border, so it is hardcoded here.
37
* All components, which can be focused should take care about it.
38
*/
39
public static final int FOCUS_SIZE = 4;
40
41
private static native long getPtrForConstant(final int constant);
42
43
static class Key {
44
@Native protected static final int _value = 20;
45
public static final Key VALUE = new Key(_value);
46
47
@Native protected static final int _thumbProportion = 24;
48
public static final Key THUMB_PROPORTION = new Key(_thumbProportion);
49
50
@Native protected static final int _thumbStart = 25;
51
public static final Key THUMB_START = new Key(_thumbStart);
52
53
@Native protected static final int _windowTitleBarHeight = 28;
54
public static final Key WINDOW_TITLE_BAR_HEIGHT = new Key(_windowTitleBarHeight);
55
56
@Native protected static final int _animationFrame = 23;
57
public static final Key ANIMATION_FRAME = new Key(_animationFrame);
58
59
final int constant;
60
private long ptr;
61
62
private Key(final int constant) {
63
this.constant = constant;
64
}
65
66
long getConstantPtr() {
67
if (ptr != 0) return ptr;
68
ptr = getPtrForConstant(constant);
69
if (ptr != 0) return ptr;
70
throw new RuntimeException("Constant not implemented in native: " + this);
71
}
72
73
public String toString() {
74
return getConstantName(this) + (ptr == 0 ? "(unlinked)" : "");
75
}
76
}
77
78
static class DoubleValue {
79
@Native protected static final byte TYPE_CODE = 1;
80
81
final double doubleValue;
82
83
DoubleValue(final double doubleValue) {
84
this.doubleValue = doubleValue;
85
}
86
87
public byte getTypeCode() {
88
return TYPE_CODE;
89
}
90
91
public void putValueInBuffer(final ByteBuffer buffer) {
92
buffer.putDouble(doubleValue);
93
}
94
95
public boolean equals(final Object obj) {
96
return (obj instanceof DoubleValue) && (((DoubleValue)obj).doubleValue == doubleValue);
97
}
98
99
public int hashCode() {
100
final long bits = Double.doubleToLongBits(doubleValue);
101
return (int)(bits ^ (bits >>> 32));
102
}
103
104
public String toString() {
105
return Double.toString(doubleValue);
106
}
107
}
108
109
110
static class PropertyEncoding {
111
final long mask;
112
final byte shift;
113
114
PropertyEncoding(final long mask, final byte shift) {
115
this.mask = mask;
116
this.shift = shift;
117
}
118
}
119
120
static class Property {
121
final PropertyEncoding encoding;
122
final long value;
123
final byte ordinal;
124
125
Property(final PropertyEncoding encoding, final byte ordinal) {
126
this.encoding = encoding;
127
this.value = ((long)ordinal) << encoding.shift;
128
this.ordinal = ordinal;
129
}
130
131
/**
132
* Applies this property value to the provided state
133
* @param encodedState the incoming JRSUI encoded state
134
* @return the composite of the provided JRSUI encoded state and this value
135
*/
136
public long apply(final long encodedState) {
137
return (encodedState & ~encoding.mask) | value;
138
}
139
140
public String toString() {
141
return getConstantName(this);
142
}
143
}
144
145
public static class Size extends Property {
146
@Native private static final byte SHIFT = 0;
147
@Native private static final byte SIZE = 3;
148
@Native private static final long MASK = (long)0x7 << SHIFT;
149
private static final PropertyEncoding size = new PropertyEncoding(MASK, SHIFT);
150
151
Size(final byte value) {
152
super(size, value);
153
}
154
155
@Native private static final byte _mini = 1;
156
public static final Size MINI = new Size(_mini);
157
@Native private static final byte _small = 2;
158
public static final Size SMALL = new Size(_small);
159
@Native private static final byte _regular = 3;
160
public static final Size REGULAR = new Size(_regular);
161
@Native private static final byte _large = 4;
162
public static final Size LARGE = new Size(_large);
163
}
164
165
public static class State extends Property {
166
@Native private static final byte SHIFT = Size.SHIFT + Size.SIZE;
167
@Native private static final byte SIZE = 4;
168
@Native private static final long MASK = (long)0xF << SHIFT;
169
private static final PropertyEncoding state = new PropertyEncoding(MASK, SHIFT);
170
171
State(final byte value) {
172
super(state, value);
173
}
174
175
@Native private static final byte _active = 1;
176
public static final State ACTIVE = new State(_active);
177
@Native private static final byte _inactive = 2;
178
public static final State INACTIVE = new State(_inactive);
179
@Native private static final byte _disabled = 3;
180
public static final State DISABLED = new State(_disabled);
181
@Native private static final byte _pressed = 4;
182
public static final State PRESSED = new State(_pressed);
183
@Native private static final byte _pulsed = 5;
184
public static final State PULSED = new State(_pulsed);
185
@Native private static final byte _rollover = 6;
186
public static final State ROLLOVER = new State(_rollover);
187
@Native private static final byte _drag = 7;
188
public static final State DRAG = new State(_drag);
189
}
190
191
public static class Direction extends Property {
192
@Native private static final byte SHIFT = State.SHIFT + State.SIZE;
193
@Native private static final byte SIZE = 4;
194
@Native private static final long MASK = (long)0xF << SHIFT;
195
private static final PropertyEncoding direction = new PropertyEncoding(MASK, SHIFT);
196
197
Direction(final byte value) {
198
super(direction, value);
199
}
200
201
@Native private static final byte _none = 1;
202
public static final Direction NONE = new Direction(_none);
203
@Native private static final byte _up = 2;
204
public static final Direction UP = new Direction(_up);
205
@Native private static final byte _down = 3;
206
public static final Direction DOWN = new Direction(_down);
207
@Native private static final byte _left = 4;
208
public static final Direction LEFT = new Direction(_left);
209
@Native private static final byte _right = 5;
210
public static final Direction RIGHT = new Direction(_right);
211
@Native private static final byte _north = 6;
212
public static final Direction NORTH = new Direction(_north);
213
@Native private static final byte _south = 7;
214
public static final Direction SOUTH = new Direction(_south);
215
@Native private static final byte _east = 8;
216
public static final Direction EAST = new Direction(_east);
217
@Native private static final byte _west = 9;
218
public static final Direction WEST = new Direction(_west);
219
}
220
221
public static class Orientation extends Property {
222
@Native private static final byte SHIFT = Direction.SHIFT + Direction.SIZE;
223
@Native private static final byte SIZE = 2;
224
@Native private static final long MASK = (long)0x3 << SHIFT;
225
private static final PropertyEncoding orientation = new PropertyEncoding(MASK, SHIFT);
226
227
Orientation(final byte value) {
228
super(orientation, value);
229
}
230
231
@Native private static final byte _horizontal = 1;
232
public static final Orientation HORIZONTAL = new Orientation(_horizontal);
233
@Native private static final byte _vertical = 2;
234
public static final Orientation VERTICAL = new Orientation(_vertical);
235
}
236
237
public static class AlignmentVertical extends Property {
238
@Native private static final byte SHIFT = Orientation.SHIFT + Orientation.SIZE;
239
@Native private static final byte SIZE = 2;
240
@Native private static final long MASK = (long)0x3 << SHIFT;
241
private static final PropertyEncoding alignmentVertical = new PropertyEncoding(MASK, SHIFT);
242
243
AlignmentVertical(final byte value){
244
super(alignmentVertical, value);
245
}
246
247
@Native private static final byte _top = 1;
248
public static final AlignmentVertical TOP = new AlignmentVertical(_top);
249
@Native private static final byte _center = 2;
250
public static final AlignmentVertical CENTER = new AlignmentVertical(_center);
251
@Native private static final byte _bottom = 3;
252
public static final AlignmentVertical BOTTOM = new AlignmentVertical(_bottom);
253
}
254
255
public static class AlignmentHorizontal extends Property {
256
@Native private static final byte SHIFT = AlignmentVertical.SHIFT + AlignmentVertical.SIZE;
257
@Native private static final byte SIZE = 2;
258
@Native private static final long MASK = (long)0x3 << SHIFT;
259
private static final PropertyEncoding alignmentHorizontal = new PropertyEncoding(MASK, SHIFT);
260
261
AlignmentHorizontal(final byte value){
262
super(alignmentHorizontal, value);
263
}
264
265
@Native private static final byte _left = 1;
266
public static final AlignmentHorizontal LEFT = new AlignmentHorizontal(_left);
267
@Native private static final byte _center = 2;
268
public static final AlignmentHorizontal CENTER = new AlignmentHorizontal(_center);
269
@Native private static final byte _right = 3;
270
public static final AlignmentHorizontal RIGHT = new AlignmentHorizontal(_right);
271
}
272
273
public static class SegmentPosition extends Property {
274
@Native private static final byte SHIFT = AlignmentHorizontal.SHIFT + AlignmentHorizontal.SIZE;
275
@Native private static final byte SIZE = 3;
276
@Native private static final long MASK = (long)0x7 << SHIFT;
277
private static final PropertyEncoding segmentPosition = new PropertyEncoding(MASK, SHIFT);
278
279
SegmentPosition(final byte value) {
280
super(segmentPosition, value);
281
}
282
283
@Native private static final byte _first = 1;
284
public static final SegmentPosition FIRST = new SegmentPosition(_first);
285
@Native private static final byte _middle = 2;
286
public static final SegmentPosition MIDDLE = new SegmentPosition(_middle);
287
@Native private static final byte _last = 3;
288
public static final SegmentPosition LAST = new SegmentPosition(_last);
289
@Native private static final byte _only = 4;
290
public static final SegmentPosition ONLY = new SegmentPosition(_only);
291
}
292
293
public static class ScrollBarPart extends Property {
294
@Native private static final byte SHIFT = SegmentPosition.SHIFT + SegmentPosition.SIZE;
295
@Native private static final byte SIZE = 4;
296
@Native private static final long MASK = (long)0xF << SHIFT;
297
private static final PropertyEncoding scrollBarPart = new PropertyEncoding(MASK, SHIFT);
298
299
ScrollBarPart(final byte value) {
300
super(scrollBarPart, value);
301
}
302
303
@Native private static final byte _none = 1;
304
public static final ScrollBarPart NONE = new ScrollBarPart(_none);
305
@Native private static final byte _thumb = 2;
306
public static final ScrollBarPart THUMB = new ScrollBarPart(_thumb);
307
@Native private static final byte _arrowMin = 3;
308
public static final ScrollBarPart ARROW_MIN = new ScrollBarPart(_arrowMin);
309
@Native private static final byte _arrowMax = 4;
310
public static final ScrollBarPart ARROW_MAX = new ScrollBarPart(_arrowMax);
311
@Native private static final byte _arrowMaxInside = 5;
312
public static final ScrollBarPart ARROW_MAX_INSIDE = new ScrollBarPart(_arrowMaxInside);
313
@Native private static final byte _arrowMinInside = 6;
314
public static final ScrollBarPart ARROW_MIN_INSIDE = new ScrollBarPart(_arrowMinInside);
315
@Native private static final byte _trackMin = 7;
316
public static final ScrollBarPart TRACK_MIN = new ScrollBarPart(_trackMin);
317
@Native private static final byte _trackMax = 8;
318
public static final ScrollBarPart TRACK_MAX = new ScrollBarPart(_trackMax);
319
}
320
321
public static class Variant extends Property {
322
@Native private static final byte SHIFT = ScrollBarPart.SHIFT + ScrollBarPart.SIZE;
323
@Native private static final byte SIZE = 4;
324
@Native private static final long MASK = (long)0xF << SHIFT;
325
private static final PropertyEncoding variant = new PropertyEncoding(MASK, SHIFT);
326
327
Variant(final byte value) {
328
super(variant, value);
329
}
330
331
@Native private static final byte _menuGlyph = 1;
332
public static final Variant MENU_GLYPH = new Variant(_menuGlyph);
333
@Native private static final byte _menuPopup = Variant._menuGlyph + 1;
334
public static final Variant MENU_POPUP = new Variant(_menuPopup);
335
@Native private static final byte _menuPulldown = Variant._menuPopup + 1;
336
public static final Variant MENU_PULLDOWN = new Variant(_menuPulldown);
337
@Native private static final byte _menuHierarchical = Variant._menuPulldown + 1;
338
public static final Variant MENU_HIERARCHICAL = new Variant(_menuHierarchical);
339
340
@Native private static final byte _gradientListBackgroundEven = Variant._menuHierarchical + 1;
341
public static final Variant GRADIENT_LIST_BACKGROUND_EVEN = new Variant(_gradientListBackgroundEven);
342
@Native private static final byte _gradientListBackgroundOdd = Variant._gradientListBackgroundEven + 1;
343
public static final Variant GRADIENT_LIST_BACKGROUND_ODD = new Variant(_gradientListBackgroundOdd);
344
@Native private static final byte _gradientSideBar = Variant._gradientListBackgroundOdd + 1;
345
public static final Variant GRADIENT_SIDE_BAR = new Variant(_gradientSideBar);
346
@Native private static final byte _gradientSideBarSelection = Variant._gradientSideBar + 1;
347
public static final Variant GRADIENT_SIDE_BAR_SELECTION = new Variant(_gradientSideBarSelection);
348
@Native private static final byte _gradientSideBarFocusedSelection = Variant._gradientSideBarSelection + 1;
349
public static final Variant GRADIENT_SIDE_BAR_FOCUSED_SELECTION = new Variant(_gradientSideBarFocusedSelection);
350
}
351
352
public static class WindowType extends Property {
353
@Native private static final byte SHIFT = Variant.SHIFT + Variant.SIZE;
354
@Native private static final byte SIZE = 2;
355
@Native private static final long MASK = (long)0x3 << SHIFT;
356
private static final PropertyEncoding windowType = new PropertyEncoding(MASK, SHIFT);
357
358
WindowType(final byte value){
359
super(windowType, value);
360
}
361
362
@Native private static final byte _document = 1;
363
public static final WindowType DOCUMENT = new WindowType(_document);
364
@Native private static final byte _utility = 2;
365
public static final WindowType UTILITY = new WindowType(_utility);
366
@Native private static final byte _titlelessUtility = 3;
367
public static final WindowType TITLELESS_UTILITY = new WindowType(_titlelessUtility);
368
}
369
370
public static class Focused extends Property {
371
@Native private static final byte SHIFT = WindowType.SHIFT + WindowType.SIZE;
372
@Native private static final byte SIZE = 1;
373
@Native private static final long MASK = (long)0x1 << SHIFT;
374
private static final PropertyEncoding focused = new PropertyEncoding(MASK, SHIFT);
375
376
Focused(final byte value) {
377
super(focused, value);
378
}
379
380
@Native private static final byte _no = 0;
381
public static final Focused NO = new Focused(_no);
382
@Native private static final byte _yes = 1;
383
public static final Focused YES = new Focused(_yes);
384
}
385
386
public static class IndicatorOnly extends Property {
387
@Native private static final byte SHIFT = Focused.SHIFT + Focused.SIZE;
388
@Native private static final byte SIZE = 1;
389
@Native private static final long MASK = (long)0x1 << SHIFT;
390
private static final PropertyEncoding indicatorOnly = new PropertyEncoding(MASK, SHIFT);
391
392
IndicatorOnly(final byte value) {
393
super(indicatorOnly, value);
394
}
395
396
@Native private static final byte _no = 0;
397
public static final IndicatorOnly NO = new IndicatorOnly(_no);
398
@Native private static final byte _yes = 1;
399
public static final IndicatorOnly YES = new IndicatorOnly(_yes);
400
}
401
402
public static class NoIndicator extends Property {
403
@Native private static final byte SHIFT = IndicatorOnly.SHIFT + IndicatorOnly.SIZE;
404
@Native private static final byte SIZE = 1;
405
@Native private static final long MASK = (long)0x1 << SHIFT;
406
private static final PropertyEncoding noIndicator = new PropertyEncoding(MASK, SHIFT);
407
408
NoIndicator(final byte value) {
409
super(noIndicator, value);
410
}
411
412
@Native private static final byte _no = 0;
413
public static final NoIndicator NO = new NoIndicator(_no);
414
@Native private static final byte _yes = 1;
415
public static final NoIndicator YES = new NoIndicator(_yes);
416
}
417
418
public static class ArrowsOnly extends Property {
419
@Native private static final byte SHIFT = NoIndicator.SHIFT + NoIndicator.SIZE;
420
@Native private static final byte SIZE = 1;
421
@Native private static final long MASK = (long)0x1 << SHIFT;
422
private static final PropertyEncoding focused = new PropertyEncoding(MASK, SHIFT);
423
424
ArrowsOnly(final byte value) {
425
super(focused, value);
426
}
427
428
@Native private static final byte _no = 0;
429
public static final ArrowsOnly NO = new ArrowsOnly(_no);
430
@Native private static final byte _yes = 1;
431
public static final ArrowsOnly YES = new ArrowsOnly(_yes);
432
}
433
434
public static class FrameOnly extends Property {
435
@Native private static final byte SHIFT = ArrowsOnly.SHIFT + ArrowsOnly.SIZE;
436
@Native private static final byte SIZE = 1;
437
@Native private static final long MASK = (long)0x1 << SHIFT;
438
private static final PropertyEncoding focused = new PropertyEncoding(MASK, SHIFT);
439
440
FrameOnly(final byte value) {
441
super(focused, value);
442
}
443
444
@Native private static final byte _no = 0;
445
public static final FrameOnly NO = new FrameOnly(_no);
446
@Native private static final byte _yes = 1;
447
public static final FrameOnly YES = new FrameOnly(_yes);
448
}
449
450
public static class SegmentTrailingSeparator extends Property {
451
@Native private static final byte SHIFT = FrameOnly.SHIFT + FrameOnly.SIZE;
452
@Native private static final byte SIZE = 1;
453
@Native private static final long MASK = (long)0x1 << SHIFT;
454
private static final PropertyEncoding focused = new PropertyEncoding(MASK, SHIFT);
455
456
SegmentTrailingSeparator(final byte value) {
457
super(focused, value);
458
}
459
460
@Native private static final byte _no = 0;
461
public static final SegmentTrailingSeparator NO = new SegmentTrailingSeparator(_no);
462
@Native private static final byte _yes = 1;
463
public static final SegmentTrailingSeparator YES = new SegmentTrailingSeparator(_yes);
464
}
465
466
public static class SegmentLeadingSeparator extends Property {
467
@Native private static final byte SHIFT = SegmentTrailingSeparator.SHIFT + SegmentTrailingSeparator.SIZE;
468
@Native private static final byte SIZE = 1;
469
@Native private static final long MASK = (long)0x1 << SHIFT;
470
private static final PropertyEncoding leadingSeparator = new PropertyEncoding(MASK, SHIFT);
471
472
SegmentLeadingSeparator(final byte value) {
473
super(leadingSeparator, value);
474
}
475
476
@Native private static final byte _no = 0;
477
public static final SegmentLeadingSeparator NO = new SegmentLeadingSeparator(_no);
478
@Native private static final byte _yes = 1;
479
public static final SegmentLeadingSeparator YES = new SegmentLeadingSeparator(_yes);
480
}
481
482
public static class NothingToScroll extends Property {
483
@Native private static final byte SHIFT = SegmentLeadingSeparator.SHIFT + SegmentLeadingSeparator.SIZE;
484
@Native private static final byte SIZE = 1;
485
@Native private static final long MASK = (long)0x1 << SHIFT;
486
private static final PropertyEncoding focused = new PropertyEncoding(MASK, SHIFT);
487
488
NothingToScroll(final byte value) {
489
super(focused, value);
490
}
491
492
@Native private static final byte _no = 0;
493
public static final NothingToScroll NO = new NothingToScroll(_no);
494
@Native private static final byte _yes = 1;
495
public static final NothingToScroll YES = new NothingToScroll(_yes);
496
}
497
498
public static class WindowTitleBarSeparator extends Property {
499
@Native private static final byte SHIFT = NothingToScroll.SHIFT + NothingToScroll.SIZE;
500
@Native private static final byte SIZE = 1;
501
@Native private static final long MASK = (long)0x1 << SHIFT;
502
private static final PropertyEncoding focused = new PropertyEncoding(MASK, SHIFT);
503
504
WindowTitleBarSeparator(final byte value) {
505
super(focused, value);
506
}
507
508
@Native private static final byte _no = 0;
509
public static final WindowTitleBarSeparator NO = new WindowTitleBarSeparator(_no);
510
@Native private static final byte _yes = 1;
511
public static final WindowTitleBarSeparator YES = new WindowTitleBarSeparator(_yes);
512
}
513
514
public static class WindowClipCorners extends Property {
515
@Native private static final byte SHIFT = WindowTitleBarSeparator.SHIFT + WindowTitleBarSeparator.SIZE;
516
@Native private static final byte SIZE = 1;
517
@Native private static final long MASK = (long)0x1 << SHIFT;
518
private static final PropertyEncoding focused = new PropertyEncoding(MASK, SHIFT);
519
520
WindowClipCorners(final byte value) {
521
super(focused, value);
522
}
523
524
@Native private static final byte _no = 0;
525
public static final WindowClipCorners NO = new WindowClipCorners(_no);
526
@Native private static final byte _yes = 1;
527
public static final WindowClipCorners YES = new WindowClipCorners(_yes);
528
}
529
530
public static class ShowArrows extends Property {
531
@Native private static final byte SHIFT = WindowClipCorners.SHIFT + WindowClipCorners.SIZE;
532
@Native private static final byte SIZE = 1;
533
@Native private static final long MASK = (long)0x1 << SHIFT;
534
private static final PropertyEncoding showArrows = new PropertyEncoding(MASK, SHIFT);
535
536
ShowArrows(final byte value) {
537
super(showArrows, value);
538
}
539
540
@Native private static final byte _no = 0;
541
public static final ShowArrows NO = new ShowArrows(_no);
542
@Native private static final byte _yes = 1;
543
public static final ShowArrows YES = new ShowArrows(_yes);
544
}
545
546
public static class BooleanValue extends Property {
547
@Native private static final byte SHIFT = ShowArrows.SHIFT + ShowArrows.SIZE;
548
@Native private static final byte SIZE = 1;
549
@Native private static final long MASK = (long)0x1 << SHIFT;
550
private static final PropertyEncoding booleanValue = new PropertyEncoding(MASK, SHIFT);
551
552
BooleanValue(final byte value) {
553
super(booleanValue, value);
554
}
555
556
@Native private static final byte _no = 0;
557
public static final BooleanValue NO = new BooleanValue(_no);
558
@Native private static final byte _yes = 1;
559
public static final BooleanValue YES = new BooleanValue(_yes);
560
}
561
562
public static class Animating extends Property {
563
@Native private static final byte SHIFT = BooleanValue.SHIFT + BooleanValue.SIZE;
564
@Native private static final byte SIZE = 1;
565
@Native private static final long MASK = (long)0x1 << SHIFT;
566
private static final PropertyEncoding animating = new PropertyEncoding(MASK, SHIFT);
567
568
Animating(final byte value) {
569
super(animating, value);
570
}
571
572
@Native private static final byte _no = 0;
573
public static final Animating NO = new Animating(_no);
574
@Native private static final byte _yes = 1;
575
public static final Animating YES = new Animating(_yes);
576
}
577
578
public static class Widget extends Property {
579
@Native private static final byte SHIFT = Animating.SHIFT + Animating.SIZE;
580
@Native private static final byte SIZE = 7;
581
@Native private static final long MASK = (long)0x7F << SHIFT;
582
private static final PropertyEncoding widget = new PropertyEncoding(MASK, SHIFT);
583
584
Widget(final byte constant) {
585
super(widget, constant);
586
}
587
588
@Native private static final byte _background = 1;
589
public static final Widget BACKGROUND = new Widget(_background);
590
591
@Native private static final byte _buttonBevel = _background + 1;
592
public static final Widget BUTTON_BEVEL = new Widget(_buttonBevel);
593
@Native private static final byte _buttonBevelInset = _buttonBevel + 1;
594
public static final Widget BUTTON_BEVEL_INSET = new Widget(_buttonBevelInset);
595
@Native private static final byte _buttonBevelRound = _buttonBevelInset + 1;
596
public static final Widget BUTTON_BEVEL_ROUND = new Widget(_buttonBevelRound);
597
598
@Native private static final byte _buttonCheckBox = _buttonBevelRound + 1;
599
public static final Widget BUTTON_CHECK_BOX = new Widget(_buttonCheckBox);
600
601
@Native private static final byte _buttonComboBox = _buttonCheckBox + 1;
602
public static final Widget BUTTON_COMBO_BOX = new Widget(_buttonComboBox);
603
@Native private static final byte _buttonComboBoxInset = _buttonComboBox + 1;
604
public static final Widget BUTTON_COMBO_BOX_INSET = new Widget(_buttonComboBoxInset); // not hooked up in JRSUIConstants.m
605
606
@Native private static final byte _buttonDisclosure = _buttonComboBoxInset + 1;
607
public static final Widget BUTTON_DISCLOSURE = new Widget(_buttonDisclosure);
608
609
@Native private static final byte _buttonListHeader = _buttonDisclosure + 1;
610
public static final Widget BUTTON_LIST_HEADER = new Widget(_buttonListHeader);
611
612
@Native private static final byte _buttonLittleArrows = _buttonListHeader + 1;
613
public static final Widget BUTTON_LITTLE_ARROWS = new Widget(_buttonLittleArrows);
614
615
@Native private static final byte _buttonPopDown = _buttonLittleArrows + 1;
616
public static final Widget BUTTON_POP_DOWN = new Widget(_buttonPopDown);
617
@Native private static final byte _buttonPopDownInset = _buttonPopDown + 1;
618
public static final Widget BUTTON_POP_DOWN_INSET = new Widget(_buttonPopDownInset);
619
@Native private static final byte _buttonPopDownSquare = _buttonPopDownInset + 1;
620
public static final Widget BUTTON_POP_DOWN_SQUARE = new Widget(_buttonPopDownSquare);
621
622
@Native private static final byte _buttonPopUp = _buttonPopDownSquare + 1;
623
public static final Widget BUTTON_POP_UP = new Widget(_buttonPopUp);
624
@Native private static final byte _buttonPopUpInset = _buttonPopUp + 1;
625
public static final Widget BUTTON_POP_UP_INSET = new Widget(_buttonPopUpInset);
626
@Native private static final byte _buttonPopUpSquare = _buttonPopUpInset + 1;
627
public static final Widget BUTTON_POP_UP_SQUARE = new Widget(_buttonPopUpSquare);
628
629
@Native private static final byte _buttonPush = _buttonPopUpSquare + 1;
630
public static final Widget BUTTON_PUSH = new Widget(_buttonPush);
631
@Native private static final byte _buttonPushScope = _buttonPush + 1;
632
public static final Widget BUTTON_PUSH_SCOPE = new Widget(_buttonPushScope);
633
@Native private static final byte _buttonPushScope2 = _buttonPushScope + 1;
634
public static final Widget BUTTON_PUSH_SCOPE2 = new Widget(_buttonPushScope2);
635
@Native private static final byte _buttonPushTextured = _buttonPushScope2 + 1;
636
public static final Widget BUTTON_PUSH_TEXTURED = new Widget(_buttonPushTextured);
637
@Native private static final byte _buttonPushInset = _buttonPushTextured + 1;
638
public static final Widget BUTTON_PUSH_INSET = new Widget(_buttonPushInset);
639
@Native private static final byte _buttonPushInset2 = _buttonPushInset + 1;
640
public static final Widget BUTTON_PUSH_INSET2 = new Widget(_buttonPushInset2);
641
642
@Native private static final byte _buttonRadio = _buttonPushInset2 + 1;
643
public static final Widget BUTTON_RADIO = new Widget(_buttonRadio);
644
645
@Native private static final byte _buttonRound = _buttonRadio + 1;
646
public static final Widget BUTTON_ROUND = new Widget(_buttonRound);
647
@Native private static final byte _buttonRoundHelp = _buttonRound + 1;
648
public static final Widget BUTTON_ROUND_HELP = new Widget(_buttonRoundHelp);
649
@Native private static final byte _buttonRoundInset = _buttonRoundHelp + 1;
650
public static final Widget BUTTON_ROUND_INSET = new Widget(_buttonRoundInset);
651
@Native private static final byte _buttonRoundInset2 =_buttonRoundInset + 1;
652
public static final Widget BUTTON_ROUND_INSET2 = new Widget(_buttonRoundInset2);
653
654
@Native private static final byte _buttonSearchFieldCancel = _buttonRoundInset2 + 1;
655
public static final Widget BUTTON_SEARCH_FIELD_CANCEL = new Widget(_buttonSearchFieldCancel);
656
@Native private static final byte _buttonSearchFieldFind = _buttonSearchFieldCancel + 1;
657
public static final Widget BUTTON_SEARCH_FIELD_FIND = new Widget(_buttonSearchFieldFind);
658
659
@Native private static final byte _buttonSegmented = _buttonSearchFieldFind + 1;
660
public static final Widget BUTTON_SEGMENTED = new Widget(_buttonSegmented);
661
@Native private static final byte _buttonSegmentedInset = _buttonSegmented + 1;
662
public static final Widget BUTTON_SEGMENTED_INSET = new Widget(_buttonSegmentedInset);
663
@Native private static final byte _buttonSegmentedInset2 = _buttonSegmentedInset + 1;
664
public static final Widget BUTTON_SEGMENTED_INSET2 = new Widget(_buttonSegmentedInset2);
665
@Native private static final byte _buttonSegmentedSCurve = _buttonSegmentedInset2 + 1;
666
public static final Widget BUTTON_SEGMENTED_SCURVE = new Widget(_buttonSegmentedSCurve);
667
@Native private static final byte _buttonSegmentedTextured = _buttonSegmentedSCurve + 1;
668
public static final Widget BUTTON_SEGMENTED_TEXTURED = new Widget(_buttonSegmentedTextured);
669
@Native private static final byte _buttonSegmentedToolbar = _buttonSegmentedTextured + 1;
670
public static final Widget BUTTON_SEGMENTED_TOOLBAR = new Widget(_buttonSegmentedToolbar);
671
672
@Native private static final byte _dial = _buttonSegmentedToolbar + 1;
673
public static final Widget DIAL = new Widget(_dial);
674
675
@Native private static final byte _disclosureTriangle = _dial + 1;
676
public static final Widget DISCLOSURE_TRIANGLE = new Widget(_disclosureTriangle);
677
678
@Native private static final byte _dividerGrabber = _disclosureTriangle + 1;
679
public static final Widget DIVIDER_GRABBER = new Widget(_dividerGrabber);
680
@Native private static final byte _dividerSeparatorBar = _dividerGrabber + 1;
681
public static final Widget DIVIDER_SEPARATOR_BAR = new Widget(_dividerSeparatorBar);
682
@Native private static final byte _dividerSplitter = _dividerSeparatorBar + 1;
683
public static final Widget DIVIDER_SPLITTER = new Widget(_dividerSplitter);
684
685
@Native private static final byte _focus = _dividerSplitter + 1;
686
public static final Widget FOCUS = new Widget(_focus);
687
688
@Native private static final byte _frameGroupBox = _focus + 1;
689
public static final Widget FRAME_GROUP_BOX = new Widget(_frameGroupBox);
690
@Native private static final byte _frameGroupBoxSecondary = _frameGroupBox + 1;
691
public static final Widget FRAME_GROUP_BOX_SECONDARY = new Widget(_frameGroupBoxSecondary);
692
693
@Native private static final byte _frameListBox = _frameGroupBoxSecondary + 1;
694
public static final Widget FRAME_LIST_BOX = new Widget(_frameListBox);
695
696
@Native private static final byte _framePlacard = _frameListBox + 1;
697
public static final Widget FRAME_PLACARD = new Widget(_framePlacard);
698
699
@Native private static final byte _frameTextField = _framePlacard + 1;
700
public static final Widget FRAME_TEXT_FIELD = new Widget(_frameTextField);
701
@Native private static final byte _frameTextFieldRound = _frameTextField + 1;
702
public static final Widget FRAME_TEXT_FIELD_ROUND = new Widget(_frameTextFieldRound);
703
704
@Native private static final byte _frameWell = _frameTextFieldRound + 1;
705
public static final Widget FRAME_WELL = new Widget(_frameWell);
706
707
@Native private static final byte _growBox = _frameWell + 1;
708
public static final Widget GROW_BOX = new Widget(_growBox);
709
@Native private static final byte _growBoxTextured = _growBox + 1;
710
public static final Widget GROW_BOX_TEXTURED = new Widget(_growBoxTextured);
711
712
@Native private static final byte _gradient = _growBoxTextured + 1;
713
public static final Widget GRADIENT = new Widget(_gradient);
714
715
@Native private static final byte _menu = _gradient + 1;
716
public static final Widget MENU = new Widget(_menu);
717
@Native private static final byte _menuItem = _menu + 1;
718
public static final Widget MENU_ITEM = new Widget(_menuItem);
719
@Native private static final byte _menuBar = _menuItem + 1;
720
public static final Widget MENU_BAR = new Widget(_menuBar);
721
@Native private static final byte _menuTitle = _menuBar + 1;
722
public static final Widget MENU_TITLE = new Widget(_menuTitle);
723
724
@Native private static final byte _progressBar = _menuTitle + 1;
725
public static final Widget PROGRESS_BAR = new Widget(_progressBar);
726
@Native private static final byte _progressIndeterminateBar = _progressBar + 1;
727
public static final Widget PROGRESS_INDETERMINATE_BAR = new Widget(_progressIndeterminateBar);
728
@Native private static final byte _progressRelevance = _progressIndeterminateBar + 1;
729
public static final Widget PROGRESS_RELEVANCE = new Widget(_progressRelevance);
730
@Native private static final byte _progressSpinner = _progressRelevance + 1;
731
public static final Widget PROGRESS_SPINNER = new Widget(_progressSpinner);
732
733
@Native private static final byte _scrollBar = _progressSpinner + 1;
734
public static final Widget SCROLL_BAR = new Widget(_scrollBar);
735
736
@Native private static final byte _scrollColumnSizer = _scrollBar + 1;
737
public static final Widget SCROLL_COLUMN_SIZER = new Widget(_scrollColumnSizer);
738
739
@Native private static final byte _slider = _scrollColumnSizer + 1;
740
public static final Widget SLIDER = new Widget(_slider);
741
@Native private static final byte _sliderThumb = _slider + 1;
742
public static final Widget SLIDER_THUMB = new Widget(_sliderThumb);
743
744
@Native private static final byte _synchronization = _sliderThumb + 1;
745
public static final Widget SYNCHRONIZATION = new Widget(_synchronization);
746
747
@Native private static final byte _tab = _synchronization + 1;
748
public static final Widget TAB = new Widget(_tab);
749
750
@Native private static final byte _titleBarCloseBox = _tab + 1;
751
public static final Widget TITLE_BAR_CLOSE_BOX = new Widget(_titleBarCloseBox);
752
@Native private static final byte _titleBarCollapseBox = _titleBarCloseBox + 1;
753
public static final Widget TITLE_BAR_COLLAPSE_BOX = new Widget(_titleBarCollapseBox);
754
@Native private static final byte _titleBarZoomBox = _titleBarCollapseBox + 1;
755
public static final Widget TITLE_BAR_ZOOM_BOX = new Widget(_titleBarZoomBox);
756
757
@Native private static final byte _titleBarToolbarButton = _titleBarZoomBox + 1;
758
public static final Widget TITLE_BAR_TOOLBAR_BUTTON = new Widget(_titleBarToolbarButton);
759
760
@Native private static final byte _toolbarItemWell = _titleBarToolbarButton + 1;
761
public static final Widget TOOLBAR_ITEM_WELL = new Widget(_toolbarItemWell);
762
763
@Native private static final byte _windowFrame = _toolbarItemWell + 1;
764
public static final Widget WINDOW_FRAME = new Widget(_windowFrame);
765
}
766
767
public static class Hit {
768
@Native private static final int _unknown = -1;
769
public static final Hit UNKNOWN = new Hit(_unknown);
770
@Native private static final int _none = 0;
771
public static final Hit NONE = new Hit(_none);
772
@Native private static final int _hit = 1;
773
public static final Hit HIT = new Hit(_hit);
774
775
final int hit;
776
Hit(final int hit) { this.hit = hit; }
777
778
public boolean isHit() {
779
return hit > 0;
780
}
781
782
public String toString() {
783
return getConstantName(this);
784
}
785
}
786
787
public static class ScrollBarHit extends Hit {
788
@Native private static final int _thumb = 2;
789
public static final ScrollBarHit THUMB = new ScrollBarHit(_thumb);
790
791
@Native private static final int _trackMin = 3;
792
public static final ScrollBarHit TRACK_MIN = new ScrollBarHit(_trackMin);
793
@Native private static final int _trackMax = 4;
794
public static final ScrollBarHit TRACK_MAX = new ScrollBarHit(_trackMax);
795
796
@Native private static final int _arrowMin = 5;
797
public static final ScrollBarHit ARROW_MIN = new ScrollBarHit(_arrowMin);
798
@Native private static final int _arrowMax = 6;
799
public static final ScrollBarHit ARROW_MAX = new ScrollBarHit(_arrowMax);
800
@Native private static final int _arrowMaxInside = 7;
801
public static final ScrollBarHit ARROW_MAX_INSIDE = new ScrollBarHit(_arrowMaxInside);
802
@Native private static final int _arrowMinInside = 8;
803
public static final ScrollBarHit ARROW_MIN_INSIDE = new ScrollBarHit(_arrowMinInside);
804
805
ScrollBarHit(final int hit) { super(hit); }
806
}
807
808
static Hit getHit(final int hit) {
809
switch (hit) {
810
case Hit._none:
811
return Hit.NONE;
812
case Hit._hit:
813
return Hit.HIT;
814
815
case ScrollBarHit._thumb:
816
return ScrollBarHit.THUMB;
817
case ScrollBarHit._trackMin:
818
return ScrollBarHit.TRACK_MIN;
819
case ScrollBarHit._trackMax:
820
return ScrollBarHit.TRACK_MAX;
821
case ScrollBarHit._arrowMin:
822
return ScrollBarHit.ARROW_MIN;
823
case ScrollBarHit._arrowMax:
824
return ScrollBarHit.ARROW_MAX;
825
case ScrollBarHit._arrowMaxInside:
826
return ScrollBarHit.ARROW_MAX_INSIDE;
827
case ScrollBarHit._arrowMinInside:
828
return ScrollBarHit.ARROW_MIN_INSIDE;
829
}
830
return Hit.UNKNOWN;
831
}
832
833
static String getConstantName(final Object object) {
834
final Class<? extends Object> clazz = object.getClass();
835
try {
836
for (final Field field : clazz.getFields()) {
837
if (field.get(null) == object) {
838
return field.getName();
839
}
840
}
841
} catch (final Exception e) {}
842
return clazz.getSimpleName();
843
}
844
}
845
846