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

TColorDialog Class Reference

Viewer used to examine and change the standard palette. More...

#include <colorsel.h>

Inheritance diagram for TColorDialog::

TDialog TWindow TGroup TWindowInit TView TObject TStreamable List of all members.

Public Methods

 TColorDialog (TPalette *aPalette, TColorGroup *aGroups)
 ~TColorDialog ()
virtual ushort dataSize ()
virtual void getData (void *rec)
virtual void handleEvent (TEvent &event)
virtual void setData (void *rec)
void getIndexes (TColorIndex *&)
void setIndexes (TColorIndex *&)

Static Public Methods

TStreamablebuild ()

Public Attributes

TPalettepal

Static Public Attributes

const char* const name

Protected Methods

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

Protected Attributes

TColorDisplaydisplay
TColorGroupListgroups
TLabelforLabel
TColorSelectorforSel
TLabelbakLabel
TColorSelectorbakSel
TLabelmonoLabel
TMonoSelectormonoSel
uchar groupIndex

Detailed Description

These interrelated classes provide viewers and dialog boxes from which the user can select and change the color assignments from available palettes with immediate effect on the screen:

TColorDisplay, TColorGroup, TColorGroupList, TColorItem, TColorItemList, TColorSelector, TMonoSelector and TColorDialog.

TColorDialog is a specialized scrollable dialog box called "Colors" from which the user can examine various palette selections before making a selection.

Definition at line 825 of file colorsel.h.


Constructor & Destructor Documentation

TColorDialog::TColorDialog ( TPalette * aPalette,
TColorGroup * aGroups )
 

Constructor.

Calls the TDialog and TScrollBar constructors to create a fixed size, framed window titled "Colors" with two scroll bars. The pal data member is set to `aPalette'. The given `aGroups' argument creates and inserts a TColorGroup object with an associated label: "~G~roup". The items in `aGroups' initialize a TColorItemList object, which is also inserted in the dialog, labeled as "~I~tem".

`aPalette' is a pointer to the initial palette to be modified. This class creates a local copy of the initial palette, so the initial palette is never modified. You may safely leave this field to 0 and set the palette with a subsequent call to setData(). `aGroups' is a pointer to a cluster of objects which specifies all the items in the palette.

See file `demo/tvdemo2.cc' for an example.

TColorDialog::~TColorDialog ( )
 

Destructor.

Deletes the local copy of the palette.

TColorDialog::TColorDialog ( StreamableInit ) [protected]
 

Constructor.

Used to recover the dialog from a stream. Foreground and background color selectors are created and inserted, labeled as "~F~oreground" and "~B~ackground". The string "Text " is displayed in the current text color.

A TMonoSelector object is created, inserted, and labeled "~C~olor". All the items are displayed in their correct colors and attributes. Finally, "O~K~" and "Cancel" buttons are inserted.


Member Function Documentation

TStreamable * TColorDialog::build ( ) [static]
 

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

Reimplemented from TDialog.

ushort TColorDialog::dataSize ( ) [virtual]
 

By default, dataSize() returns the size of the current palette, expressed in bytes.

Reimplemented from TGroup.

void TColorDialog::getData ( void * rec ) [virtual]
 

Reads the data record of this dialog.

Copies dataSize() bytes from pal to `rec'. `rec' should point to a TPalette object. Its contents will be overwritten by the contents of this object.

See also:
setData

Reimplemented from TGroup.

void TColorDialog::getIndexes ( TColorIndex *& )
 

Undocumented.

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

Calls TDialog::handleEvent() and redisplays if the broadcast event generated is cmNewColorIndex.

Reimplemented from TDialog.

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

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

Reimplemented from TWindow.

void TColorDialog::setData ( void * rec ) [virtual]
 

Writes the data record of this view.

The reverse of getData(): copies from `rec' to pal, restoring the saved color selections. `rec' should point to a TPalette object.

Reimplemented from TGroup.

void TColorDialog::setIndexes ( TColorIndex *& )
 

Undocumented.

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

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

Reimplemented from TWindow.


Member Data Documentation

TLabel * TColorDialog::bakLabel [protected]
 

The background color label.

Definition at line 906 of file colorsel.h.

TColorSelector * TColorDialog::bakSel [protected]
 

The background color selector.

Definition at line 910 of file colorsel.h.

TColorDisplay * TColorDialog::display [protected]
 

The color display object for this dialog box.

Definition at line 890 of file colorsel.h.

TLabel * TColorDialog::forLabel [protected]
 

The foreground color label.

Definition at line 898 of file colorsel.h.

TColorSelector * TColorDialog::forSel [protected]
 

The foreground color selector.

Definition at line 902 of file colorsel.h.

uchar TColorDialog::groupIndex [protected]
 

Undocumented.

Definition at line 922 of file colorsel.h.

TColorGroupList * TColorDialog::groups [protected]
 

The color group for this dialog box.

Definition at line 894 of file colorsel.h.

TLabel * TColorDialog::monoLabel [protected]
 

The monochrome label.

Definition at line 914 of file colorsel.h.

TMonoSelector * TColorDialog::monoSel [protected]
 

The selector for monochrome attributes.

Definition at line 918 of file colorsel.h.

const char *const TColorDialog::name [static]
 

Undocumented.

Reimplemented from TDialog.

Definition at line 970 of file colorsel.h.

TPalette * TColorDialog::pal
 

Is a pointer to the current palette selection.

Definition at line 885 of file colorsel.h.


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