home *** CD-ROM | disk | FTP | other *** search
- /*-----------------------------------------------------------------------*/
- /* filename - tdemo2.cpp */
- /* */
- /* function(s) */
- /* definitions for the following classes used in the */
- /* TVColorDialog demo program... */
- /* */
- /* TXDialog1 */
- /* TXDialog2 */
- /* TXDialog3 */
- /* TAppStatusLine */
- /* */
- /* author - Michael "Mick" Newton */
- /* */
- /*-----------------------------------------------------------------------*/
-
- /*-----------------------------------------------------------------------*/
- /* */
- /* TDEMO2.CPP */
- /* */
- /* TVColorDialog shareware version 2.0 */
- /* (C) Copyright 1992,1993 Comsoft Software */
- /* All Rights Reserved. */
- /* */
- /*-----------------------------------------------------------------------*/
-
- // Define Turbo Vision classes used ***************************************
-
- #define Uses_TApplication
- #define Uses_TDeskTop
- #define Uses_TDialog
- #define Uses_TListBox
- #define Uses_TObject
- #define Uses_TPalette
- #define Uses_TPoint
- #define Uses_TRect
- #define Uses_TSItem
- #define Uses_TSortedCollection
- #define Uses_TStatusDef
- #define Uses_TStatusItem
- #define Uses_TStatusLine
- #define Uses_TView
- #define Uses_TWindow
-
- #include <tv.h>
-
-
-
-
-
- // CRTL header files ******************************************************
-
- #if !defined __STRSTREAM_H
- #include <strstrea.h>
- #endif
-
-
-
-
-
- // Non-CRTL header files **************************************************
-
- #if !defined __TDEMO2_HPP
- #include "tdemo2.hpp"
- #endif
-
-
-
-
-
- // TXDialog1 **************************************************************
-
- /* ┌───────────────────────────────────────────────────────────────────┐ */
- /* │ TXDialog1 palette layout │ */
- /* ╞═══════╤═══════╤═══════════════════════════════════════════════════╡ */
- /* │ owner │ This │ │ */
- /* │ index │ index │ Item │ */
- /* ├───────┼───────┼───────────────────────────────────────────────────┤ */
- /* │ 64 │ 1 │ Frame passive │ */
- /* │ 65 │ 2 │ Frame active │ */
- /* │ 66 │ 3 │ Frame icon │ */
- /* │ 67 │ 4 │ ScrollBar page │ */
- /* │ 68 │ 5 │ ScrollBar controls │ */
- /* │ 69 │ 6 │ StaticText │ */
- /* │ 70 │ 7 │ Label normal │ */
- /* │ 71 │ 8 │ Label selected │ */
- /* │ 72 │ 9 │ Label shortcut │ */
- /* │ 73 │ 10 │ Button normal │ */
- /* │ 74 │ 11 │ Button default │ */
- /* │ 75 │ 12 │ Button selected │ */
- /* │ 76 │ 13 │ Button disabled │ */
- /* │ 77 │ 14 │ Button shortcut │ */
- /* │ 78 │ 15 │ Button shadow │ */
- /* │ 79 │ 16 │ Cluster normal │ */
- /* │ 80 │ 17 │ Cluster selected │ */
- /* │ 81 │ 18 │ Cluster shortcut │ */
- /* │ 82 │ 19 │ InputLine normal text │ */
- /* │ 83 │ 20 │ InputLine selected text │ */
- /* │ 84 │ 21 │ InputLine arrows │ */
- /* │ 85 │ 22 │ History arrow │ */
- /* │ 86 │ 23 │ History sides │ */
- /* │ 87 │ 24 │ History scrollbar page │ */
- /* │ 88 │ 25 │ History scrollbar controls │ */
- /* │ 89 │ 26 │ ListViewer normal │ */
- /* │ 90 │ 27 │ ListViewer focused │ */
- /* │ 91 │ 28 │ ListViewer selected │ */
- /* │ 92 │ 29 │ ListViewer divider │ */
- /* │ 93 │ 30 │ InfoPane │ */
- /* │ 94 │ 31 │ Reserved │ */
- /* │ 95 │ 32 │ Reserved │ */
- /* │ 96 │ 33 │ Unused │ */
- /* │ 97 │ 34 │ Unused │ */
- /* │ 98 │ 35 │ Unused │ */
- /* │ 99 │ 36 │ Unused │ */
- /* │ 100 │ 37 │ Unused │ */
- /* │ 101 │ 38 │ Unused │ */
- /* │ 102 │ 39 │ Unused │ */
- /* │ 103 │ 40 │ Unused │ */
- /* │ 104 │ 41 │ Unused │ */
- /* │ 105 │ 42 │ Unused │ */
- /* │ 106 │ 43 │ Unused │ */
- /* │ 107 │ 44 │ Unused │ */
- /* │ 108 │ 45 │ Unused │ */
- /* │ 109 │ 46 │ Unused │ */
- /* │ 110 │ 47 │ Unused │ */
- /* │ 111 │ 48 │ Unused │ */
- /* │ 112 │ 49 │ Unused │ */
- /* │ 113 │ 50 │ Unused │ */
- /* └───────┴───────┴───────────────────────────────────────────────────┘ */
-
- // Index 64 - 113
- #define cpTXDialog1 \
- "\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49" \
- "\x4A\x4B\x4C\x4D\x4E\x4F\x50\x51\x52\x53" \
- "\x54\x55\x56\x57\x58\x59\x5A\x5B\x5C\x5D" \
- "\x5E\x5F\x60\x61\x62\x63\x64\x65\x66\x67" \
- "\x68\x69\x6A\x6B\x6C\x6D\x6E\x6F\x70\x71"
-
- TXDialog1::TXDialog1(const TRect& bounds, const char *aTitle) :
- TDialog(bounds, aTitle),
- TWindowInit(initFrame)
- {
- }
-
-
- void TXDialog1::shutDown()
- {
- listbox->newList(0);
- TDialog::shutDown();
- }
-
-
- TPalette& TXDialog1::getPalette() const
- {
- static TPalette palette(cpTXDialog1, sizeof(cpTXDialog1) - 1);
- return palette;
- }
-
-
- void TXDialog1::handleEvent(TEvent& event)
- {
- TDialog::handleEvent(event);
-
- if(event.what == evCommand && event.message.command == cmCloseX)
- {
- if(TApplication::deskTop->current == this)
- {
- TApplication::deskTop->remove(this);
- TObject::destroy((TXDialog1 *) this);
- clearEvent(event);
- }
- }
- }
-
-
-
-
-
- // TXDialog2 **************************************************************
-
- /* ┌───────────────────────────────────────────────────────────────────┐ */
- /* │ TXDialog2 palette layout │ */
- /* ╞═══════╤═══════╤═══════════════════════════════════════════════════╡ */
- /* │ owner │ This │ │ */
- /* │ index │ index │ Item │ */
- /* ├───────┼───────┼───────────────────────────────────────────────────┤ */
- /* │ 114 │ 1 │ Frame passive │ */
- /* │ 115 │ 2 │ Frame active │ */
- /* │ 116 │ 3 │ Frame icon │ */
- /* │ 117 │ 4 │ Scrollbar page │ */
- /* │ 118 │ 5 │ Scrollbar controls │ */
- /* │ 119 │ 6 │ Static text │ */
- /* │ 120 │ 7 │ Label normal │ */
- /* │ 121 │ 8 │ Label selected │ */
- /* │ 122 │ 9 │ Label shortcut │ */
- /* │ 123 │ 10 │ Button normal │ */
- /* │ 124 │ 11 │ Button default │ */
- /* │ 125 │ 12 │ Button selected │ */
- /* │ 126 │ 13 │ Button disabled │ */
- /* │ 127 │ 14 │ Button shortcut │ */
- /* │ 128 │ 15 │ Button shadow │ */
- /* │ 129 │ 16 │ Cluster normal │ */
- /* │ 130 │ 17 │ Cluster selected │ */
- /* │ 131 │ 18 │ Cluster shortcut │ */
- /* │ 132 │ 19 │ Input normal text │ */
- /* │ 133 │ 20 │ Input selected text │ */
- /* │ 134 │ 21 │ Input arrows │ */
- /* │ 135 │ 22 │ History arrow │ */
- /* │ 136 │ 23 │ History sides │ */
- /* │ 137 │ 24 │ History scrollbar page │ */
- /* │ 138 │ 25 │ History scrollbar controls │ */
- /* │ 139 │ 26 │ List normal │ */
- /* │ 140 │ 27 │ List focused │ */
- /* │ 141 │ 28 │ List selected │ */
- /* │ 142 │ 29 │ List divider │ */
- /* │ 143 │ 30 │ InfoPane │ */
- /* │ 144 │ 31 │ Reserved │ */
- /* │ 145 │ 32 │ Reserved │ */
- /* │ 146 │ 33 │ Unused │ */
- /* │ 147 │ 34 │ Unused │ */
- /* │ 148 │ 35 │ Unused │ */
- /* │ 149 │ 36 │ Unused │ */
- /* │ 150 │ 37 │ Unused │ */
- /* │ 151 │ 38 │ Unused │ */
- /* │ 152 │ 39 │ Unused │ */
- /* │ 153 │ 40 │ Unused │ */
- /* │ 154 │ 41 │ Unused │ */
- /* │ 155 │ 42 │ Unused │ */
- /* │ 156 │ 43 │ Unused │ */
- /* │ 157 │ 44 │ Unused │ */
- /* │ 158 │ 45 │ Unused │ */
- /* │ 159 │ 46 │ Unused │ */
- /* │ 160 │ 47 │ Unused │ */
- /* │ 161 │ 48 │ Unused │ */
- /* │ 162 │ 49 │ Unused │ */
- /* │ 163 │ 50 │ Unused │ */
- /* └───────┴───────┴───────────────────────────────────────────────────┘ */
-
- // Index 114 - 163
- #define cpTXDialog2 \
- "\x72\x73\x74\x75\x76\x77\x78\x79\x7A\x7B" \
- "\x7C\x7D\x7E\x7F\x80\x81\x82\x83\x84\x85" \
- "\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F" \
- "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99" \
- "\x9A\x9B\x9C\x9D\x9E\x9F\xA0\xA1\xA2\xA3"
-
- TXDialog2::TXDialog2(const TRect& bounds, const char *aTitle) :
- TDialog(bounds, aTitle),
- TWindowInit(initFrame)
- {
- }
-
-
- void TXDialog2::shutDown()
- {
- listbox->newList(0);
- TDialog::shutDown();
- }
-
-
- TPalette& TXDialog2::getPalette() const
- {
- static TPalette palette(cpTXDialog2, sizeof(cpTXDialog2) - 1);
- return palette;
- }
-
-
- void TXDialog2::handleEvent(TEvent& event)
- {
- TDialog::handleEvent(event);
-
- if(event.what == evCommand && event.message.command == cmCloseX)
- {
- if(TApplication::deskTop->current == this)
- {
- TApplication::deskTop->remove(this);
- TObject::destroy((TXDialog2 *) this);
- clearEvent(event);
- }
- }
- }
-
-
-
-
-
- // TXDialog3 **************************************************************
-
- /* ┌───────────────────────────────────────────────────────────────────┐ */
- /* │ TXDialog3 palette layout │ */
- /* ╞═══════╤═══════╤═══════════════════════════════════════════════════╡ */
- /* │ owner │ This │ │ */
- /* │ index │ index │ Item │ */
- /* ├───────┼───────┼───────────────────────────────────────────────────┤ */
- /* │ 164 │ 1 │ Frame passive │ */
- /* │ 165 │ 2 │ Frame active │ */
- /* │ 166 │ 3 │ Frame icon │ */
- /* │ 167 │ 4 │ ScrollBar page │ */
- /* │ 168 │ 5 │ ScrollBar controls │ */
- /* │ 169 │ 6 │ StaticText │ */
- /* │ 170 │ 7 │ Label normal │ */
- /* │ 171 │ 8 │ Label selected │ */
- /* │ 172 │ 9 │ Label shortcut │ */
- /* │ 173 │ 10 │ Button normal │ */
- /* │ 174 │ 11 │ Button default │ */
- /* │ 175 │ 12 │ Button selected │ */
- /* │ 176 │ 13 │ Button disabled │ */
- /* │ 177 │ 14 │ Button shortcut │ */
- /* │ 178 │ 15 │ Button shadow │ */
- /* │ 179 │ 16 │ Cluster normal │ */
- /* │ 180 │ 17 │ Cluster selected │ */
- /* │ 181 │ 18 │ Cluster shortcut │ */
- /* │ 182 │ 19 │ Input normal text │ */
- /* │ 183 │ 20 │ Input selected text │ */
- /* │ 184 │ 21 │ InputLine arrows │ */
- /* │ 185 │ 22 │ History arrow │ */
- /* │ 186 │ 23 │ History sides │ */
- /* │ 187 │ 24 │ History scrollbar page │ */
- /* │ 188 │ 25 │ History scrollbar controls │ */
- /* │ 189 │ 26 │ ListViewer normal │ */
- /* │ 190 │ 27 │ ListViewer focused │ */
- /* │ 191 │ 28 │ ListViewer selected │ */
- /* │ 192 │ 29 │ ListViewer divider │ */
- /* │ 193 │ 30 │ InfoPane │ */
- /* │ 194 │ 31 │ Reserved │ */
- /* │ 195 │ 32 │ Reserved │ */
- /* │ 196 │ 33 │ Unused │ */
- /* │ 197 │ 34 │ Unused │ */
- /* │ 198 │ 35 │ Unused │ */
- /* │ 199 │ 36 │ Unused │ */
- /* │ 200 │ 37 │ Unused │ */
- /* │ 201 │ 38 │ Unused │ */
- /* │ 202 │ 39 │ Unused │ */
- /* │ 203 │ 40 │ Unused │ */
- /* │ 204 │ 41 │ Unused │ */
- /* │ 205 │ 42 │ Unused │ */
- /* │ 206 │ 43 │ Unused │ */
- /* │ 207 │ 44 │ Unused │ */
- /* │ 208 │ 45 │ Unused │ */
- /* │ 209 │ 46 │ Unused │ */
- /* │ 210 │ 47 │ Unused │ */
- /* │ 211 │ 48 │ Unused │ */
- /* │ 212 │ 49 │ Unused │ */
- /* │ 213 │ 50 │ Unused │ */
- /* └───────┴───────┴───────────────────────────────────────────────────┘ */
-
- // Index 164 - 213
- #define cpTXDialog3 \
- "\xA4\xA5\xA6\xA7\xA8\xA9\xAA\xAB\xAC\xAD" \
- "\xAE\xAF\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7" \
- "\xB8\xB9\xBA\xBB\xBC\xBD\xBE\xBF\xC0\xC1" \
- "\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB" \
- "\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5"
-
- TXDialog3::TXDialog3(const TRect& bounds, const char *aTitle) :
- TDialog(bounds, aTitle),
- TWindowInit(initFrame)
- {
- }
-
-
- void TXDialog3::shutDown()
- {
- listbox->newList(0);
- TDialog::shutDown();
- }
-
-
- TPalette& TXDialog3::getPalette() const
- {
- static TPalette palette(cpTXDialog3, sizeof(cpTXDialog3) - 1);
- return palette;
- }
-
-
- void TXDialog3::handleEvent(TEvent& event)
- {
- TDialog::handleEvent(event);
-
- if(event.what == evCommand && event.message.command == cmCloseX)
- {
- if(TApplication::deskTop->current == this)
- {
- TApplication::deskTop->remove(this);
- TObject::destroy((TXDialog3 *) this);
- clearEvent(event);
- }
- }
- }
-
-
-
-
-
- // TAppStatusLine *********************************************************
-
- /* ┌───────────────────────────────────────────────────────────────────┐ */
- /* │ TAppStatusLine palette layout │ */
- /* ╞═══════╤═══════╤═══════════════════════════════════════════════════╡ */
- /* │ owner │ This │ │ */
- /* │ index │ index │ Item │ */
- /* ├───────┼───────┼───────────────────────────────────────────────────┤ */
- /* │ 214 │ 1 │ Normal Text │ */
- /* │ 215 │ 2 │ Disabled Text │ */
- /* │ 216 │ 3 │ Shortcut Text │ */
- /* │ 217 │ 4 │ Normal Selection │ */
- /* │ 218 │ 5 │ Disabled Selection │ */
- /* │ 219 │ 6 │ Shortcut Selection │ */
- /* └───────┴───────┴───────────────────────────────────────────────────┘ */
-
- #define cpAppStatusLine "\xD6\xD7\xD8\xD9\xDA\xDB"
-
- TAppStatusLine::TAppStatusLine(const TRect& bounds, TStatusDef& aDefs) :
- TStatusLine(bounds, aDefs)
- {
- }
-
-
- TPalette& TAppStatusLine::getPalette() const
- {
- static TPalette palette(cpAppStatusLine, sizeof(cpAppStatusLine) - 1);
- return palette;
- }
-
-
- const char *TAppStatusLine::hint(ushort aHelpCtx)
- {
- static char buff[maxViewWidth];
- ostrstream os(buff, sizeof buff);
-
- memset(buff, '\0', 81);
-
- switch(aHelpCtx)
- {
- case hcSystem:
- os << "Program system menu";
- break;
- case hcAbout:
- os << "Information about this program";
- break;
- case hcWritePal:
- os << "Write application palettes to file";
- break;
- case hcExit:
- os << "Quit this program";
- break;
- case hcColors:
- os << "Select colors and pattern character";
- break;
- case hcOptions:
- os << "Select TVColorDialog options";
- break;
- case hcXDialogs:
- os << "Extended palette demo dialogs";
- break;
- default:
- os << "No hint available";
- }
-
- os << ends;
-
- return buff;
- }
-
- // End of TDEMO2.CPP
-
-
-
-