TTransparentEditText Class Reference

Custom edit text control that does not erase its background. More...

#include <TTransparentEditText.h>

Inheritance diagram for TTransparentEditText:

Inheritance graph
[legend]
Collaboration diagram for TTransparentEditText:

Collaboration graph
[legend]
List of all members.

Protected Member Functions

 TTransparentEditText (HIViewRef inControl)
 Constructor. The real initialisation takes place in Initialize().
virtual ~TTransparentEditText ()
 Clean up after ourself.
virtual ControlKind GetKind ()
virtual bool UseNonblockingTracking ()
 To enable the non-blocking tracking a subclass must override this method to return true.
virtual void ProcessTextInput (UniChar *text, uint32_t count, uint32_t modifiers)
 Has the same effect as typing whatever characters are passed in text.
virtual void SetDrawFrame (bool draw)
Event handlers
virtual OSStatus Initialize (TCarbonEvent &inEvent)
 Creates the ATSUI text style and text layout objects.
virtual void TitleChanged ()
virtual void ActiveStateChanged ()
 Set mIsActive and force a redraw.
virtual OSStatus SetFocusPart (ControlPartCode inDesiredFocus, Boolean inFocusEverything, ControlPartCode *outActualFocus)
 Set the mIsFocused member and force a redraw.
virtual OSStatus BoundsChanged (UInt32 inOptions, const HIRect &inOriginalBounds, const HIRect &inCurrentBounds, RgnHandle inInvalRgn)
 Here we call UpdateTextLayout() because is needs to update the soft line breaks with the new control width.
virtual ControlPartCode HitTest (const HIPoint &inWhere)
 Asks your view to return what part of itself (if any) is hit by the point given to it.
virtual OSStatus StillTracking (TCarbonEvent &inEvent, HIPoint &from)
 Handle the mouse moving from one location to another while the button is still held down.
virtual OSStatus StartTracking (TCarbonEvent &inEvent, HIPoint &from)
 Handle the initial mouse down event.
virtual void DrawStaticBackground (RgnHandle inLimitRgn, CGContextRef inContext, bool inCompositing)
virtual void CompatibleDraw (RgnHandle inLimitRgn, CGContextRef inContext, bool inCompositing)
 The fun part of the control.
virtual UInt32 GetBehaviors ()
virtual OSStatus SetData (OSType inTag, ControlPartCode inPart, Size inSize, const void *inPtr)
 This method is used to set the text in the edit field, or attributes of that text.
virtual OSStatus GetData (OSType inTag, ControlPartCode inPart, Size inSize, Size *outSize, void *inPtr)
 This method can return the text or various information about it and the current settings.
virtual OSStatus TextInput (TCarbonEvent &inEvent)
 Handle all key events.

Detailed Description

Custom edit text control that does not erase its background.

This control subclass works like a standard unicode edit text control, except for how it draws. It will never erase the background with a solid color, and it does not draw any sort of frame or box around the text. The focus ring may be turned off.


Constructor & Destructor Documentation

TTransparentEditText::TTransparentEditText HIViewRef  inControl  )  [protected]
 

Constructor. The real initialisation takes place in Initialize().

TTransparentEditText::~TTransparentEditText  )  [protected, virtual]
 

Clean up after ourself.


Member Function Documentation

void TTransparentEditText::ActiveStateChanged  )  [protected, virtual]
 

Set mIsActive and force a redraw.

OSStatus TTransparentEditText::BoundsChanged UInt32  inOptions,
const HIRect &  inOriginalBounds,
const HIRect &  inCurrentBounds,
RgnHandle  inInvalRgn
[protected, virtual]
 

Here we call UpdateTextLayout() because is needs to update the soft line breaks with the new control width.

Then we force a redraw.

void TTransparentEditText::CompatibleDraw RgnHandle  inLimitRgn,
CGContextRef  inContext,
bool  inCompositing
[protected, virtual]
 

The fun part of the control.

Because the HIView coordinates have 0 of the y axis at the upper left, we must flip the context by using a y scale value of -1.0. Then coordinates are translated so that 0, 0 is at the bottom left. The context graphics state is saved and restored.

Implements TViewNoCompositingCompatible.

void TTransparentEditText::DrawStaticBackground RgnHandle  inLimitRgn,
CGContextRef  inContext,
bool  inCompositing
[protected, virtual]
 

Reimplemented from TViewNoCompositingCompatible.

virtual UInt32 TTransparentEditText::GetBehaviors  )  [inline, protected, virtual]
 

GetBehaviors

Reimplemented from TViewNoCompositingCompatible.

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

This method can return the text or various information about it and the current settings.

Reimplemented from TViewNoCompositingCompatible.

ControlKind TTransparentEditText::GetKind  )  [protected, virtual]
 

ControlPartCode TTransparentEditText::HitTest const HIPoint &  inWhere  )  [protected, virtual]
 

Asks your view to return what part of itself (if any) is hit by the point given to it.

The point is in view coordinates, so you should get the view rect to do bounds checking. All points within the view are considered to be in the kControlEditTextPart control part.

Reimplemented from TViewNoCompositingCompatible.

OSStatus TTransparentEditText::Initialize TCarbonEvent &  inEvent  )  [protected, virtual]
 

Creates the ATSUI text style and text layout objects.

At this point, the text storage will most likely be empty, so we're just setting things up to be updated once text is set. We also activate keyboard focus and unicode text entry events. Wouldn't be much use without those!

void TTransparentEditText::ProcessTextInput UniChar *  text,
uint32_t  count,
uint32_t  modifiers
[protected, virtual]
 

Has the same effect as typing whatever characters are passed in text.

It may be called once for a group of multiple characters, or it may be called repeatedly with a single character at a time.

Both command and data characters are handled. Only the first character is looked at as a possible command (e.g., arrow key, enter, tab, etc).

OSStatus TTransparentEditText::SetData OSType  inTag,
ControlPartCode  inPart,
Size  inSize,
const void *  inPtr
[protected, virtual]
 

This method is used to set the text in the edit field, or attributes of that text.

virtual void TTransparentEditText::SetDrawFrame bool  draw  )  [inline, protected, virtual]
 

OSStatus TTransparentEditText::SetFocusPart ControlPartCode  inDesiredFocus,
Boolean  inFocusEverything,
ControlPartCode *  outActualFocus
[protected, virtual]
 

Set the mIsFocused member and force a redraw.

Reimplemented from TViewNoCompositingCompatible.

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

Handle the initial mouse down event.

Reimplemented from TViewNoCompositingCompatible.

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

Handle the mouse moving from one location to another while the button is still held down.

Reimplemented from TViewNoCompositingCompatible.

OSStatus TTransparentEditText::TextInput TCarbonEvent &  inEvent  )  [protected, virtual]
 

Handle all key events.

void TTransparentEditText::TitleChanged  )  [protected, virtual]
 

virtual bool TTransparentEditText::UseNonblockingTracking  )  [inline, protected, virtual]
 

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

Reimplemented from TViewNoCompositingCompatible.


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




Generated on Sat Jul 8 13:11:08 2006 for AUGUI Framework by doxygen1.4.6

hosted on SourceForge.net Logo