Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

TView.h

Go to the documentation of this file.
00001 /* 00002 File: TView.h 00003 00004 Version: 1.0 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 00044 #ifndef TView_H_ 00045 #define TView_H_ 00046 00047 #include <Carbon/Carbon.h> 00048 00049 #include "TObject.h" 00050 #include "TCarbonEvent.h" 00051 #include "TRect.h" 00052 00053 #define PURE_VIRTUAL 0 00054 00055 class TView 00056 : public TObject 00057 { 00058 public: 00059 // Bounds and Frame 00060 void SetFrame( 00061 const HIRect& inBounds ); 00062 HIRect Frame(); 00063 HIRect Bounds(); 00064 00065 void GetOptimalSize( 00066 HISize* outSize, 00067 float* outBaseLine ); 00068 00069 // Visibility 00070 void Show(); 00071 void Hide(); 00072 00073 OSStatus AddSubView( 00074 TView* inSubView ); 00075 OSStatus RemoveFromSuperView(); 00076 00077 // Accessors 00078 HIViewRef GetViewRef() 00079 { return (HIViewRef) GetObjectRef(); } 00080 void Hilite( 00081 ControlPartCode inPart ); 00082 ControlPartCode GetHilite(); 00083 WindowRef GetOwner(); 00084 SInt32 GetValue(); 00085 void SetValue( 00086 SInt32 inValue ); 00087 SInt32 GetMinimum(); 00088 void SetMinimum( 00089 SInt32 inMinimum ); 00090 SInt32 GetMaximum(); 00091 void SetMaximum( 00092 SInt32 inMaximum ); 00093 00094 // State 00095 Boolean IsVisible(); 00096 Boolean IsEnabled(); 00097 Boolean IsActive(); 00098 00099 OSStatus Invalidate(); // was SetNeedsDisplay() 00100 00101 protected: 00102 // Autoinvalidation 00103 enum { 00104 kAutoInvalidateOnActivate = (1 << 0), 00105 kAutoInvalidateOnHilite = (1 << 1), 00106 kAutoInvalidateOnEnable = (1 << 2), 00107 kAutoInvalidateOnValueChange = (1 << 3), 00108 kAutoInvalidateOnTitleChange = (1 << 4) 00109 }; 00110 void ChangeAutoInvalidateFlags( 00111 OptionBits inSetFlags, 00112 OptionBits inClearFlags ); 00113 OptionBits GetAutoInvalidateFlags() 00114 { return fAutoInvalidateFlags; } 00115 00116 // Construction/Destruction 00117 TView( 00118 HIViewRef inView ); 00119 virtual ~TView(); 00120 00121 virtual ControlKind GetKind() = PURE_VIRTUAL; 00122 virtual UInt32 GetBehaviors(); 00123 00124 // Notifications 00125 virtual void ActiveStateChanged(); 00126 virtual void BoundsChanged( 00127 UInt32 inOptions, 00128 const HIRect& inOriginalBounds, 00129 const HIRect& inCurrentBounds ); 00130 virtual void EnabledStateChanged(); 00131 virtual void HiliteChanged( 00132 ControlPartCode inOriginalPart, 00133 ControlPartCode inCurrentPart ); 00134 virtual void OwninmWindowChanged( 00135 WindowRef oldWindow, 00136 WindowRef newWindow ); 00137 virtual void VisibilityChanged(); 00138 virtual void TitleChanged(); 00139 virtual void ValueChanged(); 00140 00141 00142 // Handlers 00143 virtual OSStatus ControlHit( 00144 ControlPartCode inPart, 00145 UInt32 inModifiers ); 00146 virtual void Draw( 00147 RgnHandle inLimitRgn, 00148 CGContextRef inContext ); 00149 virtual OSStatus GetData( 00150 OSType inTag, 00151 ControlPartCode inPart, 00152 Size inSize, 00153 Size* outSize, 00154 void* inPtr ); 00155 virtual OSStatus GetRegion( 00156 ControlPartCode inPart, 00157 RgnHandle outRgn ); 00158 virtual ControlPartCode HitTest( 00159 const HIPoint& inWhere ); 00160 virtual OSStatus SetData( 00161 OSType inTag, 00162 ControlPartCode inPart, 00163 Size inSize, 00164 const void* inPtr ); 00165 virtual OSStatus SetFocusPart( 00166 ControlPartCode inDesiredFocus, 00167 Boolean inFocusEverything, 00168 ControlPartCode* outActualFocus ); 00169 virtual OSStatus TextInput( 00170 TCarbonEvent& inEvent ); 00171 virtual OSStatus Track( 00172 TCarbonEvent& inEvent, 00173 ControlPartCode* outPartHit ); 00174 00175 // Sizing 00176 virtual OSStatus GetSizeConstraints( 00177 HISize* outMin, 00178 HISize* outMax ); 00179 virtual OSStatus GetOptimalSizeSelf( 00180 HISize* outSize, 00181 float* outBaseLine ); 00182 00183 // Accessors 00184 WindowRef GetWindowRef() 00185 { return GetControlOwner( GetViewRef() ); } 00186 00187 00188 // Drag and drop 00189 virtual bool DragEnter( 00190 DragRef inDrag ); 00191 virtual bool DragWithin( 00192 DragRef inDrag ); 00193 virtual bool DragLeave( 00194 DragRef inDrag ); 00195 virtual OSStatus DragReceive( 00196 DragRef inDrag ); 00197 00198 // Command processing 00199 virtual OSStatus ProcessCommand( 00200 const HICommand& inCommand ); 00201 virtual OSStatus UpdateCommandStatus( 00202 const HICommand& inCommand ); 00203 00204 // Utility 00205 static OSStatus RegisterSubclass( 00206 CFStringRef inID, 00207 ConstructProc inProc ) 00208 { return TObject::RegisterSubclass( inID, kHIViewClassID, inProc ); } 00209 00210 enum Interface { 00211 kDragAndDrop = 1, 00212 kKeyboardFocus 00213 }; 00214 virtual OSStatus ActivateInterface( 00215 Interface inInterface ); 00216 00217 // Debugging 00218 virtual void PrintDebugInfoSelf(); 00219 00220 private: 00221 static pascal OSStatus ViewEventHandler( 00222 EventHandlerCallRef inCallRef, 00223 EventRef inEvent, 00224 void* inUserData ); 00225 OSStatus HandleEvent( 00226 EventHandlerCallRef inCallRef, 00227 TCarbonEvent& inEvent ); 00228 00229 HIViewRef fViewRef; 00230 EventHandlerRef fHandler; 00231 00232 OptionBits fAutoInvalidateFlags; 00233 }; 00234 00235 typedef TView* TViewPtr; 00236 00237 #endif // TView_H_





Generated on Sun May 23 09:05:17 2004 for AUGUI Framework by doxygen1.3.7

hosted on SourceForge.net Logo