home *** CD-ROM | disk | FTP | other *** search
/ Media Share 13 / mediashare_13.zip / mediashare_13 / ZIPPED / PROGRAM / DFLT18.ZIP / DFLAT.H < prev    next >
C/C++ Source or Header  |  1994-03-24  |  21KB  |  480 lines

  1. /* ------------- dflat.h ----------- */
  2. #ifndef DFLAT_H
  3. #define DFLAT_H
  4.  
  5. #ifdef BUILD_FULL_DFLAT
  6. #define INCLUDE_MULTI_WINDOWS
  7. #define INCLUDE_LOGGING
  8. #define INCLUDE_SHELLDOS
  9. #define INCLUDE_WINDOWOPTIONS
  10. #define INCLUDE_PICTUREBOX
  11. #define INCLUDE_MINIMIZE
  12. #define INCLUDE_MAXIMIZE
  13. #define INCLUDE_RESTORE
  14. #define INCLUDE_EXTENDEDSELECTIONS
  15. #endif
  16.  
  17. #include <stdio.h>
  18. #include <string.h>
  19. #include <stdlib.h>
  20. #include <dos.h>
  21. #include <process.h>
  22. #include <conio.h>
  23. #include <bios.h>
  24. #include <ctype.h>
  25. #include <io.h>
  26. #include <sys\types.h>
  27. #include <sys\stat.h>
  28. #include <time.h>
  29. #include <setjmp.h>
  30.  
  31. #ifndef VERSION
  32. #define VERSION "Version 18"
  33. #endif
  34.  
  35. void *DFcalloc(size_t, size_t);
  36. void *DFmalloc(size_t);
  37. void *DFrealloc(void *, size_t);
  38.  
  39. typedef enum {FALSE, TRUE} BOOL;
  40.  
  41. #define MAXMESSAGES 50
  42. #define DELAYTICKS 1
  43. #define FIRSTDELAY 7
  44. #define DOUBLETICKS 5
  45.  
  46. #define MAXTEXTLEN 65000U /* maximum text buffer            */
  47. #define EDITLEN     1024  /* starting length for multiliner */
  48. #define ENTRYLEN     256  /* starting length for one-liner  */
  49. #define GROWLENGTH    64  /* buffers grow by this much      */
  50.  
  51. #include "system.h"
  52. #include "config.h"
  53. #include "rect.h"
  54. #include "menu.h"
  55. #include "keys.h"
  56. #include "commands.h"
  57. #include "dialbox.h"
  58. #include "helpbox.h"
  59.  
  60. /* ------ integer type for message parameters ----- */
  61. typedef long PARAM;
  62.  
  63. enum Condition     {
  64.     ISRESTORED, ISMINIMIZED, ISMAXIMIZED, ISCLOSING
  65. };
  66.  
  67. typedef struct window {
  68.     CLASS class;           /* window class                  */
  69.     char *title;           /* window title                  */
  70.     int (*wndproc)
  71.         (struct window *, enum messages, PARAM, PARAM);
  72.     /* ----------------- window colors -------------------- */
  73.     char WindowColors[4][2];
  74.     /* ---------------- window dimensions ----------------- */
  75.     RECT rc;               /* window coordinates
  76.                                             (0/0 to 79/24)  */
  77.     int ht, wd;            /* window height and width       */
  78.     RECT RestoredRC;       /* restored condition rect       */
  79.     /* -------------- linked list pointers ---------------- */
  80.     struct window *parent; /* parent window                 */
  81.     struct window *firstchild;  /* first child this parent  */
  82.     struct window *lastchild;   /* last child this parent   */
  83.     struct window *nextsibling; /* next sibling             */
  84.     struct window *prevsibling; /* previous sibling         */
  85.  
  86.     struct window *childfocus;    /* child that ha(s/d) focus */
  87.     int attrib;                 /* Window attributes        */
  88.     char *videosave;            /* video save buffer        */
  89.     enum Condition condition;   /* Restored, Maximized,
  90.                                    Minimized, Closing       */
  91.     enum Condition oldcondition;/* previous condition       */
  92.     BOOL wasCleared;
  93.     int restored_attrib;        /* attributes when restored */
  94.     void *extension;      /* menus, dialogs, documents, etc */
  95.     struct window *PrevMouse;
  96.     struct window *PrevKeyboard;
  97.     struct window *MenuBarWnd;/* menu bar                   */
  98.     struct window *StatusBar; /* status bar                 */
  99.     int isHelping;        /* > 0 when help is being displayed */
  100.     /* ----------------- text box fields ------------------ */
  101.     int wlines;     /* number of lines of text              */
  102.     int wtop;       /* text line that is on the top display */
  103.     unsigned char *text; /* window text                     */
  104.     unsigned int textlen;  /* text length                   */
  105.     int wleft;      /* left position in window viewport     */
  106.     int textwidth;  /* width of longest line in textbox     */
  107.     int BlkBegLine; /* beginning line of marked block       */
  108.     int BlkBegCol;  /* beginning column of marked block     */
  109.     int BlkEndLine; /* ending line of marked block          */
  110.     int BlkEndCol;  /* ending column of marked block        */
  111.     int HScrollBox; /* position of horizontal scroll box    */
  112.     int VScrollBox; /* position of vertical scroll box      */
  113.     unsigned int *TextPointers; /* -> list of line offsets    */
  114.     /* ----------------- list box fields ------------------ */
  115.     int selection;  /* current selection                    */
  116.     BOOL AddMode;   /* adding extended selections mode      */
  117.     int AnchorPoint;/* anchor point for extended selections */
  118.     int SelectCount;/* count of selected items              */
  119.     /* ----------------- edit box fields ------------------ */
  120.     int CurrCol;      /* Current column                     */
  121.     int CurrLine;     /* Current line                       */
  122.     int WndRow;       /* Current window row                 */
  123.     BOOL TextChanged; /* TRUE if text has changed           */
  124.     unsigned char *DeletedText; /* for undo                 */
  125.     unsigned DeletedLength; /* Length of deleted field      */
  126.     BOOL InsertMode;   /* TRUE or FALSE for text insert     */
  127.     BOOL WordWrapMode; /* TRUE or FALSE for word wrap       */
  128.     unsigned int MaxTextLength; /* maximum text length      */
  129.     /* ---------------- dialog box fields ----------------- */
  130.     int ReturnCode;        /* return code from a dialog box */
  131.     BOOL Modal;               /* True if a modeless dialog box */
  132.     CTLWINDOW *ct;           /* control structure             */
  133.     struct window *dfocus; /* control window that has focus */
  134.     /* -------------- popdownmenu fields ------------------ */
  135.     MENU *mnu;        /* points to menu structure             */
  136.     MBAR *holdmenu; /* previous active menu                 */
  137.     struct window *oldFocus;
  138.     /* -------------- status bar fields ------------------- */
  139.     BOOL TimePosted; /* True if time has been posted        */
  140. #ifdef INCLUDE_PICTUREBOX
  141.     /* ------------- picture box fields ------------------- */
  142.     int VectorCount;  /* number of vectors in vector list   */
  143.     void *VectorList; /* list of picture box vectors        */
  144. #endif
  145. } * WINDOW;
  146.  
  147. #include "classdef.h"
  148. #include "video.h"
  149.  
  150. void LogMessages (WINDOW, MESSAGE, PARAM, PARAM);
  151. void MessageLog(WINDOW);
  152. /* ------- window methods ----------- */
  153. #define ICONHEIGHT 3
  154. #define ICONWIDTH  10
  155. #define WindowHeight(w)      ((w)->ht)
  156. #define WindowWidth(w)       ((w)->wd)
  157. #define BorderAdj(w)         (TestAttribute(w,HASBORDER)?1:0)
  158. #define BottomBorderAdj(w)   (TestAttribute(w,HASSTATUSBAR)?1:BorderAdj(w))
  159. #define TopBorderAdj(w)      ((TestAttribute(w,HASTITLEBAR) &&   \
  160.                               TestAttribute(w,HASMENUBAR)) ?  \
  161.                               2 : (TestAttribute(w,HASTITLEBAR | \
  162.                               HASMENUBAR | HASBORDER) ? 1 : 0))
  163. #define ClientWidth(w)       (WindowWidth(w)-BorderAdj(w)*2)
  164. #define ClientHeight(w)      (WindowHeight(w)-TopBorderAdj(w)-\
  165.                               BottomBorderAdj(w))
  166. #define WindowRect(w)        ((w)->rc)
  167. #define GetTop(w)            (RectTop(WindowRect(w)))
  168. #define GetBottom(w)         (RectBottom(WindowRect(w)))
  169. #define GetLeft(w)           (RectLeft(WindowRect(w)))
  170. #define GetRight(w)          (RectRight(WindowRect(w)))
  171. #define GetClientTop(w)      (GetTop(w)+TopBorderAdj(w))
  172. #define GetClientBottom(w)   (GetBottom(w)-BottomBorderAdj(w))
  173. #define GetClientLeft(w)     (GetLeft(w)+BorderAdj(w))
  174. #define GetClientRight(w)    (GetRight(w)-BorderAdj(w))
  175. #define GetTitle(w)          ((w)->title)
  176. #define GetParent(w)         ((w)->parent)
  177. #define FirstWindow(w)       ((w)->firstchild)
  178. #define LastWindow(w)        ((w)->lastchild)
  179. #define NextWindow(w)        ((w)->nextsibling)
  180. #define PrevWindow(w)        ((w)->prevsibling)
  181. #define GetClass(w)          ((w)->class)
  182. #define GetAttribute(w)      ((w)->attrib)
  183. #define AddAttribute(w,a)    (GetAttribute(w) |= a)
  184. #define ClearAttribute(w,a)  (GetAttribute(w) &= ~(a))
  185. #define TestAttribute(w,a)   (GetAttribute(w) & (a))
  186. #define isHidden(w)          (!(GetAttribute(w) & VISIBLE))
  187. #define SetVisible(w)        (GetAttribute(w) |= VISIBLE)
  188. #define ClearVisible(w)      (GetAttribute(w) &= ~VISIBLE)
  189. #define gotoxy(w,x,y) cursor(w->rc.lf+(x)+1,w->rc.tp+(y)+1)
  190. BOOL isVisible(WINDOW);
  191. WINDOW CreateWindow(CLASS,char *,int,int,int,int,void*,WINDOW,
  192.        int (*)(struct window *,enum messages,PARAM,PARAM),int);
  193. void AddTitle(WINDOW, char *);
  194. void InsertTitle(WINDOW, char *);
  195. void DisplayTitle(WINDOW, RECT *);
  196. void RepaintBorder(WINDOW, RECT *);
  197. void PaintShadow(WINDOW);
  198. void ClearWindow(WINDOW, RECT *, int);
  199. void writeline(WINDOW, char *, int, int, BOOL);
  200. void InitWindowColors(WINDOW);
  201.  
  202. void SetNextFocus(void);
  203. void SetPrevFocus(void);
  204. void RemoveWindow(WINDOW);
  205. void AppendWindow(WINDOW);
  206. void ReFocus(WINDOW);
  207. void SkipApplicationControls(void);
  208.  
  209. BOOL CharInView(WINDOW, int, int);
  210. void CreatePath(char *, char *, int, int);
  211. #define SwapVideoBuffer(wnd, ish, fh) swapvideo(wnd, wnd->videosave, ish, fh)
  212. int LineLength(char *);
  213. RECT AdjustRectangle(WINDOW, RECT);
  214. BOOL isDerivedFrom(WINDOW, CLASS);
  215. WINDOW GetAncestor(WINDOW);
  216. void PutWindowChar(WINDOW,int,int,int);
  217. void PutWindowLine(WINDOW, void *,int,int);
  218. #define BaseWndProc(class,wnd,msg,p1,p2)    \
  219.     (*classdefs[(classdefs[class].base)].wndproc)(wnd,msg,p1,p2)
  220. #define DefaultWndProc(wnd,msg,p1,p2)         \
  221.     (classdefs[wnd->class].wndproc == NULL) ? \
  222.     BaseWndProc(wnd->class,wnd,msg,p1,p2) :      \
  223.     (*classdefs[wnd->class].wndproc)(wnd,msg,p1,p2)
  224. struct LinkedList    {
  225.     WINDOW FirstWindow;
  226.     WINDOW LastWindow;
  227. };
  228. extern WINDOW ApplicationWindow;
  229. extern WINDOW inFocus;
  230. extern WINDOW CaptureMouse;
  231. extern WINDOW CaptureKeyboard;
  232. extern int foreground, background;
  233. extern BOOL WindowMoving;
  234. extern BOOL WindowSizing;
  235. extern BOOL VSliding;
  236. extern BOOL HSliding;
  237. extern char DFlatApplication[];
  238. extern char *Clipboard;
  239. extern unsigned ClipboardLength;
  240. extern BOOL ClipString;
  241. /* --------- space between menubar labels --------- */
  242. #define MSPACE 2
  243. /* --------------- border characters ------------- */
  244. #define FOCUS_NW      (unsigned char) '\xc9'
  245. #define FOCUS_NE      (unsigned char) '\xbb'
  246. #define FOCUS_SE      (unsigned char) '\xbc'
  247. #define FOCUS_SW      (unsigned char) '\xc8'
  248. #define FOCUS_SIDE    (unsigned char) '\xba'
  249. #define FOCUS_LINE    (unsigned char) '\xcd'
  250. #define NW            (unsigned char) '\xda'
  251. #define NE            (unsigned char) '\xbf'
  252. #define SE            (unsigned char) '\xd9'
  253. #define SW            (unsigned char) '\xc0'
  254. #define SIDE          (unsigned char) '\xb3'
  255. #define LINE          (unsigned char) '\xc4'
  256. #define LEDGE         (unsigned char) '\xc3'
  257. #define REDGE         (unsigned char) '\xb4'
  258. /* ------------- scroll bar characters ------------ */
  259. #define UPSCROLLBOX    (unsigned char) '\x1e'
  260. #define DOWNSCROLLBOX  (unsigned char) '\x1f'
  261. #define LEFTSCROLLBOX  (unsigned char) '\x11'
  262. #define RIGHTSCROLLBOX (unsigned char) '\x10'
  263. #define SCROLLBARCHAR  (unsigned char) 176 
  264. #define SCROLLBOXCHAR  (unsigned char) 178
  265. /* ------------------ menu characters --------------------- */
  266. #define CHECKMARK      (unsigned char) (SCREENHEIGHT==25?251:4)
  267. #define CASCADEPOINTER (unsigned char) '\x10'
  268. /* ----------------- title bar characters ----------------- */
  269. #define CONTROLBOXCHAR (unsigned char) '\xf0'
  270. #define MAXPOINTER     24      /* maximize token            */
  271. #define MINPOINTER     25      /* minimize token            */
  272. #define RESTOREPOINTER 18      /* restore token             */
  273. /* --------------- text control characters ---------------- */
  274. #define APPLCHAR     (unsigned char) 176 /* fills application window */
  275. #define SHORTCUTCHAR '~'    /* prefix: shortcut key display */
  276. #define CHANGECOLOR  (unsigned char) 174 /* prefix to change colors  */
  277. #define RESETCOLOR   (unsigned char) 175 /* reset colors to default  */
  278. #define LISTSELECTOR   4    /* selected list box entry      */
  279. /* --------- message prototypes ----------- */
  280. BOOL init_messages(void);
  281. void PostMessage(WINDOW, MESSAGE, PARAM, PARAM);
  282. int SendMessage(WINDOW, MESSAGE, PARAM, PARAM);
  283. BOOL dispatch_message(void);
  284. void handshake(void);
  285. int TestCriticalError(void);
  286. /* ---- standard window message processing prototypes ----- */
  287. int ApplicationProc(WINDOW, MESSAGE, PARAM, PARAM);
  288. int NormalProc(WINDOW, MESSAGE, PARAM, PARAM);
  289. int TextBoxProc(WINDOW, MESSAGE, PARAM, PARAM);
  290. int ListBoxProc(WINDOW, MESSAGE, PARAM, PARAM);
  291. int EditBoxProc(WINDOW, MESSAGE, PARAM, PARAM);
  292. int EditorProc(WINDOW, MESSAGE, PARAM, PARAM);
  293. int PictureProc(WINDOW, MESSAGE, PARAM, PARAM);
  294. int MenuBarProc(WINDOW, MESSAGE, PARAM, PARAM);
  295. int PopDownProc(WINDOW, MESSAGE, PARAM, PARAM);
  296. int ButtonProc(WINDOW, MESSAGE, PARAM, PARAM);
  297. int ComboProc(WINDOW, MESSAGE, PARAM, PARAM);
  298. int TextProc(WINDOW, MESSAGE, PARAM, PARAM);
  299. int RadioButtonProc(WINDOW, MESSAGE, PARAM, PARAM);
  300. int CheckBoxProc(WINDOW, MESSAGE, PARAM, PARAM);
  301. int SpinButtonProc(WINDOW, MESSAGE, PARAM, PARAM);
  302. int BoxProc(WINDOW, MESSAGE, PARAM, PARAM);
  303. int DialogProc(WINDOW, MESSAGE, PARAM, PARAM);
  304. int SystemMenuProc(WINDOW, MESSAGE, PARAM, PARAM);
  305. int HelpBoxProc(WINDOW, MESSAGE, PARAM, PARAM);
  306. int MessageBoxProc(WINDOW, MESSAGE, PARAM, PARAM);
  307. int CancelBoxProc(WINDOW, MESSAGE, PARAM, PARAM);
  308. int ErrorBoxProc(WINDOW, MESSAGE, PARAM, PARAM);
  309. int YesNoBoxProc(WINDOW, MESSAGE, PARAM, PARAM);
  310. int StatusBarProc(WINDOW, MESSAGE, PARAM, PARAM);
  311. int WatchIconProc(WINDOW, MESSAGE, PARAM, PARAM);
  312. /* ------------- normal box prototypes ------------- */
  313. void SetStandardColor(WINDOW);
  314. void SetReverseColor(WINDOW);
  315. BOOL isAncestor(WINDOW, WINDOW);
  316. #define HitControlBox(wnd, p1, p2)     \
  317.      (TestAttribute(wnd, CONTROLBOX) && \
  318.      p1 == 2 && p2 == 0)
  319. #define WndForeground(wnd)         \
  320.     (wnd->WindowColors [STD_COLOR] [FG])
  321. #define WndBackground(wnd)         \
  322.     (wnd->WindowColors [STD_COLOR] [BG])
  323. #define FrameForeground(wnd)     \
  324.     (wnd->WindowColors [FRAME_COLOR] [FG])
  325. #define FrameBackground(wnd)     \
  326.     (wnd->WindowColors [FRAME_COLOR] [BG])
  327. #define SelectForeground(wnd)     \
  328.     (wnd->WindowColors [SELECT_COLOR] [FG])
  329. #define SelectBackground(wnd)     \
  330.     (wnd->WindowColors [SELECT_COLOR] [BG])
  331. #define HighlightForeground(wnd)     \
  332.     (wnd->WindowColors [HILITE_COLOR] [FG])
  333. #define HighlightBackground(wnd)     \
  334.     (wnd->WindowColors [HILITE_COLOR] [BG])
  335. #define WindowClientColor(wnd, fg, bg)     \
  336.         WndForeground(wnd) = fg, WndBackground(wnd) = bg
  337. #define WindowReverseColor(wnd, fg, bg) \
  338.         SelectForeground(wnd) = fg, SelectBackground(wnd) = bg
  339. #define WindowFrameColor(wnd, fg, bg) \
  340.         FrameForeground(wnd) = fg, FrameBackground(wnd) = bg
  341. #define WindowHighlightColor(wnd, fg, bg) \
  342.         HighlightForeground(wnd) = fg, HighlightBackground(wnd) = bg
  343. /* -------- text box prototypes ---------- */
  344. #define TextLine(wnd, sel) \
  345.       (wnd->text + *((wnd->TextPointers) + sel))
  346. void WriteTextLine(WINDOW, RECT *, int, BOOL);
  347. #define TextBlockMarked(wnd) (  wnd->BlkBegLine ||    \
  348.                                 wnd->BlkEndLine ||    \
  349.                                 wnd->BlkBegCol  ||    \
  350.                                 wnd->BlkEndCol)
  351. void MarkTextBlock(WINDOW, int, int, int, int);
  352. #define ClearTextBlock(wnd) wnd->BlkBegLine = wnd->BlkEndLine =  \
  353.                         wnd->BlkBegCol  = wnd->BlkEndCol = 0;
  354. #define TextBlockBegin(wnd) (TextLine(wnd,wnd->BlkBegLine)+wnd->BlkBegCol)
  355. #define TextBlockEnd(wnd)   (TextLine(wnd,wnd->BlkEndLine)+wnd->BlkEndCol)
  356. #define GetText(w)        ((w)->text)
  357. #define GetTextLines(w)   ((w)->wlines)
  358. void ClearTextPointers(WINDOW);
  359. void BuildTextPointers(WINDOW);
  360. int TextLineNumber(WINDOW, char *);
  361. /* ------------ Clipboard prototypes ------------- */
  362. void CopyTextToClipboard(char *);
  363. void CopyToClipboard(WINDOW);
  364. #define PasteFromClipboard(wnd) PasteText(wnd,Clipboard,ClipboardLength)
  365. BOOL PasteText(WINDOW, char *, unsigned);
  366. void ClearClipboard(void);
  367. /* --------- menu prototypes ---------- */
  368. int CopyCommand(unsigned char *, unsigned char *, int, int);
  369. void PrepFileMenu(void *, struct Menu *);
  370. void PrepEditMenu(void *, struct Menu *);
  371. void PrepSearchMenu(void *, struct Menu *);
  372. void PrepWindowMenu(void *, struct Menu *);
  373. void BuildSystemMenu(WINDOW);
  374. BOOL isActive(MBAR *, int);
  375. char *GetCommandText(MBAR *, int);
  376. BOOL isCascadedCommand(MBAR *,int);
  377. void ActivateCommand(MBAR *,int);
  378. void DeactivateCommand(MBAR *,int);
  379. BOOL GetCommandToggle(MBAR *,int);
  380. void SetCommandToggle(MBAR *,int);
  381. void ClearCommandToggle(MBAR *,int);
  382. void InvertCommandToggle(MBAR *,int);
  383. int BarSelection(int);
  384. /* ------------- list box prototypes -------------- */
  385. BOOL ItemSelected(WINDOW, int);
  386. /* ------------- edit box prototypes ----------- */
  387. #define CurrChar (TextLine(wnd, wnd->CurrLine)+wnd->CurrCol)
  388. #define WndCol   (wnd->CurrCol-wnd->wleft)
  389. #define isMultiLine(wnd) TestAttribute(wnd, MULTILINE)
  390. void SearchText(WINDOW);
  391. void ReplaceText(WINDOW);
  392. void SearchNext(WINDOW);
  393. /* ------------- editor prototypes ----------- */
  394. void CollapseTabs(WINDOW wnd);
  395. void ExpandTabs(WINDOW wnd);
  396. /* --------- message box prototypes -------- */
  397. WINDOW SliderBox(int, char *, char *);
  398. BOOL InputBox(WINDOW, char *, char *, char *, int, int);
  399. BOOL GenericMessage(WINDOW, char *, char *, int,
  400.     int (*)(struct window *, enum messages, PARAM, PARAM),
  401.     char *, char *, int, int, int);
  402. #define TestErrorMessage(msg)    \
  403.     GenericMessage(NULL, "Error", msg, 2, ErrorBoxProc,      \
  404.         Ok, Cancel, ID_OK, ID_CANCEL, TRUE)
  405. #define ErrorMessage(msg) \
  406.     GenericMessage(NULL, "Error", msg, 1, ErrorBoxProc,   \
  407.         Ok, NULL, ID_OK, 0, TRUE)
  408. #define MessageBox(ttl, msg) \
  409.     GenericMessage(NULL, ttl, msg, 1, MessageBoxProc, \
  410.         Ok, NULL, ID_OK, 0, TRUE)
  411. #define YesNoBox(msg)    \
  412.     GenericMessage(NULL, NULL, msg, 2, YesNoBoxProc,   \
  413.         Yes, No, ID_OK, ID_CANCEL, TRUE)
  414. #define CancelBox(wnd, msg) \
  415.     GenericMessage(wnd, "Wait...", msg, 1, CancelBoxProc, \
  416.         Cancel, NULL, ID_CANCEL, 0, FALSE)
  417. void CloseCancelBox(void);
  418. WINDOW MomentaryMessage(char *);
  419. int MsgHeight(char *);
  420. int MsgWidth(char *);
  421.  
  422. /* ------------- dialog box prototypes -------------- */
  423. BOOL DialogBox(WINDOW, DBOX *, BOOL,
  424.        int (*)(struct window *, enum messages, PARAM, PARAM));
  425. void ClearDialogBoxes(void);
  426. BOOL OpenFileDialogBox(char *, char *);
  427. BOOL SaveAsDialogBox(char *, char *);
  428. void GetDlgListText(WINDOW, char *, enum commands);
  429. BOOL RadioButtonSetting(DBOX *, enum commands);
  430. void PushRadioButton(DBOX *, enum commands);
  431. void PutItemText(WINDOW, enum commands, char *);
  432. void PutComboListText(WINDOW, enum commands, char *);
  433. void GetItemText(WINDOW, enum commands, char *, int);
  434. char *GetDlgTextString(DBOX *, enum commands, CLASS);
  435. void SetDlgTextString(DBOX *, enum commands, char *, CLASS);
  436. BOOL CheckBoxSetting(DBOX *, enum commands);
  437. CTLWINDOW *FindCommand(DBOX *, enum commands, int);
  438. WINDOW ControlWindow(DBOX *, enum commands);
  439. void SetScrollBars(WINDOW);
  440. void SetRadioButton(DBOX *, CTLWINDOW *);
  441. void ControlSetting(DBOX *, enum commands, int, int);
  442. void SetFocusCursor(WINDOW);
  443.  
  444. #define GetControl(wnd)             (wnd->ct)
  445. #define GetDlgText(db, cmd)         GetDlgTextString(db, cmd, TEXT)
  446. #define GetDlgTextBox(db, cmd)      GetDlgTextString(db, cmd, TEXTBOX)
  447. #define GetEditBoxText(db, cmd)     GetDlgTextString(db, cmd, EDITBOX)
  448. #define GetComboBoxText(db, cmd)    GetDlgTextString(db, cmd, COMBOBOX)
  449. #define SetDlgText(db, cmd, s)      SetDlgTextString(db, cmd, s, TEXT)
  450. #define SetDlgTextBox(db, cmd, s)   SetDlgTextString(db, cmd, s, TEXTBOX)
  451. #define SetEditBoxText(db, cmd, s)  SetDlgTextString(db, cmd, s, EDITBOX)
  452. #define SetComboBoxText(db, cmd, s) SetDlgTextString(db, cmd, s, COMBOBOX)
  453. #define SetDlgTitle(db, ttl)        ((db)->dwnd.title = ttl)
  454. #define SetCheckBox(db, cmd)        ControlSetting(db, cmd, CHECKBOX, ON)
  455. #define ClearCheckBox(db, cmd)      ControlSetting(db, cmd, CHECKBOX, OFF)
  456. #define EnableButton(db, cmd)       ControlSetting(db, cmd, BUTTON, ON)
  457. #define DisableButton(db, cmd)      ControlSetting(db, cmd, BUTTON, OFF)
  458.  
  459. /* ---- types of vectors that can be in a picture box ------- */
  460. enum VectTypes {VECTOR, SOLIDBAR, HEAVYBAR, CROSSBAR, LIGHTBAR};
  461.  
  462. /* ------------- picture box prototypes ------------- */
  463. void DrawVector(WINDOW, int, int, int, int);
  464. void DrawBox(WINDOW, int, int, int, int);
  465. void DrawBar(WINDOW, enum VectTypes, int, int, int, int);
  466. WINDOW WatchIcon(void);
  467.  
  468. /* ------------- help box prototypes ------------- */
  469. void LoadHelpFile(void);
  470. void UnLoadHelpFile(void);
  471. BOOL DisplayHelp(WINDOW, char *);
  472. char *HelpComment(char *);
  473.  
  474. extern char *ClassNames[];
  475.  
  476. void BuildFileName(char *, char *);
  477.  
  478. #endif
  479.  
  480.