home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 May / Pcwk5b98.iso / Borland / Cplus45 / BC45 / OWLINC.PAK / TINYCAPT.H < prev    next >
C/C++ Source or Header  |  1995-08-29  |  4KB  |  95 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows
  3. // (C) Copyright 1992, 1994 by Borland International, All Rights Reserved
  4. //
  5. //----------------------------------------------------------------------------
  6. #if !defined(OWL_TINYCAPT_H)
  7. #define OWL_TINYCAPT_H
  8.  
  9. #if !defined(OWL_WINDOW_H)
  10. # include <owl/window.h>
  11. #endif
  12. class _OWLCLASS TFont;
  13.  
  14. //
  15. //  class TTinyCaption
  16. //  ----- ------------
  17. //
  18. class _OWLCLASS TTinyCaption : public virtual TWindow {
  19.   protected:
  20.     TTinyCaption();
  21.    ~TTinyCaption();
  22.  
  23.     //
  24.     // Pass closeBox=true to replace SystemMenu box with a box that will 
  25.     // close window when clicked
  26.     // Used for floating palettes, etc.
  27.     //
  28.     void        EnableTinyCaption(int ch=58, bool closeBox=false);
  29.  
  30.     //
  31.     // Controller class must handle events that call these mixin handlers
  32.     //
  33.     TEventStatus DoNCHitTest(TPoint& screenPt, uint& evRes);
  34.     TEventStatus DoNCPaint();
  35.     TEventStatus DoNCCalcSize(bool calcValidRects, 
  36.                               NCCALCSIZE_PARAMS far& calcSize, uint& evRes);
  37.     TEventStatus DoNCLButtonDown(uint hitTest, TPoint& screenPt);
  38.     TEventStatus DoMouseMove(uint hitTest, TPoint& screenPt);
  39.     TEventStatus DoLButtonUp(uint hitTest, TPoint& screenPt);
  40.     TEventStatus DoNCActivate(bool active, bool& evRes);
  41.     TEventStatus DoCommand(uint id, HWND hWndCtl, uint notifyCode, LRESULT& evRes);
  42.     TEventStatus DoSysCommand(uint cmdType, TPoint& p);
  43.  
  44.   protected:
  45.     //
  46.     // Cache system metrics 
  47.     //
  48.     TSize    Border; // Thin frame border size for dividers
  49.     TSize    Frame;  // Actual Left and Right, Top and Bottom frame size
  50.  
  51.     bool     CloseBox;      // True for special close box
  52.     bool     TCEnabled;
  53.     int      CaptionHeight;
  54.     TFont*   CaptionFont;   // Tiny font for caption bar
  55.     uint     DownHit;       // Mouse down hit test result
  56.     bool     IsPressed;     // Is a button currently pressed
  57.     bool     WaitingForSysCmd;
  58.  
  59.     void        PaintButton(TDC& dc, TRect& boxRect, bool pressed);
  60.     void        PaintCloseBox(TDC& dc, TRect& boxRect, bool pressed);
  61.     void        PaintSysBox(TDC& dc, TRect& boxRect, bool pressed);
  62.     void        PaintMinBox(TDC& dc, TRect& boxRect, bool pressed);
  63.     void        PaintMaxBox(TDC& dc, TRect& boxRect, bool pressed);
  64.     void        PaintCaption(bool active);
  65.     void        DoSysMenu();
  66.  
  67.     TRect       GetCaptionRect();  // Get caption area for hit test or paint
  68.     TRect       GetSysBoxRect();   // Same for close box
  69.     TRect       GetMinBoxRect();
  70.     TRect       GetMaxBoxRect();
  71.  
  72.   protected:
  73.     uint        EvNCHitTest(TPoint& screenPt);
  74.     void        EvNCPaint();
  75.     uint        EvNCCalcSize(bool calcValidRects, NCCALCSIZE_PARAMS far& calcSize);
  76.     void        EvNCLButtonDown(uint hitTest, TPoint& screenPt);
  77.     void        EvMouseMove(uint hitTest, TPoint& screenPt);
  78.     void        EvLButtonUp(uint hitTest, TPoint& screenPt);
  79.     bool        EvNCActivate(bool active);
  80.     LRESULT     EvCommand(uint id, HWND hWndCtl, uint notifyCode);
  81.     void        EvSysCommand(uint cmdType, TPoint& p);
  82.  
  83.   private:
  84.     //
  85.     // hidden to prevent accidental copying or assignment
  86.     //
  87.     TTinyCaption(const TTinyCaption&);
  88.     TTinyCaption& operator =(const TTinyCaption&);
  89.  
  90.   DECLARE_RESPONSE_TABLE(TTinyCaption);
  91.   DECLARE_STREAMABLE(_OWLCLASS, TTinyCaption, 1);
  92. };
  93.  
  94. #endif  // OWL_TINYCAPT_H
  95.