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

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows
  3. // (C) Copyright 1992, 1994 by Borland International, All Rights Reserved
  4. //
  5. //   Defines class TGauge.  This defines the basic behavior
  6. //   of gauge controls.
  7. //----------------------------------------------------------------------------
  8. #if !defined(OWL_GAUGE_H)
  9. #define OWL_GAUGE_H
  10.  
  11. #if !defined(OWL_CONTROL_H)
  12. # include <owl/control.h>
  13. #endif
  14. #if !defined(OWL_COLOR_H)
  15. # include <owl/color.h>
  16. #endif
  17.  
  18. //
  19. //  class TGauge
  20. //  ----- ------
  21. //
  22. class _OWLCLASS TGauge : public TControl {
  23.   public:
  24.     TGauge(TWindow*        parent,
  25.            const char far* title,
  26.            int             id,
  27.            int X, int Y, int W, int H,
  28.            bool            isHorizontal = true,
  29.            int             margin = 0,
  30.            TModule*        module = 0);
  31.  
  32.     //
  33.     // Getting & setting gauge properties
  34.     //
  35.     void          GetRange(int& min, int& max) const {min = Min; max = Max;}
  36.     int           GetValue() const {return Value;}
  37.     void          SetRange(int min, int max);
  38.     void          SetValue(int value);
  39.     void          SetLed(int spacing, int thickPercent = 90);
  40.     void          SetColor(TColor color) {BarColor = color;}
  41.  
  42.   protected:
  43.  
  44.     //
  45.     // Override TWindow virtual member functions
  46.     //
  47.     void          Paint(TDC& dc, bool erase, TRect& rect);
  48.  
  49.     //
  50.     // self sent by method Paint(). override this is if you want to
  51.     // implement a border style that isn't supported
  52.     //
  53.     virtual void   PaintBorder(TDC& dc);
  54.  
  55.     //
  56.     // message response functions
  57.     //
  58.     bool          EvEraseBkgnd(HDC);
  59.   
  60.   protected:
  61.     int           Min;        // Minimum value
  62.     int           Max;        // Maximum value
  63.     int           Value;      // Current value
  64.     int           Margin;     // margin between bevel & graphic
  65.     int           IsHorizontal;
  66.     int           LedSpacing; // Spacing of 'leds' in value units
  67.     int           LedThick;   // Thickness of leds in percent of spacing
  68.     TColor        BarColor;   // Bar or LED color, defaults to blue
  69.  
  70.   private:
  71.     //
  72.     // hidden to prevent accidental copying or assignment
  73.     //
  74.     TGauge(const TGauge&);
  75.     TGauge& operator=(const TGauge&);
  76.  
  77.   DECLARE_RESPONSE_TABLE(TGauge);
  78. };
  79.  
  80. #endif  // OWL_GAUGE_H
  81.