home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c083 / 19.ddi / OWLINC.PAK / WINDOW.H < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-02  |  55.3 KB  |  1,677 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows - (C) Copyright 1991, 1993 by Borland International
  3. //   include\owl\window.h
  4. //   Base window class definition, including HWND encapsulation.
  5. //----------------------------------------------------------------------------
  6. #if !defined(__OWL_WINDOW_H)
  7. #define __OWL_WINDOW_H
  8.  
  9. #if !defined(__OWL_POINT_H)
  10.   #include <owl\point.h>
  11. #endif
  12. #if !defined(__OWL_CLIPBOAR_H)
  13.   #include <owl\clipboar.h>
  14. #endif
  15. #if !defined(__OWL_WINDOWEV_H)
  16.   #include <owl\windowev.h>
  17. #endif
  18. #if !defined(__OWL_MODULE_H)
  19.   #include <owl\module.h>
  20. #endif
  21. #if defined(__WIN32__) && !defined(__CLASSLIB_THREAD_H)
  22.   #include <classlib\thread.h>
  23. #endif
  24. #include <owl\window.rh>
  25.  
  26. class _OWLCLASS TApplication;
  27. class _OWLCLASS TModule;
  28. class _OWLCLASS TScroller;
  29. class _OWLCLASS TRegion;
  30. class _OWLCLASS TWindow;
  31. class _OWLCLASS TDC;
  32.  
  33. //
  34. //  enum TWindowFlag
  35. //  ---- -----------
  36. //
  37. enum TWindowFlag {
  38.   wfAlias           = 0x0001,
  39.   wfAutoCreate      = 0x0002,
  40.   wfFromResource    = 0x0004,
  41.   wfShrinkToClient  = 0x0008,
  42.   wfMainWindow      = 0x0010,
  43.   wfStreamTop       = 0x0020,
  44.   wfPredefinedClass = 0x0040,
  45.   wfTransfer        = 0x0080,
  46.   wfUnHidden        = 0x0100,  // used temporarily when destroying MDI child
  47.   wfUnDisabled      = 0x0200,  // used temporarily when destroying MDI child
  48. };
  49.  
  50. //
  51. // Transfer function flags
  52. //
  53. enum TTransferDirection {tdGetData, tdSetData, tdSizeData};
  54.  
  55. //
  56. // Mixin window event implementation return status
  57. //
  58. enum TEventStatus {
  59.   esPartial,    // Additional handlers may be invoked
  60.   esComplete    // No additional handlers are needed
  61. };
  62.  
  63. //
  64. // special background color flags for EvEraseBkgnd processing
  65. //
  66. const DWORD NoColor = 0xFF000000l;  // let DefWindowProc erase
  67. const DWORD NoErase = 0xFE000000l;  // don't erase, wait for Paint
  68.  
  69. //
  70. //  windows 3.1 windowsx.h name confict with TWindows::GetFirstChild()
  71. //
  72. #if defined(GetFirstChild)
  73.   #undef GetFirstChild(hwnd)
  74. #endif
  75.  
  76. typedef void (*TActionFunc)(TWindow* win, void* param);
  77. typedef BOOL (*TCondFunc)(TWindow* win, void* param);
  78.  
  79. typedef void (TWindow::*TActionMemFunc)(TWindow* win, void* param);
  80. typedef BOOL (TWindow::*TCondMemFunc)(TWindow* win, void* param);
  81.  
  82. //
  83. //  class TCommandEnabler
  84. //  ----- ---------------
  85. //
  86. //  provides an extensible interface for auto enabling/disabling of commands
  87. //  (menu items, tool bar buttons, ...)
  88. //
  89. class _OWLCLASS TCommandEnabler {
  90.   public:
  91.     const UINT  Id;
  92.  
  93.     TCommandEnabler(UINT id, HWND hWndReceiver = 0);
  94.  
  95.     virtual void  Enable(BOOL enable = TRUE);  // sets "Handled" to TRUE
  96.     virtual void  SetText(LPCSTR text) = 0;
  97.     enum {Unchecked, Checked, Indeterminate};
  98.     virtual void  SetCheck(int check) = 0;  // Unchecked, Checked, or Indeterminate
  99.  
  100.     BOOL        GetHandled() {return Handled;}
  101.     BOOL        IsReceiver(HWND hReceiver) {return hReceiver==HWndReceiver;}
  102.  
  103.   protected:
  104.     const HWND  HWndReceiver;
  105.     BOOL        Handled;
  106. };
  107.  
  108. //
  109. //  struct TWindowsAttr
  110. //  ------ ------------
  111. //
  112. //  Window creation attributes
  113. //
  114. struct TWindowAttr {
  115.     DWORD      Style;
  116.     DWORD      ExStyle;
  117.     int        X, Y, W, H;
  118.     TResId     Menu;        // Menu resource id
  119.     int        Id;          // Child identifier
  120.     char far*  Param;
  121.     TResId     AccelTable;  // Accelerator table resource id
  122. };
  123.  
  124. //
  125. //  class TWindow
  126. //  ----- -------
  127. //
  128. class _OWLCLASS TWindow : virtual public TEventHandler,
  129.                           virtual public TStreamableBase {
  130.   public:
  131.     class _OWLCLASS_RTL TXWindow : public TXOwl {
  132.       public:
  133.         TXWindow(TWindow* win = 0, UINT resourceId = IDS_INVALIDWINDOW);
  134.         TXWindow(const TXWindow& src);
  135.         int Unhandled(TModule* app, unsigned promptResId);
  136.         TXOwl* Clone();
  137.         void Throw() {throw *this;}
  138.         TWindow*      Window;
  139.         static string Msg(TWindow* wnd, UINT resourceid);
  140.     };
  141.  
  142.     TStatus        Status;
  143.     HWND           HWindow;  // handle to associated MS-Windows window
  144.     char far*      Title;
  145.     TWindow*       Parent;
  146.     TWindowAttr    Attr;
  147.     WNDPROC        DefaultProc;
  148.     TScroller*     Scroller;
  149.  
  150.     TWindow(TWindow*        parent,
  151.             const char far* title = 0,
  152.             TModule*        module = 0);
  153.  
  154.     TWindow(HWND hWnd, TModule* module = 0);
  155.  
  156.     virtual ~TWindow();
  157.  
  158.     //
  159.     // two iterators that take function pointers
  160.     //
  161.     TWindow*          FirstThat(TCondFunc test, void* paramList = 0);
  162.     void              ForEach(TActionFunc action, void* paramList = 0);
  163.  
  164.     //
  165.     // two iterators that take pointers to member functions
  166.     //
  167.     TWindow*          FirstThat(TCondMemFunc test, void* paramList = 0);
  168.     void              ForEach(TActionMemFunc action, void* paramList = 0);
  169.  
  170.     //
  171.     // other functions for iteration
  172.     //
  173.     TWindow*          Next() {return SiblingList;}
  174.     void              SetNext(TWindow* next) {SiblingList = next;}
  175.     TWindow*          GetFirstChild()
  176.                           {return ChildList ? ChildList->SiblingList : 0;}
  177.     TWindow*          GetLastChild() {return ChildList;}
  178.     TWindow*          Previous();
  179.     unsigned          NumChildren();  // number of child windows
  180.  
  181.     //
  182.     // query and set the flags
  183.     //
  184.     void              SetFlag(TWindowFlag mask) {Flags |= DWORD(mask);}
  185.     void              ClearFlag(TWindowFlag mask) {Flags &= DWORD(~mask);}
  186.     BOOL              IsFlagSet(TWindowFlag mask) {return (Flags & mask) ? 1 : 0;}
  187.  
  188.     //
  189.     // sets/clears flag which indicates that the TWindow should be
  190.     // created if a create is sent while in the parent's child list
  191.     //
  192.     void              EnableAutoCreate() {SetFlag(wfAutoCreate);}
  193.     void              DisableAutoCreate() {ClearFlag(wfAutoCreate);}
  194.  
  195.     //
  196.     // sets flag which indicates that the TWindow can/will transfer data
  197.     // via the transfer mechanism
  198.     //
  199.     void              EnableTransfer() {SetFlag(wfTransfer);}
  200.     void              DisableTransfer() {ClearFlag(wfTransfer);}
  201.  
  202.     //
  203.     // Window's default module access functions
  204.     //
  205.     TModule*          GetModule() const {return Module;}
  206.     void              SetModule(TModule* module) {Module = module;}
  207.  
  208.     TApplication*     GetApplication() const {return Application;}
  209.     WNDPROC           GetThunk() const {return Thunk;}
  210.     virtual BOOL      Register();
  211.  
  212.     //
  213.     // create/destroy an MS_Windows element to be associated with an OWL window
  214.     //
  215.     virtual BOOL      Create();
  216.     virtual void      PerformCreate(int menuOrId);
  217.     BOOL              CreateChildren();
  218.     virtual void      Destroy(int retVal = 0);
  219.  
  220.     //
  221.     // suggest an Owl window to close itself
  222.     //
  223.     virtual void      CloseWindow(int retVal = 0);
  224.  
  225.     //
  226.     // This function is obsolete. Destroy() should be called directly, & then
  227.     // the window destructed (using delete, etc).
  228.     //
  229.     void              ShutDownWindow(int retVal = 0);
  230.  
  231.   #if defined(__WIN32__)
  232.     //
  233.     // override TEventHandler::Dispatch() to handle multi-thread
  234.     // synchronization
  235.     //
  236.     virtual LRESULT  Dispatch(TEventInfo& info, WPARAM wp, LPARAM lp = 0);
  237.   #endif
  238.  
  239.     //
  240.     // called from TApplication::ProcessAppMsg() to give the window an
  241.     // opportunity to perform preprocessing of the Windows message
  242.     //
  243.     // if you return TRUE, further processing of the message is halted
  244.     //
  245.     // if you override this method in a derived class, make sure to call this
  246.     // routine because it handles translation of accelerators...
  247.     //
  248.     virtual BOOL      PreProcessMsg(MSG& msg);
  249.     virtual BOOL      IdleAction(long idleCount);
  250.     virtual BOOL      HoldFocusHWnd(HWND hWndLose, HWND hWndGain);
  251.  
  252.     int               GetId() const {return Attr.Id;}
  253.     TWindow*          ChildWithId(int id) const;
  254.  
  255.     virtual void      SetParent(TWindow* newParent);
  256.     virtual BOOL      SetDocTitle(LPCSTR docname, int index);
  257.  
  258.     void              Show(int cmdShow);
  259.     void              SetCaption(const char far* title);
  260.     void              GetWindowTextTitle();
  261.     void              GetHWndState();
  262.     BOOL              SetCursor(TModule* module, TResId resId);
  263.     void              SetBkgndColor(DWORD color) {BkgndColor = color;}
  264.  
  265.     virtual BOOL      CanClose();
  266.  
  267.     //
  268.     // forwards the current event to "hWnd" using either PostMessage() or
  269.     // SendMessage(). Owl window version calls directly to window proc on send.
  270.     //
  271.     LRESULT           ForwardMessage(HWND hWnd, BOOL send = TRUE);
  272.     LRESULT           ForwardMessage(BOOL send = TRUE);
  273.  
  274.     //
  275.     // send message to all children
  276.     //
  277.     void              ChildBroadcastMessage(UINT msg, WPARAM wParam=0, LPARAM lParam=0);
  278.  
  279.     //
  280.     // Notify a window (parent usually) of a child action.
  281.     //
  282.     void              SendNotification(int id, int notifyCode, HWND hCtl,
  283.                                        UINT msg = WM_COMMAND);
  284.  
  285.     //
  286.     // Called from StdWndProc to allow exceptions to be caught and suspended.
  287.     // Calls HandleMessage from within try block. Catches and suspends all
  288.     // exceptions before returning to Windows (Windows is not exception safe).
  289.     //
  290.     LRESULT           ReceiveMessage(UINT   msg,
  291.                                      WPARAM wParam = 0,
  292.                                      LPARAM lParam = 0);
  293.  
  294.     //
  295.     // Call a Window's window proc to handle a message. Similar to SendMessage
  296.     // but more direct.
  297.     //
  298.     LRESULT           HandleMessage(UINT   msg,
  299.                                     WPARAM wParam = 0,
  300.                                     LPARAM lParam = 0);
  301.  
  302.     //
  303.     // virtual functions called to handle a message, and to deal with an
  304.     // unhandled message in a default way.
  305.     //
  306.     virtual LRESULT   WindowProc(UINT msg, WPARAM wParam, LPARAM lParam);
  307.     virtual LRESULT   DefWindowProc(UINT msg, WPARAM wParam, LPARAM lParam);
  308.  
  309.     //
  310.     // called by WindowProc() to handle WM_COMMANDs
  311.     //
  312.     // "id"         - specifies the identifier of the menu item or control
  313.     //
  314.     // "hWndCtl"    - specifies the control sending the message if the message
  315.     //                is from a control; otherwise it is 0
  316.     //
  317.     // "notifyCode" - specifies the notification message if the message is from
  318.     //                a control. if the message is from an accelerator, it is 1.
  319.     //                if the message is from a menu, it is 0
  320.     //
  321.     virtual LRESULT   EvCommand(UINT id, HWND hWndCtl, UINT notifyCode);
  322.  
  323.     //
  324.     // called by WindowProc() to handle WM_COMMAND_ENABLE
  325.     //
  326.     virtual void      EvCommandEnable(TCommandEnabler& ce);
  327.  
  328.     //
  329.     // default processing, deals with special cases or calling DefWindowProc
  330.     //
  331.     LRESULT           DefaultProcessing();
  332.  
  333.     //
  334.     // Paint function called by base classes when responding to WM_PAINT
  335.     //
  336.     virtual void      Paint(TDC& dc, BOOL erase, TRect& rect);
  337.  
  338.     //
  339.     // transfer buffer
  340.     //
  341.     void              SetTransferBuffer(void* transferBuffer)
  342.                           {TransferBuffer = transferBuffer;}
  343.     virtual UINT      Transfer(void* buffer, TTransferDirection direction);
  344.     virtual void      TransferData(TTransferDirection direction);
  345.  
  346.     //
  347.     // installs the thunk as the window function and saves the previous window
  348.     // function in "DefaultProc"
  349.     //
  350.     void              SubclassWindowFunction();
  351.  
  352.     //
  353.     // Encapsulated HWND functions inline
  354.     //
  355.  
  356.     //
  357.     // allow a TWindow& to be used as an HWND in Windows API calls
  358.     //
  359.     operator          HWND() const {return HWindow;}
  360.     BOOL              IsWindow() const {return ::IsWindow(HWindow);}
  361.  
  362.     //
  363.     // messages
  364.     //
  365.     LRESULT           SendMessage(UINT   msg,
  366.                                   WPARAM wParam = 0,
  367.                                   LPARAM lParam = 0);
  368.     LRESULT           SendDlgItemMessage(int    childId,
  369.                                          UINT   msg,
  370.                                          WPARAM wParam = 0,
  371.                                          LPARAM lParam = 0);
  372.     BOOL              PostMessage(UINT   msg,
  373.                                   WPARAM wParam = 0,
  374.                                   LPARAM lParam = 0);
  375.     static HWND       GetCapture();
  376.     HWND              SetCapture();
  377.     static void       ReleaseCapture();
  378.     static HWND       GetFocus();
  379.     HWND              SetFocus();
  380.     BOOL              IsWindowEnabled() const;
  381.     virtual BOOL      EnableWindow(BOOL enable);
  382.     void              SetRedraw(BOOL redraw);
  383.  
  384.     //
  385.     // window coordinates, dimensions...
  386.     //
  387.     void              ScreenToClient(TPoint& point) const;
  388.     void              MapWindowPoints(HWND    hWndTo,
  389.                                       TPoint* points,
  390.                                       int     count) const;
  391.     void              GetClientRect(TRect& rect) const;
  392.     TRect             GetClientRect() const;
  393.     static HWND       WindowFromPoint(const TPoint& point);
  394.     HWND              ChildWindowFromPoint(const TPoint& point) const;
  395.     void              ClientToScreen(TPoint& point) const;
  396.     void              GetWindowRect(TRect& rect) const;
  397.     TRect             GetWindowRect() const;
  398.     static void       AdjustWindowRect(TRect& rect, DWORD style, BOOL menu);
  399.     static void       AdjustWindowRectEx(TRect& rect, DWORD style,
  400.                                          BOOL  menu,  DWORD exStyle);
  401.  
  402.     //
  403.     // window and class Words and Longs, window properties
  404.     //
  405.     long              GetClassName(char far* className, int maxCount) const;
  406.     long              GetClassLong(int index) const;
  407.     long              SetClassLong(int index, long newLong);
  408.     WORD              GetClassWord(int index) const;
  409.     WORD              SetClassWord(int index, WORD newWord);
  410.     long              GetWindowLong(int index) const;
  411.     long              SetWindowLong(int index, long newLong);
  412.     WORD              GetWindowWord(int index) const;
  413.     WORD              SetWindowWord(int index, WORD newWord);
  414.     int               EnumProps(PROPENUMPROC proc);
  415.     HANDLE            GetProp(WORD atom) const;
  416.     HANDLE            RemoveProp(WORD atom) const;
  417.     BOOL              SetProp(WORD atom, HANDLE data) const;
  418.     HANDLE            GetProp(const char far* str) const;
  419.     HANDLE            RemoveProp(const char far* str) const;
  420.     BOOL              SetProp(const char far* str, HANDLE data) const;
  421.  
  422.     //
  423.     // window placement(X,Y) and display
  424.     //
  425.     BOOL              MoveWindow(int x, int y, int w, int h, BOOL repaint = FALSE);
  426.     BOOL              MoveWindow(const TRect& rect, BOOL repaint = FALSE);
  427.     virtual BOOL      ShowWindow(int cmdShow);
  428.     void              ShowOwnedPopups(BOOL show);
  429.     BOOL              IsWindowVisible() const;
  430.     BOOL              IsZoomed() const;
  431.     BOOL              IsIconic() const;
  432.     int               GetWindowTextLength() const;
  433.     int               GetWindowText(char far* str, int maxCount) const;
  434.     void              SetWindowText(const char far* str);
  435.     BOOL              GetWindowPlacement(WINDOWPLACEMENT* place) const;
  436.     BOOL              SetWindowPlacement(const WINDOWPLACEMENT* place);
  437.  
  438.     //
  439.     // window positioning(Z), sibling relationships
  440.     //
  441.     void              BringWindowToTop();
  442.     static HWND       GetActiveWindow();
  443.     HWND              SetActiveWindow();
  444.     static HWND       GetDesktopWindow();
  445.   #if !defined(__WIN32__)
  446.     static HWND       GetSysModalWindow();
  447.     HWND              SetSysModalWindow();
  448.   #endif
  449.     HWND              GetLastActivePopup() const;
  450.     HWND              GetNextWindow(UINT dirFlag) const;
  451.     HWND              GetTopWindow() const;
  452.     HWND              GetWindow(UINT cmd) const;
  453.     BOOL              SetWindowPos(HWND         hWndInsertAfter,
  454.                                    const TRect& rect,
  455.                                    UINT         flags);
  456.     BOOL              SetWindowPos(HWND hWndInsertAfter,
  457.                                    int x, int y, int w, int h,
  458.                                    UINT flags);
  459.  
  460.     //
  461.     // window painting: invalidating, validating & updating
  462.     //
  463.     void              Invalidate(BOOL erase = TRUE);
  464.     void              InvalidateRect(const TRect& rect, BOOL erase = TRUE);
  465.     void              InvalidateRgn(HRGN hRgn, BOOL erase = TRUE);
  466.     void              Validate();
  467.     void              ValidateRect(const TRect& rect);
  468.     void              ValidateRgn(HRGN hRgn);
  469.     void              UpdateWindow();
  470.     BOOL              FlashWindow(BOOL invert);
  471.     BOOL              GetUpdateRect(TRect& rect, BOOL erase = TRUE) const;
  472.     BOOL              GetUpdateRgn(TRegion& rgn, BOOL erase = TRUE) const;
  473.     BOOL              LockWindowUpdate();
  474.     BOOL              RedrawWindow(TRect* update,
  475.                                    HRGN   hUpdateRgn,
  476.                                    UINT   redrawFlags = RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE);
  477.  
  478.     //
  479.     // scrolling and scrollbars
  480.     //
  481.     int               GetScrollPos(int bar) const;
  482.     int               SetScrollPos(int bar, int pos, BOOL redraw = TRUE);
  483.     void              GetScrollRange(int bar, int& minPos, int& maxPos) const;
  484.     void              SetScrollRange(int  bar,
  485.                                      int  minPos,
  486.                                      int  maxPos,
  487.                                      BOOL redraw = TRUE);
  488.     BOOL              EnableScrollBar(UINT sbFlags=SB_BOTH,
  489.                                       UINT arrowFlags=ESB_ENABLE_BOTH);
  490.     void              ShowScrollBar(int bar, BOOL show = TRUE);
  491.     void              ScrollWindow(int              dx,
  492.                                    int              dy,
  493.                                    const TRect far* scroll = 0,
  494.                                    const TRect far* clip = 0);
  495.     void              ScrollWindowEx(int              dx,
  496.                                      int              dy,
  497.                                      const TRect far* scroll = 0,
  498.                                      const TRect far* clip = 0,
  499.                                      HRGN             hUpdateRgn = 0,
  500.                                      TRect far*       update = 0,
  501.                                      UINT             flags = 0);
  502.  
  503.     //
  504.     // parent/child with Ids
  505.     //
  506.     int               GetDlgCtrlID() const;
  507.     HWND              GetDlgItem(int childId) const;
  508.     UINT              GetDlgItemInt(int   childId,
  509.                                     BOOL* translated = 0,
  510.                                     BOOL  isSigned = TRUE) const;
  511.     void              SetDlgItemInt(int  childId,
  512.                                     UINT value,
  513.                                     BOOL isSigned = TRUE) const;
  514.     int               GetDlgItemText(int       childId,
  515.                                      char far* text,
  516.                                      int       max) const;
  517.     void              SetDlgItemText(int childId, const char far* text) const;
  518.     UINT              IsDlgButtonChecked(int buttonId) const;
  519.     HWND              GetParent() const;
  520.     BOOL              IsChild(HWND) const;
  521.     HWND              GetNextDlgGroupItem(HWND hWndCtrl,
  522.                                           BOOL previous = FALSE) const;
  523.     HWND              GetNextDlgTabItem(HWND HWndCtrl,
  524.                                         BOOL previous = FALSE) const;
  525.     void              CheckDlgButton(int buttonId, UINT check);
  526.     void              CheckRadioButton(int firstButtonId,
  527.                                        int lastButtonId,
  528.                                        int checkButtonId);
  529.  
  530.     //
  531.     // menus and menubar
  532.     //
  533.     HMENU             GetMenu() const;
  534.     HMENU             GetSystemMenu(BOOL revert = FALSE) const;
  535.     BOOL              SetMenu(HMENU hMenu);
  536.     BOOL              HiliteMenuItem(HMENU hMenu, UINT idItem, UINT hilite);
  537.     void              DrawMenuBar();
  538.  
  539.     //
  540.     // clipboard
  541.     //
  542.     TClipboard&       OpenClipboard();
  543.  
  544.     //
  545.     // timer
  546.     //
  547.     BOOL              KillTimer(UINT timerId);
  548.     UINT              SetTimer(UINT timerId, UINT timeout, TIMERPROC proc = 0);
  549.  
  550.     //
  551.     // caret, cursor, font
  552.     //
  553.     void              CreateCaret(HBITMAP hBitmap);
  554.     void              CreateCaret(BOOL isGray, int width, int height);
  555.     static UINT       GetCaretBlinkTime();
  556.     static void       GetCaretPos(TPoint& point);
  557.     void              HideCaret();
  558.     static void       SetCaretBlinkTime(WORD milliSecs);
  559.     static void       SetCaretPos(int x, int y);
  560.     static void       SetCaretPos(const TPoint& pos);
  561.     void              ShowCaret();
  562.     static void       DestroyCaret();
  563.     static void       GetCursorPos(TPoint& pos);
  564.     void              SetWindowFont(HFONT font, BOOL redraw);
  565.     HFONT             GetWindowFont();
  566.  
  567.     //
  568.     // hot keys
  569.     //
  570.   #if defined(__WIN32__)
  571.     BOOL              RegisterHotKey(int  idHotKey,
  572.                                      UINT modifiers,
  573.                                      UINT virtKey);
  574.     BOOL              UnregisterHotKey(int idHotKey);
  575.   #endif
  576.  
  577.     //
  578.     // Misc
  579.     //
  580.     BOOL              WinHelp(const char far* helpFile,
  581.                               UINT            command,
  582.                               DWORD           data);
  583.     int               MessageBox(const char far* text,
  584.                                  const char far* caption = 0,
  585.                                  UINT            type = MB_OK);
  586.     HTASK             GetWindowTask() const;
  587.     void              DragAcceptFiles(BOOL accept);
  588.  
  589.   protected:
  590.     //
  591.     // these events are processed by TWindow
  592.     //
  593.     void              EvClose();
  594.     int               EvCreate(CREATESTRUCT far& createStruct);
  595.     void              EvDestroy();
  596.     LRESULT           EvCompareItem(UINT ctrlId, COMPAREITEMSTRUCT far& compareInfo);
  597.     void              EvDeleteItem(UINT ctrlId, DELETEITEMSTRUCT far& deleteInfo);
  598.     void              EvDrawItem(UINT ctrlId, DRAWITEMSTRUCT far& drawInfo);
  599.     void              EvMeasureItem(UINT ctrlId, MEASUREITEMSTRUCT far& measureInfo);
  600.     void              EvHScroll(UINT scrollCode, UINT thumbPos, HWND hWndCtl);
  601.     void              EvVScroll(UINT scrollCode, UINT thumbPos, HWND hWndCtl);
  602.     void              EvMove(TPoint& clientOrigin);
  603.     void              EvNCDestroy();
  604.     BOOL              EvQueryEndSession();
  605.     void              EvSize(UINT sizeType, TSize& size);
  606.     void              EvLButtonDown(UINT modKeys, TPoint& point);
  607.     BOOL              EvEraseBkgnd(HDC);
  608.     void              EvPaint();
  609.     void              EvSysColorChange();
  610.     LRESULT           EvWin32CtlColor(WPARAM, LPARAM);
  611.  
  612.     void              CmExit();  // CM_EXIT
  613.  
  614.     //
  615.     // input validation message handler
  616.     //
  617.     void              EvChildInvalid(HWND hWnd);
  618.  
  619.     //
  620.     // system messages
  621.     //
  622.     void              EvCompacting(UINT compactRatio);
  623.     void              EvDevModeChange(char far* devName);
  624.     void              EvEnable(BOOL enabled);
  625.     void              EvEndSession(BOOL endSession);
  626.     void              EvFontChange();
  627.     int               EvPower(UINT powerEvent);
  628.     void              EvSysCommand(UINT cmdType, TPoint& point);
  629.     void              EvSystemError(UINT error);
  630.     void              EvTimeChange();
  631.     void              EvTimer(UINT timerId);
  632.     void              EvWinIniChange(char far* section);
  633.  
  634.     //
  635.     // window manager messages
  636.     //
  637.     void              EvActivate(UINT active,
  638.                                  BOOL minimized,
  639.                                  HWND hWndOther /* may be 0 */);
  640.     void              EvActivateApp(BOOL active, HTASK hTask);
  641.     void              EvCancelMode();
  642.     void              EvGetMinMaxInfo(MINMAXINFO far& minmaxinfo);
  643.     void              EvIconEraseBkgnd(HDC hDC);
  644.     void              EvKillFocus(HWND hWndGetFocus /* may be 0 */);
  645.     UINT              EvMouseActivate(HWND hWndTopLevel,
  646.                                       UINT hitTestCode,
  647.                                       UINT msg);
  648.  
  649.     // The following five are called under Win32 only
  650.     //
  651.     void              EvInputFocus(BOOL gainingFocus);
  652.     void              EvOtherWindowCreated(HWND hWndOther);
  653.     void              EvOtherWindowDestroyed(HWND hWndOther);
  654.     void              EvPaintIcon();
  655.     void              EvHotKey(int idHotKey);
  656.  
  657.     void              EvParentNotify(UINT event,
  658.                                      UINT childHandleOrX,
  659.                                      UINT childIDOrY);
  660.     HANDLE            EvQueryDragIcon();
  661.     BOOL              EvQueryOpen();
  662.     BOOL              EvSetCursor(HWND hWndCursor,
  663.                                   UINT hitTest,
  664.                                   UINT mouseMsg);
  665.     void              EvSetFocus(HWND hWndLostFocus /* may be 0 */);
  666.     void              EvSetFont(HFONT, BOOL);
  667.     void              EvSetText(const char far*);
  668.     void              EvShowWindow(BOOL show, UINT status);
  669.     void              EvWindowPosChanged(WINDOWPOS far& windowPos);
  670.     void              EvWindowPosChanging(WINDOWPOS far& windowPos);
  671.  
  672.     //
  673.     // keyboard input
  674.     //
  675.     void              EvChar(UINT key, UINT repeatCount, UINT flags);
  676.     void              EvDeadChar(UINT deadKey, UINT repeatCount, UINT flags);
  677.     void              EvKeyDown(UINT key, UINT repeatCount, UINT flags);
  678.     void              EvKeyUp(UINT key, UINT repeatCount, UINT flags);
  679.     void              EvSysChar(UINT key, UINT repeatCount, UINT flags);
  680.     void              EvSysDeadChar(UINT key, UINT repeatCount, UINT flags);
  681.     void              EvSysKeyDown(UINT key, UINT repeatCount, UINT flags);
  682.     void              EvSysKeyUp(UINT key, UINT repeatCount, UINT flags);
  683.  
  684.     //
  685.     // controls
  686.     //
  687.     HBRUSH            EvCtlColor(HDC hDC, HWND hWndChild, UINT ctlType);
  688.  
  689.     //
  690.     // mouse input
  691.     //
  692.     void              EvLButtonDblClk(UINT modKeys, TPoint& point);
  693.     void              EvLButtonUp(UINT modKeys, TPoint& point);
  694.     void              EvMButtonDblClk(UINT modKeys, TPoint& point);
  695.     void              EvMButtonDown(UINT modKeys, TPoint& point);
  696.     void              EvMButtonUp(UINT modKeys, TPoint& point);
  697.     void              EvMouseMove(UINT modKeys, TPoint& point);
  698.     void              EvRButtonDblClk(UINT modKeys, TPoint& point);
  699.     void              EvRButtonDown(UINT modKeys, TPoint& point);
  700.     void              EvRButtonUp(UINT modKeys, TPoint& point);
  701.  
  702.     //
  703.     // menu related messages
  704.     //
  705.     void              EvInitMenu(HMENU hMenu);
  706.     void              EvInitMenuPopup(HMENU hPopupMenu,
  707.                                       UINT  index,
  708.                                       BOOL  sysMenu);
  709.     UINT              EvMenuChar(UINT nChar, UINT menuType, HMENU hMenu);
  710.     void              EvMenuSelect(UINT menuItemId, UINT flags, HMENU hMenu);
  711.  
  712.     //
  713.     // dialog messages
  714.     //
  715.     void              EvEnterIdle(UINT source, HWND hWndDlg);
  716.     UINT              EvGetDlgCode(MSG far*);
  717.  
  718.     //
  719.     // print manager messages
  720.     //
  721.     void              EvSpoolerStatus(UINT jobStatus, UINT jobsLeft);
  722.  
  723.     //
  724.     // clipboard messages
  725.     //
  726.     void              EvAskCBFormatName(UINT bufLen, char far* buffer);
  727.     void              EvChangeCBChain(HWND hWndRemoved, HWND hWndNext);
  728.     void              EvDrawClipboard();
  729.     void              EvDestroyClipboard();
  730.     void              EvHScrollClipboard(HWND hWndCBViewer,
  731.                                          UINT scrollCode,
  732.                                          UINT pos);
  733.     void              EvPaintClipboard(HWND hWnd, HANDLE hPaintStruct);
  734.     void              EvRenderAllFormats();
  735.     void              EvRenderFormat(UINT dataFormat);
  736.     void              EvSizeClipboard(HWND hWndViewer, HANDLE hRect);
  737.     void              EvVScrollClipboard(HWND hWndCBViewer,
  738.                                          UINT scrollCode,
  739.                                          UINT pos);
  740.  
  741.     //
  742.     // palette manager messages
  743.     //
  744.     void              EvPaletteChanged(HWND hWndPalChg);
  745.     void              EvPaletteIsChanging(HWND hWndPalChg);
  746.     BOOL              EvQueryNewPalette();
  747.  
  748.     //
  749.     // drag-n-drop messages
  750.     //
  751.     void              EvDropFiles(TDropInfo dropInfo);
  752.  
  753.     //
  754.     // list box messages
  755.     //
  756.     int               EvCharToItem(UINT key, HWND hWndListBox, UINT caretPos);
  757.     int               EvVKeyToItem(UINT key, HWND hWndListBox, UINT caretPos);
  758.  
  759.     //
  760.     // non-client messages
  761.     //
  762.     BOOL              EvNCActivate(BOOL active);
  763.     UINT              EvNCCalcSize(BOOL calcValidRects, NCCALCSIZE_PARAMS far& params);
  764.     BOOL              EvNCCreate(CREATESTRUCT far& createStruct);
  765.     UINT              EvNCHitTest(TPoint& point);
  766.     void              EvNCLButtonDblClk(UINT hitTest, TPoint& point);
  767.     void              EvNCLButtonDown(UINT hitTest, TPoint& point);
  768.     void              EvNCLButtonUp(UINT hitTest, TPoint& point);
  769.     void              EvNCMButtonDblClk(UINT hitTest, TPoint& point);
  770.     void              EvNCMButtonDown(UINT hitTest, TPoint& point);
  771.     void              EvNCMButtonUp(UINT hitTest, TPoint& point);
  772.     void              EvNCMouseMove(UINT hitTest, TPoint& point);
  773.     void              EvNCPaint();
  774.     void              EvNCRButtonDblClk(UINT hitTest, TPoint& point);
  775.     void              EvNCRButtonDown(UINT hitTest, TPoint& point);
  776.     void              EvNCRButtonUp(UINT hitTest, TPoint& point);
  777.  
  778.   protected:
  779.     void*        TransferBuffer;
  780.     HACCEL       hAccel;
  781.     TModule*     CursorModule;
  782.     TResId       CursorResId;
  783.     HCURSOR      HCursor;
  784.     DWORD        BkgndColor;
  785.  
  786.     //
  787.     // Constructor & subsequent initializer for use with virtual derivations
  788.     // Immediate derivitives must call Init() before constructions are done.
  789.     //
  790.     TWindow();
  791.     void              Init(TWindow* parent, const char far* title, TModule* module);
  792.  
  793.     virtual void      GetWindowClass(WNDCLASS& wndClass);
  794.     virtual char far* GetClassName();
  795.  
  796.     virtual void      SetupWindow();
  797.     virtual void      CleanupWindow();
  798.  
  799.     void              DispatchScroll(UINT scrollCode, UINT thumbPos, HWND hWndCtrl);
  800.  
  801.     void              LoadAcceleratorTable();
  802.     virtual void      RemoveChild(TWindow* child);
  803.  
  804.   private:
  805.     WNDPROC         Thunk;        // Thunk that load 'this' into registers
  806.     TApplication*   Application;  // Application that this window belongs to
  807.     TModule*        Module;       // default module used for getting resources
  808.     DWORD           Flags;
  809.     WORD            ZOrder;
  810.     TWindow*        ChildList;
  811.     TWindow*        SiblingList;
  812.     DWORD           UniqueId;
  813.  
  814.     static DWORD    LastUniqueId;
  815.  
  816.     void              Init(TWindow* parent, TModule* module);
  817.     BOOL              OrderIsI(TWindow* win, void* position);
  818.     void              AssignZOrder();
  819.     void              AddChild(TWindow* child);
  820.     int               IndexOf(TWindow* child);
  821.     TWindow*          At(int position);
  822.  
  823.     void              SetUniqueId();
  824.  
  825.     //
  826.     // hidden to prevent accidental copying or assignment
  827.     //
  828.     TWindow(const TWindow&);
  829.     TWindow& operator =(const TWindow&);
  830.  
  831.   DECLARE_RESPONSE_TABLE(TWindow);
  832.   DECLARE_STREAMABLE(_OWLCLASS, TWindow, 1);
  833. };  // end of class TWindow
  834.  
  835. //
  836. // A TActionFunc defined in window.cpp
  837. //
  838. void DoEnableAutoCreate(TWindow* win, void*);
  839.  
  840. //
  841. // Global funciton to retrieve a TWindow pointer given an HWND
  842. //
  843. TWindow* _OWLFUNC GetWindowPtr(HWND hWnd);
  844. inline TWindow*   GetObjectPtr(HWND hWnd) {return GetWindowPtr(hWnd);}
  845.  
  846. #if defined(__TRACE) || defined(__WARN)
  847.   ostream& operator <<(ostream& os, const TWindow& w);
  848. #endif
  849.  
  850. //----------------------------------------------------------------------------
  851.  
  852. inline void
  853. TWindow::SendNotification(int id, int notifyCode, HWND hCtl, UINT msg) {
  854.   #if defined(__WIN32__)
  855.     HandleMessage(msg, MAKEWPARAM(id, notifyCode), LPARAM(hCtl));
  856.   #else
  857.     HandleMessage(msg, id, MAKELPARAM(hCtl, notifyCode));
  858.   #endif
  859. }
  860.  
  861. //
  862. // HWND wrappers
  863. //
  864. inline LRESULT
  865. TWindow::SendDlgItemMessage(int     childId, UINT   msg,
  866.                              WPARAM wParam,  LPARAM lParam) {
  867.   return ::SendDlgItemMessage(HWindow, childId, msg, wParam, lParam);
  868. }
  869.  
  870. inline BOOL
  871. TWindow::PostMessage(UINT msg, WPARAM wParam, LPARAM lParam) {
  872.   return ::PostMessage(HWindow, msg, wParam, lParam);
  873. }
  874.  
  875. inline HWND
  876. TWindow::GetCapture() {
  877.   return ::GetCapture();
  878. }
  879.  
  880. inline HWND
  881. TWindow::SetCapture() {
  882.   return ::SetCapture(HWindow);
  883. }
  884.  
  885. inline void
  886. TWindow::ReleaseCapture() {
  887.   ::ReleaseCapture();
  888. }
  889.  
  890. inline HWND
  891. TWindow::GetFocus() {
  892.   return ::GetFocus();
  893. }
  894.  
  895. inline HWND
  896. TWindow::SetFocus() {
  897.   return ::SetFocus(HWindow);
  898. }
  899.  
  900. inline BOOL
  901. TWindow::IsWindowEnabled() const {
  902.   return ::IsWindowEnabled(HWindow);
  903. }
  904.  
  905. inline BOOL
  906. TWindow::EnableWindow(BOOL enable) {
  907.   return ::EnableWindow(HWindow, enable);
  908. }
  909.  
  910. inline void
  911. TWindow::SetRedraw(BOOL redraw) {
  912.   SendMessage(WM_SETREDRAW, redraw);
  913. }
  914.  
  915. inline void
  916. TWindow::ScreenToClient(TPoint& point) const {
  917.   ::ScreenToClient(HWindow, &point);
  918. }
  919.  
  920. inline void
  921. TWindow::MapWindowPoints(HWND hWndTo, TPoint* points, int count) const {
  922.   ::MapWindowPoints(HWindow, hWndTo, points, count);
  923. }
  924.  
  925. inline void
  926. TWindow::GetClientRect(TRect& rect) const {
  927.   ::GetClientRect(HWindow, &rect);
  928. }
  929.  
  930. inline TRect TWindow::GetClientRect() const {
  931.   TRect  rect;
  932.   ::GetClientRect(HWindow, &rect);
  933.   return rect;
  934. }
  935.  
  936. inline HWND
  937. TWindow::WindowFromPoint(const TPoint& point) {
  938.   return ::WindowFromPoint(point);
  939. }
  940.  
  941. inline HWND
  942. TWindow::ChildWindowFromPoint(const TPoint& point) const {
  943.   return ::ChildWindowFromPoint(HWindow, point);
  944. }
  945.  
  946. inline void
  947. TWindow::ClientToScreen(TPoint& point) const {
  948.   ::ClientToScreen(HWindow, &point);
  949. }
  950.  
  951. inline void
  952. TWindow::GetWindowRect(TRect& rect) const {
  953.   ::GetWindowRect(HWindow, &rect);
  954. }
  955.  
  956. inline TRect
  957. TWindow::GetWindowRect() const {
  958.   TRect  rect;
  959.   ::GetWindowRect(HWindow, &rect);
  960.   return rect;
  961. }
  962.  
  963. inline void
  964. TWindow::AdjustWindowRect(TRect& rect, DWORD style, BOOL menu) {
  965.   ::AdjustWindowRect(&rect, style, menu);
  966. }
  967.  
  968. inline void
  969. TWindow::AdjustWindowRectEx(TRect& rect, DWORD style, BOOL menu, DWORD exStyle) {
  970.   ::AdjustWindowRectEx(&rect, style, menu, exStyle);
  971. }
  972.  
  973.  
  974. //
  975. // window and class Words and Longs, window properties
  976. //
  977. inline long
  978. TWindow::GetClassName(char far* className, int maxCount) const {
  979.   return ::GetClassName(HWindow, className, maxCount);
  980. }
  981.  
  982. inline long
  983. TWindow::GetClassLong(int index) const {
  984.   return ::GetClassLong(HWindow, index);
  985. }
  986.  
  987. inline long
  988. TWindow::SetClassLong(int index, long newLong) {
  989.   return ::SetClassLong(HWindow, index, newLong);
  990. }
  991.  
  992. inline WORD
  993. TWindow::GetClassWord(int index) const {
  994.   return ::GetClassWord(HWindow, index);
  995. }
  996.  
  997. inline WORD
  998. TWindow::SetClassWord(int index, WORD newWord) {
  999.   return ::SetClassWord(HWindow, index, newWord);
  1000. }
  1001.  
  1002. inline long
  1003. TWindow::GetWindowLong(int index) const {
  1004.   return ::GetWindowLong(HWindow, index);
  1005. }
  1006.  
  1007. inline long
  1008. TWindow::SetWindowLong(int index, long newLong) {
  1009.   return ::SetWindowLong(HWindow, index, newLong);
  1010. }
  1011.  
  1012. inline WORD
  1013. TWindow::GetWindowWord(int index) const {
  1014.   return ::GetWindowWord(HWindow, index);
  1015. }
  1016.  
  1017. inline WORD
  1018. TWindow::SetWindowWord(int index, WORD newWord) {
  1019.   return ::SetWindowWord(HWindow, index, newWord);
  1020. }
  1021.  
  1022. inline int
  1023. TWindow::EnumProps(PROPENUMPROC proc) {
  1024.   return ::EnumProps(HWindow, proc);
  1025. }
  1026.  
  1027. inline HANDLE
  1028. TWindow::GetProp(WORD atom) const {
  1029.   return :: GetProp(HWindow, (LPCSTR)(DWORD)atom);
  1030. }
  1031.  
  1032. inline HANDLE
  1033. TWindow::RemoveProp(WORD atom) const {
  1034.   return :: RemoveProp(HWindow, (LPCSTR)(DWORD)atom);
  1035. }
  1036.  
  1037. inline BOOL
  1038. TWindow::SetProp(WORD atom, HANDLE data) const {
  1039.   return :: SetProp(HWindow, (LPCSTR)(DWORD)atom, data);
  1040. }
  1041.  
  1042. inline HANDLE
  1043. TWindow::GetProp(const char far* str) const {
  1044.   return ::GetProp(HWindow, str);
  1045. }
  1046.  
  1047. inline HANDLE
  1048. TWindow::RemoveProp(const char far* str) const {
  1049.   return ::RemoveProp(HWindow, str);
  1050. }
  1051.  
  1052. inline BOOL
  1053. TWindow::SetProp(const char far* str, HANDLE data) const {
  1054.   return ::SetProp(HWindow, str, data);
  1055. }
  1056.  
  1057. inline BOOL
  1058. TWindow::MoveWindow(int x, int y, int w, int h, BOOL repaint) {
  1059.   return ::MoveWindow(HWindow, x, y, w, h, repaint);
  1060. }
  1061.  
  1062. inline BOOL
  1063. TWindow::MoveWindow(const TRect& rect, BOOL repaint) {
  1064.   return ::MoveWindow(HWindow, rect.left, rect.top,
  1065.                       rect.Width(), rect.Height(), repaint);
  1066. }
  1067.  
  1068. inline BOOL
  1069. TWindow::ShowWindow(int cmdShow) {
  1070.   return ::ShowWindow(HWindow, cmdShow);
  1071. }
  1072.  
  1073. inline void
  1074. TWindow::ShowOwnedPopups(BOOL show) {
  1075.   ::ShowOwnedPopups(HWindow, show);
  1076. }
  1077.  
  1078. inline BOOL
  1079. TWindow::IsWindowVisible() const {
  1080.   return ::IsWindowVisible(HWindow);
  1081. }
  1082.  
  1083. inline BOOL
  1084. TWindow::IsZoomed() const {
  1085.   return ::IsZoomed(HWindow);
  1086. }
  1087.  
  1088. inline BOOL
  1089. TWindow::IsIconic() const {
  1090.   return ::IsIconic(HWindow);
  1091. }
  1092.  
  1093. inline int
  1094. TWindow::GetWindowTextLength() const {
  1095.   return ::GetWindowTextLength(HWindow);
  1096. }
  1097.  
  1098. inline int
  1099. TWindow::GetWindowText(char far* str, int maxCount) const {
  1100.   return ::GetWindowText(HWindow, str, maxCount);
  1101. }
  1102.  
  1103. inline void
  1104. TWindow::SetWindowText(const char far* str) {
  1105.   ::SetWindowText(HWindow, str);
  1106. }
  1107.  
  1108. inline BOOL
  1109. TWindow::GetWindowPlacement(WINDOWPLACEMENT* place) const {
  1110.   return ::GetWindowPlacement(HWindow, place);
  1111. }
  1112.  
  1113. inline BOOL
  1114. TWindow::SetWindowPlacement(const WINDOWPLACEMENT* place) {
  1115.   return ::SetWindowPlacement(HWindow, place);
  1116. }
  1117.  
  1118. inline void
  1119. TWindow::BringWindowToTop() {
  1120.   ::BringWindowToTop(HWindow);
  1121. }
  1122.  
  1123. inline HWND
  1124. TWindow::GetActiveWindow() {
  1125.   return ::GetActiveWindow();
  1126. }
  1127.  
  1128. inline HWND
  1129. TWindow::SetActiveWindow() {
  1130.   return ::SetActiveWindow(HWindow);
  1131. }
  1132.  
  1133. inline HWND
  1134. TWindow::GetDesktopWindow() {
  1135.   return ::GetDesktopWindow();
  1136. }
  1137.  
  1138. #if !defined(__WIN32__)
  1139. inline HWND
  1140. TWindow::GetSysModalWindow() {
  1141.   return ::GetSysModalWindow();
  1142. }
  1143.  
  1144. inline HWND
  1145. TWindow::SetSysModalWindow() {
  1146.   return ::SetSysModalWindow(HWindow);
  1147. }
  1148.  
  1149. inline HWND
  1150. TWindow::GetNextWindow(UINT flag) const {
  1151.   return ::GetNextWindow(HWindow, flag);
  1152. }
  1153. #endif
  1154.  
  1155. inline HWND
  1156. TWindow::GetLastActivePopup() const {
  1157.   return ::GetLastActivePopup(HWindow);
  1158. }
  1159.  
  1160. inline HWND
  1161. TWindow::GetWindow(UINT flag) const {
  1162.   return ::GetWindow(HWindow, flag);
  1163. }
  1164.  
  1165. inline HWND
  1166. TWindow::GetTopWindow() const {
  1167.   return ::GetTopWindow(HWindow);
  1168. }
  1169.  
  1170. inline BOOL
  1171. TWindow::SetWindowPos(HWND hWndInsertAfter, const TRect& rect, UINT flags) {
  1172.   return ::SetWindowPos(HWindow, hWndInsertAfter, rect.left, rect.top,
  1173.                         rect.Width(), rect.Height(), flags);
  1174. }
  1175.  
  1176. inline BOOL
  1177. TWindow::SetWindowPos(HWND hWndInsertAfter,
  1178.                       int x, int y, int w, int h,
  1179.                       UINT flags) {
  1180.   return ::SetWindowPos(HWindow, hWndInsertAfter, x, y, w, h, flags);
  1181. }
  1182.  
  1183. inline void
  1184. TWindow::Invalidate(BOOL erase) {
  1185.   ::InvalidateRect(HWindow, 0, erase);
  1186. }
  1187.  
  1188. inline void
  1189. TWindow::InvalidateRect(const TRect& rect, BOOL erase) {
  1190.   ::InvalidateRect(HWindow, &rect, erase);
  1191. }
  1192.  
  1193. inline void
  1194. TWindow::InvalidateRgn(HRGN hRgn, BOOL erase) {
  1195.   ::InvalidateRgn(HWindow, hRgn, erase);
  1196. }
  1197.  
  1198. inline void
  1199. TWindow::Validate() {
  1200.   ::ValidateRect(HWindow, 0);
  1201. }
  1202.  
  1203. inline void
  1204. TWindow::ValidateRect(const TRect& rect) {
  1205.   ::ValidateRect(HWindow, &rect);
  1206. }
  1207.  
  1208. inline void
  1209. TWindow::ValidateRgn(HRGN hRgn) {
  1210.   ::ValidateRgn(HWindow, hRgn);
  1211. }
  1212.  
  1213. inline void
  1214. TWindow::UpdateWindow() {
  1215.   ::UpdateWindow(HWindow);
  1216. }
  1217.  
  1218. inline BOOL
  1219. TWindow::FlashWindow(BOOL invert) {
  1220.   return ::FlashWindow(HWindow, invert);
  1221. }
  1222.  
  1223. inline BOOL
  1224. TWindow::GetUpdateRect(TRect& rect, BOOL erase) const {
  1225.   return ::GetUpdateRect(HWindow, &rect, erase);
  1226. }
  1227.  
  1228. inline BOOL
  1229. TWindow::LockWindowUpdate() {
  1230.   return ::LockWindowUpdate(HWindow);
  1231. }
  1232.  
  1233. inline BOOL
  1234. TWindow::RedrawWindow(TRect* update, HRGN hUpdateRgn, UINT redraw) {
  1235.   return ::RedrawWindow(HWindow, update, hUpdateRgn, redraw);
  1236. }
  1237.  
  1238. inline int
  1239. TWindow::GetScrollPos(int bar) const {
  1240.   return ::GetScrollPos(HWindow, bar);
  1241. }
  1242.  
  1243. inline int
  1244. TWindow::SetScrollPos(int bar, int pos, BOOL redraw) {
  1245.   return ::SetScrollPos(HWindow, bar, pos, redraw);
  1246. }
  1247.  
  1248. inline void
  1249. TWindow::GetScrollRange(int bar, int& minPos, int& maxPos) const {
  1250.   ::GetScrollRange(HWindow, bar, &minPos, &maxPos);
  1251. }
  1252.  
  1253. inline void
  1254. TWindow::SetScrollRange(int bar, int minPos, int maxPos, BOOL redraw) {
  1255.   ::SetScrollRange(HWindow, bar, minPos, maxPos, redraw);
  1256. }
  1257.  
  1258. inline BOOL
  1259. TWindow::EnableScrollBar(UINT sbFlags, UINT arrowFlags) {
  1260.   return ::EnableScrollBar(HWindow, sbFlags, arrowFlags);
  1261. }
  1262.  
  1263. inline void TWindow::ShowScrollBar(int bar, BOOL show) {
  1264.   ::ShowScrollBar(HWindow, bar, show);
  1265. }
  1266.  
  1267. inline void
  1268. TWindow::ScrollWindow(int              dx,
  1269.                       int              dy,
  1270.                       const TRect far* scroll,
  1271.                       const TRect far* clip) {
  1272.   ::ScrollWindow(HWindow, dx, dy, scroll, clip);
  1273. }
  1274.  
  1275. inline void
  1276. TWindow::ScrollWindowEx(int              dx,
  1277.                         int              dy,
  1278.                         const TRect far* scroll,
  1279.                         const TRect far* clip,
  1280.                         HRGN             hUpdateRgn,
  1281.                         TRect far*       update,
  1282.                         UINT             flags) {
  1283.   ::ScrollWindowEx(HWindow, dx, dy, scroll, clip, hUpdateRgn, update, flags);
  1284. }
  1285.  
  1286. inline int
  1287. TWindow::GetDlgCtrlID() const {
  1288.   return ::GetDlgCtrlID(HWindow);
  1289. }
  1290.  
  1291. inline HWND
  1292. TWindow::GetDlgItem(int childId) const {
  1293.   return ::GetDlgItem(HWindow, childId);
  1294. }
  1295.  
  1296. inline UINT
  1297. TWindow::GetDlgItemInt(int childId, BOOL* translated, BOOL isSigned) const {
  1298.   return ::GetDlgItemInt(HWindow, childId, translated, isSigned);
  1299. }
  1300.  
  1301. inline void
  1302. TWindow::SetDlgItemInt(int childId, UINT value, BOOL isSigned) const {
  1303.   ::SetDlgItemInt(HWindow, childId, value, isSigned);
  1304. }
  1305.  
  1306. inline int
  1307. TWindow::GetDlgItemText(int childId, char far* text, int max) const {
  1308.   return ::GetDlgItemText(HWindow, childId, text, max);
  1309. }
  1310.  
  1311. inline void
  1312. TWindow::SetDlgItemText(int childId, const char far* text) const {
  1313.   ::SetDlgItemText(HWindow, childId, text);
  1314. }
  1315.  
  1316. inline UINT
  1317. TWindow::IsDlgButtonChecked(int buttonId) const {
  1318.   return ::IsDlgButtonChecked(HWindow, buttonId);
  1319. }
  1320.  
  1321. inline HWND
  1322. TWindow::GetParent() const {
  1323.   return ::GetParent(HWindow);
  1324. }
  1325.  
  1326. inline BOOL
  1327. TWindow::IsChild(HWND hWnd) const {
  1328.   return ::IsChild(HWindow, hWnd);
  1329. }
  1330.  
  1331. inline HWND
  1332. TWindow::GetNextDlgGroupItem(HWND hWndCtrl, BOOL previous) const {
  1333.   return ::GetNextDlgGroupItem(HWindow, hWndCtrl, previous);
  1334. }
  1335.  
  1336. inline HWND
  1337. TWindow::GetNextDlgTabItem(HWND hWndCtrl, BOOL previous) const {
  1338.   return ::GetNextDlgTabItem(HWindow, hWndCtrl, previous);
  1339. }
  1340.  
  1341. inline void
  1342. TWindow::CheckDlgButton(int buttonId, UINT check) {
  1343.   ::CheckDlgButton(HWindow, buttonId, check);
  1344. }
  1345.  
  1346. inline void
  1347. TWindow::CheckRadioButton(int firstButtonId, int lastButtonId, int checkButtonId) {
  1348.   ::CheckRadioButton(HWindow, firstButtonId, lastButtonId, checkButtonId);
  1349. }
  1350.  
  1351. inline HMENU
  1352. TWindow::GetMenu() const {
  1353.   return ::GetMenu(HWindow);
  1354. }
  1355.  
  1356. inline HMENU
  1357. TWindow::GetSystemMenu(BOOL revert) const {
  1358.   return ::GetSystemMenu(HWindow, revert);
  1359. }
  1360.  
  1361. inline BOOL
  1362. TWindow::SetMenu(HMENU hMenu) {
  1363.   return ::SetMenu(HWindow, hMenu);
  1364. }
  1365.  
  1366. inline BOOL
  1367. TWindow::HiliteMenuItem(HMENU hMenu, UINT idItem, UINT hilite) {
  1368.   return ::HiliteMenuItem(HWindow, hMenu, idItem, hilite);
  1369. }
  1370.  
  1371. inline void
  1372. TWindow::DrawMenuBar() {
  1373.   ::DrawMenuBar(HWindow);
  1374. }
  1375.  
  1376. inline TClipboard&
  1377. TWindow::OpenClipboard() {
  1378.   TClipboard& clip = TClipboard::GetClipboard();
  1379.  
  1380.   clip.OpenClipboard(HWindow);
  1381.   return clip;
  1382. }
  1383.  
  1384. inline BOOL
  1385. TWindow::KillTimer(UINT timerId) {
  1386.   return ::KillTimer(HWindow, timerId);
  1387. }
  1388.  
  1389. inline UINT
  1390. TWindow::SetTimer(UINT timerId, UINT timeout, TIMERPROC proc) {
  1391.   return ::SetTimer(HWindow, timerId, timeout, proc);
  1392. }
  1393.  
  1394. inline void
  1395. TWindow::CreateCaret(HBITMAP hBitmap) {
  1396.   ::CreateCaret(HWindow, hBitmap, 0, 0);
  1397. }
  1398.  
  1399. inline void
  1400. TWindow::CreateCaret(int shade, int width, int height) {
  1401.   ::CreateCaret(HWindow,(HBITMAP) shade, width, height);
  1402. }
  1403.  
  1404. inline void
  1405. TWindow::DestroyCaret() {
  1406.   ::DestroyCaret();
  1407. }
  1408.  
  1409. inline UINT
  1410. TWindow::GetCaretBlinkTime() {
  1411.   return ::GetCaretBlinkTime();
  1412. }
  1413.  
  1414. inline void
  1415. TWindow::GetCaretPos(TPoint& point) {
  1416.   ::GetCaretPos(&point);
  1417. }
  1418.  
  1419. inline void
  1420. TWindow::HideCaret() {
  1421.   ::HideCaret(HWindow);
  1422. }
  1423.  
  1424. inline void
  1425. TWindow::SetCaretBlinkTime(WORD milliSecs) {
  1426.   ::SetCaretBlinkTime(milliSecs);
  1427. }
  1428.  
  1429. inline void
  1430. TWindow::SetCaretPos(int x, int y) {
  1431.   ::SetCaretPos(x, y);
  1432. }
  1433.  
  1434. inline void
  1435. TWindow::SetCaretPos(const TPoint& pos) {
  1436.   ::SetCaretPos(pos.x, pos.y);
  1437. }
  1438.  
  1439. inline void
  1440. TWindow::ShowCaret() {
  1441.   ::ShowCaret(HWindow);
  1442. }
  1443.  
  1444. inline void
  1445. TWindow::GetCursorPos(TPoint& pos) {
  1446.   ::GetCursorPos(&pos);
  1447. }
  1448.  
  1449. inline void
  1450. TWindow::SetWindowFont(HFONT font, BOOL redraw) {
  1451.   HandleMessage(WM_SETFONT, WPARAM(font), redraw);
  1452. }
  1453.  
  1454. inline HFONT
  1455. TWindow::GetWindowFont() {
  1456.   return (HFONT)HandleMessage(WM_GETFONT);
  1457. }
  1458.  
  1459. #if defined(__WIN32__)
  1460. inline BOOL
  1461. TWindow::RegisterHotKey(int idHotKey, UINT modifiers, UINT virtKey) {
  1462.   return ::RegisterHotKey(HWindow, idHotKey, modifiers, virtKey);
  1463. }
  1464.  
  1465. inline BOOL
  1466. TWindow::UnregisterHotKey(int idHotKey) {
  1467.   return ::UnregisterHotKey(HWindow, idHotKey);
  1468. }
  1469. #endif
  1470.  
  1471. inline BOOL
  1472. TWindow::WinHelp(const char far* helpFile, UINT command, DWORD data) {
  1473.   return ::WinHelp(HWindow, helpFile, command, data);
  1474. }
  1475.  
  1476. inline HTASK
  1477. TWindow::GetWindowTask() const {
  1478. #if defined(__WIN32__)
  1479.   return (HANDLE)::GetWindowThreadProcessId(HWindow, 0);
  1480. #else
  1481.   return ::GetWindowTask(HWindow);
  1482. #endif
  1483. }
  1484.  
  1485. inline void
  1486. TWindow::DragAcceptFiles(BOOL accept) {
  1487.   ::DragAcceptFiles(HWindow, accept);
  1488. }
  1489.  
  1490. //
  1491. // inline member functions that call DefWindowProc()
  1492. //
  1493. inline void    TWindow::EvActivate(UINT active,
  1494.                                    BOOL minimized,
  1495.                                    HWND hWndOther /*may be 0*/)
  1496.                    {DefaultProcessing();}
  1497. inline void    TWindow::EvActivateApp(BOOL active, HTASK hTask /* threadId*/)
  1498.                    {DefaultProcessing();}
  1499. inline void    TWindow::EvAskCBFormatName(UINT bufLen, char far* buffer)
  1500.                    {DefaultProcessing();}
  1501. inline void    TWindow::EvCancelMode()
  1502.                    {DefaultProcessing();}
  1503. inline void    TWindow::EvChangeCBChain(HWND hWndRemoved, HWND hWndNext)
  1504.                    {DefaultProcessing();}
  1505. inline void    TWindow::EvChar(UINT key, UINT repeatCount, UINT flags)
  1506.                    {DefaultProcessing();}
  1507. inline int     TWindow::EvCharToItem(UINT key, HWND hWndListBox, UINT caretPos)
  1508.                    {return (int)DefaultProcessing();}
  1509. inline int     TWindow::EvVKeyToItem(UINT key, HWND hWndListBox, UINT caretPos)
  1510.                    {return (int)DefaultProcessing();}
  1511. inline void    TWindow::EvCompacting(UINT compactRatio)
  1512.                    {DefaultProcessing();}
  1513. inline HBRUSH  TWindow::EvCtlColor(HDC hDC, HWND hWndChild, UINT ctlType)
  1514.                    {return (HBRUSH)DefaultProcessing();}
  1515. inline void    TWindow::EvDeadChar(UINT deadKey, UINT repeatCount, UINT flags)
  1516.                    {DefaultProcessing();}
  1517. inline void    TWindow::EvDestroyClipboard()
  1518.                    {DefaultProcessing();}
  1519. inline void    TWindow::EvDevModeChange(char far*)
  1520.                    {DefaultProcessing();}
  1521. inline void    TWindow::EvDropFiles(TDropInfo)
  1522.                    {DefaultProcessing();}
  1523. inline void    TWindow::EvDrawClipboard()
  1524.                    {DefaultProcessing();}
  1525. inline void    TWindow::EvEnable(BOOL enabled)
  1526.                    {DefaultProcessing();}
  1527. inline void    TWindow::EvEndSession(BOOL endSession)
  1528.                    {DefaultProcessing();}
  1529. inline void    TWindow::EvEnterIdle(UINT source, HWND hWndDlg)
  1530.                    {DefaultProcessing();}
  1531. inline void    TWindow::EvFontChange()
  1532.                    {DefaultProcessing();}
  1533. inline UINT    TWindow::EvGetDlgCode(MSG far*)
  1534.                    {return (UINT)DefaultProcessing();}
  1535. inline void    TWindow::EvGetMinMaxInfo(MINMAXINFO far&)
  1536.                    {DefaultProcessing();}
  1537. inline void  TWindow::EvHotKey(int idHotKey)
  1538.                    {DefaultProcessing();}
  1539. inline void  TWindow::EvInputFocus(BOOL gainingFocus)
  1540.                    {DefaultProcessing();}
  1541. inline void    TWindow::EvHScrollClipboard(HWND hWndCBViewer,
  1542.                                            UINT scrollCode,
  1543.                                            UINT pos)
  1544.                    {DefaultProcessing();}
  1545. inline void    TWindow::EvIconEraseBkgnd(HDC)
  1546.                    {DefaultProcessing();}
  1547. inline void    TWindow::EvInitMenu(HMENU)
  1548.                    {DefaultProcessing();}
  1549. inline void    TWindow::EvInitMenuPopup(HMENU hPopupMenu, UINT index, BOOL sysMenu)
  1550.                    {DefaultProcessing();}
  1551. inline void    TWindow::EvKeyDown(UINT key, UINT repeatCount, UINT flags)
  1552.                    {DefaultProcessing();}
  1553. inline void    TWindow::EvKeyUp(UINT key, UINT repeatCount, UINT flags)
  1554.                    {DefaultProcessing();}
  1555. inline void    TWindow::EvLButtonDblClk(UINT modKeys, TPoint&)
  1556.                    {DefaultProcessing();}
  1557. inline void    TWindow::EvLButtonUp(UINT modKeys, TPoint&)
  1558.                    {DefaultProcessing();}
  1559. inline void    TWindow::EvMButtonDblClk(UINT modKeys, TPoint&)
  1560.                    {DefaultProcessing();}
  1561. inline void    TWindow::EvMButtonDown(UINT modKeys, TPoint&)
  1562.                    {DefaultProcessing();}
  1563. inline void    TWindow::EvMButtonUp(UINT modKeys, TPoint&)
  1564.                    {DefaultProcessing();}
  1565. inline UINT    TWindow::EvMenuChar(UINT nChar, UINT menuType, HMENU hMenu)
  1566.                    {return (UINT)DefaultProcessing();}
  1567. inline void    TWindow::EvMenuSelect(UINT menuItemId, UINT flags, HMENU hMenu)
  1568.                    {DefaultProcessing();}
  1569. inline UINT    TWindow::EvMouseActivate(HWND hWndTopLevel, UINT hitTestCode, UINT msg)
  1570.                    {return (UINT)DefaultProcessing();}
  1571. inline void    TWindow::EvMouseMove(UINT modKeys, TPoint&)
  1572.                    {DefaultProcessing();}
  1573. inline BOOL    TWindow::EvNCActivate(BOOL active)
  1574.                    {return (BOOL)DefaultProcessing();}
  1575. inline UINT    TWindow::EvNCCalcSize(BOOL calcValidRects, NCCALCSIZE_PARAMS far&)
  1576.                    {return (UINT)DefaultProcessing();}
  1577. inline BOOL    TWindow::EvNCCreate(CREATESTRUCT far&)
  1578.                    {return (BOOL)DefaultProcessing();}
  1579. inline UINT    TWindow::EvNCHitTest(TPoint&)
  1580.                    {return (UINT)DefaultProcessing();}
  1581. inline void    TWindow::EvNCLButtonDblClk(UINT hitTest, TPoint&)
  1582.                    {DefaultProcessing();}
  1583. inline void    TWindow::EvNCLButtonDown(UINT hitTest, TPoint&)
  1584.                    {DefaultProcessing();}
  1585. inline void    TWindow::EvNCLButtonUp(UINT hitTest, TPoint&)
  1586.                    {DefaultProcessing();}
  1587. inline void    TWindow::EvNCMButtonDblClk(UINT hitTest, TPoint&)
  1588.                    {DefaultProcessing();}
  1589. inline void    TWindow::EvNCMButtonDown(UINT hitTest, TPoint&)
  1590.                    {DefaultProcessing();}
  1591. inline void    TWindow::EvNCMButtonUp(UINT hitTest, TPoint&)
  1592.                    {DefaultProcessing();}
  1593. inline void    TWindow::EvNCMouseMove(UINT hitTest, TPoint&)
  1594.                    {DefaultProcessing();}
  1595. inline void    TWindow::EvNCPaint()
  1596.                    {DefaultProcessing();}
  1597. inline void    TWindow::EvNCRButtonDblClk(UINT hitTest, TPoint&)
  1598.                    {DefaultProcessing();}
  1599. inline void    TWindow::EvNCRButtonDown(UINT hitTest, TPoint&)
  1600.                    {DefaultProcessing();}
  1601. inline void    TWindow::EvNCRButtonUp(UINT hitTest, TPoint&)
  1602.                    {DefaultProcessing();}
  1603. inline void    TWindow::EvOtherWindowCreated(HWND hWndOther)
  1604.                    {DefaultProcessing();}
  1605. inline void    TWindow::EvOtherWindowDestroyed(HWND hWndOther)
  1606.                    {DefaultProcessing();}
  1607. inline void    TWindow::EvPaintIcon()
  1608.                    {DefaultProcessing();}
  1609. inline void    TWindow::EvPaintClipboard(HWND, HANDLE hPaintStruct)
  1610.                    {DefaultProcessing();}
  1611. inline void    TWindow::EvPaletteChanged(HWND hWndPalChg)
  1612.                    {DefaultProcessing();}
  1613. inline void    TWindow::EvPaletteIsChanging(HWND hWndPalChg)
  1614.                    {DefaultProcessing();}
  1615. inline void    TWindow::EvParentNotify(UINT event,
  1616.                                        UINT childHandleOrX,
  1617.                                        UINT childIDOrY)
  1618.                    {DefaultProcessing();}
  1619. inline int     TWindow::EvPower(UINT)
  1620.                    {return (int)DefaultProcessing();}
  1621. inline void    TWindow::EvSysCommand(UINT cmdType, TPoint&)
  1622.                    {DefaultProcessing();}
  1623. inline HANDLE  TWindow::EvQueryDragIcon()
  1624.                    {return (HANDLE)DefaultProcessing();}
  1625. inline BOOL    TWindow::EvQueryNewPalette()
  1626.                    {return (BOOL)DefaultProcessing();}
  1627. inline BOOL    TWindow::EvQueryOpen()
  1628.                    {return (BOOL)DefaultProcessing();}
  1629. inline void    TWindow::EvRenderAllFormats()
  1630.                    {DefaultProcessing();}
  1631. inline void    TWindow::EvRenderFormat(UINT dataFormat)
  1632.                    {DefaultProcessing();}
  1633. inline void    TWindow::EvRButtonDblClk(UINT modKeys, TPoint&)
  1634.                    {DefaultProcessing();}
  1635. inline void    TWindow::EvRButtonDown(UINT modKeys, TPoint&)
  1636.                    {DefaultProcessing();}
  1637. inline void    TWindow::EvRButtonUp(UINT modKeys, TPoint&)
  1638.                    {DefaultProcessing();}
  1639. inline void    TWindow::EvSetFocus(HWND hWndLostFocus)
  1640.                    {DefaultProcessing();}
  1641. inline void    TWindow::EvSetFont(HFONT, BOOL)
  1642.                    {DefaultProcessing();}
  1643. inline void    TWindow::EvSetText(const char far*)
  1644.                    {DefaultProcessing();}
  1645. inline void    TWindow::EvShowWindow(BOOL show, UINT status)
  1646.                    {DefaultProcessing();}
  1647. inline void    TWindow::EvSizeClipboard(HWND hWndViewer, HANDLE hRect)
  1648.                    {DefaultProcessing();}
  1649. inline void    TWindow::EvSpoolerStatus(UINT jobStatus, UINT jobsLeft)
  1650.                    {DefaultProcessing();}
  1651. inline void    TWindow::EvSysChar(UINT key, UINT repeatCount, UINT flags)
  1652.                    {DefaultProcessing();}
  1653. inline void    TWindow::EvSysDeadChar(UINT key, UINT repeatCount, UINT flags)
  1654.                    {DefaultProcessing();}
  1655. inline void    TWindow::EvSysKeyDown(UINT key, UINT repeatCount, UINT flags)
  1656.                    {DefaultProcessing();}
  1657. inline void    TWindow::EvSysKeyUp(UINT key, UINT repeatCount, UINT flags)
  1658.                    {DefaultProcessing();}
  1659. inline void    TWindow::EvSystemError(UINT error)
  1660.                    {DefaultProcessing();}
  1661. inline void    TWindow::EvTimeChange()
  1662.                    {DefaultProcessing();}
  1663. inline void    TWindow::EvTimer(UINT timerId)
  1664.                    {DefaultProcessing();}
  1665. inline void    TWindow::EvWinIniChange(char far* section)
  1666.                    {DefaultProcessing();}
  1667. inline void    TWindow::EvVScrollClipboard(HWND hWndCBViewer,
  1668.                                            UINT scrollCode,
  1669.                                            UINT pos)
  1670.                    {DefaultProcessing();}
  1671. inline void    TWindow::EvWindowPosChanged(WINDOWPOS far& windowPos)
  1672.                    {DefaultProcessing();}
  1673. inline void    TWindow::EvWindowPosChanging(WINDOWPOS far& windowPos)
  1674.                    {DefaultProcessing();}
  1675.  
  1676. #endif  // __OWL_WINDOW_H
  1677.