Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

TLabel Class Reference

Used to attach a label to a view. More...

#include <dialogs.h>

Inheritance diagram for TLabel::

TStaticText TView TObject TStreamable List of all members.

Public Methods

 TLabel (const TRect &bounds, const char *aText, TView *aLink)
virtual void draw ()
virtual TPalettegetPalette () const
virtual void handleEvent (TEvent &event)
virtual void shutDown ()

Static Public Methods

TStreamablebuild ()

Static Public Attributes

const char* const name

Protected Methods

 TLabel (StreamableInit)
virtual void write (opstream &os)
virtual void* read (ipstream &is)

Protected Attributes

TViewlink
Boolean light

Detailed Description

Used to attach a label to a given view.

A TLabel object is a piece of text in a view that can be selected (highlighted) by a mouse click, cursor keys, or Alt-letter hot key. The label is usually "attached" via a pointer (called link) to some other control view such as an input line, cluster, or list viewer to guide the user.

See also:
TCluster , TInputLine , TListViewer

Useful mainly with input lines, list boxes, check boxes and radio buttons, since they don't have a default caption.
See also:
TCheckBoxes , TListBox , TRadioButtons

Definition at line 2056 of file dialogs.h.


Constructor & Destructor Documentation

TLabel::TLabel ( const TRect & bounds,
const char * aText,
TView * aLink )
 

Constructor.

Creates a TLabel object of the given size and text by calling TStaticText::TStaticText(bounds, aText), then setting the link data member to `aLink' for the associated control (make `aLink' 0 if no control is needed).

See also:
TStaticText::TStaticText

`bounds' is the bounding rectangle of the view while `aText' is the caption to show.
See also:
text

The options data member is set to ofPreProcess and ofPostProcess. The eventMask is set to evBroadcast. `aText' can designate a hot key letter for the label by surrounding the letter with tildes, like "~F~ile".

TLabel::TLabel ( StreamableInit ) [protected]
 

Each streamable class needs a "builder" to allocate the correct memory for its objects together with the initialized virtual table pointers. This is achieved by calling this constructor with an argument of type StreamableInit.


Member Function Documentation

TStreamable * TLabel::build ( ) [static]
 

Creates a new TLabel.

Called to create an object in certain stream-reading situations.

Reimplemented from TStaticText.

void TLabel::draw ( ) [virtual]
 

Draws the label with the appropriate colors from the default palette.

Reimplemented from TStaticText.

TPalette & TLabel::getPalette ( ) const [virtual]
 

Returns a reference to the label palette.

Reimplemented from TStaticText.

void TLabel::handleEvent ( TEvent & event ) [virtual]
 

Handles TLabel events.

Handles all events by calling TView::handleEvent(). If an evMouseDown or hot key event is received, the appropriate linked control (if any) is selected with link->select().

See also:
select

handleEvent() also handles cmReceivedFocus and cmReleasedFocus broadcast events from the linked control in order to adjust the value of the light data member and redraw the label as necessary.

Reimplemented from TView.

void * TLabel::read ( ipstream & is ) [protected, virtual]
 

Used to recover the view from a stream. Reads from the input stream `is'.

Reimplemented from TStaticText.

void TLabel::shutDown ( ) [virtual]
 

Releases TLabel resources.

Used internally by TObject::destroy() to ensure correct destruction of derived and related objects. shutDown() is overridden in many classes to ensure the proper setting of related data members when destroy() is called.

This method releases all the resources allocated by the TLabel. It sets pointer link to 0 and then calls TStaticText::shutDown(). Since TStaticText::shutDown() is not implemented, TView::shutDown() will be called instead.

Reimplemented from TView.

void TLabel::write ( opstream & os ) [protected, virtual]
 

Used to store the view in a stream. Writes to the output stream `os'.

Reimplemented from TStaticText.


Member Data Documentation

Boolean TLabel::light [protected]
 

If True, the label and its linked control has been selected and will be highlighted. Otherwise, light is set to False.

Definition at line 2123 of file dialogs.h.

TView * TLabel::link [protected]
 

This is a pointer to the view to focus when the user selects this label.

Definition at line 2118 of file dialogs.h.

const char *const TLabel::name [static]
 

Undocumented.

Reimplemented from TStaticText.

Definition at line 2150 of file dialogs.h.


The documentation for this class was generated from the following file:
Generated at Sat Sep 22 20:19:28 2001 for TVision by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001