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