home *** CD-ROM | disk | FTP | other *** search
/ Stars of Shareware: Programmierung / SOURCE.mdf / programm / windows / c / lckowl15 / lckowl.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-01-08  |  10.7 KB  |  294 lines

  1. /************************************************************************
  2.  
  3.     Software:    LCKOWL.DLL
  4.  
  5.     Version:    1.5
  6.             Copyright by Larry Klein, LCK Consulting, December 15, 1992
  7.  
  8.     Developed By:    Larry Klein
  9.             LCK Consulting
  10.             732 Symphony Woods Drive
  11.             Silver Spring, MD  20901
  12.             Phone - 301-593-2745
  13.             Fax   - 301-593-4262
  14.             Compuserve - 76330,2525
  15.  
  16.     Purpose:    BC++ OWL-derived MDI Frame class that automatically manages
  17.                 a status bar, tool bar and toolbox.
  18.             BC++ OWL-derived Window classes that add administrative
  19.                 features lacking in OWL.
  20.  
  21.     Requirements:    Borland C++ Compiler 3.0 or higher
  22.             LCKUtil.DLL for error message handling
  23.  
  24.     Requirements    Drover's Toolbox by Farpoint
  25.     For Extending        FarPoint Technologies
  26.     LCKOWL.DLL:        P.O. Box 309
  27.                 75 Walnut Street
  28.                 Richmond, Ohio  43944-0309
  29.                 Phone: 614-765-4333
  30.                 Fax:   614-765-4939
  31.  
  32.             DataTable by ProtoView Development Corp
  33.                 ProtoView Development Corp
  34.                 353 Georges Road
  35.                 Dayton, NJ  08810
  36.                 Phone: 908-329-8588
  37.                                    Fax:   908-329-8624
  38.  
  39.     NOTE:        This product was developed by LCK
  40.             Consulting as shareware for general use.
  41.             This software and associated
  42.             documentation are provided "as-is" and
  43.             without any express or implied
  44.             warranties whatsoever.  The user is
  45.             advised to test the program thoroughly
  46.             before relying on it.  The user assumes
  47.             the entire risk of using the program.
  48.  
  49.     Shareware:    If this program is utilized to your
  50.             satisfaction, a $20 shareware fee can be
  51.             sent to the LCK Consulting.  This fee
  52.             will go towards upgrading the product.
  53.             Your name and address will be placed on
  54.             a mailing list for further upgrades.
  55.             Where possible, include any bulletin
  56.             board address to which notifications can
  57.             be sent.
  58.  
  59. ************************************************************************/
  60.  
  61. #include "string.h"
  62. #include "owl.h"
  63. #include "mdi.h"
  64. #include "dtctl.h"
  65. #include "lckowl2.h"
  66.  
  67. #ifndef __LCKOWL_H__
  68. #define __LCKOWL_H__
  69.  
  70. #define TOOLBAR_WIDTH              32
  71. #define TOOLBAR_HEIGHT             32
  72.  
  73. #define LCK_MAXLEN_TITLE    32
  74. #define LCK_MAXLEN_CLASSNAME    40
  75. #define LCK_MAXLEN_DIALOGNAME    40
  76. #define LCK_MAXLEN_MENUNAME    40
  77.  
  78. _CLASSDEF(TLCKStatusBar)
  79. _CLASSDEF(TLCKToolBar)
  80. _CLASSDEF(TLCKToolBox)
  81. _CLASSDEF(TMDIChildDialog)
  82. _CLASSDEF(TMDIChildWindow)
  83. _CLASSDEF(TMDIFrameTools)
  84. _CLASSDEF(TWindowTools)
  85.  
  86. class _EXPORT TWindowTools : public TWindow
  87. {
  88.     protected:
  89.     PTLCKStatusBar    StatusBar;
  90.     PTLCKToolBar    ToolBar;
  91.     PTLCKToolBox    ToolBox;
  92.     char        szClassName[LCK_MAXLEN_CLASSNAME + 1];
  93.     char        szMDIMenu[LCK_MAXLEN_MENUNAME + 1], szOldMDIMenu[LCK_MAXLEN_MENUNAME + 1];
  94.     int        MDIChildMenuPos, OldMDIChildMenuPos;
  95.     BOOL        bMDIMenu;
  96.  
  97.     public:
  98.     BOOL        bResize;
  99.     WORD        wWindowType;
  100.  
  101.     TWindowTools(PTWindowsObject AParent, LPSTR ATitle, WORD AWindowType = NULL);
  102.     ~TWindowTools();
  103.     virtual void    CMCreateStatusBar(RTMessage Msg)    = [CM_FIRST + IDM_CREATESTATUSBAR];
  104.     virtual void    CMCreateToolBar(RTMessage Msg)        = [CM_FIRST + IDM_CREATETOOLBAR];
  105.     virtual void    CMCreateToolBox(RTMessage Msg)        = [CM_FIRST + IDM_CREATETOOLBOX];
  106.     virtual void    CMDestroyStatusBar(RTMessage Msg)    = [CM_FIRST + IDM_DESTROYSTATUSBAR];
  107.     virtual void    CMDestroyToolBar(RTMessage Msg)        = [CM_FIRST + IDM_DESTROYTOOLBAR];
  108.     virtual void    CMDestroyToolBox(RTMessage Msg)        = [CM_FIRST + IDM_DESTROYTOOLBOX];
  109.     virtual void    CMToggleStatusBar(RTMessage Msg)    = [CM_FIRST + IDM_TOGGLESTATUSBAR];
  110.     virtual void    CMToggleToolBar(RTMessage Msg)        = [CM_FIRST + IDM_TOGGLETOOLBAR];
  111.     virtual void    CMToggleToolBox(RTMessage Msg)        = [CM_FIRST + IDM_TOGGLETOOLBOX];
  112.     virtual LPSTR     GetClassName();
  113.     virtual void     GetWindowClass(WNDCLASS _FAR & AWndClass);
  114.     void CALLBACK    InitStatusBar(LPSTATUSBARITEM AStatusBar, int AItems, int AHeight = NULL,
  115.                 DWORD AStyle = WS_CHILD | WS_VISIBLE | SBRS_DRAWTOPLINE | SBRS_PIXELS);
  116.     void CALLBACK    InitToolBar(LPTOOLBOXITEM AToolBar, int AItems, int AHeight = TOOLBAR_HEIGHT, int AWidth = TOOLBAR_WIDTH,
  117.                 DWORD AStyle = WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | WS_BORDER | TBXS_NOSTATE);
  118.     void CALLBACK    InitToolBox(LPTOOLBOXITEM AToolBox, int AItems, LPSTR ATitle = NULL, int AColumns = TBX_RESIZE,
  119.             int ARows = 1, int AHeight = TOOLBAR_HEIGHT, int AWidth = TOOLBAR_WIDTH,
  120.             DWORD AStyle = WS_CLIPSIBLINGS | WS_VISIBLE | WS_BORDER | WS_CAPTION | TBXS_SINGLESEL);
  121.     BOOL         IsWindowType(PTWindowsObject Child, Pvoid Param);
  122.     virtual void     Resize();
  123.     void        SetMDIMenu(LPSTR AMenuName, int AChildMenuPos = 0);
  124.     void        SetOldMDIMenu(LPSTR AMenuName, int AChildMenuPos = 0);
  125.     virtual void    SetupWindow();
  126.     virtual void    WMCommand(RTMessage Msg)        = [WM_FIRST + WM_COMMAND];
  127.     virtual void    WMMDIActivate(RTMessage Msg)        = [WM_FIRST + WM_MDIACTIVATE];
  128.     virtual void     WMNCCreate(RTMessage Msg)        = [WM_FIRST + WM_NCCREATE];
  129.     virtual void     WMNCLButtonDown(RTMessage Msg)        = [WM_FIRST + WM_NCLBUTTONDOWN];
  130.     virtual void    WMSize(RTMessage Msg)            = [WM_FIRST + WM_SIZE];
  131. };
  132.  
  133. class _EXPORT TMDIChildDialog : public TDialog
  134. {
  135.     public:
  136.     TMDIChildDialog(PTWindowsObject AParent, LPSTR ATitle)
  137.         : TDialog(AParent, ATitle) {};
  138.     virtual void     Cancel(RTMessage Msg)        = [ID_FIRST + IDCANCEL]
  139.         { Parent->CloseWindow(); };
  140.     virtual void    Ok(RTMessage Msg)        = [ID_FIRST + IDOK]
  141.         { TDialog::Ok(Msg); Parent->CloseWindow(); };
  142.     virtual void    WMSetFocus(RTMessage Msg)    = [WM_FIRST + WM_SETFOCUS]
  143.         { GetApplication()->SetKBHandler( this ); DefWndProc( Msg ); };
  144. };
  145.  
  146. class _EXPORT TMDIChildWindow : public TWindowTools
  147. {
  148.     protected:
  149.     PTDialog    ChildDialog;
  150.     char        szDialogName[LCK_MAXLEN_DIALOGNAME + 1];
  151.  
  152.     public:
  153.     TMDIChildWindow(PTWindowsObject AParent, LPSTR ATitle, LPSTR ADialogName, WORD AWindowType = NULL);
  154.     virtual PTDialog CreateChildDialog();
  155.     PTDialog    GetChildDialog() { return ChildDialog; };
  156.     virtual void    Resize();
  157.     virtual void    SetupWindow();
  158.     virtual void     WMMDIActivate(RTMessage Msg)        = [WM_FIRST + WM_MDIACTIVATE];
  159.     virtual void    WMSize(RTMessage Msg)            = [WM_FIRST + WM_SIZE];
  160. };
  161.  
  162. class _EXPORT TMDIFrameTools : public TMDIFrame
  163. {
  164.     protected:
  165.     int        nWindowTypeCount;
  166.     PTLCKStatusBar    StatusBar;
  167.     PTLCKToolBar    ToolBar;
  168.     PTLCKToolBox    ToolBox;
  169.  
  170.     public:
  171.     TMDIFrameTools(LPSTR ATitle, LPSTR MenuName);
  172.     ~TMDIFrameTools();
  173.     void        CloseChildWindows(WORD AWindowType);
  174.     void        CloseChildWindow(PTWindowsObject Child, Pvoid Param);
  175.     virtual void    CMCreateStatusBar(RTMessage Msg)    = [CM_FIRST + IDM_CREATESTATUSBAR];
  176.     virtual void    CMCreateToolBar(RTMessage Msg)        = [CM_FIRST + IDM_CREATETOOLBAR];
  177.     virtual void    CMCreateToolBox(RTMessage Msg)        = [CM_FIRST + IDM_CREATETOOLBOX];
  178.     virtual void    CMDestroyStatusBar(RTMessage Msg)    = [CM_FIRST + IDM_DESTROYSTATUSBAR];
  179.     virtual void    CMDestroyToolBar(RTMessage Msg)        = [CM_FIRST + IDM_DESTROYTOOLBAR];
  180.     virtual void    CMDestroyToolBox(RTMessage Msg)        = [CM_FIRST + IDM_DESTROYTOOLBOX];
  181.     virtual void    CMToggleStatusBar(RTMessage Msg)    = [CM_FIRST + IDM_TOGGLESTATUSBAR];
  182.     virtual void    CMToggleToolBar(RTMessage Msg)        = [CM_FIRST + IDM_TOGGLETOOLBAR];
  183.     virtual void    CMToggleToolBox(RTMessage Msg)        = [CM_FIRST + IDM_TOGGLETOOLBOX];
  184.     PTWindowsObject    GetFirstChildWindow(WORD AWindowType);
  185.     int        GetWindowTypeCount(WORD AWindowType);
  186.     void         IncWindowTypeCount(PTWindowsObject Child, Pvoid Param);
  187.     void CALLBACK    InitStatusBar(LPSTATUSBARITEM AStatusBar, int AItems, int AHeight = NULL,
  188.                 DWORD AStyle = WS_CHILD | WS_VISIBLE | SBRS_DRAWTOPLINE | SBRS_PIXELS);
  189.     void CALLBACK    InitToolBar(LPTOOLBOXITEM AToolBar, int AItems, int AHeight = TOOLBAR_HEIGHT, int AWidth = TOOLBAR_WIDTH,
  190.                 DWORD AStyle = WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | WS_BORDER | TBXS_NOSTATE);
  191.     void CALLBACK    InitToolBox(LPTOOLBOXITEM AToolBox, int AItems, LPSTR ATitle = NULL, int AColumns = TBX_RESIZE,
  192.             int ARows = 1, int AHeight = TOOLBAR_HEIGHT, int AWidth = TOOLBAR_WIDTH,
  193.             DWORD AStyle = WS_CLIPSIBLINGS | WS_VISIBLE | WS_BORDER | WS_CAPTION | TBXS_SINGLESEL);
  194.     BOOL         IsWindowType(PTWindowsObject Child, Pvoid Param);
  195.     void         Resize();
  196.     virtual void    WMCommand(RTMessage Msg)        = [WM_FIRST + WM_COMMAND];
  197.     virtual void    WMSize(RTMessage Msg)            = [WM_FIRST + WM_SIZE];
  198. };
  199.  
  200. class _EXPORT TLCKStatusBar
  201. {
  202.     protected:
  203.     int        nItems;
  204.     DWORD        Style;
  205.     LPSTATUSBARITEM    StatusBar;
  206.  
  207.     public:
  208.     HWND        HWindow;
  209.     int        nHeight;
  210.  
  211.     TLCKStatusBar(LPSTATUSBARITEM AStatusBar, int AItems, int AHeight = NULL,
  212.             DWORD AStyle = WS_CHILD | WS_VISIBLE | SBRS_DRAWTOPLINE | SBRS_PIXELS);
  213.     ~TLCKStatusBar();
  214.     HWND CALLBACK    Create(HWND AWindow);
  215.     void CALLBACK    Destroy();
  216.     BOOL CALLBACK    Exists() { return HWindow == NULL ? FALSE : TRUE; };
  217.     void CALLBACK    SetItemText(WORD AItem, LPSTR AText);
  218.     void CALLBACK    SetProgressPos(WORD AItem, WORD APos);
  219.         void CALLBACK    SetProgressRange(WORD AItem, WORD AMinimum, WORD AMaximum);
  220. };
  221.  
  222. class _EXPORT TLCKToolBar
  223. {
  224.     protected:
  225.     int        nItems;
  226.     DWORD        Style;
  227.     LPTOOLBOXITEM    ToolBar;
  228.     short        x, y, dColCount, dRowCount, dBorderSize;
  229.  
  230.     public:
  231.     HWND        HWindow;
  232.     int        nHeight;
  233.     int        nWidth;
  234.  
  235.     TLCKToolBar(LPTOOLBOXITEM AToolBar, int AItems, int AHeight = TOOLBAR_HEIGHT, int AWidth = TOOLBAR_WIDTH,
  236.             DWORD AStyle = WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | WS_BORDER | TBXS_NOSTATE);
  237.     ~TLCKToolBar();
  238.     HWND CALLBACK    Create(HINSTANCE AInst, HWND AWindow);
  239.     void CALLBACK    Destroy();
  240.     BOOL CALLBACK    Exists() { return HWindow == NULL ? FALSE : TRUE; };
  241. };
  242.  
  243. class _EXPORT TLCKToolBox
  244. {
  245.     protected:
  246.     char        Title[LCK_MAXLEN_TITLE];
  247.     int        nItems;
  248.     DWORD        Style;
  249.     LPTOOLBOXITEM    ToolBox;
  250.     short        x, y, dColCount, dRowCount, dBorderSize;
  251.  
  252.     public:
  253.     HWND        HWindow;
  254.     int        nHeight;
  255.     int        nWidth;
  256.  
  257.     TLCKToolBox(LPTOOLBOXITEM AToolBox, int AItems, LPSTR ATitle = NULL, int AColumns = TBX_RESIZE,
  258.             int ARows = 1, int AHeight = TOOLBAR_HEIGHT, int AWidth = TOOLBAR_WIDTH,
  259.             DWORD AStyle = WS_CLIPSIBLINGS | WS_VISIBLE | WS_BORDER | WS_CAPTION | TBXS_SINGLESEL);
  260.     ~TLCKToolBox();
  261.     HWND CALLBACK    Create(HINSTANCE AInst, HWND AWindow);
  262.     void CALLBACK    Destroy();
  263.     BOOL CALLBACK    Exists() { return HWindow == NULL ? FALSE : TRUE; };
  264. };
  265.  
  266.  
  267. #define LEN_DATATBL_STRING    40
  268. typedef struct tagCOLUMNCFG {
  269.     COLUMNCFGSTRUCT        ColCfg;
  270.     char            szFormat[LEN_DATATBL_STRING * 3];
  271. } COLUMNCFG, FAR * PCOLUMNCFG;
  272.  
  273. class _EXPORT TWindowTable : public TWindowTools
  274. {
  275.     protected:
  276.     WORD        wTableStyle;
  277.  
  278.     public:
  279.         PTDataTbl    DataTbl;
  280.  
  281.     TWindowTable(PTWindowsObject AParent, LPSTR ATitle, WORD AWindowType, WORD ATableStyle = NULL);
  282.     ~TWindowTable();
  283.     virtual void    DoubleClick() {};
  284.     virtual void     Resize();
  285.     void         SetColumns(int NCols, PCOLUMNCFG TableColumns);
  286.     void        SetNotifyToAccess();
  287.     virtual void    SetupWindow();
  288.     virtual void    StatusChange() {};
  289.     virtual void    WMCommand(RTMessage Msg)        = [WM_FIRST + WM_COMMAND];
  290.     virtual void    WMSize(RTMessage Msg)            = [WM_FIRST + WM_SIZE];
  291. };
  292.  
  293. #endif // __LCKOWL_H__
  294.