~ubuntu-branches/ubuntu/karmic/likewise-open/karmic

« back to all changes in this revision

Viewing changes to domainjoin/domainjoin-gui/carbon/DomainJoin/HIFramework/TCarbonEvent.cp

  • Committer: Bazaar Package Importer
  • Author(s): Rick Clark
  • Date: 2008-08-27 08:56:20 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20080827085620-5q0f58b9qtog9myq
Tags: 4.1.0.2956-0ubuntu1
* missing-likewise-logo.diff: removed
* fixed copyright notice
* updated Standards-Version to 3.8.0
* removed path from command in prerm
* removed stop in S runlevel

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    File:               TCarbonEvent.cp
 
3
    
 
4
    Version:    1.1
 
5
 
 
6
        Disclaimer:     IMPORTANT:  This Apple software is supplied to you by Apple Computer, Inc.
 
7
                                ("Apple") in consideration of your agreement to the following terms, and your
 
8
                                use, installation, modification or redistribution of this Apple software
 
9
                                constitutes acceptance of these terms.  If you do not agree with these terms,
 
10
                                please do not use, install, modify or redistribute this Apple software.
 
11
 
 
12
                                In consideration of your agreement to abide by the following terms, and subject
 
13
                                to these terms, Apple grants you a personal, non-exclusive license, under Apple�s
 
14
                                copyrights in this original Apple software (the "Apple Software"), to use,
 
15
                                reproduce, modify and redistribute the Apple Software, with or without
 
16
                                modifications, in source and/or binary forms; provided that if you redistribute
 
17
                                the Apple Software in its entirety and without modifications, you must retain
 
18
                                this notice and the following text and disclaimers in all such redistributions of
 
19
                                the Apple Software.  Neither the name, trademarks, service marks or logos of
 
20
                                Apple Computer, Inc. may be used to endorse or promote products derived from the
 
21
                                Apple Software without specific prior written permission from Apple.  Except as
 
22
                                expressly stated in this notice, no other rights or licenses, express or implied,
 
23
                                are granted by Apple herein, including but not limited to any patent rights that
 
24
                                may be infringed by your derivative works or by other works in which the Apple
 
25
                                Software may be incorporated.
 
26
 
 
27
                                The Apple Software is provided by Apple on an "AS IS" basis.  APPLE MAKES NO
 
28
                                WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
 
29
                                WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 
30
                                PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
 
31
                                COMBINATION WITH YOUR PRODUCTS.
 
32
 
 
33
                                IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
 
34
                                CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 
35
                                GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 
36
                                ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION
 
37
                                OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT
 
38
                                (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN
 
39
                                ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
40
 
 
41
        Copyright � 2000-2005 Apple Computer, Inc., All Rights Reserved
 
42
*/
 
43
 
 
44
#include "TCarbonEvent.h"
 
45
 
 
46
//-----------------------------------------------------------------------------------
 
47
//      TCarbonEvent constructor
 
48
//-----------------------------------------------------------------------------------
 
49
//
 
50
TCarbonEvent::TCarbonEvent(
 
51
        UInt32                          inClass,
 
52
        UInt32                          inKind )
 
53
{
 
54
        CreateEvent( NULL, inClass, inKind, 0, 0, &fEvent );
 
55
}
 
56
 
 
57
//-----------------------------------------------------------------------------------
 
58
//      TCarbonEvent constructor
 
59
//-----------------------------------------------------------------------------------
 
60
//
 
61
TCarbonEvent::TCarbonEvent(
 
62
        EventRef                        inEvent )
 
63
{
 
64
        fEvent = inEvent;
 
65
        RetainEvent( fEvent );
 
66
}
 
67
 
 
68
//-----------------------------------------------------------------------------------
 
69
//      TCarbonEvent destructor
 
70
//-----------------------------------------------------------------------------------
 
71
//
 
72
TCarbonEvent::~TCarbonEvent()
 
73
{
 
74
        ReleaseEvent( fEvent );
 
75
}
 
76
 
 
77
//-----------------------------------------------------------------------------------
 
78
//      PostToQueue
 
79
//-----------------------------------------------------------------------------------
 
80
//
 
81
OSStatus
 
82
TCarbonEvent::PostToQueue(
 
83
        EventQueueRef           inQueue,
 
84
        EventPriority           inPriority )
 
85
{
 
86
        return PostEventToQueue( inQueue, fEvent, inPriority );
 
87
}
 
88
 
 
89
//-----------------------------------------------------------------------------------
 
90
//      SetParameter
 
91
//-----------------------------------------------------------------------------------
 
92
//
 
93
OSStatus
 
94
TCarbonEvent::SetParameter(
 
95
        EventParamName          inName,
 
96
        EventParamType          inType,
 
97
        UInt32                          inSize,
 
98
        const void*                     inData )
 
99
{
 
100
        return SetEventParameter( fEvent, inName, inType, inSize, inData );
 
101
}
 
102
 
 
103
//-----------------------------------------------------------------------------------
 
104
//      GetParameter
 
105
//-----------------------------------------------------------------------------------
 
106
//
 
107
OSStatus
 
108
TCarbonEvent::GetParameter(
 
109
        EventParamName          inName,
 
110
        EventParamType          inType,
 
111
        UInt32                          inBufferSize,
 
112
        void*                           outData )
 
113
{
 
114
        return GetEventParameter( fEvent, inName, inType, NULL, inBufferSize, NULL, outData );
 
115
}
 
116
 
 
117
//-----------------------------------------------------------------------------------
 
118
//      GetParameterType
 
119
//-----------------------------------------------------------------------------------
 
120
//
 
121
OSStatus
 
122
TCarbonEvent::GetParameterType(
 
123
        EventParamName          inName,
 
124
        EventParamType*         outType )
 
125
{
 
126
        return GetEventParameter( fEvent, inName, typeWildCard, outType, 0, NULL, NULL );
 
127
}
 
128
 
 
129
//-----------------------------------------------------------------------------------
 
130
//      GetParameterSize
 
131
//-----------------------------------------------------------------------------------
 
132
//
 
133
OSStatus
 
134
TCarbonEvent::GetParameterSize(
 
135
        EventParamName          inName,
 
136
        UInt32*                         outSize )
 
137
{
 
138
        return GetEventParameter( fEvent, inName, typeWildCard, NULL, 0, outSize, NULL );
 
139
}
 
140
 
 
141
//-----------------------------------------------------------------------------------
 
142
//      SetParameter
 
143
//-----------------------------------------------------------------------------------
 
144
//
 
145
OSStatus
 
146
TCarbonEvent::SetParameter(
 
147
        EventParamName          inName,
 
148
        Boolean                         inValue )
 
149
{
 
150
        return SetParameter<Boolean>( inName, typeBoolean, inValue );
 
151
}
 
152
 
 
153
//-----------------------------------------------------------------------------------
 
154
//      GetParameter
 
155
//-----------------------------------------------------------------------------------
 
156
//
 
157
OSStatus
 
158
TCarbonEvent::GetParameter(
 
159
        EventParamName          inName,
 
160
        Boolean*                        outValue )
 
161
{
 
162
        return GetParameter<Boolean>( inName, typeBoolean, outValue );
 
163
}
 
164
 
 
165
//-----------------------------------------------------------------------------------
 
166
//      SetParameter
 
167
//-----------------------------------------------------------------------------------
 
168
//
 
169
OSStatus
 
170
TCarbonEvent::SetParameter(
 
171
        EventParamName          inName,
 
172
        bool                            inValue )
 
173
{
 
174
        return SetParameter<Boolean>( inName, typeBoolean, (Boolean) inValue );
 
175
}
 
176
 
 
177
//-----------------------------------------------------------------------------------
 
178
//      GetParameter
 
179
//-----------------------------------------------------------------------------------
 
180
//
 
181
OSStatus
 
182
TCarbonEvent::GetParameter(
 
183
        EventParamName          inName,
 
184
        bool*                           outValue )
 
185
{
 
186
        return GetParameter<Boolean>( inName, sizeof( Boolean ), (Boolean*) outValue );
 
187
}
 
188
 
 
189
//-----------------------------------------------------------------------------------
 
190
//      SetParameter
 
191
//-----------------------------------------------------------------------------------
 
192
//
 
193
OSStatus
 
194
TCarbonEvent::SetParameter(
 
195
        EventParamName          inName,
 
196
        Point                           inPt )
 
197
{
 
198
        return SetParameter<Point>( inName, typeQDPoint, inPt );
 
199
}
 
200
 
 
201
//-----------------------------------------------------------------------------------
 
202
//      GetParameter
 
203
//-----------------------------------------------------------------------------------
 
204
//
 
205
OSStatus
 
206
TCarbonEvent::GetParameter(
 
207
        EventParamName          inName,
 
208
        Point*                          outPt )
 
209
{
 
210
        return GetParameter<Point>( inName, typeQDPoint, outPt );
 
211
}
 
212
 
 
213
//-----------------------------------------------------------------------------------
 
214
//      SetParameter
 
215
//-----------------------------------------------------------------------------------
 
216
//
 
217
OSStatus
 
218
TCarbonEvent::SetParameter(
 
219
        EventParamName          inName,
 
220
        const HIPoint&          inPt )
 
221
{
 
222
        return SetParameter<HIPoint>( inName, typeHIPoint, inPt );
 
223
}
 
224
 
 
225
//-----------------------------------------------------------------------------------
 
226
//      GetParameter
 
227
//-----------------------------------------------------------------------------------
 
228
//
 
229
OSStatus
 
230
TCarbonEvent::GetParameter(
 
231
        EventParamName          inName,
 
232
        HIPoint*                        outPt )
 
233
{
 
234
        return GetParameter<HIPoint>( inName, typeHIPoint, outPt );
 
235
}
 
236
 
 
237
//-----------------------------------------------------------------------------------
 
238
//      SetParameter
 
239
//-----------------------------------------------------------------------------------
 
240
//
 
241
OSStatus
 
242
TCarbonEvent::SetParameter(
 
243
        EventParamName          inName,
 
244
        const Rect&                     inRect )
 
245
{
 
246
        return SetParameter<Rect>( inName, typeQDRectangle, inRect );
 
247
}
 
248
 
 
249
//-----------------------------------------------------------------------------------
 
250
//      GetParameter
 
251
//-----------------------------------------------------------------------------------
 
252
//
 
253
OSStatus
 
254
TCarbonEvent::GetParameter(
 
255
        EventParamName          inName,
 
256
        Rect*                           outRect )
 
257
{
 
258
        return GetParameter<Rect>( inName, typeQDRectangle, outRect );
 
259
}
 
260
 
 
261
//-----------------------------------------------------------------------------------
 
262
//      SetParameter
 
263
//-----------------------------------------------------------------------------------
 
264
//
 
265
OSStatus
 
266
TCarbonEvent::SetParameter(
 
267
        EventParamName          inName,
 
268
        const HIRect&           inRect )
 
269
{
 
270
        return SetParameter<HIRect>( inName, typeHIRect, inRect );
 
271
}
 
272
 
 
273
//-----------------------------------------------------------------------------------
 
274
//      GetParameter
 
275
//-----------------------------------------------------------------------------------
 
276
//
 
277
OSStatus
 
278
TCarbonEvent::GetParameter(
 
279
        EventParamName          inName,
 
280
        HIRect*                         outRect )
 
281
{
 
282
        return GetParameter<HIRect>( inName, typeHIRect, outRect );
 
283
}
 
284
 
 
285
//-----------------------------------------------------------------------------------
 
286
//      SetParameter
 
287
//-----------------------------------------------------------------------------------
 
288
//
 
289
OSStatus
 
290
TCarbonEvent::SetParameter(
 
291
        EventParamName          inName,
 
292
        const HISize&           inSize )
 
293
{
 
294
        return SetParameter<HISize>( inName, typeHISize, inSize );
 
295
}
 
296
 
 
297
//-----------------------------------------------------------------------------------
 
298
//      GetParameter
 
299
//-----------------------------------------------------------------------------------
 
300
//
 
301
OSStatus
 
302
TCarbonEvent::GetParameter(
 
303
        EventParamName          inName,
 
304
        HISize*                         outSize )
 
305
{
 
306
        return GetParameter<HISize>( inName, typeHISize, outSize );
 
307
}
 
308
 
 
309
//-----------------------------------------------------------------------------------
 
310
//      SetParameter
 
311
//-----------------------------------------------------------------------------------
 
312
//
 
313
OSStatus
 
314
TCarbonEvent::SetParameter(
 
315
        EventParamName          inName,
 
316
        RgnHandle                       inRegion )
 
317
{
 
318
        return SetParameter<RgnHandle>( inName, typeQDRgnHandle, inRegion );
 
319
}
 
320
 
 
321
//-----------------------------------------------------------------------------------
 
322
//      GetParameter
 
323
//-----------------------------------------------------------------------------------
 
324
//
 
325
OSStatus
 
326
TCarbonEvent::GetParameter(
 
327
        EventParamName          inName,
 
328
        RgnHandle*                      outRegion )
 
329
{
 
330
        return GetParameter<RgnHandle>( inName, typeQDRgnHandle, outRegion );
 
331
}
 
332
 
 
333
//-----------------------------------------------------------------------------------
 
334
//      SetParameter
 
335
//-----------------------------------------------------------------------------------
 
336
//
 
337
OSStatus
 
338
TCarbonEvent::SetParameter(
 
339
        EventParamName          inName,
 
340
        WindowRef                       inWindow )
 
341
{
 
342
        return SetParameter<WindowRef>( inName, typeWindowRef, inWindow );
 
343
}
 
344
 
 
345
//-----------------------------------------------------------------------------------
 
346
//      GetParameter
 
347
//-----------------------------------------------------------------------------------
 
348
//
 
349
OSStatus
 
350
TCarbonEvent::GetParameter(
 
351
        EventParamName          inName,
 
352
        WindowRef*                      outWindow )
 
353
{
 
354
        return GetParameter<WindowRef>( inName, typeWindowRef, outWindow );
 
355
}
 
356
 
 
357
//-----------------------------------------------------------------------------------
 
358
//      SetParameter
 
359
//-----------------------------------------------------------------------------------
 
360
//
 
361
OSStatus
 
362
TCarbonEvent::SetParameter(
 
363
        EventParamName          inName,
 
364
        ControlRef                      inControl )
 
365
{
 
366
        return SetParameter<ControlRef>( inName, typeControlRef, inControl );
 
367
}
 
368
 
 
369
//-----------------------------------------------------------------------------------
 
370
//      GetParameter
 
371
//-----------------------------------------------------------------------------------
 
372
//
 
373
OSStatus
 
374
TCarbonEvent::GetParameter(
 
375
        EventParamName          inName,
 
376
        ControlRef* outControl )
 
377
{
 
378
        return GetParameter<ControlRef>( inName, typeControlRef, outControl );
 
379
}
 
380
 
 
381
//-----------------------------------------------------------------------------------
 
382
//      SetParameter
 
383
//-----------------------------------------------------------------------------------
 
384
//
 
385
OSStatus
 
386
TCarbonEvent::SetParameter(
 
387
        EventParamName          inName,
 
388
        MenuRef                         inMenu )
 
389
{
 
390
        return SetParameter<MenuRef>( inName, typeMenuRef, inMenu );
 
391
}
 
392
 
 
393
//-----------------------------------------------------------------------------------
 
394
//      GetParameter
 
395
//-----------------------------------------------------------------------------------
 
396
//
 
397
OSStatus
 
398
TCarbonEvent::GetParameter(
 
399
        EventParamName          inName,
 
400
        MenuRef*                        outMenu )
 
401
{
 
402
        return GetParameter<MenuRef>( inName, typeMenuRef, outMenu );
 
403
}
 
404
 
 
405
//-----------------------------------------------------------------------------------
 
406
//      SetParameter
 
407
//-----------------------------------------------------------------------------------
 
408
//
 
409
OSStatus
 
410
TCarbonEvent::SetParameter(
 
411
        EventParamName          inName,
 
412
        DragRef                         inDrag )
 
413
{
 
414
        return SetParameter<DragRef>( inName, typeDragRef, inDrag );
 
415
}
 
416
 
 
417
//-----------------------------------------------------------------------------------
 
418
//      GetParameter
 
419
//-----------------------------------------------------------------------------------
 
420
//
 
421
OSStatus
 
422
TCarbonEvent::GetParameter(
 
423
        EventParamName          inName,
 
424
        DragRef*                        outDrag )
 
425
{
 
426
        return GetParameter<DragRef>( inName, typeDragRef, outDrag );
 
427
}
 
428
 
 
429
//-----------------------------------------------------------------------------------
 
430
//      SetParameter
 
431
//-----------------------------------------------------------------------------------
 
432
//
 
433
OSStatus
 
434
TCarbonEvent::SetParameter(
 
435
        EventParamName          inName,
 
436
        UInt32                          inValue )
 
437
{
 
438
        return SetParameter<UInt32>( inName, typeUInt32, inValue );
 
439
}
 
440
 
 
441
//-----------------------------------------------------------------------------------
 
442
//      GetParameter
 
443
//-----------------------------------------------------------------------------------
 
444
//
 
445
OSStatus
 
446
TCarbonEvent::GetParameter(
 
447
        EventParamName          inName,
 
448
        UInt32*                         outValue )
 
449
{
 
450
        return GetParameter<UInt32>( inName, typeUInt32, outValue );
 
451
}
 
452
 
 
453
//-----------------------------------------------------------------------------------
 
454
//      SetParameter
 
455
//-----------------------------------------------------------------------------------
 
456
//
 
457
OSStatus
 
458
TCarbonEvent::SetParameter(
 
459
        EventParamName          inName,
 
460
        const HICommand&        inValue )
 
461
{
 
462
        return SetParameter<HICommand>( inName, typeHICommand, inValue );
 
463
}
 
464
 
 
465
//-----------------------------------------------------------------------------------
 
466
//      GetParameter
 
467
//-----------------------------------------------------------------------------------
 
468
//
 
469
OSStatus
 
470
TCarbonEvent::GetParameter(
 
471
        EventParamName          inName,
 
472
        HICommand*                      outValue )
 
473
{
 
474
        return GetParameter<HICommand>( inName, typeHICommand, outValue );
 
475
}
 
476
 
 
477
//-----------------------------------------------------------------------------------
 
478
//      SetParameter
 
479
//-----------------------------------------------------------------------------------
 
480
//
 
481
OSStatus
 
482
TCarbonEvent::SetParameter(
 
483
        EventParamName                          inName,
 
484
        const HICommandExtended&        inValue )
 
485
{
 
486
        return SetParameter<HICommandExtended>( inName, typeHICommand, inValue );
 
487
}
 
488
 
 
489
//-----------------------------------------------------------------------------------
 
490
//      GetParameter
 
491
//-----------------------------------------------------------------------------------
 
492
//
 
493
OSStatus
 
494
TCarbonEvent::GetParameter(
 
495
        EventParamName          inName,
 
496
        HICommandExtended*      outValue )
 
497
{
 
498
        return GetParameter<HICommandExtended>( inName, typeHICommand, outValue );
 
499
}
 
500
 
 
501
//-----------------------------------------------------------------------------------
 
502
//      SetParameter
 
503
//-----------------------------------------------------------------------------------
 
504
//
 
505
OSStatus
 
506
TCarbonEvent::SetParameter(
 
507
        EventParamName                  inName,
 
508
        const ControlPartCode&  inValue )
 
509
{
 
510
        return SetParameter<ControlPartCode>( inName, typeControlPartCode, inValue );
 
511
}
 
512
 
 
513
//-----------------------------------------------------------------------------------
 
514
//      GetParameter
 
515
//-----------------------------------------------------------------------------------
 
516
//
 
517
OSStatus
 
518
TCarbonEvent::GetParameter(
 
519
        EventParamName          inName,
 
520
        ControlPartCode*        outValue )
 
521
{
 
522
        return GetParameter<ControlPartCode>( inName, typeControlPartCode, outValue );
 
523
}