From f3acaa1f79a33ca7cd08a0acb3796645245c52f4 Mon Sep 17 00:00:00 2001 From: mattias Date: Tue, 1 May 2007 11:47:27 +0000 Subject: [PATCH] lcl: added TColorBox.GetColor, TColorListBox.GetColor from Michael Van Canneyt git-svn-id: trunk@11042 - --- lcl/colorbox.pas | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/lcl/colorbox.pas b/lcl/colorbox.pas index bebb51d3c6..0fe0fa5444 100644 --- a/lcl/colorbox.pas +++ b/lcl/colorbox.pas @@ -32,9 +32,12 @@ uses type TColorPalette = (cpDefault, cpFull); + { TColorBox } + TColorBox = class(TCustomComboBox) private FPalette: TColorPalette; + function GetColor(Index : Integer): TColor; function GetSelection: TColor; procedure SetSelection(Value: TColor); procedure SetPalette(Value: TColorPalette); @@ -45,6 +48,7 @@ type constructor Create(AOwner: TComponent); override; procedure SetColorList; property Selection: TColor read GetSelection write SetSelection; + Property Colors[Index : Integer] : TColor Read GetColor; published property Align; property Anchors; @@ -102,9 +106,12 @@ type property OnSelect; end; + { TColorListBox } + TColorListBox = class(TCustomListBox) private FPalette: TColorPalette; + function GetColor(Index : Integer): TColor; function GetSelection: TColor; procedure SetSelection(Value: TColor); procedure SetPalette(Value: TColorPalette); @@ -115,6 +122,7 @@ type constructor Create(AOwner: TComponent); override; procedure SetColorList; property Selection: TColor read GetSelection write SetSelection; + Property Colors[Index : Integer] : TColor Read GetColor; published property Align; property Anchors; @@ -220,6 +228,22 @@ begin if not IdentToColor(Items[ItemIndex], LongInt(Result)) then Result := 0; 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 Params: Value @@ -390,6 +414,21 @@ begin if not IdentToColor(Items[ItemIndex], LongInt(Result)) then Result := 0; 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 Params: Value