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

colorsel.h

Go to the documentation of this file.
00001 /*
00002  * colorsel.h
00003  *
00004  * Turbo Vision - Version 2.0
00005  *
00006  * Copyright (c) 1994 by Borland International
00007  * All Rights Reserved.
00008  *
00009  * Modified by Sergio Sigala <sergio@sigala.it>
00010  */
00011 
00012 #if !defined( __COLOR_COMMAND_CODES )
00013 #define __COLOR_COMMAND_CODES
00014 
00019 const
00020   int cmColorForegroundChanged = 71,
00021   cmColorBackgroundChanged = 72,
00022   cmColorSet               = 73,
00023   cmNewColorItem           = 74,
00024   cmNewColorIndex          = 75,
00025   cmSaveColorIndex         = 76;
00026 
00027 #endif  // __COLOR_COMMAND_CODES
00028 
00029 class TColorItem;
00030 class TColorGroup;
00031 
00032 TColorItem& operator + ( TColorItem& i1, TColorItem& i2 );
00033 TColorGroup& operator + ( TColorGroup& g, TColorItem& i );
00034 TColorGroup& operator + ( TColorGroup& g1, TColorGroup& g2 );
00035 
00036 #if defined( Uses_TColorItem ) && !defined( __TColorItem )
00037 #define __TColorItem
00038 
00039 class TColorGroup;
00040 
00052 class TColorItem
00053 {
00054 public:
00067     TColorItem( const char *nm, uchar idx, TColorItem *nxt = 0 );
00071     virtual ~TColorItem();
00075     const char *name;
00079     uchar index;
00083     TColorItem *next;
00088     friend TColorGroup& operator + ( TColorGroup& g, TColorItem& i );
00093     friend TColorItem& operator + ( TColorItem& i1, TColorItem& i2 );
00094 };
00095 
00096 #endif  // Uses_TColorItem
00097 
00098 #if defined( Uses_TColorGroup ) && !defined( __TColorGroup )
00099 #define __TColorGroup
00100 
00101 class TColorItem;
00102 
00115 class TColorGroup
00116 {
00117 public:
00130     TColorGroup( const char *nm, TColorItem *itm = 0, TColorGroup *nxt = 0 );
00134     virtual ~TColorGroup();
00138     const char *name;
00142     uchar index;
00147     TColorItem *items;
00151     TColorGroup *next;
00156     friend TColorGroup& operator + ( TColorGroup& g, TColorItem& i);
00162     friend TColorGroup& operator + ( TColorGroup& g1, TColorGroup& g2 );
00163 };
00164 
00169 class TColorIndex
00170 {
00171 public:
00175     uchar groupIndex;
00179     uchar colorSize;
00183     uchar colorIndex[256];
00184 };
00185 
00186 
00187 #endif  // Uses_TColorGroup
00188 
00189 #if defined( Uses_TColorSelector ) && !defined( __TColorSelector )
00190 #define __TColorSelector
00191 
00192 class TRect;
00193 class TEvent;
00194 
00206 class TColorSelector : public TView
00207 {
00208 public:
00213     enum ColorSel { csBackground = 0, csForeground };
00231     TColorSelector( const TRect& bounds, ColorSel aSelType );
00235     virtual void draw();
00243     virtual void handleEvent( TEvent& event );
00247     static char icon;
00248 protected:
00252     uchar color;
00264     ColorSel selType;
00265 private:
00266     void colorChanged();
00267     virtual const char *streamableName() const
00268         { return name; }
00269 protected:
00275     TColorSelector( StreamableInit );
00279     virtual void write( opstream& os );
00284     virtual void *read( ipstream& is );
00285 public:
00289     static const char * const name;
00295     static TStreamable *build();
00296 };
00297 
00301 inline ipstream& operator >> ( ipstream& is, TColorSelector& cl )
00302     { return is >> (TStreamable&)cl; }
00306 inline ipstream& operator >> ( ipstream& is, TColorSelector*& cl )
00307     { return is >> (void *&)cl; }
00308 
00312 inline opstream& operator << ( opstream& os, TColorSelector& cl )
00313     { return os << (TStreamable&)cl; }
00317 inline opstream& operator << ( opstream& os, TColorSelector* cl )
00318     { return os << (TStreamable *)cl; }
00319 
00320 #endif  // Uses_TColorSelector
00321 
00322 
00323 #if defined( Uses_TMonoSelector ) && !defined( __TMonoSelector )
00324 #define __TMonoSelector
00325 
00326 class TRect;
00327 class TEvent;
00328 
00341 class TMonoSelector : public TCluster
00342 {
00343 public:
00353     TMonoSelector( const TRect& bounds );
00357     virtual void draw();
00364     virtual void handleEvent( TEvent& event );
00369     virtual Boolean mark( int item );
00373     void newColor();
00377     virtual void press( int item );
00381     void movedTo( int item );
00382 private:
00383     static const char * button;
00384     static const char * normal;
00385     static const char * highlight;
00386     static const char * underline;
00387     static const char * inverse;
00388     virtual const char *streamableName() const
00389         { return name; }
00390 protected:
00396     TMonoSelector( StreamableInit );
00397 public:
00401     static const char * const name;
00408     static TStreamable *build();
00409 };
00410 
00414 inline ipstream& operator >> ( ipstream& is, TMonoSelector& cl )
00415     { return is >> (TStreamable&)cl; }
00419 inline ipstream& operator >> ( ipstream& is, TMonoSelector*& cl )
00420     { return is >> (void *&)cl; }
00421 
00425 inline opstream& operator << ( opstream& os, TMonoSelector& cl )
00426     { return os << (TStreamable&)cl; }
00430 inline opstream& operator << ( opstream& os, TMonoSelector* cl )
00431     { return os << (TStreamable *)cl; }
00432 
00433 #endif  // Uses_TMonoSelector
00434 
00435 #if defined( Uses_TColorDisplay ) && !defined( __TColorDisplay )
00436 #define __TColorDisplay
00437 
00438 class TRect;
00439 class TEvent;
00440 
00454 class TColorDisplay : public TView
00455 {
00456 public:
00466     TColorDisplay( const TRect& bounds, const char *aText );
00472     virtual ~TColorDisplay();
00476     virtual void draw();
00482     virtual void handleEvent( TEvent& event );
00488     virtual void setColor( uchar *aColor );
00489 protected:
00493     uchar *color;
00497     const char *text;
00498 private:
00499     virtual const char *streamableName() const
00500         { return name; }
00501 protected:
00507     TColorDisplay( StreamableInit );
00511     virtual void write( opstream& os );
00516     virtual void *read( ipstream& is );
00517 public:
00521     static const char * const name;
00528     static TStreamable *build();
00529 };
00530 
00534 inline ipstream& operator >> ( ipstream& is, TColorDisplay& cl )
00535     { return is >> (TStreamable&)cl; }
00539 inline ipstream& operator >> ( ipstream& is, TColorDisplay*& cl )
00540     { return is >> (void *&)cl; }
00541 
00545 inline opstream& operator << ( opstream& os, TColorDisplay& cl )
00546     { return os << (TStreamable&)cl; }
00550 inline opstream& operator << ( opstream& os, TColorDisplay* cl )
00551     { return os << (TStreamable *)cl; }
00552 
00553 #endif  // Uses_TColorDisplay
00554 
00555 
00556 #if defined( Uses_TColorGroupList ) && !defined( __TColorGroupList )
00557 #define __TColorGroupList
00558 
00559 class TRect;
00560 class TScrollBar;
00561 class TColorGroup;
00562 class TColorItem;
00563 
00580 class TColorGroupList : public TListViewer
00581 {
00582 public:
00591     TColorGroupList( const TRect& bounds,
00592                      TScrollBar *aScrollBar,
00593                      TColorGroup *aGroups
00594                       );
00598     virtual ~TColorGroupList();
00604     virtual void focusItem( short item );
00608     virtual void getText( char *dest, short item, short maxLen );
00612     virtual void handleEvent(TEvent&);
00613 protected:
00617     TColorGroup *groups;
00618 private:
00619     virtual const char *streamableName() const
00620         { return name; }
00621     static void writeItems( opstream&, TColorItem * );
00622     static void writeGroups( opstream&, TColorGroup * );
00623     static TColorItem *readItems( ipstream& );
00624     static TColorGroup *readGroups( ipstream& );
00625 protected:
00629     TColorGroupList( StreamableInit );
00633     virtual void write( opstream& os );
00637     virtual void *read( ipstream& is );
00638 public:
00642     void setGroupIndex(uchar groupNum, uchar itemNum);
00646     TColorGroup* getGroup(uchar groupNum);
00650     uchar getGroupIndex(uchar groupNum);
00654     uchar getNumGroups();
00658     static const char * const name;
00662     static TStreamable *build();
00663 };
00664 
00668 inline ipstream& operator >> ( ipstream& is, TColorGroupList& cl )
00669     { return is >> (TStreamable&)cl; }
00673 inline ipstream& operator >> ( ipstream& is, TColorGroupList*& cl )
00674     { return is >> (void *&)cl; }
00675 
00679 inline opstream& operator << ( opstream& os, TColorGroupList& cl )
00680     { return os << (TStreamable&)cl; }
00684 inline opstream& operator << ( opstream& os, TColorGroupList* cl )
00685     { return os << (TStreamable *)cl; }
00686 
00687 #endif  // Uses_TColorGroupList
00688 
00689 
00690 #if defined( Uses_TColorItemList ) && !defined( __TColorItemList )
00691 #define __TColorItemList
00692 
00693 class TRect;
00694 class TScrollBar;
00695 class TColorItem;
00696 class TEvent;
00697 
00717 class TColorItemList : public TListViewer
00718 {
00719 public:
00727     TColorItemList( const TRect& bounds,
00728                     TScrollBar *aScrollBar,
00729                     TColorItem *aItems
00730                   );
00736     virtual void focusItem( short item );
00740     virtual void getText( char *dest, short item, short maxLen );
00746     virtual void handleEvent( TEvent& event );
00747 protected:
00751     TColorItem *items;
00752 private:
00753     virtual const char *streamableName() const
00754         { return name; }
00755 protected:
00762     TColorItemList( StreamableInit );
00763 public:
00767     static const char * const name;
00771     static TStreamable *build();
00772 };
00773 
00777 inline ipstream& operator >> ( ipstream& is, TColorItemList& cl )
00778     { return is >> (TStreamable&)cl; }
00782 inline ipstream& operator >> ( ipstream& is, TColorItemList*& cl )
00783     { return is >> (void *&)cl; }
00784 
00788 inline opstream& operator << ( opstream& os, TColorItemList& cl )
00789     { return os << (TStreamable&)cl; }
00793 inline opstream& operator << ( opstream& os, TColorItemList* cl )
00794     { return os << (TStreamable *)cl; }
00795 
00796 #endif  // Uses_TColorItemList
00797 
00798 
00799 #if defined( Uses_TColorDialog ) && !defined( __TColorDialog )
00800 #define __TColorDialog
00801 
00802 class TColorGroup;
00803 class TEvent;
00804 class TColorDisplay;
00805 class TColorGroupList;
00806 class TLabel;
00807 class TColorSelector;
00808 class TMonoSelector;
00809 class TPalette;
00810 
00825 class TColorDialog : public TDialog
00826 {
00827 public:
00848     TColorDialog( TPalette *aPalette, TColorGroup *aGroups );
00854     ~TColorDialog();
00859     virtual ushort dataSize();
00868     virtual void getData( void *rec );
00873     virtual void handleEvent( TEvent& event );
00881     virtual void setData( void *rec);
00885     TPalette *pal;
00886 protected:
00890     TColorDisplay *display;
00894     TColorGroupList *groups;
00898     TLabel *forLabel;
00902     TColorSelector *forSel;
00906     TLabel *bakLabel;
00910     TColorSelector *bakSel;
00914     TLabel *monoLabel;
00918     TMonoSelector *monoSel;
00922     uchar groupIndex;
00923 private:
00924     static const char * colors;
00925     static const char * groupText;
00926     static const char * itemText;
00927     static const char * forText;
00928     static const char * bakText;
00929     static const char * textText;
00930     static const char * colorText;
00931     static const char * okText;
00932     static const char * cancelText;
00933     virtual const char *streamableName() const
00934         { return name; }
00935 protected:
00948     TColorDialog( StreamableInit );
00952     virtual void write( opstream& os );
00957     virtual void *read( ipstream& is );
00958 public:
00962     void getIndexes(TColorIndex*&);
00966     void setIndexes(TColorIndex*&);
00970     static const char * const name;
00974     static TStreamable *build();
00975 };
00976 
00980 inline ipstream& operator >> ( ipstream& is, TColorDialog& cl )
00981     { return is >> (TStreamable&)cl; }
00985 inline ipstream& operator >> ( ipstream& is, TColorDialog*& cl )
00986     { return is >> (void *&)cl; }
00987 
00991 inline opstream& operator << ( opstream& os, TColorDialog& cl )
00992     { return os << (TStreamable&)cl; }
00996 inline opstream& operator << ( opstream& os, TColorDialog* cl )
00997     { return os << (TStreamable *)cl; }
00998 
00999 #endif  // TColorDialog

Generated at Sat Sep 22 20:19:07 2001 for TVision by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001