git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1579 8e941d3f-bd1b-0410-a28a-d453659cc2b4

This commit is contained in:
yangjixian
2011-04-18 17:23:32 +00:00
parent 1f24c85aaf
commit 8c1017c19f
2 changed files with 33 additions and 6 deletions

View File

@ -0,0 +1,14 @@
LazarusResources.Add('tcolorpalette','XPM',[
'/* XPM */'#10'static char *graphic[] = {'#10'"20 21 13 1",'#10'". c #848484"'
+','#10'", c None",'#10'"- c #FFFFFF",'#10'"* c #C6C6C6",'#10'"a c #000000",'
+#10'"b c #840000",'#10'"c c #848400",'#10'"d c #808000",'#10'"e c #FF0000",'
+#10'"f c #FFFF00",'#10'"g c #008400",'#10'"h c #008484",'#10'"i c #000084",'
+#10'"...................,",'#10'".-----------------*-",'#10'".-aaaaaaaaaaaaa'
+'aaa.-",'#10'".-aaaaaabbbbacccca.-",'#10'".-aaaaaabbbbacccca.-",'#10'".-aaaa'
+'aabbbbacccca.-",'#10'".-aaaaaabbbbaddcca.-",'#10'".-aaaaaaaaaaaaaaaa.-",'#10
+'".-a----aeeeeaffffa.-",'#10'".-a----aeeeeaffffa.-",'#10'".-a----aeeeeaffffa'
+'.-",'#10'".-a----aeeeeaffffa.-",'#10'".-aaaaaaaaaaaaaaaa.-",'#10'".-aggggah'
+'hhhaiiiia.-",'#10'".-aggggahhhhaiiiia.-",'#10'".-aggggahhhhaiiiia.-",'#10'"'
+'.-aggggahhhhaiiiia.-",'#10'".-aaaaaaaaaaaaaaaa.-",'#10'".*.................'
+'-",'#10'",-------------------",'#10'",,,,,,,,,,,,,,,,,,,,"}'#10
]);

View File

@ -73,9 +73,12 @@ type
protected
procedure MouseDown(Button: TMouseButton; Shift:TShiftState; X, Y:Integer); override;
procedure MouseMove(Shift:TShiftState; X, Y:Integer); override;
procedure MouseUp(Button: TMouseButton; Shift:TShiftState; X, Y:Integer); override;
procedure ColorPick(AColor: TColor; Shift: TShiftState); dynamic;
procedure ColorMouseMove(AColor: TColor; Shift: TShiftState); dynamic;
public
PickedColor: TColor;
PickShift: TShiftState;
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
procedure Paint; override;
@ -174,21 +177,31 @@ end;
procedure TCustomColorPalette.MouseDown(Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var
C: TColor;
begin
inherited;
X := X div FButtonWidth;
Y := Y div FButtonHeight;
// if X + Y * FCols < 0 then
// Exit;
if X + Y * FCols < FColors.Count then
begin
C := TColor(FColors.Items[X + Y * FCols]);
if C <> clNone then ColorPick(C, Shift);
PickedColor := TColor(FColors.Items[X + Y * FCols]);
//if PickedColor <> clNone then ColorPick(PickedColor, Shift);
PickShift := Shift;
end;
end;
procedure TCustomColorPalette.MouseUp(Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if PickedColor <> clNone then
ColorPick(PickedColor, PickShift);
inherited;
end;
procedure TCustomColorPalette.MouseMove(Shift: TShiftState; X, Y: Integer);
var
C: TColor;