home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / cprog / dflt14.zip / DFLAT.H < prev    next >
Text File  |  1992-07-29  |  21KB  |  475 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 14"
  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.  
  59. /* ------ integer type for message parameters ----- */
  60. typedef long PARAM;
  61.  
  62. enum Condition     {
  63.     ISRESTORED, ISMINIMIZED, ISMAXIMIZED, ISCLOSING
  64. };
  65.  
  66. typedef struct window {
  67.     CLASS class;           /* window class                  */
  68.     char *title;           /* window title                  */
  69.     int (*wndproc)
  70.         (struct window *, enum messages, PARAM, PARAM);
  71.     /* ----------------- window colors -------------------- */
  72.     char WindowColors[4][2];
  73.     /* ---------------- window dimensions ----------------- */
  74.     RECT rc;               /* window coordinates
  75.                                             (0/0 to 79/24)  */
  76.     int ht, wd;            /* window height and width       */
  77.     RECT RestoredRC;       /* restored condition rect       */
  78.     /* -------------- linked list pointers ---------------- */
  79.     struct window *parent; /* parent window                 */
  80.     struct window *firstchild;  /* first child this parent  */
  81.     struct window *lastchild;   /* last child this parent   */
  82.     struct window *nextsibling; /* next sibling             */
  83.     struct window *prevsibling; /* previous sibling         */
  84.  
  85.     struct window *childfocus;    /* child that ha(s/d) focus */
  86.     int attrib;                 /* Window attributes        */
  87.     char *videosave;            /* video save buffer        */
  88.     enum Condition condition;   /* Restored, Maximized,
  89.                                    Minimized, Closing       */
  90.     enum Condition oldcondition;/* previous condition       */
  91.     int restored_attrib;        /* attributes when restored */
  92.     void *extension;      /* menus, dialogs, documents, etc */
  93.     struct window *PrevMouse;
  94.     struct window *PrevKeyboard;
  95.     struct window *MenuBarWnd;/* menu bar                   */
  96.     struct window *StatusBar; /* status bar                 */
  97.     /* ----------------- text box fields ------------------ */
  98.     int wlines;     /* number of lines of text              */
  99.     int wtop;       /* text line that is on the top display */
  100.     unsigned char *text; /* window text                     */
  101.     unsigned int textlen;  /* text length                   */
  102.     int wleft;      /* left position in window viewport     */
  103.     int textwidth;  /* width of longest line in textbox     */
  104.     int BlkBegLine; /* beginning line of marked block       */
  105.     int BlkBegCol;  /* beginning column of marked block     */
  106.     int BlkEndLine; /* ending line of marked block          */
  107.     int BlkEndCol;  /* ending column of marked block        */
  108.     int HScrollBox; /* position of horizontal scroll box    */
  109.     int VScrollBox; /* position of vertical scroll box      */
  110.     unsigned int *TextPointers; /* -> list of line offsets    */
  111.     /* ----------------- list box fields ------------------ */
  112.     int selection;  /* current selection                    */
  113.     BOOL AddMode;   /* adding extended selections mode      */
  114.     int AnchorPoint;/* anchor point for extended selections */
  115.     int SelectCount;/* count of selected items              */
  116.     /* ----------------- edit box fields ------------------ */
  117.     int CurrCol;      /* Current column                     */
  118.     int CurrLine;     /* Current line                       */
  119.     int WndRow;       /* Current window row                 */
  120.     BOOL TextChanged; /* TRUE if text has changed           */
  121.     unsigned char *DeletedText; /* for undo                 */
  122.     unsigned DeletedLength; /* Length of deleted field      */
  123.     BOOL InsertMode;   /* TRUE or FALSE for text insert     */
  124.     BOOL WordWrapMode; /* TRUE or FALSE for word wrap       */
  125.     unsigned int MaxTextLength; /* maximum text length      */
  126.     /* ---------------- dialog box fields ----------------- */
  127.     int ReturnCode;        /* return code from a dialog box */
  128.     BOOL Modal;               /* True if a modeless dialog box */
  129.     CTLWINDOW *ct;           /* control structure             */
  130.     /* -------------- popdownmenu fields ------------------ */
  131.     MENU *mnu;        /* points to menu structure             */
  132.     MBAR *holdmenu; /* previous active menu                 */
  133.     struct window *oldFocus;
  134.     /* --------------- help box fields -------------------- */
  135.     void *firstword; /* -> first in list of key words       */
  136.     void *lastword;  /* -> last in list of key words        */
  137.     void *thisword;  /* -> current in list of key words     */
  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 PictureProc(WINDOW, MESSAGE, PARAM, PARAM);
  293. int MenuBarProc(WINDOW, MESSAGE, PARAM, PARAM);
  294. int PopDownProc(WINDOW, MESSAGE, PARAM, PARAM);
  295. int ButtonProc(WINDOW, MESSAGE, PARAM, PARAM);
  296. int ComboProc(WINDOW, MESSAGE, PARAM, PARAM);
  297. int TextProc(WINDOW, MESSAGE, PARAM, PARAM);
  298. int RadioButtonProc(WINDOW, MESSAGE, PARAM, PARAM);
  299. int CheckBoxProc(WINDOW, MESSAGE, PARAM, PARAM);
  300. int SpinButtonProc(WINDOW, MESSAGE, PARAM, PARAM);
  301. int BoxProc(WINDOW, MESSAGE, PARAM, PARAM);
  302. int DialogProc(WINDOW, MESSAGE, PARAM, PARAM);
  303. int SystemMenuProc(WINDOW, MESSAGE, PARAM, PARAM);
  304. int HelpBoxProc(WINDOW, MESSAGE, PARAM, PARAM);
  305. int MessageBoxProc(WINDOW, MESSAGE, PARAM, PARAM);
  306. int CancelBoxProc(WINDOW, MESSAGE, PARAM, PARAM);
  307. int ErrorBoxProc(WINDOW, MESSAGE, PARAM, PARAM);
  308. int YesNoBoxProc(WINDOW, MESSAGE, PARAM, PARAM);
  309. int StatusBarProc(WINDOW, MESSAGE, PARAM, PARAM);
  310. int WatchIconProc(WINDOW, MESSAGE, PARAM, PARAM);
  311. /* ------------- normal box prototypes ------------- */
  312. void SetStandardColor(WINDOW);
  313. void SetReverseColor(WINDOW);
  314. BOOL isAncestor(WINDOW, WINDOW);
  315. #define HitControlBox(wnd, p1, p2)     \
  316.      (TestAttribute(wnd, CONTROLBOX) && \
  317.      p1 == 2 && p2 == 0)
  318. #define WndForeground(wnd)         \
  319.     (wnd->WindowColors [STD_COLOR] [FG])
  320. #define WndBackground(wnd)         \
  321.     (wnd->WindowColors [STD_COLOR] [BG])
  322. #define FrameForeground(wnd)     \
  323.     (wnd->WindowColors [FRAME_COLOR] [FG])
  324. #define FrameBackground(wnd)     \
  325.     (wnd->WindowColors [FRAME_COLOR] [BG])
  326. #define SelectForeground(wnd)     \
  327.     (wnd->WindowColors [SELECT_COLOR] [FG])
  328. #define SelectBackground(wnd)     \
  329.     (wnd->WindowColors [SELECT_COLOR] [BG])
  330. #define HighlightForeground(wnd)     \
  331.     (wnd->WindowColors [HILITE_COLOR] [FG])
  332. #define HighlightBackground(wnd)     \
  333.     (wnd->WindowColors [HILITE_COLOR] [BG])
  334. #define WindowClientColor(wnd, fg, bg)     \
  335.         WndForeground(wnd) = fg, WndBackground(wnd) = bg
  336. #define WindowReverseColor(wnd, fg, bg) \
  337.         SelectForeground(wnd) = fg, SelectBackground(wnd) = bg
  338. #define WindowFrameColor(wnd, fg, bg) \
  339.         FrameForeground(wnd) = fg, FrameBackground(wnd) = bg
  340. #define WindowHighlightColor(wnd, fg, bg) \
  341.         HighlightForeground(wnd) = fg, HighlightBackground(wnd) = bg
  342. /* -------- text box prototypes ---------- */
  343. #define TextLine(wnd, sel) \
  344.       (wnd->text + *((wnd->TextPointers) + sel))
  345. void WriteTextLine(WINDOW, RECT *, int, BOOL);
  346. void SetAnchor(WINDOW, int, int);
  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 GetText(w)        ((w)->text)
  355. #define GetTextLines(w)   ((w)->wlines)
  356. void ClearTextPointers(WINDOW);
  357. void BuildTextPointers(WINDOW);
  358. int TextLineNumber(WINDOW, char *);
  359. /* ------------ Clipboard prototypes ------------- */
  360. void CopyTextToClipboard(char *);
  361. void CopyToClipboard(WINDOW);
  362. #define PasteFromClipboard(wnd) PasteText(wnd,Clipboard,ClipboardLength)
  363. BOOL PasteText(WINDOW, char *, unsigned);
  364. void ClearClipboard(void);
  365. /* --------- menu prototypes ---------- */
  366. int CopyCommand(unsigned char *, unsigned char *, int, int);
  367. void PrepFileMenu(void *, struct Menu *);
  368. void PrepEditMenu(void *, struct Menu *);
  369. void PrepSearchMenu(void *, struct Menu *);
  370. void PrepWindowMenu(void *, struct Menu *);
  371. void BuildSystemMenu(WINDOW);
  372. BOOL isActive(MBAR *, int);
  373. char *GetCommandText(MBAR *, int);
  374. BOOL isCascadedCommand(MBAR *,int);
  375. void ActivateCommand(MBAR *,int);
  376. void DeactivateCommand(MBAR *,int);
  377. BOOL GetCommandToggle(MBAR *,int);
  378. void SetCommandToggle(MBAR *,int);
  379. void ClearCommandToggle(MBAR *,int);
  380. void InvertCommandToggle(MBAR *,int);
  381. int BarSelection(int);
  382. /* ------------- list box prototypes -------------- */
  383. BOOL ItemSelected(WINDOW, int);
  384. /* ------------- edit box prototypes ----------- */
  385. #define CurrChar (TextLine(wnd, wnd->CurrLine)+wnd->CurrCol)
  386. #define WndCol   (wnd->CurrCol-wnd->wleft)
  387. #define isMultiLine(wnd) TestAttribute(wnd, MULTILINE)
  388. void SearchText(WINDOW);
  389. void ReplaceText(WINDOW);
  390. void SearchNext(WINDOW);
  391. /* --------- message box prototypes -------- */
  392. WINDOW SliderBox(int, char *, char *);
  393. BOOL InputBox(WINDOW, char *, char *, char *, int);
  394. BOOL GenericMessage(WINDOW, char *, char *, int,
  395.     int (*)(struct window *, enum messages, PARAM, PARAM),
  396.     char *, char *, int, int, int);
  397. #define TestErrorMessage(msg)    \
  398.     GenericMessage(NULL, "Error", msg, 2, ErrorBoxProc,      \
  399.         Ok, Cancel, ID_OK, ID_CANCEL, TRUE)
  400. #define ErrorMessage(msg) \
  401.     GenericMessage(NULL, "Error", msg, 1, ErrorBoxProc,   \
  402.         Ok, NULL, ID_OK, 0, TRUE)
  403. #define MessageBox(ttl, msg) \
  404.     GenericMessage(NULL, ttl, msg, 1, MessageBoxProc, \
  405.         Ok, NULL, ID_OK, 0, TRUE)
  406. #define YesNoBox(msg)    \
  407.     GenericMessage(NULL, NULL, msg, 2, YesNoBoxProc,   \
  408.         Yes, No, ID_OK, ID_CANCEL, TRUE)
  409. #define CancelBox(wnd, msg) \
  410.     GenericMessage(wnd, "Wait...", msg, 1, CancelBoxProc, \
  411.         Cancel, NULL, ID_CANCEL, 0, FALSE)
  412. void CloseCancelBox(void);
  413. WINDOW MomentaryMessage(char *);
  414. int MsgHeight(char *);
  415. int MsgWidth(char *);
  416.  
  417. /* ------------- dialog box prototypes -------------- */
  418. BOOL DialogBox(WINDOW, DBOX *, BOOL,
  419.        int (*)(struct window *, enum messages, PARAM, PARAM));
  420. void ClearDialogBoxes(void);
  421. BOOL OpenFileDialogBox(char *, char *);
  422. BOOL SaveAsDialogBox(char *);
  423. void GetDlgListText(WINDOW, char *, enum commands);
  424. BOOL DlgDirList(WINDOW, char *, enum commands,
  425.                             enum commands, unsigned);
  426. BOOL RadioButtonSetting(DBOX *, enum commands);
  427. void PushRadioButton(DBOX *, enum commands);
  428. void PutItemText(WINDOW, enum commands, char *);
  429. void PutComboListText(WINDOW, enum commands, char *);
  430. void GetItemText(WINDOW, enum commands, char *, int);
  431. char *GetDlgTextString(DBOX *, enum commands, CLASS);
  432. void SetDlgTextString(DBOX *, enum commands, char *, CLASS);
  433. BOOL CheckBoxSetting(DBOX *, enum commands);
  434. CTLWINDOW *FindCommand(DBOX *, enum commands, int);
  435. WINDOW ControlWindow(DBOX *, enum commands);
  436. void SetScrollBars(WINDOW);
  437. void SetRadioButton(DBOX *, CTLWINDOW *);
  438. void ControlSetting(DBOX *, enum commands, int, int);
  439. void SetFocusCursor(WINDOW);
  440.  
  441. #define GetControl(wnd)             (wnd->ct)
  442. #define GetDlgText(db, cmd)         GetDlgTextString(db, cmd, TEXT)
  443. #define GetDlgTextBox(db, cmd)      GetDlgTextString(db, cmd, TEXTBOX)
  444. #define GetEditBoxText(db, cmd)     GetDlgTextString(db, cmd, EDITBOX)
  445. #define GetComboBoxText(db, cmd)    GetDlgTextString(db, cmd, COMBOBOX)
  446. #define SetDlgText(db, cmd, s)      SetDlgTextString(db, cmd, s, TEXT)
  447. #define SetDlgTextBox(db, cmd, s)   SetDlgTextString(db, cmd, s, TEXTBOX)
  448. #define SetEditBoxText(db, cmd, s)  SetDlgTextString(db, cmd, s, EDITBOX)
  449. #define SetComboBoxText(db, cmd, s) SetDlgTextString(db, cmd, s, COMBOBOX)
  450. #define SetDlgTitle(db, ttl)        ((db)->dwnd.title = ttl)
  451. #define SetCheckBox(db, cmd)        ControlSetting(db, cmd, CHECKBOX, ON)
  452. #define ClearCheckBox(db, cmd)      ControlSetting(db, cmd, CHECKBOX, OFF)
  453. #define EnableButton(db, cmd)       ControlSetting(db, cmd, BUTTON, ON)
  454. #define DisableButton(db, cmd)      ControlSetting(db, cmd, BUTTON, OFF)
  455.  
  456. /* ---- types of vectors that can be in a picture box ------- */
  457. enum VectTypes {VECTOR, SOLIDBAR, HEAVYBAR, CROSSBAR, LIGHTBAR};
  458.  
  459. /* ------------- picture box prototypes ------------- */
  460. void DrawVector(WINDOW, int, int, int, int);
  461. void DrawBox(WINDOW, int, int, int, int);
  462. void DrawBar(WINDOW, enum VectTypes, int, int, int, int);
  463. WINDOW WatchIcon(void);
  464.  
  465. /* ------------- help box prototypes ------------- */
  466. void LoadHelpFile(void);
  467. void UnLoadHelpFile(void);
  468. BOOL DisplayHelp(WINDOW, char *);
  469.  
  470. extern char *ClassNames[];
  471.  
  472. void BuildFileName(char *, char *);
  473.  
  474. #endif
  475.