customdrawn: Finishes initial support for TCDPanel and TPanel

git-svn-id: trunk@33982 -
This commit is contained in:
sekelsenmat 2011-12-05 21:37:41 +00:00
parent 500ee16db6
commit 6bec10272d
5 changed files with 92 additions and 10 deletions

View File

@ -78,6 +78,9 @@ type
// TCDGroupBox
procedure DrawGroupBox(ADest: TCanvas; ASize: TSize;
AState: TCDControlState; AStateEx: TCDControlStateEx); override;
// TCDPanel
procedure DrawPanel(ADest: TCanvas; ASize: TSize;
AState: TCDControlState; AStateEx: TCDControlStateEx); override;
// ===================================
// Additional Tab
// ===================================
@ -1066,6 +1069,19 @@ begin
ADest.TextOut(FCaptionMiddle+3, 0, lCaption);
end;
procedure TCDDrawerCommon.DrawPanel(ADest: TCanvas; ASize: TSize;
AState: TCDControlState; AStateEx: TCDControlStateEx);
begin
// Background
ADest.Brush.Color := Palette.BtnFace;
ADest.Brush.Style := bsSolid;
ADest.Pen.Style := psClear;
ADest.FillRect(0, 0, ASize.cx, ASize.cy);
// The frame
DrawRaisedFrame(ADest, Point(0, 0), ASize);
end;
procedure TCDDrawerCommon.DrawStaticText(ADest: TCanvas;
ASize: TSize; AState: TCDControlState; AStateEx: TCDControlStateEx);
var

View File

@ -351,6 +351,23 @@ type
property TabStop default False;
end;
{ TCDPanel }
TCDPanel = class(TCDControl)
private
function GetControlId: TCDControlID; override;
protected
procedure RealSetText(const Value: TCaption); override; // to update on caption changes
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
//property AutoSize;
property DrawStyle;
property Caption;
property TabStop default False;
end;
// ===================================
// Additional Tab
// ===================================
@ -619,6 +636,33 @@ implementation
resourcestring
sTABSHEET_DEFAULT_NAME = 'CTabSheet';
{ TCDPanel }
function TCDPanel.GetControlId: TCDControlID;
begin
Result := cidPanel;
end;
procedure TCDPanel.RealSetText(const Value: TCaption);
begin
inherited RealSetText(Value);
if not (csLoading in ComponentState) then Invalidate;
end;
constructor TCDPanel.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
Width := 170;
Height := 50;
TabStop := False;
AutoSize := False;
end;
destructor TCDPanel.Destroy;
begin
inherited Destroy;
end;
{ TCDScrollableControl }
procedure TCDScrollableControl.SetScrollBars(AValue: TScrollStyle);

View File

@ -212,7 +212,7 @@ type
cidControl,
// Standard
cidMenu, cidPopUp, cidButton, cidEdit, cidCheckBox, cidRadioButton,
cidListBox, cidComboBox, cidScrollBar, cidGroupBox,
cidListBox, cidComboBox, cidScrollBar, cidGroupBox, cidPanel,
// Additional
cidStaticText,
// Common Controls
@ -319,6 +319,9 @@ type
// TCDGroupBox
procedure DrawGroupBox(ADest: TCanvas; ASize: TSize;
AState: TCDControlState; AStateEx: TCDControlStateEx); virtual; abstract;
// TCDPanel
procedure DrawPanel(ADest: TCanvas; ASize: TSize;
AState: TCDControlState; AStateEx: TCDControlStateEx); virtual; abstract;
// ===================================
// Additional Tab
// ===================================
@ -619,6 +622,7 @@ begin
cidRadioButton:DrawRadioButton(ADest, ASize, AState, AStateEx);
cidScrollBar: DrawScrollBar(ADest, ASize, AState, TCDPositionedCStateEx(AStateEx));
cidGroupBox: DrawGroupBox(ADest, ASize, AState, AStateEx);
cidPanel: DrawPanel(ADest, ASize, AState, AStateEx);
//
cidStaticText: DrawStaticText(ADest, ASize, AState, AStateEx);
//

View File

@ -34,7 +34,7 @@ uses
ImgList,
// Widgetset
WSExtCtrls, WSProc, WSLCLClasses,
customdrawncontrols;
customdrawncontrols, customdrawnwscontrols, customdrawnproc;
type
{ TCDWSPage }
@ -139,6 +139,7 @@ type
published
class function CreateHandle(const AWinControl: TWinControl;
const AParams: TCreateParams): TLCLIntfHandle; override;
class procedure ShowHide(const AWinControl: TWinControl); override;
end;
{ TCDWSPanel }
@ -218,7 +219,11 @@ end; *)
class procedure TCDWSCustomPanel.CreateCDControl(
const AWinControl: TWinControl; var ACDControlField: TCDControl);
begin
ACDControlField := TCDPanel.Create(AWinControl);
// TCDIntfButton(ACDControlField).LCLButton := TButton(AWinControl);
ACDControlField.Caption := AWinControl.Caption;
ACDControlField.Parent := AWinControl;
ACDControlField.Align := alClient;
end;
{------------------------------------------------------------------------------
@ -230,15 +235,23 @@ end;
------------------------------------------------------------------------------}
class function TCDWSCustomPanel.CreateHandle(const AWinControl: TWinControl;
const AParams: TCreateParams): TLCLIntfHandle;
var
lCDWinControl: TCDWinControl;
begin
{ QtFrame := TQtFrame.Create(AWinControl, AParams);
QtFrame.AttachEvents;
Result := TCDWSWinControl.CreateHandle(AWinControl, AParams);
lCDWinControl := TCDWinControl(Result);
end;
// Set's initial properties
QtFrame.setFrameShape(TBorderStyleToQtFrameShapeMap[TCustomPanel(AWinControl).BorderStyle]);
class procedure TCDWSCustomPanel.ShowHide(const AWinControl: TWinControl);
var
lCDWinControl: TCDWinControl;
begin
lCDWinControl := TCDWinControl(AWinControl.Handle);
// Return the Handle
Result := TLCLIntfHandle(QtFrame);}
TCDWSWinControl.ShowHide(AWinControl);
if lCDWinControl.CDControl = nil then
CreateCDControl(AWinControl, lCDWinControl.CDControl);
end;
(*{ TCDWSCustomTrayIcon }

View File

@ -114,7 +114,7 @@ end;"/>
<License Value="modified LGPL-2
"/>
<Version Major="1" Release="1"/>
<Files Count="382">
<Files Count="383">
<Item1>
<Filename Value="carbon/agl.pp"/>
<AddToUsesPkgSection Value="False"/>
@ -1898,6 +1898,11 @@ end;"/>
<AddToUsesPkgSection Value="False"/>
<UnitName Value="CustomDrawnWSComCtrls"/>
</Item382>
<Item383>
<Filename Value="customdrawn/customdrawnwsextctrls.pas"/>
<AddToUsesPkgSection Value="False"/>
<UnitName Value="CustomDrawnWSExtCtrls"/>
</Item383>
</Files>
<LazDoc Paths="../../docs/xml/lcl"/>
<i18n>