{$I OVC.INC}

{$B-} {Complete Boolean Evaluation}
{$I+} {Input/Output-Checking}
{$P+} {Open Parameters}
{$T-} {Typed @ Operator}
{$W-} {Windows Stack Frame}
{$X+} {Extended Syntax}

{$IFNDEF Win32}
{$G+} {286 Instructions}
{$N+} {Numeric Coprocessor}
{$C MOVEABLE,DEMANDLOAD,DISCARDABLE}
{$ENDIF}

{*********************************************************}
{*                  OVCMETER.PAS 2.00                    *}
{*     Copyright (c) TurboPower Software Co 1995-96      *}
{*                 All rights reserved.                  *}
{*********************************************************}

unit OvcMeter;

interface

uses
  {$IFDEF Win32} Windows, {$ELSE} WinTypes, WinProcs, {$ENDIF}
  Classes, Controls, Graphics, Forms, Messages, SysUtils,
  OvcBase, OvcConst, OvcData;

type
  TMeterOrientation = (moHorizontal, moVertical);

const
  DefMeterBorderStyle  = bsNone;
  DefMeterCtl3D        = True;
  DefMeterDividerColor = clBlack;
  DefMeterOrientation  = moHorizontal;
  DefMeterParentCtl3D  = True;
  DefMeterPercent      = 33;
  DefMeterShowPercent  = False;
  DefMeterUsedColor    = clLime;
  DefMeterUsedShadow   = clGreen;
  DefMeterUnusedColor  = clWindow;
  DefMeterUnusedShadow = clWindowFrame;

type
  TOvcCustomMeter = class(TOvcBase)
  {.Z+}
  protected {private}
    {Property fields}
    FBorderStyle  : TBorderStyle;
    FDividerColor : TColor;
    FOrientation  : TMeterOrientation;
    FPercent      : Byte;
    FShowPercent  : Boolean;
    FUsedColor    : TColor;
    FUsedShadow   : TColor;
    FUnusedColor  : TColor;
    FUnusedShadow : TColor;

    ValueString   : string[5];

    {Property access methods}
    procedure SetBorderStyle(const BS : TBorderStyle);
    procedure SetDividerColor(const C : TColor);
    procedure SetOrientation(const O : TMeterOrientation);
    procedure SetPercent(const V : byte);
    procedure SetShowPercent(const SP : boolean);
    procedure SetUnusedColor(const C : TColor);
    procedure SetUnusedShadow(const C : TColor);
    procedure SetUsedColor(const C : TColor);
    procedure SetUsedShadow(const C : TColor);

  protected
    {VCL methods}
    procedure CreateParams(var Params: TCreateParams);
      override;
    procedure Paint;
      override;
  {.Z-}

  public
    {VCL methods}
    constructor Create(AOwner : TComponent);
      override;

    {public properties}
    property BorderStyle : TBorderStyle
      read FBorderStyle
      write SetBorderStyle
      default DefMeterBorderStyle;

    property Canvas;

    property DividerColor : TColor
       read FDividerColor
       write SetDividerColor
       default DefMeterDividerColor;

    property Orientation : TMeterOrientation
      read FOrientation
      write SetOrientation
      default DefMeterOrientation;

    property ShowPercent : boolean
      read FShowPercent
      write SetShowPercent
      default DefMeterShowPercent;

    property UnusedColor : TColor
      read FUnusedColor
      write SetUnusedColor
      default DefMeterUnusedColor;

    property UnusedShadow : TColor
      read FUnusedShadow
      write SetUnusedShadow
      default DefMeterUnusedShadow;

    property UsedColor : TColor
      read FUsedColor
      write SetUsedColor
      default DefMeterUsedColor;

    property UsedShadow : TColor
      read FUsedShadow
      write SetUsedShadow
      default DefMeterUsedShadow;

    property Percent : Byte
      read FPercent
      write SetPercent
      default DefMeterPercent;
  end;

  TOvcMeter = class(TOvcCustomMeter)
  published
    property BorderStyle;
    property DividerColor;
    property Orientation;
    property Percent;
    property ShowPercent;
    property UnusedColor;
    property UnusedShadow;
    property UsedColor;
    property UsedShadow;

    {inherited properties}
    property Align;
    property Ctl3D;
    property Font;
    property ParentCtl3D;
    property ParentFont;
    property ParentShowHint;
    property ShowHint;
    property Visible;

    {inherited events}
    property OnClick;
    property OnDblClick;
    property OnMouseDown;
    property OnMouseMove;
    property OnMouseUp;
  end;


implementation
