mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-15 00:19:22 +02:00
lcl: added TColorBox.GetColor, TColorListBox.GetColor from Michael Van Canneyt
git-svn-id: trunk@11042 -
This commit is contained in:
parent
1398f3e372
commit
f3acaa1f79
@ -32,9 +32,12 @@ uses
|
|||||||
type
|
type
|
||||||
TColorPalette = (cpDefault, cpFull);
|
TColorPalette = (cpDefault, cpFull);
|
||||||
|
|
||||||
|
{ TColorBox }
|
||||||
|
|
||||||
TColorBox = class(TCustomComboBox)
|
TColorBox = class(TCustomComboBox)
|
||||||
private
|
private
|
||||||
FPalette: TColorPalette;
|
FPalette: TColorPalette;
|
||||||
|
function GetColor(Index : Integer): TColor;
|
||||||
function GetSelection: TColor;
|
function GetSelection: TColor;
|
||||||
procedure SetSelection(Value: TColor);
|
procedure SetSelection(Value: TColor);
|
||||||
procedure SetPalette(Value: TColorPalette);
|
procedure SetPalette(Value: TColorPalette);
|
||||||
@ -45,6 +48,7 @@ type
|
|||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
procedure SetColorList;
|
procedure SetColorList;
|
||||||
property Selection: TColor read GetSelection write SetSelection;
|
property Selection: TColor read GetSelection write SetSelection;
|
||||||
|
Property Colors[Index : Integer] : TColor Read GetColor;
|
||||||
published
|
published
|
||||||
property Align;
|
property Align;
|
||||||
property Anchors;
|
property Anchors;
|
||||||
@ -102,9 +106,12 @@ type
|
|||||||
property OnSelect;
|
property OnSelect;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TColorListBox }
|
||||||
|
|
||||||
TColorListBox = class(TCustomListBox)
|
TColorListBox = class(TCustomListBox)
|
||||||
private
|
private
|
||||||
FPalette: TColorPalette;
|
FPalette: TColorPalette;
|
||||||
|
function GetColor(Index : Integer): TColor;
|
||||||
function GetSelection: TColor;
|
function GetSelection: TColor;
|
||||||
procedure SetSelection(Value: TColor);
|
procedure SetSelection(Value: TColor);
|
||||||
procedure SetPalette(Value: TColorPalette);
|
procedure SetPalette(Value: TColorPalette);
|
||||||
@ -115,6 +122,7 @@ type
|
|||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
procedure SetColorList;
|
procedure SetColorList;
|
||||||
property Selection: TColor read GetSelection write SetSelection;
|
property Selection: TColor read GetSelection write SetSelection;
|
||||||
|
Property Colors[Index : Integer] : TColor Read GetColor;
|
||||||
published
|
published
|
||||||
property Align;
|
property Align;
|
||||||
property Anchors;
|
property Anchors;
|
||||||
@ -220,6 +228,22 @@ begin
|
|||||||
if not IdentToColor(Items[ItemIndex], LongInt(Result)) then
|
if not IdentToColor(Items[ItemIndex], LongInt(Result)) then
|
||||||
Result := 0;
|
Result := 0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------
|
||||||
|
Method: TColorBox.GetColor
|
||||||
|
Params: Index
|
||||||
|
Returns: Color at position Index
|
||||||
|
|
||||||
|
Used as read procedure from Colors property.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------}
|
||||||
|
|
||||||
|
function TColorBox.GetColor(Index : Integer): TColor;
|
||||||
|
begin
|
||||||
|
if Not IdentToColor(Items[Index],Result) then
|
||||||
|
Result:=clNone;
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Method: TColorBox.SetSelection
|
Method: TColorBox.SetSelection
|
||||||
Params: Value
|
Params: Value
|
||||||
@ -390,6 +414,21 @@ begin
|
|||||||
if not IdentToColor(Items[ItemIndex], LongInt(Result)) then
|
if not IdentToColor(Items[ItemIndex], LongInt(Result)) then
|
||||||
Result := 0;
|
Result := 0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------
|
||||||
|
Method: TColorListBox.GetColor
|
||||||
|
Params: Index
|
||||||
|
Returns: Color at position Index
|
||||||
|
|
||||||
|
Used as read procedure from Colors property.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------}
|
||||||
|
function TColorListBox.GetColor(Index : Integer): TColor;
|
||||||
|
begin
|
||||||
|
if Not IdentToColor(Items[Index],Result) then
|
||||||
|
Result:=clNone;
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Method: TColorListBox.SetSelection
|
Method: TColorListBox.SetSelection
|
||||||
Params: Value
|
Params: Value
|
||||||
|
Loading…
Reference in New Issue
Block a user