old quark gui: openOS is not osx only
[supercollider.git] / SCClassLibrary / QtCollider / enums.sc
blob4fe3afcb784ec6dfd5885f44895fdd99c2c376b0
1 QAlignment {
2   classvar dict;
4   *initClass {
5     dict = IdentityDictionary.new;
6     dict.put( \left, 16r1 | 16r80 );
7     dict.put( \center, 16r4 | 16r80 );
8     dict.put( \right, 16r2 | 16r80 );
9     dict.put( \topLeft, 16r1 | 16r20 );
10     dict.put( \top, 16r4 | 16r20 );
11     dict.put( \topRight, 16r2 | 16r20 );
12     dict.put( \bottomLeft, 16r1 | 16r40 );
13     dict.put( \bottom, 16r4 | 16r40 );
14     dict.put( \bottomRight, 16r2 | 16r40 );
15   }
17   *new { arg alignment; ^dict[alignment]; }
20 QOrientation {
21   classvar dict;
23   *initClass {
24     dict = IdentityDictionary.new;
25     dict.put( \horizontal, 1 );
26     dict.put( \vertical, 2 );
27   }
29   *new { arg alignment; ^dict[alignment]; }
32 QLimits {
33   classvar dict;
35   *initClass {
36     dict = IdentityDictionary.new;
37     dict.put( \maxWidgetSize, 16777215 );
38   }
40   *new { arg limit; ^dict[limit]; }
43 QKey {
44   classvar
45     <left = 16r1000012,
46     <up = 16r1000013,
47     <right = 16r1000014,
48     <down = 16r1000015;
51 QKeyModifiers {
52   classvar
53     <shift = 16r2000000,
54     <control = 16r4000000,
55     <alt = 16r8000000,
56     <meta = 16r10000000,
57     <keypad = 16r20000000;
59   *toCocoa { arg mods;
60     var cmods = 0;
61     if (mods & QKeyModifiers.shift > 0) {cmods = cmods | 131072};
62     if (mods & QKeyModifiers.alt > 0 ) {cmods = cmods | 524288};
63     Platform.case (
64       \osx,
65           {
66             if (mods & QKeyModifiers.control > 0) {cmods = cmods | 1048576}; // Cmd
67             if (mods & QKeyModifiers.meta > 0) {cmods = cmods | 262144}; // Ctrl
68           },
69       { if (mods & QKeyModifiers.control > 0) {cmods = cmods | 262144} } // Ctrl
70     );
71     if (mods & QKeyModifiers.keypad > 0) {cmods = cmods | 2097152};
72     // TODO: caps-lock, func, help
73     ^cmods;
74   }
77 QWebFontFamily {
78   classvar
79     <standard = 0,
80     <fixed = 1,
81     <serif = 2,
82     <sansSerif = 3,
83     <cursive = 4,
84     <fantasy = 5;
86   *new { arg symbol; ^this.perform(symbol); }
89 QCurve {
90   classvar
91     <step = 0,
92     <linear = 1, <lin = 1,
93     <sine = 2, <sin = 2,
94     <welch = 3, <wel = 3,
95     <exponential = 4, <exp = 4,
96     <squared = 5, <sqr = 5,
97     <cubed = 6, <cub = 6;
99   *new { arg curve;
100     ^ if (curve.isNumber) {curve.asFloat} {this.perform(curve).asInteger};
101   }