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