unit CCPanel;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  CCGeneral;
type TCCPanelBevelMode=(ccpbmNone,ccpbmLower,ccpbmRaised);
type
  TCCPanel = class(TCCComponent)
  protected
    { Protected-Deklarationen}
    FBevelInner_ccpbm:TCCPanelBevelMode;
    FBevelOuter_ccpbm:TCCPanelBevelMode;
    FBorderStyle_bs:TBorderStyle;
    FBorderWidth_i:integer;
  public
    { Public-Deklarationen}
    constructor create(aowner_xcc:tcomponent);override;
    procedure paint;override;
  published
    { Published-Deklarationen }
    property caption;
    property BevelInner:TCCPanelBevelMode read FBevelInner_ccpbm write FBevelInner_ccpbm;
    property BevelOuter:TCCPanelBevelMode read FBevelOuter_ccpbm write FBevelOuter_ccpbm;
    property BorderStyle:TBorderStyle read FBorderStyle_bs write FBorderStyle_bs;
    property BorderWidth:integer read FBorderWidth_i write FBorderWidth_i;
  end;

procedure Register;

implementation
constructor TCCPanel.create(aowner_xcc:tcomponent);
begin
  inherited;
  ControlStyle:=ControlStyle +  [csAcceptsControls];//include(ControlStyle,csAcceptsControls);
  TabStop:=false;
end;
procedure TCCPanel.paint;
begin
  inherited;
  if BorderStyle=bsSingle then begin
    drawLowerButtonRect(0,0,width,height,true);
    case BevelOuter of
      ccpbmLower: drawLowerButtonRect(2,2,width-2,height-2,false);
      ccpbmRaised: drawUpperRect(2,2,width-2,height-2,false);
    end;
    case BevelInner of
      ccpbmLower: drawLowerButtonRect(3+BorderWidth,3+BorderWidth,width-3-BorderWidth,height-3-BorderWidth,false);
      ccpbmRaised: drawUpperRect(3+BorderWidth,3+BorderWidth,width-3-BorderWidth,height-3-BorderWidth,false);
    end;
  end else begin
    case BevelOuter of
      ccpbmLower: drawLowerButtonRect(0,0,width,height,false);
      ccpbmRaised: drawUpperRect(0,0,width,height,false);
    end;
    case BevelInner of
      ccpbmLower: drawLowerButtonRect(1+BorderWidth,1+BorderWidth,width-1-BorderWidth,height-1-BorderWidth,false);
      ccpbmRaised: drawUpperRect(1+BorderWidth,1+BorderWidth,width-1-BorderWidth,height-1-BorderWidth,false);
    end;
  end;
  if DarstellungsOptionen=nil then exit;
  Canvas.font.Color:=DarstellungsOptionen.getColorFromWindowColorKey(COLOR_BTNTEXT);
  canvas.brush.Style:=bsClear;
  Canvas.TextOut((width-canvas.textwidth(caption))div 2,(height-canvas.textHeight(caption)) div 2,caption);
end;
procedure Register;
begin
  RegisterComponents('Custom Controls', [TCCPanel]);
end;

end.
