Copyright clean-up (part 1):
[AROS.git] / test / oop / hidd.cs
blob31c5392f0a994b0933e4fdd3f209ee6e1bd5f107
1 /*
2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 /*
7 This is an example for a pseudolanguage to use our OOP
8 system in C.
9 */
11 class HIDD
13 version 41.0;
15 /* This is a global constant for this class */
16 const ClassTable = 0;
19 FindHIDD takes three arguments: A string with the type
20 and the subtype of the HIDD (eg. "gfx"/"printer")
21 and a list of attributes.
23 It returns an array of HIDDs which match the specified
24 attributes.
26 Array findHIDD
28 String type,
29 String subType,
30 TagArray attrs
33 hiddTableLock.lock ();
35 Array hiddTable = classTable.get (type);
36 Array hidds = Array (hiddTable.len ());
38 ULONG t;
39 for (t=0; hiddTable[t]; t++)
41 if (!strcasecmp (hiddTable[t].subType, subType)
42 && hiddTable[t].match (attrs)
45 hidds.append (hiddTable[t])
49 hiddTableLock.unlock ();
51 return hidds;
54 /* These are global class variables */
55 static HashTable hiddTable = HashTable (256, HashTable.calcStringHashCode);
56 static Semaphore hiddTableLock = Semaphore ();
59 class Window
61 /* Position and size of the window. The attribute can be read
62 and written from outside. */
63 [RW] UWORD x, y, width, height;
64 [RW] UWORD minWidth, minHeight, maxWidth, maxHeight;
66 /* Before writing to width, execute this code */
67 pre W width
69 if (width < 0)
70 Raise IllegalValue ("width (%d) too small, must be > 0", width);
72 if (width < minWidth)
73 /* This could also raise an error */
74 width = minWidth;
76 if (width > maxWidth)
77 width = maxWidth;
80 post W width
82 this.resize (this.width, this.height);
85 ...