home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / deans.zip / WINDOW.HPP < prev   
Text File  |  1994-09-14  |  37KB  |  977 lines

  1. //
  2. // NAME: CIDGui_Window.Hpp
  3. //
  4. // DESCRIPTION:
  5. //
  6. //  This is the header for the CIDGui_Window.Cpp module. This module provides
  7. //  the base window class from which all other window classes are derived. It
  8. //  provides a number of standard methods that operate on all window types
  9. //  the same, and some pure virtual ones that must be overridden in derived
  10. //  classes.
  11. //
  12. //  The base WINDOW class is pretty simple. Though it supports a good number
  13. //  of  methods, these methods generally just turn around and call PM and
  14. //  system methods.
  15. //
  16. //  The class hierarchy here is:
  17. //
  18. //              CIDOBJECT
  19. //                  │
  20. //               WINDOW
  21. //
  22. //
  23. // AUTHOR: Dean Roddey
  24. //
  25. // CREATE DATE: 04/11/93
  26. //
  27. // COPYRIGHT: 1992, 1993, 'CIDCorp
  28. //
  29. // CAVEATS/GOTCHAS:
  30. //
  31. //  1)  Out of necessity, the window handle of the window is publically
  32. //      available, but they should seldom be needed and should not be
  33. //      abused!!
  34. //
  35. //  2)  Control messages are actually reflected back to the window from
  36. //      which they came (via the protected, virtual method _bControl().) The
  37. //      control is free to process these messages and send them on to the
  38. //      owner via the public versions. They have to convert any OS/2
  39. //      structures to objects as required by the particular message.
  40. //
  41. //      This will change soon I think so that the protected versions of
  42. //      _bControl() and _bCommand() will not be visible outside of this
  43. //      facility. They will handle filtering of PM control wrapper classes
  44. //      and then calling a public version that is for general use (and
  45. //      will be sure never to even accidentally see PM specific stuff.)
  46. //
  47. // MODIFICATION LOG:
  48. //
  49.  
  50.  
  51. // Avoid multiple inclusions
  52. #if            !defined(CIDGUI_WINDOW_HPP)
  53. #define        CIDGUI_WINDOW_HPP
  54.  
  55. // -----------------------------------------------------------------------------
  56. //  Some typedefs to build some pseudo class names based on existing classes.
  57. //  These are to make the code more self documenting without the overhead of
  58. //  deriving new classes that add no functionality.
  59. // -----------------------------------------------------------------------------
  60. typedef C4UNION MPARM;
  61.  
  62.  
  63. // -----------------------------------------------------------------------------
  64. //   CLASS: WINDOW
  65. //  PREFIX: wnd
  66. //
  67. //  This is the primal window class. It is the basis for all window classes and
  68. //  provides a lot of the standard funtionality of windows.
  69. // -----------------------------------------------------------------------------
  70. class               WINDOW : public CIDOBJECT
  71. {
  72.     public          :
  73.         // ---------------------------------------------------------------------
  74.         //  Constructors and Destructors.
  75.         //
  76.         //  WINDOW
  77.         //      The default constructor is protected. These two are for
  78.         //      creating a new window object or creating a window object
  79.         //      from an existing PM window.
  80.         //
  81.         //  ~WINDOW
  82.         //      The destructor will destroy the window. Since this is the
  83.         //      last level of the window classes, it knows that nobody else
  84.         //      is still handling messages, because all higher level
  85.         //      destructors have been called. Since WINDOW is a base class,
  86.         //      its destructor is  virtual.
  87.         // ---------------------------------------------------------------------
  88.         WINDOW
  89.         (
  90.             const   WINDOW&                 wndParent
  91.             , const WINDOW&                 wndOwner
  92.             ,       tCIDGui::eWNDSTYLES     eStyle
  93.             , const WINDOW&                 wndBehind
  94.             , const AREA&                   areaInit = AREA(0,0,0,0)
  95.             , const STRGBUF&                strbText = ""
  96.             ,       tCIDLib::CARD4          c4Id = 0
  97.             ,       PFNWP                   pfnWndProc = PFNWP(0)
  98.         );
  99.  
  100.         WINDOW
  101.         (
  102.                     HWND                    hwndWnd
  103.         );
  104.  
  105.         ~WINDOW();
  106.  
  107.  
  108.         // ---------------------------------------------------------------------
  109.         //  Public, inherited, virtual methods
  110.         //
  111.         //  FormatToStr
  112.         //      Formats some debug info into the string.
  113.         // ---------------------------------------------------------------------
  114.         STDVPUBMETHODS(WINDOW,CIDOBJECT,tCIDLib::eFALSE);
  115.  
  116.         virtual tCIDLib::VOID FormatToStr
  117.         (
  118.                     STRGBUF&                strbDest
  119.         ) const;
  120.  
  121.  
  122.         // ---------------------------------------------------------------------
  123.         //  Public, virtual methods
  124.         //
  125.         //  bAdjustNewArea
  126.         //      This method is called when the area of the window is about to be
  127.         //      changed. This happens after the user sizes the window, but
  128.         //      before the size change actually takes place. This method allows
  129.         //      the new size to be adjusted before it is used to resize the
  130.         //      window.
  131.         //
  132.         //      This version just needs to return eFALSE to let it go to the
  133.         //      default handler.
  134.         //
  135.         //  bChar
  136.         //      This method is called when non-extended chars are received. Non
  137.         //      extended means the typeable characters, not function keys and
  138.         //      such.
  139.         //
  140.         //  bClick
  141.         //      This method is called when a mouse click occurs. The eType parm
  142.         //      indicates the type of mouse event and the pntPos is a POINT
  143.         //      object that indicates the position of the event.
  144.         //
  145.         //  bClose
  146.         //      This method is called when the Close option is selected from the
  147.         //      system menu. It is passed to frame windows. If eTRUE is returned
  148.         //      the close of the application can be suppressed. The default
  149.         //      action is to return eFALSE, letting it pass to the default
  150.         //      handler when will close the application or dialog window.
  151.         //
  152.         //  bDestroy
  153.         //      This is called when the PM window is destroyed. This version
  154.         //      does not need to do anything, but derived classes should clean
  155.         //      up any resources related to the window. The low level message
  156.         //      handler will zero out the window handle member after all classes
  157.         //      have handled this message so that any further operations will
  158.         //      cause an error. This default version does nothing.
  159.         //
  160.         //  bEnableState
  161.         //      This method is called when the window's enable state has
  162.         //      changed. This default version does nothing.
  163.         //
  164.         //  bExendedChar
  165.         //      This method is related to bChar() but is called for extended
  166.         //      characters, which are things like function keys and keypad keys.
  167.         //      This default version handles looking for the F10 key and popping
  168.         //      up the window's menu, if it has one. Otherwise, it just returns
  169.         //      eFALSE to let the key go on to the default handler.
  170.         //
  171.         //  bMoved
  172.         //      This method is called when the window's origin moves relative to
  173.         //      its parent, but not when it is moved along with its parent (thus
  174.         //      keeping the same relative position.) This default version does
  175.         //      nothing.
  176.         //
  177.         //  bMouseMove
  178.         //      This method is called when the mouse moves over the window. It
  179.         //      receives a POINT object that indicates where the mouse was when
  180.         //      the message was received.
  181.         //
  182.         //  bPaint
  183.         //      This method is called when the window gets a WM_PAINT message.
  184.         //      The parameter is a reference to an AREA object that holds the
  185.         //      invalidated area. This class provides the most basic painting by
  186.         //      calling GpiErase().
  187.         //
  188.         //  bPopUpMenu
  189.         //      This method will pop up the menu for this window, if it has
  190.         //      one. It is called internally when the WM_CONTEXTMENU message
  191.         //      arrives.
  192.         //
  193.         //  bPresParamChanged
  194.         //      A presentation parameter has changed, so we need to requery our
  195.         //      colors and redisplay if needed.
  196.         //
  197.         //  bScrollEvent
  198.         //      This method is called when a scroll bar child object wants to
  199.         //      tell us about a scroll event.
  200.         //
  201.         //  bShowState
  202.         //      This method is called when the windows visibility state is set.
  203.         //      The new visibility state is passed. This default version does
  204.         //      nothing.
  205.         //
  206.         //  bSizeChange
  207.         //      This method is called when the window is resized. If the window
  208.         //      has the size repaint style, this will be called when the window
  209.         //      is sized in or out, otherwise only when the window is sized out.
  210.         //      Note that the area is 0 based so only the size is relevant. The
  211.         //      old size is also passed in case it allows the window to be more
  212.         //      efficient.
  213.         //
  214.         //  bSysColorChange
  215.         //      A system color has been changed, so we need to requery our
  216.         //      colors and redisplay.
  217.         //
  218.         //  bUserMsg
  219.         //      This is called for any user event message that is posted. The
  220.         //      default here is to return eTRUE to eat the message, so that
  221.         //      it does not go to the default window proc.
  222.         //
  223.         //  SetDefMenu
  224.         //      This will cause the window to install its default menu,
  225.         //      destroying any existing popup menu for this window if the
  226.         //      bDestroyOldMenu parm is eTRUE. The default version here does
  227.         //      nothing. It generally will just call SetMenu() with its menu,
  228.         //      passing on the destroy flag.
  229.         //
  230.         //  SetMenu
  231.         //      This menu will install the passed menu object as the top level
  232.         //      menu for this window object. Optionally, the bDestroyOldMenu
  233.         //      parameter can be set to eTRUE to cause the old menu (if any),
  234.         //      to be destroyed. This parm defaults to eFALSE.
  235.         // ---------------------------------------------------------------------
  236.         virtual tCIDLib::eBOOL bAdjustNewArea
  237.         (
  238.             const   AREA&                   areaNew
  239.             ,       AREA&                   areaModifed
  240.             ,       tCIDLib::eBOOL&         bChange
  241.         )           {return tCIDLib::eFALSE;}
  242.  
  243.         virtual tCIDLib::eBOOL bChar
  244.         (
  245.                     tCIDLib::CH             chKey
  246.             ,       tCIDGui::eSHIFTKEYS     eShifts
  247.         )           {return tCIDLib::eFALSE;}
  248.  
  249.         virtual tCIDLib::eBOOL bClick
  250.         (
  251.                     tCIDGui::eMOUSECLKS     eType
  252.             , const POINT&                  pntPos
  253.         )           {return tCIDLib::eFALSE;}
  254.  
  255.         virtual tCIDLib::eBOOL bClose
  256.         (
  257.         )           {return tCIDLib::eFALSE;}
  258.  
  259.         virtual tCIDLib::eBOOL bDestroy
  260.         (
  261.         )           {return tCIDLib::eFALSE;}
  262.  
  263.         virtual tCIDLib::eBOOL bEnableState
  264.         (
  265.                     tCIDLib::eBOOL          bNewEnable
  266.         )           {return tCIDLib::eFALSE;}
  267.  
  268.         virtual tCIDLib::eBOOL bExtendedChar
  269.         (
  270.                     tCIDGui::eEXTKEYS       eExtKey
  271.             ,       tCIDGui::eSHIFTKEYS     eShifts
  272.         )           {return tCIDLib::eFALSE;}
  273.  
  274.         virtual tCIDLib::eBOOL bGettingFocus
  275.         (
  276.         )           {return tCIDLib::eFALSE;}
  277.  
  278.         virtual tCIDLib::eBOOL bLosingFocus
  279.         (
  280.         )           {return tCIDLib::eFALSE;}
  281.  
  282.         virtual tCIDLib::eBOOL bMoved
  283.         (
  284.         )           {return tCIDLib::eFALSE;}
  285.  
  286.         virtual tCIDLib::eBOOL bMouseMove
  287.         (
  288.             const   POINT&                  pntPos
  289.         )           {return tCIDLib::eFALSE;}
  290.  
  291.         virtual tCIDLib::eBOOL bPaint
  292.         (
  293.             const   AREA&                   areaInvalid
  294.             ,       PAINTBRUSH&             ptbTarget
  295.         );
  296.  
  297.         virtual tCIDLib::eBOOL bPopUpMenu
  298.         (
  299.             const   POINT&                  pntPos
  300.         );
  301.  
  302.         virtual tCIDLib::eBOOL bPresParamChanged
  303.         (
  304.         )           {return tCIDLib::eFALSE;}
  305.  
  306.         virtual tCIDLib::eBOOL bScrollEvent
  307.         (
  308.                     tCIDLib::CARD4          c4ChildId
  309.             ,       tCIDGui::eSCROLLEV      eScrollEvent
  310.             ,       tCIDLib::INT4           i4ScrollPos
  311.         )           {return tCIDLib::eFALSE;}
  312.  
  313.         virtual tCIDLib::eBOOL bSizeChanged
  314.         (
  315.             const   AREA&                   areaNewSize
  316.             , const AREA&                   areaOldSize
  317.         )           {return tCIDLib::eFALSE;}
  318.  
  319.         virtual tCIDLib::eBOOL bSysColorChanged
  320.         (
  321.         )           {return tCIDLib::eFALSE;}
  322.  
  323.         virtual tCIDLib::eBOOL bShowState
  324.         (
  325.                     tCIDLib::eBOOL          bNewState
  326.         )           {return tCIDLib::eFALSE;}
  327.  
  328.         virtual tCIDLib::eBOOL bUserMsg
  329.         (
  330.                     tCIDLib::CARD4          c4Msg
  331.             , const MPARM&                  mp1
  332.             , const MPARM&                  mp2
  333.         )           {return tCIDLib::eTRUE;}
  334.  
  335.         virtual tCIDLib::VOID SetDefMenu
  336.         (
  337.                     tCIDLib::eBOOL          bDestroyOldMenu = tCIDLib::eFALSE
  338.         )           {}
  339.  
  340.         virtual tCIDLib::VOID SetMenu
  341.         (
  342.                     POPUPMENU*              pmenuNew
  343.             ,       tCIDLib::eBOOL          bDestroyOldMenu = tCIDLib::eFALSE
  344.         );
  345.  
  346.  
  347.         // ---------------------------------------------------------------------
  348.         //  Public, non-virtual methods
  349.         //
  350.         //  operator HWND
  351.         //      An implicit conversion to get the window handle. This is mainly
  352.         //      for internal use so that we can pass WINDOW objects to PM APIs.
  353.         //
  354.         //  areaWnd
  355.         //      This method will get the area of the window.
  356.         //
  357.         //  areaWndSize
  358.         //      This method will get the size of the window. It returns a
  359.         //      0 based area that indicates the size of the window, but not its
  360.         //      position relative to its parent.
  361.         //
  362.         //  bGetPresColor
  363.         //      This method will return the presentation color. If this color
  364.         //      has not been defined for the particular window, eFALSE will be
  365.         //      returned. If so, the appropriate system color should be
  366.         //      queried.
  367.         //
  368.         //  bGotFocus
  369.         //      Returns eTRUE if this window has the focus, else eFALSE.
  370.         //
  371.         //  bIsChildWindow
  372.         //      Tests the passed window to see if it is a child (descendant
  373.         //      actually) of this window object.
  374.         //
  375.         //  bIsEnabled
  376.         //      Returns eTRUE if this window is enabled.
  377.         //
  378.         //  bIsShowing
  379.         //  bIsVisible
  380.         //      These methods will tell the caller if this window is showing or
  381.         //      visible. Visibility is a function of the window's current
  382.         //      visibility flag (set by Show() and Hide()), whereas showing
  383.         //      means that the window is visible and is not totally covered
  384.         //      by other windows.
  385.         //
  386.         //  bMouseCaptured
  387.         //      Returns eTRUE if this window has the mouse captured, else
  388.         //      eFALSE.
  389.         //
  390.         //  bQueryWndColor
  391.         //      This method will first attempt to query the passed presparam
  392.         //      color from this window. If it cannot be found, it will then
  393.         //      query the passed system color and return that. It returns
  394.         //      eTRUE if it got the presparam color and eFALSE if it got the
  395.         //      system color.
  396.         //
  397.         //  c4Id
  398.         //      Gets the window id for this window
  399.         //
  400.         //  c4WindowTextLen
  401.         //      Returns the number of characters in the window text for this
  402.         //      window object.
  403.         //
  404.         //  CaptureMouse
  405.         //      When a window calls this, it will get all mouse event messages
  406.         //      until it calls ReleaseMouse().
  407.         //
  408.         //  Disable
  409.         //  Enable
  410.         //      These methods will disable or enable this window object. If
  411.         //      disabled, the window will not accept input from the user.
  412.         //
  413.         //  eWndStyles
  414.         //      This method will get/set the WINDOW class styles. When setting,
  415.         //      there is a mask of bits and a mask of relevant bits. If the
  416.         //      relevant bit is not set, then that style is not updated.
  417.         //
  418.         //  ExitMsgLoop
  419.         //      This will post a quit message to the message loop to cause it
  420.         //      to exit.
  421.         //
  422.         //  ForceRepaint
  423.         //      This method will cause the window to get a paint method call
  424.         //      with the entire window invalid.
  425.         //
  426.         //  Hide
  427.         //      Hides this window object
  428.         //
  429.         //  hwndThis
  430.         //      Returns the window handle for this window. It should not be
  431.         //      abused!!!
  432.         //
  433.         //  InvalidateArea
  434.         //      This method will invalidate the passed area, causing the
  435.         //      window to get a paint event, with this area as the update
  436.         //      area.
  437.         //
  438.         //  menuThis
  439.         //      Returns a reference to the menu object for this window.
  440.         //
  441.         //  pntWndOrg
  442.         //      Returns the origin of the window.
  443.         //
  444.         //  ReleaseMouse
  445.         //      Releases the mouse, which was captured with CaptureMouse()
  446.         //
  447.         //  ScrollArea
  448.         //      This method will scroll the indicated area of the window by
  449.         //      the indicated x and y relative pels. There is an optional
  450.         //      version that clips the scroll area.
  451.         //
  452.         //  SetPresColor
  453.         //      This method will set the indicated presentation color to the
  454.         //      passed color value.
  455.         //
  456.         //  SetSWPFlags
  457.         //      This method allows several operations to be done on a window
  458.         //      at once. If the size or move options are used, then the AREA
  459.         //      parameter must be present. If the 'z order' option is used,
  460.         //      then the WINDOW parameter must be present.
  461.         //
  462.         //  SetWndPos
  463.         //  SetWndSize
  464.         //  SetWndSizePos
  465.         //      These methods set the size and/or position of the window.
  466.         //
  467.         //  Show
  468.         //      Set the show state of this window object to true.
  469.         //
  470.         //  strWndText
  471.         //      Gets/sets the text for this window.
  472.         //
  473.         //  TakeFocus
  474.         //      This window object takes the focus for himself.
  475.         //
  476.         //  ToBottom
  477.         //  ToTop
  478.         //      These methods will move this window to the top of its
  479.         //      siblings or to the bottom.
  480.         //
  481.         //  TranslateCoord
  482.         //      This method will translate coordinates from the passed
  483.         //      source window's coordinate system to this window's.
  484.         //
  485.         //  wndChildFromID
  486.         //      Returns a reference to the child window object that has the
  487.         //      passed id.
  488.         //
  489.         //  wndChildUnderPnt
  490.         //      Returns a reference to the child window of this window that is
  491.         //      under the passed point. If bDeep is eTRUE, then all descendants
  492.         //      are searched, otherwise only direct children.
  493.         //
  494.         //  wndOwner
  495.         //  wndParent
  496.         //      Sets the owner or parent of this window object to the passed
  497.         //      window object.
  498.         // ---------------------------------------------------------------------
  499.         operator HWND
  500.         (
  501.         )   const   {return __hwndThis;}
  502.  
  503.         AREA areaWnd() const;
  504.  
  505.         AREA areaWndSize() const;
  506.  
  507.         tCIDLib::eBOOL bGotFocus() const;
  508.  
  509.         tCIDLib::eBOOL bIsChildWindow
  510.         (
  511.             const   WINDOW&                 wndTest
  512.         );
  513.  
  514.         tCIDLib::eBOOL bIsEnabled() const;
  515.  
  516.         tCIDLib::eBOOL bIsShowing() const;
  517.  
  518.         tCIDLib::eBOOL bIsVisible() const;
  519.  
  520.         tCIDLib::eBOOL bMouseCaptured
  521.         (
  522.         )   const   {return __bMouseCaptured;}
  523.  
  524.         tCIDLib::eBOOL bQueryPresColor
  525.         (
  526.                     tCIDGui::ePRESCLRS      ePresClr
  527.             ,       RGBCLR&                 rgbClr
  528.         )   const;
  529.  
  530.         tCIDLib::eBOOL bQueryWndColor
  531.         (
  532.                     tCIDGui::ePRESCLRS      ePresClr
  533.             ,       tCIDGui::eSYSCOLORS     eSysClr
  534.             ,       RGBCLR&                 rgbResult
  535.         )   const;
  536.  
  537.         tCIDLib::CARD4 c4Id
  538.         (
  539.         )   const   {return __c4Id;}
  540.  
  541.         tCIDLib::CARD4 c4WindowTextLen() const;
  542.  
  543.         tCIDLib::VOID CaptureMouse();
  544.  
  545.         tCIDLib::VOID Disable();
  546.  
  547.         tCIDLib::VOID Enable();
  548.  
  549.         tCIDGui::eWNDSTYLES eWndStyles() const;
  550.  
  551.         tCIDGui::eWNDSTYLES eWndStyles
  552.         (
  553.                     tCIDGui::eWNDSTYLES     eNewStyles
  554.            ,        tCIDGui::eWNDSTYLES     eRelevant = tCIDGui::eWNDSTYLES(0xFFFFFFFF)
  555.         );
  556.  
  557.         tCIDLib::VOID ExitMsgLoop();
  558.  
  559.         tCIDLib::VOID ForceRepaint
  560.         (
  561.                     tCIDLib::eBOOL          bChildrenToo = tCIDLib::eTRUE
  562.         );
  563.  
  564.         tCIDLib::VOID Hide();
  565.  
  566.         HWND hwndThis
  567.         (
  568.         )   const   {return __hwndThis;}
  569.  
  570.         tCIDLib::VOID InvalidateArea
  571.         (
  572.             const   AREA&                   areaInvalidate
  573.             ,       tCIDLib::eBOOL          bDoClippedChild = tCIDLib::eFALSE
  574.         );
  575.  
  576.         POPUPMENU& menuThis
  577.         (
  578.         )   const   {return *__pmenuThis;}
  579.  
  580.         POINT pntWndOrg() const;
  581.  
  582.         tCIDLib::VOID ReleaseMouse();
  583.  
  584.         tCIDLib::VOID ScrollArea
  585.         (
  586.             const   AREA&                   areaScroll
  587.             ,       tCIDLib::INT4           i4CX
  588.             ,       tCIDLib::INT4           i4CY
  589.             ,       tCIDLib::eBOOL          bInvalidate
  590.             ,       tCIDLib::eBOOL          bScrollChildren = tCIDLib::eFALSE
  591.         );
  592.  
  593.         tCIDLib::VOID ScrollArea
  594.         (
  595.             const   AREA&                   areaScroll
  596.             ,       tCIDLib::INT4           i4CX
  597.             ,       tCIDLib::INT4           i4CY
  598.             ,       AREA&                   areaInvalidated
  599.             , const AREA&                   areaClip
  600.             ,       tCIDLib::eBOOL          bInvalidate
  601.             ,       tCIDLib::eBOOL          bScrollChildren = tCIDLib::eFALSE
  602.         );
  603.  
  604.         tCIDLib::VOID SetPresColor
  605.         (
  606.                     tCIDGui::ePRESCLRS      ePresClr
  607.             , const RGBCLR&                 rgbClr
  608.         );
  609.  
  610.         tCIDLib::VOID SetSWPFlags
  611.         (
  612.                     tCIDGui::eSWPFLAGS      eSwp
  613.             , const AREA&                   areaComponent = NUL_AREA
  614.             , const WINDOW&                 wndBehind = NUL_WINDOW
  615.         );
  616.  
  617.         tCIDLib::VOID SetWndPos
  618.         (
  619.             const   POINT&                  pntNewOrg
  620.         );
  621.  
  622.         tCIDLib::VOID SetWndSize
  623.         (
  624.                     tCIDLib::CARD4          c4CX
  625.             ,       tCIDLib::CARD4          c4CY
  626.         );
  627.  
  628.         tCIDLib::VOID SetWndSizePos
  629.         (
  630.             const   AREA&                   areaNew
  631.         );
  632.  
  633.         tCIDLib::VOID Show();
  634.  
  635.         const STRING& strWndText() const;
  636.  
  637.         const STRING& strWndText
  638.         (
  639.             const   STRGBUF&                strbNewText
  640.         );
  641.  
  642.         tCIDLib::VOID TakeFocus();
  643.  
  644.         tCIDLib::VOID ToBottom();
  645.  
  646.         tCIDLib::VOID ToTop();
  647.  
  648.         tCIDLib::VOID TranslateCoord
  649.         (
  650.                     POINT&                  pntTmp
  651.             , const WINDOW&                 wndSrc
  652.         );
  653.  
  654.         WINDOW& wndChildFromId
  655.         (
  656.                     tCIDLib::CARD4          c4Id
  657.         )   const;
  658.  
  659.         WINDOW& wndChildUnderPnt
  660.         (
  661.             const   POINT&                  pntPos
  662.             ,       tCIDLib::eBOOL          eDeep = tCIDLib::eFALSE
  663.         );
  664.  
  665.         WINDOW& wndEnumChildren
  666.         (
  667.             const   WINDOW&                 wndChild
  668.             ,       tCIDGui::eENUMCHILD     eEnumChild
  669.         );
  670.  
  671.         const WINDOW& wndOwner
  672.         (
  673.             const   WINDOW&                 wndNewOwner
  674.         );
  675.  
  676.         WINDOW& wndOwner() const;
  677.  
  678.         const WINDOW& wndParent
  679.         (
  680.             const   WINDOW&                 wndNewParent
  681.             ,       tCIDLib::eBOOL          eRedraw = tCIDLib::eFALSE
  682.         );
  683.  
  684.         WINDOW& wndParent() const;
  685.  
  686.  
  687.     protected       :
  688.         // ---------------------------------------------------------------------
  689.         //  Declare friend functions
  690.         //
  691.         //  _pfnwpMainSub
  692.         //      This is the central window proc that handles all message for all
  693.         //      windows. It will just pass the window message info on to the
  694.         //      _mresHandleMsg() procedure below.
  695.         // ---------------------------------------------------------------------
  696.         friend MRESULT EXPENTRY _pfnwpMainSub
  697.         (
  698.                     HWND                    hwndThis
  699.             ,       tCIDLib::CARD4          c4Msg
  700.             ,       MPARAM                  mp1
  701.             ,       MPARAM                  mp2
  702.         );
  703.  
  704.  
  705.         // ---------------------------------------------------------------------
  706.         //  Protected, inherited methods
  707.         //
  708.         //  _bIsEqual
  709.         //      This method is called from the public bIsEqual, which has
  710.         //      determined that the objects are of comparable classes and are
  711.         //      not the same object. It does the comparison down the class
  712.         //      hierarchy.
  713.         // ---------------------------------------------------------------------
  714.         virtual tCIDLib::eBOOL _bIsEqual
  715.         (
  716.             const   CIDOBJECT&              objTarget
  717.         )   const;
  718.  
  719.  
  720.         // ---------------------------------------------------------------------
  721.         //  Protected, virtual methods
  722.         //
  723.         //  _bCommand
  724.         //      This method is called when a child window generates a command
  725.         //      message. It needs to be processed by the derived class that
  726.         //      understands it.
  727.         //
  728.         //  _bControl
  729.         //      This method is called when this window generates a control
  730.         //      message. It needs to be processed by the derived class that
  731.         //      understands it and (possibly) sent on to owner via the
  732.         //      public versions.
  733.         //
  734.         //  _bMinMaxFrame
  735.         //      This method is called for FRAMEWND and its derivatives. It
  736.         //      allows the object to control what happens. At this level we
  737.         //      just return 0 to let the default action occur.
  738.         //
  739.         //  _bQueryWndParms
  740.         //      This is a protected method that is called when the window
  741.         //      receives a WM_QUERYWINDOWPARAMS message. This is intended to
  742.         //      support window text, and none of the custom window classes use
  743.         //      any other window parms. Classes that handle real PM windows
  744.         //      should override and return eFALSE to let it go to the default
  745.         //      handler.
  746.         //
  747.         //  _bSetWndParms
  748.         //      This is the sibling of the query window parms. It will just do
  749.         //      the window text. Classes that handle real PM windows should
  750.         //      override and return eFALSE to let it go to the default handler.
  751.         //
  752.         //  _InitMenu
  753.         //      This is called before the popup menu is popped up. It allows
  754.         //      derived classes to control the menu state.
  755.         //
  756.         //  _wndEnumChildren
  757.         //      This is called by the public wndEnumChildren to give derived
  758.         //      types a chance to provide the cursor movement logic. If this
  759.         //      guy returns eTRUE in bHandled it means he handled it, otherwise
  760.         //      the default PM logic will be applied. This default returns
  761.         //      eFALSE in bHandled and NUL_WINDOW for the return.
  762.         // ---------------------------------------------------------------------
  763.         virtual tCIDLib::eBOOL _bCommand
  764.         (
  765.                     tCIDLib::CARD4          c4Command
  766.         )           {return tCIDLib::eFALSE;}
  767.  
  768.         virtual tCIDLib::eBOOL _bControl
  769.         (
  770.                     tCIDLib::CARD4          c4Code
  771.             ,       tCIDLib::CARD4          c4SrcWndId
  772.             ,       tCIDLib::CARD4          c4Data1 = 0
  773.             ,       tCIDLib::CARD4          c4Data2 = 0
  774.         )           {return tCIDLib::eFALSE;}
  775.  
  776.         virtual tCIDLib::eBOOL _bMinMaxFrame
  777.         (
  778.                     tCIDGui::eSWPFLAGS&     eFlags
  779.             , const AREA&                   areaFrm
  780.         )           {return tCIDLib::eFALSE;}
  781.  
  782.         virtual tCIDLib::eBOOL _bQueryWndParams
  783.         (
  784.                     tCIDLib::VOID*          pParmBuf
  785.         )   const;
  786.  
  787.         virtual tCIDLib::eBOOL _bSetWndParams
  788.         (
  789.                     tCIDLib::VOID*          pParmBuf
  790.         );
  791.  
  792.         virtual tCIDLib::VOID _InitMenu
  793.         (
  794.                     POPUPMENU&              menuPopUp
  795.         )           {}
  796.  
  797.         virtual WINDOW& _wndEnumChildren
  798.         (
  799.             const   WINDOW&                 wndChild
  800.             ,       tCIDGui::eENUMCHILD     eEnumChild
  801.             ,       tCIDLib::eBOOL&         bHandled
  802.         )   {bHandled=tCIDLib::eFALSE; return NUL_WINDOW;}
  803.  
  804.  
  805.         // ---------------------------------------------------------------------
  806.         //  Protected, non-virtual methods
  807.         //
  808.         //  _bPMPaint
  809.         //      Get/set the __bPMPaint member. If this is eTRUE, then the
  810.         //      bPaint method is not called, instead the paint is always passed
  811.         //      to the default handler.
  812.         //
  813.         //  _c4Id
  814.         //      This method will set the id. Getting the id is public.
  815.         //
  816.         //  _CreateCursor
  817.         //      This method will create a PM cursor, which will destroy any
  818.         //      other cursor that has been created.
  819.         //
  820.         //  _hwndThis
  821.         //      Sets the window handle. Getting it is done via a public method.
  822.         //
  823.         //  _MoveCursor
  824.         //      Moves the position of the PM cursor.
  825.         //
  826.         //  _mresHandleMsg
  827.         //      This is the method that is called from the central window
  828.         //      procedure that handles all messages for all windows.
  829.         //
  830.         //  _pfnWndProc
  831.         //      This method will allow the default window proc to be set. For
  832.         //      classes that enclose PM windows, this is that type of window's
  833.         //      proc. For all CIDLib custom window classes, this is just the
  834.         //      default window handler.
  835.         //
  836.         //  _SendControl
  837.         //      This method will send a control message to the owner, if one
  838.         //      exists. It actually just calls the _bControl() method of
  839.         //      the owner.
  840.         //
  841.         //  _ShowCursor
  842.         //      Makes the cursor visible or invisible, according to the passed
  843.         //      flag.
  844.         //
  845.         //  WINDOW
  846.         //      The default constructor is protected because it should only be
  847.         //      available to derived classes.
  848.         // ---------------------------------------------------------------------
  849.         tCIDLib::eBOOL _bPMPaint
  850.         (
  851.         )   const   {return __bPMPaint;}
  852.  
  853.         tCIDLib::eBOOL _bPMPaint
  854.         (
  855.                     tCIDLib::eBOOL          bNew
  856.         )           {__bPMPaint=bNew;return bNew;}
  857.  
  858.         tCIDLib::CARD4 _c4Id
  859.         (
  860.                     tCIDLib::CARD4          c4Id
  861.         )           {__c4Id=c4Id; return c4Id;}
  862.  
  863.         tCIDLib::VOID _CreateCursor
  864.         (
  865.             const   AREA&                   areaCursor
  866.             , const AREA&                   areaClip
  867.             ,       tCIDGui::eCURSORS       eCursorType
  868.         );
  869.  
  870.         tCIDLib::VOID _DestroyCursor();
  871.  
  872.         HWND _hwndThis
  873.         (
  874.                     HWND                    hwndNew
  875.         )           {__hwndThis=hwndNew; return __hwndThis;}
  876.  
  877.         tCIDLib::VOID _MoveCursor
  878.         (
  879.             const   POINT&                  pntNewPos
  880.         );
  881.  
  882.         MRESULT _mresHandleMsg
  883.         (
  884.                     HWND                    hwndThis
  885.             ,       tCIDLib::CARD4          c4Msg
  886.             ,       MPARAM                  mp1
  887.             ,       MPARAM                  mp2
  888.         );
  889.  
  890.         PFNWP _pfnWndProc
  891.         (
  892.         )   const   {return __pfnWndProc;}
  893.  
  894.         PFNWP _pfnWndProc
  895.         (
  896.                     PFNWP                   pfnNewProc
  897.         )           {__pfnWndProc=pfnNewProc; return pfnNewProc;}
  898.  
  899.         tCIDLib::VOID _SendControl
  900.         (
  901.                     tCIDLib::CARD4          c4Code
  902.             ,       tCIDLib::CARD4          c4SrcWndId
  903.             ,       tCIDLib::CARD4          c4Data1 = 0
  904.             ,       tCIDLib::CARD4          c4Data2 = 0
  905.         );
  906.  
  907.         tCIDLib::VOID _ShowCursor
  908.         (
  909.                     tCIDLib::eBOOL          bState
  910.         );
  911.  
  912.         WINDOW();
  913.  
  914.  
  915.     private     :
  916.         // ---------------------------------------------------------------------
  917.         //  Private data members
  918.         //
  919.         //  __bDestructing
  920.         //      This is set by the destructor before destroying the window
  921.         //      so that the WM_DESTROY handling will know that it does not
  922.         //      have to call the destructor.
  923.         //
  924.         //  __bMouseCaptured
  925.         //      Returns eTRUE if this window has the mouse captured.
  926.         //
  927.         //  __bPMPaint
  928.         //      This window represents a PM control window which must be
  929.         //      allowed to handle the WM_PAINT message directly. The bPaint()
  930.         //      method is not called for these objects, instead the paint is
  931.         //      allowed to fall through 
  932.         //
  933.         //  __c4Id
  934.         //      The id given to this window when it was created. A public
  935.         //      method allows it to be retrived, but not set. It is set in the
  936.         //      constructor and left untouched.
  937.         //
  938.         //  __hwndThis
  939.         //      The window handle for this window.
  940.         //
  941.         //  __pmenuThis
  942.         //      A pointer to the menu for this window. If there is no
  943.         //      associated menu, it will be 0.
  944.         //
  945.         //  __pfnWndProc
  946.         //      A pointer to the window procedure which will receive messages
  947.         //      that are not handled by the internal window code or by the
  948.         //      derived class. For PM controls it will be the original window
  949.         //      procedure. For others it will be the default window procedure.
  950.         //
  951.         //  __strWndText
  952.         //      Storage for the window text. When the text is queried, we get
  953.         //      the window text into this and return a constant reference to
  954.         //      it. It will be reallocated as needed to hold the text.
  955.         // ---------------------------------------------------------------------
  956.         tCIDLib::eBOOL          __bDestructing;
  957.         tCIDLib::eBOOL          __bMouseCaptured;
  958.         tCIDLib::eBOOL          __bPMPaint;
  959.         tCIDLib::CARD4          __c4Id;
  960.         HWND                    __hwndThis;
  961.         POPUPMENU*              __pmenuThis;
  962.         PFNWP                   __pfnWndProc;
  963.         STRING                  __strWndText;
  964. };
  965.  
  966. #define NUL_WINDDOW             (*(WINDOW*)0)
  967.  
  968.  
  969. //
  970. //  Some global formatting functions to format our enums into a string buffer
  971. //  or text file object. The functions are in CIDGui_FmtType.Cpp.
  972. //
  973. STRGBUF& operator<<(STRGBUF& strbDest, tCIDGui::eMOUSECLKS);
  974. OTXTFILE& operator<<(OTXTFILE& otfDest, tCIDGui::eMOUSECLKS);
  975.  
  976. #endif
  977.