mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-02 03:42:01 +02:00
customdrawn: Finishes initial support for TCDPanel and TPanel
git-svn-id: trunk@33982 -
This commit is contained in:
parent
500ee16db6
commit
6bec10272d
@ -78,6 +78,9 @@ type
|
|||||||
// TCDGroupBox
|
// TCDGroupBox
|
||||||
procedure DrawGroupBox(ADest: TCanvas; ASize: TSize;
|
procedure DrawGroupBox(ADest: TCanvas; ASize: TSize;
|
||||||
AState: TCDControlState; AStateEx: TCDControlStateEx); override;
|
AState: TCDControlState; AStateEx: TCDControlStateEx); override;
|
||||||
|
// TCDPanel
|
||||||
|
procedure DrawPanel(ADest: TCanvas; ASize: TSize;
|
||||||
|
AState: TCDControlState; AStateEx: TCDControlStateEx); override;
|
||||||
// ===================================
|
// ===================================
|
||||||
// Additional Tab
|
// Additional Tab
|
||||||
// ===================================
|
// ===================================
|
||||||
@ -1066,6 +1069,19 @@ begin
|
|||||||
ADest.TextOut(FCaptionMiddle+3, 0, lCaption);
|
ADest.TextOut(FCaptionMiddle+3, 0, lCaption);
|
||||||
end;
|
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;
|
procedure TCDDrawerCommon.DrawStaticText(ADest: TCanvas;
|
||||||
ASize: TSize; AState: TCDControlState; AStateEx: TCDControlStateEx);
|
ASize: TSize; AState: TCDControlState; AStateEx: TCDControlStateEx);
|
||||||
var
|
var
|
||||||
|
@ -351,6 +351,23 @@ type
|
|||||||
property TabStop default False;
|
property TabStop default False;
|
||||||
end;
|
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
|
// Additional Tab
|
||||||
// ===================================
|
// ===================================
|
||||||
@ -619,6 +636,33 @@ implementation
|
|||||||
resourcestring
|
resourcestring
|
||||||
sTABSHEET_DEFAULT_NAME = 'CTabSheet';
|
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 }
|
{ TCDScrollableControl }
|
||||||
|
|
||||||
procedure TCDScrollableControl.SetScrollBars(AValue: TScrollStyle);
|
procedure TCDScrollableControl.SetScrollBars(AValue: TScrollStyle);
|
||||||
|
@ -212,7 +212,7 @@ type
|
|||||||
cidControl,
|
cidControl,
|
||||||
// Standard
|
// Standard
|
||||||
cidMenu, cidPopUp, cidButton, cidEdit, cidCheckBox, cidRadioButton,
|
cidMenu, cidPopUp, cidButton, cidEdit, cidCheckBox, cidRadioButton,
|
||||||
cidListBox, cidComboBox, cidScrollBar, cidGroupBox,
|
cidListBox, cidComboBox, cidScrollBar, cidGroupBox, cidPanel,
|
||||||
// Additional
|
// Additional
|
||||||
cidStaticText,
|
cidStaticText,
|
||||||
// Common Controls
|
// Common Controls
|
||||||
@ -319,6 +319,9 @@ type
|
|||||||
// TCDGroupBox
|
// TCDGroupBox
|
||||||
procedure DrawGroupBox(ADest: TCanvas; ASize: TSize;
|
procedure DrawGroupBox(ADest: TCanvas; ASize: TSize;
|
||||||
AState: TCDControlState; AStateEx: TCDControlStateEx); virtual; abstract;
|
AState: TCDControlState; AStateEx: TCDControlStateEx); virtual; abstract;
|
||||||
|
// TCDPanel
|
||||||
|
procedure DrawPanel(ADest: TCanvas; ASize: TSize;
|
||||||
|
AState: TCDControlState; AStateEx: TCDControlStateEx); virtual; abstract;
|
||||||
// ===================================
|
// ===================================
|
||||||
// Additional Tab
|
// Additional Tab
|
||||||
// ===================================
|
// ===================================
|
||||||
@ -619,6 +622,7 @@ begin
|
|||||||
cidRadioButton:DrawRadioButton(ADest, ASize, AState, AStateEx);
|
cidRadioButton:DrawRadioButton(ADest, ASize, AState, AStateEx);
|
||||||
cidScrollBar: DrawScrollBar(ADest, ASize, AState, TCDPositionedCStateEx(AStateEx));
|
cidScrollBar: DrawScrollBar(ADest, ASize, AState, TCDPositionedCStateEx(AStateEx));
|
||||||
cidGroupBox: DrawGroupBox(ADest, ASize, AState, AStateEx);
|
cidGroupBox: DrawGroupBox(ADest, ASize, AState, AStateEx);
|
||||||
|
cidPanel: DrawPanel(ADest, ASize, AState, AStateEx);
|
||||||
//
|
//
|
||||||
cidStaticText: DrawStaticText(ADest, ASize, AState, AStateEx);
|
cidStaticText: DrawStaticText(ADest, ASize, AState, AStateEx);
|
||||||
//
|
//
|
||||||
|
@ -34,7 +34,7 @@ uses
|
|||||||
ImgList,
|
ImgList,
|
||||||
// Widgetset
|
// Widgetset
|
||||||
WSExtCtrls, WSProc, WSLCLClasses,
|
WSExtCtrls, WSProc, WSLCLClasses,
|
||||||
customdrawncontrols;
|
customdrawncontrols, customdrawnwscontrols, customdrawnproc;
|
||||||
|
|
||||||
type
|
type
|
||||||
{ TCDWSPage }
|
{ TCDWSPage }
|
||||||
@ -139,6 +139,7 @@ type
|
|||||||
published
|
published
|
||||||
class function CreateHandle(const AWinControl: TWinControl;
|
class function CreateHandle(const AWinControl: TWinControl;
|
||||||
const AParams: TCreateParams): TLCLIntfHandle; override;
|
const AParams: TCreateParams): TLCLIntfHandle; override;
|
||||||
|
class procedure ShowHide(const AWinControl: TWinControl); override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TCDWSPanel }
|
{ TCDWSPanel }
|
||||||
@ -218,7 +219,11 @@ end; *)
|
|||||||
class procedure TCDWSCustomPanel.CreateCDControl(
|
class procedure TCDWSCustomPanel.CreateCDControl(
|
||||||
const AWinControl: TWinControl; var ACDControlField: TCDControl);
|
const AWinControl: TWinControl; var ACDControlField: TCDControl);
|
||||||
begin
|
begin
|
||||||
|
ACDControlField := TCDPanel.Create(AWinControl);
|
||||||
|
// TCDIntfButton(ACDControlField).LCLButton := TButton(AWinControl);
|
||||||
|
ACDControlField.Caption := AWinControl.Caption;
|
||||||
|
ACDControlField.Parent := AWinControl;
|
||||||
|
ACDControlField.Align := alClient;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -230,15 +235,23 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
class function TCDWSCustomPanel.CreateHandle(const AWinControl: TWinControl;
|
class function TCDWSCustomPanel.CreateHandle(const AWinControl: TWinControl;
|
||||||
const AParams: TCreateParams): TLCLIntfHandle;
|
const AParams: TCreateParams): TLCLIntfHandle;
|
||||||
|
var
|
||||||
|
lCDWinControl: TCDWinControl;
|
||||||
begin
|
begin
|
||||||
{ QtFrame := TQtFrame.Create(AWinControl, AParams);
|
Result := TCDWSWinControl.CreateHandle(AWinControl, AParams);
|
||||||
QtFrame.AttachEvents;
|
lCDWinControl := TCDWinControl(Result);
|
||||||
|
end;
|
||||||
|
|
||||||
// Set's initial properties
|
class procedure TCDWSCustomPanel.ShowHide(const AWinControl: TWinControl);
|
||||||
QtFrame.setFrameShape(TBorderStyleToQtFrameShapeMap[TCustomPanel(AWinControl).BorderStyle]);
|
var
|
||||||
|
lCDWinControl: TCDWinControl;
|
||||||
|
begin
|
||||||
|
lCDWinControl := TCDWinControl(AWinControl.Handle);
|
||||||
|
|
||||||
// Return the Handle
|
TCDWSWinControl.ShowHide(AWinControl);
|
||||||
Result := TLCLIntfHandle(QtFrame);}
|
|
||||||
|
if lCDWinControl.CDControl = nil then
|
||||||
|
CreateCDControl(AWinControl, lCDWinControl.CDControl);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
(*{ TCDWSCustomTrayIcon }
|
(*{ TCDWSCustomTrayIcon }
|
||||||
|
@ -114,7 +114,7 @@ end;"/>
|
|||||||
<License Value="modified LGPL-2
|
<License Value="modified LGPL-2
|
||||||
"/>
|
"/>
|
||||||
<Version Major="1" Release="1"/>
|
<Version Major="1" Release="1"/>
|
||||||
<Files Count="382">
|
<Files Count="383">
|
||||||
<Item1>
|
<Item1>
|
||||||
<Filename Value="carbon/agl.pp"/>
|
<Filename Value="carbon/agl.pp"/>
|
||||||
<AddToUsesPkgSection Value="False"/>
|
<AddToUsesPkgSection Value="False"/>
|
||||||
@ -1898,6 +1898,11 @@ end;"/>
|
|||||||
<AddToUsesPkgSection Value="False"/>
|
<AddToUsesPkgSection Value="False"/>
|
||||||
<UnitName Value="CustomDrawnWSComCtrls"/>
|
<UnitName Value="CustomDrawnWSComCtrls"/>
|
||||||
</Item382>
|
</Item382>
|
||||||
|
<Item383>
|
||||||
|
<Filename Value="customdrawn/customdrawnwsextctrls.pas"/>
|
||||||
|
<AddToUsesPkgSection Value="False"/>
|
||||||
|
<UnitName Value="CustomDrawnWSExtCtrls"/>
|
||||||
|
</Item383>
|
||||||
</Files>
|
</Files>
|
||||||
<LazDoc Paths="../../docs/xml/lcl"/>
|
<LazDoc Paths="../../docs/xml/lcl"/>
|
||||||
<i18n>
|
<i18n>
|
||||||
|
Loading…
Reference in New Issue
Block a user