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

TViewNoCompositingCompatible Class Reference

Base class for all the controls of the SDK. More...

#include <TViewNoCompositingCompatible.h>

Inheritance diagram for TViewNoCompositingCompatible:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 TViewNoCompositingCompatible (HIViewRef inControl)
 ~TViewNoCompositingCompatible ()
virtual void FlushStaticBackground ()
 Force the static background to be rebuild.

virtual void Draw (RgnHandle inLimitRgn, CGContextRef inContext)
 Build a context for non-compositing window, draw the background and call the CompatibleDraw method.

virtual void DrawStaticBackground (RgnHandle inLimitRgn, CGContextRef inContext, bool inCompositing)
virtual void CompatibleDraw (RgnHandle inLimitRgn, CGContextRef inContext, bool inCompositing)=0
virtual OSStatus SetUpTracking (TCarbonEvent &inEvent)
 This method will be called by Track() if a subclass has overridden UseNonblockingTracking() to return false.

virtual OSStatus StartTracking (TCarbonEvent &inEvent, HIPoint &from)
 Called at the beginning of tracking.

virtual OSStatus StillTracking (TCarbonEvent &inEvent, HIPoint &from)
 Called whenever the mouse is moving during tracking.

virtual OSStatus StopTracking (TCarbonEvent &inEvent, HIPoint &from)
 Called at the end of tracking.

virtual OSStatus Track (TCarbonEvent &inEvent, ControlPartCode *outPartHit)
 Will automatically call SetUpTracking() if the result of UseNonblockingTracking() is true.

virtual OSStatus GetData (OSType inTag, ControlPartCode inPart, Size inSize, Size *outSize, void *inPtr)
 Get some data about the view Only 'TVew' is supported.

virtual OSStatus GetRegion (ControlPartCode inPart, RgnHandle outRgn)
virtual ControlPartCode HitTest (const HIPoint &inWhere)
virtual OSStatus ControlHit (ControlPartCode inPart, UInt32 inModifiers)
virtual UInt32 GetBehaviors ()
virtual bool UseNonblockingTracking ()
 To enable the non-blocking tracking a subclass must override this method to return true.

virtual void DrawBackgroundImage (CGContextRef context)
 Draw background image into the context.

bool IsCompositing ()
 Return true if the view is in a compositing window.

void ConvertToGlobal (HIPoint &thePoint)
 Convert the local point to window (x,y).

void ConvertToLocal (HIPoint &thePoint)
 Convert the point to view local (x,y).


Static Public Member Functions

OSStatus RegisterSubclass (CFStringRef inID, ConstructProc inProc)
 This routine should be called by subclasses so they can be created as HIObjects.

OSStatus UnRegisterSubclass (CFStringRef inID)
 This routine should be called by subclasses to unregister themself.

void SetClassBundle (CFBundleRef sBundle)
template<class V> CFStringRef CopyClassIDForBundleID (CFStringRef bundleID)
 See AUGUI::CopyClassForBundleID().

template<class V> CFStringRef CopyCanonicalClassID ()
 See AUGUI::CopyCanonicalClassID().

template<class V> void RegisterClassForBundleID (CFStringRef str)
 Register the given class.

template<class V> void UnRegisterClassForBundleID (CFStringRef str)
template<class V> OSStatus Construct (HIObjectRef inBaseObject, TObject **outInstance)
template<class V> OSStatus Create (HIViewRef *outControl, const HIRect *inBounds, WindowRef inWindow, CFStringRef classID)
void UnRegisterAllClasses ()
void SetWindowReady (bool ready)

Static Public Attributes

const OSType theViewTag = 'TVew'

Protected Member Functions

virtual OSStatus mouseDragged (TCarbonEvent &inEvent)
 Our static mouseDragged event handler proc.

virtual OSStatus mouseUp (TCarbonEvent &inEvent)
 Our static mouseUp event handler proc.

void PrerenderStaticBackground ()
 Create the offscreen CGImageRef containing the background of the control to speed up redraw.


Protected Attributes

CFBundleRef mBundleRef

Detailed Description

Base class for all the controls of the SDK.

The custom controls classes you to use non standard controls for your GUI, like knobs, customs sliders or others.

One of the easiest way for developing custom controls, is to use Apple's HIFramework, available on Apple sample code site.

Unfortunately, it not compatible for controls embedded in windows with compositing flag.

In order to solve this problem, the SDK is offering a TViewNoCompositingCompatible class.

Just inherit from this class instead of TView, and replace your Draw( RgnHandle inLimitRgn, CGContextRef inContext) method by CompatibleDraw( RgnHandle * inLimitRgn, CGContextRef inContext,bool inCompositing ). The additional "inCompositing" flag let your control knows the kind of windows it does belongs to, if it does need it. The TViewNoCompositingCompatible class automatically build a context and release it if it is needed.

If you control needs mouse tracking (slider, knob...), instead of overriding Track and using TrackMouseLocation, you should override StillTracking, which is called each time the mouse is dragged, in a non-blocking way. That makes your host happier, since it still run while you are tracking. You can add additionnal code in StartTracking, called at the beginning of the tracking, and StopTracking, called at the end.

All custom control classes should provide a GetControlName() method that return the unique ID of the class.

For example, if you choose to define a "slider" class, you could define : static CFStringRef mySliderClass::GetControlName() { return CFSTR("myslider");};

To register your class, the RegisterClassForBundleID template method should be called in your InitWindows GUI class : TViewNoCompositingCompatible::RegisterClassForBundleID<mySliderClass>(mBundleID);

And you should set the classID of your sliders in you .nib file to "your_AU_bundle_id.myslider"


Constructor & Destructor Documentation

TViewNoCompositingCompatible::TViewNoCompositingCompatible HIViewRef  inControl  ) 
 

TViewNoCompositingCompatible::~TViewNoCompositingCompatible  ) 
 


Member Function Documentation

virtual void TViewNoCompositingCompatible::CompatibleDraw RgnHandle  inLimitRgn,
CGContextRef  inContext,
bool  inCompositing
[pure virtual]
 

Implemented in TEnvelop, TImageButton, TImagePopup, TKnobControl, TMeterControl, TMeterPartialControl, TMultiPane, TPngPictControl, TSliderControl, TTransparentEditText, TValuePictControl, TValueTextControl, and TXYControl.

template<class V>
OSStatus TViewNoCompositingCompatible::Construct HIObjectRef  inBaseObject,
TObject **  outInstance
[static]
 

OSStatus TViewNoCompositingCompatible::ControlHit ControlPartCode  inPart,
UInt32  inModifiers
[virtual]
 

Reimplemented in TValuePictButtonControl.

void TViewNoCompositingCompatible::ConvertToGlobal HIPoint &  thePoint  ) 
 

Convert the local point to window (x,y).

void TViewNoCompositingCompatible::ConvertToLocal HIPoint &  thePoint  ) 
 

Convert the point to view local (x,y).

template<class V>
CFStringRef TViewNoCompositingCompatible::CopyCanonicalClassID  )  [static]
 

See AUGUI::CopyCanonicalClassID().

template<class V>
CFStringRef TViewNoCompositingCompatible::CopyClassIDForBundleID CFStringRef  bundleID  )  [static]
 

See AUGUI::CopyClassForBundleID().

template<class V>
OSStatus TViewNoCompositingCompatible::Create HIViewRef *  outControl,
const HIRect *  inBounds,
WindowRef  inWindow,
CFStringRef  classID
[static]
 

void TViewNoCompositingCompatible::Draw RgnHandle  inLimitRgn,
CGContextRef  inContext
[virtual]
 

Build a context for non-compositing window, draw the background and call the CompatibleDraw method.

Reimplemented in TMultiPane.

void TViewNoCompositingCompatible::DrawBackgroundImage CGContextRef  context  )  [virtual]
 

Draw background image into the context.

Only the background part of the image hierarchy is taken in account (we suppose no visible part of controls are overlapping)

virtual void TViewNoCompositingCompatible::DrawStaticBackground RgnHandle  inLimitRgn,
CGContextRef  inContext,
bool  inCompositing
[inline, virtual]
 

Reimplemented in TEnvelop, TKnobControl, TPngPictControl, TSliderControl, TTransparentEditText, and TXYControl.

void TViewNoCompositingCompatible::FlushStaticBackground  )  [virtual]
 

Force the static background to be rebuild.

virtual UInt32 TViewNoCompositingCompatible::GetBehaviors  )  [inline, virtual]
 

GetBehaviors

Reimplemented in TEnvelop, TImageButton, TImagePopup, TMultiPane, TPngPictControl, TSliderControl, TTransparentEditText, and TValueTextControl.

OSStatus TViewNoCompositingCompatible::GetData OSType  inTag,
ControlPartCode  inPart,
Size  inSize,
Size *  outSize,
void *  inPtr
[virtual]
 

Get some data about the view Only 'TVew' is supported.

It is returning the C++ object.

Reimplemented in TEnvelop, TImageButton, TImagePopup, TPngPictControl, TSliderControl, TTransparentEditText, and TXYControl.

OSStatus TViewNoCompositingCompatible::GetRegion ControlPartCode  inPart,
RgnHandle  outRgn
[virtual]
 

Reimplemented in TImagePopup, and TTransparentEditText.

ControlPartCode TViewNoCompositingCompatible::HitTest const HIPoint &  inWhere  )  [virtual]
 

Reimplemented in TImagePopup, and TTransparentEditText.

bool TViewNoCompositingCompatible::IsCompositing  ) 
 

Return true if the view is in a compositing window.

OSStatus TViewNoCompositingCompatible::mouseDragged TCarbonEvent &  inEvent  )  [protected, virtual]
 

Our static mouseDragged event handler proc.

OSStatus TViewNoCompositingCompatible::mouseUp TCarbonEvent &  inEvent  )  [protected, virtual]
 

Our static mouseUp event handler proc.

void TViewNoCompositingCompatible::PrerenderStaticBackground  )  [protected]
 

Create the offscreen CGImageRef containing the background of the control to speed up redraw.

It does include the window background and the static part of the control, drawn by DrawStaticBackground method

template<class V>
void TViewNoCompositingCompatible::RegisterClassForBundleID CFStringRef  str  )  [static]
 

Register the given class.

OSStatus TViewNoCompositingCompatible::RegisterSubclass CFStringRef  inID,
ConstructProc  inProc
[static]
 

This routine should be called by subclasses so they can be created as HIObjects.

void TViewNoCompositingCompatible::SetClassBundle CFBundleRef  sBundle  )  [static]
 

OSStatus TViewNoCompositingCompatible::SetUpTracking TCarbonEvent &  inEvent  )  [virtual]
 

This method will be called by Track() if a subclass has overridden UseNonblockingTracking() to return false.

Subclasses that do not call this will inherit the default tracking behaviour. Handlers for the MouseUp and MouseDragged events are installed. The control subclass must then override StillTracking instead of Track in order to get this behavior.

See also:
UseDefaultTracking()

void TViewNoCompositingCompatible::SetWindowReady bool  ready  )  [inline, static]
 

OSStatus TViewNoCompositingCompatible::StartTracking TCarbonEvent &  inEvent,
HIPoint &  from
[virtual]
 

Called at the beginning of tracking.

Reimplemented in TEnvelop, TMeterControl, TSliderControl, TTransparentEditText, and TXYControl.

OSStatus TViewNoCompositingCompatible::StillTracking TCarbonEvent &  inEvent,
HIPoint &  from
[virtual]
 

Called whenever the mouse is moving during tracking.

Reimplemented in TEnvelop, TKnobControl, TMeterControl, TSliderControl, TTransparentEditText, TValuePictButtonControl, TValuePictControl, TValueTextControl, and TXYControl.

OSStatus TViewNoCompositingCompatible::StopTracking TCarbonEvent &  inEvent,
HIPoint &  from
[virtual]
 

Called at the end of tracking.

Our default implementation calls the HitTest() method to determine which part of the control the mouse was over when the button was released. This part code is set in inEvent.

OSStatus TViewNoCompositingCompatible::Track TCarbonEvent &  inEvent,
ControlPartCode *  outPartHit
[virtual]
 

Will automatically call SetUpTracking() if the result of UseNonblockingTracking() is true.

If false, this method will return the eventNotHandledErr error code to invoke default mouse tracking.

Reimplemented in TImageButton, and TImagePopup.

void TViewNoCompositingCompatible::UnRegisterAllClasses  )  [static]
 

template<class V>
void TViewNoCompositingCompatible::UnRegisterClassForBundleID CFStringRef  str  )  [static]
 

OSStatus TViewNoCompositingCompatible::UnRegisterSubclass CFStringRef  inID  )  [static]
 

This routine should be called by subclasses to unregister themself.

virtual bool TViewNoCompositingCompatible::UseNonblockingTracking  )  [inline, virtual]
 

To enable the non-blocking tracking a subclass must override this method to return true.

Reimplemented in TEnvelop, TKnobControl, TSliderControl, TTransparentEditText, TValuePictButtonControl, TValuePictControl, TValueTextControl, and TXYControl.


Member Data Documentation

CFBundleRef TViewNoCompositingCompatible::mBundleRef [protected]
 

const OSType TViewNoCompositingCompatible::theViewTag = 'TVew' [static]
 


The documentation for this class was generated from the following files:




Generated on Sun May 23 19:32:07 2004 for AUGUI Framework by doxygen1.3.7

hosted on SourceForge.net Logo