home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 May / Chip_2002-05_cd1.bin / chplus / cpp / 5 / Komponety.exe / cgauges.h < prev    next >
C/C++ Source or Header  |  1998-02-09  |  4KB  |  90 lines

  1. //---------------------------------------------------------------------------
  2. // Borland C++Builder
  3. // Copyright (c) 1987, 1998 Borland International Inc.  All Rights Reserved.
  4. //---------------------------------------------------------------------------
  5. #if !defined(CGaugesH)
  6. #define CGaugesH
  7. //----------------------------------------------------------------------------
  8. #include <Menus.hpp>
  9. #include <StdCtrls.hpp>
  10. #include <Forms.hpp>
  11. #include <Controls.hpp>
  12. #include <Graphics.hpp>
  13. #include <Classes.hpp>
  14. #include <Messages.hpp>
  15. #include <Windows.hpp>
  16. #include <SysUtils.hpp>
  17. #include <System.hpp>
  18. #include <Consts.hpp>
  19. #include <math.h>
  20.  
  21. //-- type declarations -------------------------------------------------------
  22. enum TCGaugeKind { gkText, gkHorizontalBar, gkVerticalBar, gkPie, gkNeedle };
  23.  
  24. class PACKAGE TCGauge : public TGraphicControl
  25. {
  26. private:
  27.     Longint FMinValue;
  28.     Longint FMaxValue;
  29.     Longint FCurValue;
  30.     TCGaugeKind FKind;
  31.     Boolean FShowText;
  32.     TFormBorderStyle FBorderStyle;
  33.     TColor FForeColor;
  34.     TColor FBackColor;
  35.     void __fastcall PaintBackground(Graphics::TBitmap *AnImage);
  36.     void __fastcall PaintAsText(Graphics::TBitmap *AnImage, const TRect &PaintRect);
  37.     void __fastcall PaintAsNothing(Graphics::TBitmap *AnImage, const TRect &PaintRect);
  38.     void __fastcall PaintAsBar(Graphics::TBitmap *AnImage, const TRect &PaintRect);
  39.     void __fastcall PaintAsPie(Graphics::TBitmap *AnImage, const TRect &PaintRect);
  40.     void __fastcall PaintAsNeedle(Graphics::TBitmap *AnImage, const TRect &PaintRect);
  41.     void __fastcall SeTCGaugeKind(TCGaugeKind Value);
  42.     void __fastcall SetShowText(Boolean Value);
  43.     void __fastcall SetBorderStyle(TBorderStyle Value);
  44.     void __fastcall SetForeColor(TColor Value);
  45.     void __fastcall SetBackColor(TColor Value);
  46.     void __fastcall SetMinValue(Longint Value);
  47.     void __fastcall SetMaxValue(Longint Value);
  48.     void __fastcall SetProgress(Longint Value);
  49.     Longint __fastcall GetPercentDone(void);
  50.     
  51. protected:
  52.     virtual void __fastcall Paint(void);
  53.     
  54. public:
  55.     __fastcall virtual TCGauge(TComponent *AOwner);
  56.     void __fastcall AddProgress(Longint Value);
  57.     __property Longint PercentDone = {read=GetPercentDone, nodefault};
  58.     
  59. __published:
  60.     __property Align ;
  61.     __property Color ;
  62.     __property Enabled ;
  63.     __property TCGaugeKind Kind = {read=FKind, write=SeTCGaugeKind, default=1};
  64.     __property Boolean ShowText = {read=FShowText, write=SetShowText, default=1};
  65.     __property Font ;
  66.     __property TBorderStyle BorderStyle = {read=FBorderStyle, write=SetBorderStyle, default=1};
  67.     __property TColor ForeColor = {read=FForeColor, write=SetForeColor, default=0};
  68.     __property TColor BackColor = {read=FBackColor, write=SetBackColor, default=16777215};
  69.     __property Longint MinValue = {read=FMinValue, write=SetMinValue, default=0};
  70.     __property Longint MaxValue = {read=FMaxValue, write=SetMaxValue, default=100};
  71.     __property ParentColor ;
  72.     __property ParentFont ;
  73.     __property ParentShowHint ;
  74.     __property PopupMenu ;
  75.     __property Longint Progress = {read=FCurValue, write=SetProgress, nodefault};
  76.     __property ShowHint ;
  77.     __property Visible ;
  78. };
  79.  
  80. class TBltBitmap : public Graphics::TBitmap{
  81. public:
  82.     __fastcall virtual TBltBitmap();
  83.     void __fastcall MakeLike(Graphics::TBitmap* ATemplate);
  84. };
  85.  
  86. //-- var, const, procedure ---------------------------------------------------
  87. #define Pi 3.1415926535897932385
  88. //-- end unit ----------------------------------------------------------------
  89. #endif    // CGaugesH
  90.