(*)
  aaaaaaaaa
(*)
unit CCButton;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,ccGeneral;

type
  TCCButton = class(TCCComponent)
  private
    { Private-Deklarationen}
  protected
    { Protected-Deklarationen}
    procedure SetFont(value:TFont);
    function GetFont():TFont;
  public
    pressed_b:boolean;
    { Public-Deklarationen}
    //redeklarationen
   // canvas:tcanvas;

    //neue deklarationen
    constructor Create(Aowner_xc:TComponent);override;
    destructor Destroy();override;
    procedure Paint;override;
    procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);override;
    procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
    procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);override;
//    procedure WndProc(var Message: TMessage); override;
//    procedure
  published
    { Published-Deklarationen }
   //Freigeben von Eigenschaften
   property caption;
   property Font:TFont read GetFont write SetFont;
  end;

procedure Register;

implementation
procedure TCCButton.SetFont(value:TFont);
begin
end;
function TCCButton.GetFont():TFont;
begin
end;
constructor TCCButton.Create(Aowner_xc:TComponent);
begin
  inherited;
end;
destructor TCCButton.Destroy();
begin
  inherited;
end;
procedure TCCButton.Paint;
begin
  inherited;
  canvas.brush.Style:=bsSolid;
  if pressed_b then
    drawLowerButtonRect(0,0,width,height,true)
   else
    drawUpperRect(0,0,width,height,true);

  if DarstellungsOptionen=nil then exit;
  canvas.brush.Style:=bsClear;
  if Enabled then begin
    Canvas.font.Color:=DarstellungsOptionen.getColorFromWindowColorKey(COLOR_BTNTEXT);
    Canvas.TextOut((width-canvas.textwidth(caption))div 2,(height-canvas.textHeight(caption)) div 2,caption);
  end else begin
    Canvas.font.Color:=DarstellungsOptionen.getAlternativColorFromWindowColorKey(COLOR_GRAYTEXT,1);
    Canvas.TextOut((width-canvas.textwidth(caption))div 2+1,(height-canvas.textHeight(caption)) div 2+1,caption);
    Canvas.font.Color:=DarstellungsOptionen.getColorFromWindowColorKey(COLOR_GRAYTEXT);
    Canvas.TextOut((width-canvas.textwidth(caption))div 2,(height-canvas.textHeight(caption)) div 2,caption);
  end;
end;
procedure TCCButton.MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  pressed_b:=true;
  SetFocus;
  refresh;
end;
procedure TCCButton.MouseMove(Shift: TShiftState; X, Y: Integer);
begin
  if (x>0)and(y>0)and(x<width)and(y<height)and(ssLeft in shift)and(pressed_b=false) then begin
    pressed_b:=true;
    refresh;
  end else if ((x<0)or(y<0)or(x>width)or(y>height))and(ssLeft in shift)and(pressed_b=true) then begin
    pressed_b:=false;
    refresh;
  end;
end;
procedure TCCButton.MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  pressed_b:=false;
  refresh;
end;
procedure Register;
begin
  RegisterComponents('Custom Controls', [TCCButton,TCCDarstellungsSteuerung]);
end;

end.

