#include <TViewNoCompositingCompatible.h>
Inheritance diagram for TViewNoCompositingCompatible:
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 |
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"
|
|
|
|
|
|
|
|
Reimplemented in TValuePictButtonControl. |
|
Convert the local point to window (x,y).
|
|
Convert the point to view local (x,y).
|
|
See AUGUI::CopyCanonicalClassID().
|
|
See AUGUI::CopyClassForBundleID().
|
|
|
|
Build a context for non-compositing window, draw the background and call the CompatibleDraw method.
Reimplemented in TMultiPane. |
|
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) |
|
Reimplemented in TEnvelop, TKnobControl, TPngPictControl, TSliderControl, TTransparentEditText, and TXYControl. |
|
Force the static background to be rebuild.
|
|
GetBehaviors Reimplemented in TEnvelop, TImageButton, TImagePopup, TMultiPane, TPngPictControl, TSliderControl, TTransparentEditText, and TValueTextControl. |
|
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. |
|
Reimplemented in TImagePopup, and TTransparentEditText. |
|
Reimplemented in TImagePopup, and TTransparentEditText. |
|
Return true if the view is in a compositing window.
|
|
Our static mouseDragged event handler proc.
|
|
Our static mouseUp event handler proc.
|
|
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 |
|
Register the given class.
|
|
This routine should be called by subclasses so they can be created as HIObjects.
|
|
|
|
This method will be called by
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
|
|
|
|
Called at the beginning of tracking.
Reimplemented in TEnvelop, TMeterControl, TSliderControl, TTransparentEditText, and TXYControl. |
|
Called whenever the mouse is moving during tracking.
Reimplemented in TEnvelop, TKnobControl, TMeterControl, TSliderControl, TTransparentEditText, TValuePictButtonControl, TValuePictControl, TValueTextControl, and TXYControl. |
|
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. |
|
Will automatically call If false, this method will return the eventNotHandledErr error code to invoke default mouse tracking. Reimplemented in TImageButton, and TImagePopup. |
|
|
|
|
|
This routine should be called by subclasses to unregister themself.
|
|
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. |
|
|
|
|