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

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows - (C) Copyright 1992, 1993 by Borland International
  3. //   include\owl\statusba.h
  4. //   Class TStatusBar.
  5. //----------------------------------------------------------------------------
  6. #if !defined(__OWL_STATUSBA_H)
  7. #define __OWL_STATUSBA_H
  8.  
  9. #if !defined(__OWL_MESSAGEB_H)
  10.   #include "owl\messageb.h"
  11. #endif
  12. #if !defined(__OWL_TEXTGADG_H)
  13.   #include "owl\textgadg.h"
  14. #endif
  15.  
  16. //
  17. //  class TStatusBar
  18. //  ----- ----------
  19. //
  20. //  status bars have more options than a plain message bar: you can have
  21. //  multiple text gadgets, different style borders, and you can reserve space
  22. //  for mode indicators
  23. //
  24. class _OWLCLASS TStatusBar : public TMessageBar {
  25.   public:
  26.     enum TModeIndicator {ExtendSelection = 1,
  27.                          CapsLock        = 1 << 1,
  28.                          NumLock         = 1 << 2,
  29.                          ScrollLock      = 1 << 3,
  30.                          Overtype        = 1 << 4,
  31.                          RecordingMacro  = 1 << 5};
  32.  
  33.     TStatusBar(TWindow*              parent = 0,
  34.                TGadget::TBorderStyle borderStyle = TGadget::Recessed,
  35.                UINT                  modeIndicators = 0,
  36.                TFont*                font = new TGadgetWindowFont,
  37.                TModule*              module = 0);
  38.  
  39.     //
  40.     // by default, adds "gadget" after the existing text gadgets and before
  41.     // the mode indicator gadgets. sets the border style to the style specified
  42.     // during construction.
  43.     //
  44.     void        Insert(TGadget& gadget, TPlacement = After, TGadget* sibling = 0);
  45.  
  46.     TGadget*    operator [](UINT index);  // can't access mode indicator gadgets
  47.  
  48.     //
  49.     // in order for the mode indicator status to appear you must have
  50.     // specified the mode when the window was constructed
  51.     //
  52.     BOOL        GetModeIndicator(TModeIndicator i) const 
  53.                   {return (ModeIndicatorState & i) ? 1 : 0;}
  54.     void        SetModeIndicator(TModeIndicator, BOOL state);
  55.     void        ToggleModeIndicator(TModeIndicator);
  56.  
  57.     struct TSpacing {
  58.       TMargins::TUnits  Units;
  59.       int               Value;
  60.  
  61.       TSpacing() {Units = TMargins::LayoutUnits; Value = 0;}
  62.     };
  63.  
  64.     //
  65.     // sets the spacing to be used between mode indicator gadgets
  66.     //
  67.     void        SetSpacing(TSpacing& spacing) {Spacing = spacing;}
  68.  
  69.   protected:
  70.     TGadget::TBorderStyle  BorderStyle;
  71.     TSpacing               Spacing;
  72.     UINT                   NumModeIndicators;
  73.     UINT                   ModeIndicators;
  74.     UINT                   ModeIndicatorState;
  75.  
  76.     void        PositionGadget(TGadget* previous, TGadget* next, TPoint& point);
  77.     BOOL        PreProcessMsg(MSG& msg);
  78.     BOOL        IdleAction(long);
  79.  
  80.   private:
  81.     BOOL        GetGadgetAndString(TModeIndicator mode, TTextGadget*& gadget, char*& str);
  82.     BOOL        IsModeIndicator(TGadget* gadget);
  83.  
  84.     //
  85.     // hidden to prevent accidental copying or assignment
  86.     //
  87.     TStatusBar(const TStatusBar&);
  88.     TStatusBar& operator =(const TStatusBar&);
  89.  
  90.   DECLARE_CASTABLE;
  91. };
  92.  
  93. #endif  // __OWL_STATUSBA_H
  94.