/Users/airy/Sources/augui/AUGUIFramework/AU View/ColorSwatch.h

Go to the documentation of this file.
00001 /*
00002         File:           ColorSwatch.h
00003 
00004     Version:    Mac OS X
00005 
00006         Disclaimer:     IMPORTANT:  This Apple software is supplied to you by Apple Computer, Inc.
00007                                 ("Apple") in consideration of your agreement to the following terms, and your
00008                                 use, installation, modification or redistribution of this Apple software
00009                                 constitutes acceptance of these terms.  If you do not agree with these terms,
00010                                 please do not use, install, modify or redistribute this Apple software.
00011 
00012                                 In consideration of your agreement to abide by the following terms, and subject
00013                                 to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs
00014                                 copyrights in this original Apple software (the "Apple Software"), to use,
00015                                 reproduce, modify and redistribute the Apple Software, with or without
00016                                 modifications, in source and/or binary forms; provided that if you redistribute
00017                                 the Apple Software in its entirety and without modifications, you must retain
00018                                 this notice and the following text and disclaimers in all such redistributions of
00019                                 the Apple Software.  Neither the name, trademarks, service marks or logos of
00020                                 Apple Computer, Inc. may be used to endorse or promote products derived from the
00021                                 Apple Software without specific prior written permission from Apple.  Except as
00022                                 expressly stated in this notice, no other rights or licenses, express or implied,
00023                                 are granted by Apple herein, including but not limited to any patent rights that
00024                                 may be infringed by your derivative works or by other works in which the Apple
00025                                 Software may be incorporated.
00026 
00027                                 The Apple Software is provided by Apple on an "AS IS" basis.  APPLE MAKES NO
00028                                 WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
00029                                 WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00030                                 PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
00031                                 COMBINATION WITH YOUR PRODUCTS.
00032 
00033                                 IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
00034                                 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
00035                                 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00036                                 ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION
00037                                 OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT
00038                                 (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN
00039                                 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00040 
00041         Copyright © 2002 Apple Computer, Inc., All Rights Reserved
00042 */
00043 // MODIFIED FOR AUGUI PROJECT
00044 
00045 #ifndef ColorSwatch_TVIEW
00046 #define ColorSwatch_TVIEW
00047 
00048 #include <Carbon/Carbon.h>
00049 
00050 #include "TViewNoCompositingCompatible.h"
00051 
00052 #define kFlavorTypeColor                'colr'
00053 
00054 #define kControlSwatchColorTag  'colr'
00055 
00056 OSStatus
00057 HIColorSwatchGetColor(
00058         ControlRef                      inControl,
00059         RGBColor*                       outColor );
00060         
00061 OSStatus
00062 HIColorSwatchSetColor(
00063         ControlRef                      inControl,
00064         RGBColor                        inColor );
00065 
00066 
00067 // ColorSwatch
00068 class ColorSwatch
00069         :       public TViewNoCompositingCompatible
00070 {
00071         AUGUIDefineControl(ColorSwatch, TViewNoCompositingCompatible, "color");
00072         protected:
00073                 // Construction/Destruction
00074                                                                 ColorSwatch(
00075                                                                         HIViewRef                       inControl );
00076                                                                 ~ColorSwatch();
00077                 
00078                 ControlKind                             GetKind();
00079                 
00080                 // Handlers
00081                 
00082                 UInt32                                  GetBehaviors();
00083                 
00084                 OSStatus                                GetData(
00085                                                                         OSType                          inTag,
00086                                                                         ControlPartCode         inPart,
00087                                                                         Size                            inSize,
00088                                                                         Size*                           outSize,
00089                                                                         void*                           inPtr );
00090         
00091                 OSStatus                                SetData(
00092                                                                         OSType                          inTag,
00093                                                                         ControlPartCode         inPart,
00094                                                                         Size                            inSize,
00095                                                                         const void*                     inPtr );
00096                 
00097                 OSStatus                                ControlHit(
00098                                                                         ControlPartCode         inPart,
00099                                                                         UInt32                          inModifiers );
00100                 
00101                 OSStatus                                Track(
00102                                                                         TCarbonEvent&           inEvent,
00103                                                                         ControlPartCode*        outPartHit );
00104                 
00105                 void            CompatibleDraw(RgnHandle inLimitRgn, CGContextRef inContext, bool  inCompositing );
00106                 
00107                 ControlPartCode                 HitTest(
00108                                                                         const HIPoint&          inWhere );
00109                 
00110                 OSStatus                                GetRegion(
00111                                                                         ControlPartCode         inPart,
00112                                                                         RgnHandle                       outRgn );
00113                 
00114                 OSStatus                                TextInput( TCarbonEvent& inEvent );
00115                 
00116                 OSStatus                                GetSizeConstraints(
00117                                                                         HISize*                         outMin,
00118                                                                         HISize*                         outMax );
00119                 
00120                 OSStatus                                GetOptimalSize(
00121                                                                         HISize*                         outSize,
00122                                                                         float*                          outBaseLine );
00123                 
00124                 // Drag and drop
00125                 bool                                    DragEnter(
00126                                                                         DragRef                         inDrag );
00127                         
00128                 bool                                    DragLeave(
00129                                                                         DragRef                         inDrag );
00130                 
00131                 OSStatus                                DragReceive(
00132                                                                         DragRef                         inDrag );
00133                 
00134         private:
00135                 RGBColor                                fSwatchColor;
00136                 float                                   fAlpha;
00137                 RgnHandle                               fSwatchRgn;
00138                 bool                                    fCanAcceptDrag;
00139                 
00140                 void                                    PerformColorDrag(
00141                                                                         EventRef                        inEvent );
00142                         
00143                 bool                                    GetColorFromDrag(
00144                                                                         DragRef                         inDragRef,
00145                                                                         RGBColor*                       inColor );
00146                 
00147                 OSStatus                                SendColorChangedCommandEvent();
00148 };
00149 
00150 typedef ColorSwatch*                            ColorSwatchPtr;
00151 
00152 #endif // ColorSwatch_TVIEW





Generated on Sat Jul 8 13:02:17 2006 for AUGUI Framework by doxygen1.4.6

hosted on SourceForge.net Logo