improved menuitems, speedbuttons and imagelist from Colin

git-svn-id: trunk@8071 -
This commit is contained in:
mattias 2005-11-06 10:23:34 +00:00
parent 0936587d9f
commit ae7c181070
5 changed files with 14 additions and 11 deletions

View File

@ -637,6 +637,7 @@ begin
FVisible:=true;
FMenuItemClass:=TMenuItem;
FSectionIndex:=-1;
FImageIndex:=-1;
{$IFDEF VerboseMenuIntf}
//debugln('TIDEMenuItem.Create ',dbgsName(Self),' Name="',Name,'"');
{$ENDIF}

View File

@ -355,6 +355,8 @@ function TMenuItem.GetBitmap: TBitmap;
begin
if FBitmap=nil then
FBitmap:=TBitmap.Create;
if (ImageIndex >= 0) and Assigned(GetImageList) then
GetImageList.GetBitmap(ImageIndex, FBitmap);
FBitmap.Transparent:=True;
Result:=FBitmap;
end;
@ -1079,6 +1081,8 @@ begin
if FImageIndex = Value then exit;
//debugln('TMenuItem.SetImageIndex A ',Name,' Old=',FImageIndex,' New=',Value);
FImageIndex := Value;
if HandleAllocated then RecreateHandle;
MenuChanged(False);
//TODO: TMenuItem.SetImageIndex
end;

View File

@ -284,14 +284,7 @@ procedure TCustomSpeedButton.ActionChange(Sender: TObject; CheckDefaults: Boolea
procedure CopyImage(ImageList: TCustomImageList; Index: Integer);
begin
with Glyph do
begin
Width := ImageList.Width;
Height := ImageList.Height;
Canvas.Brush.Color := clMaroon; // whatever
Canvas.FillRect(Rect(0,0,Width,Height));
ImageList.Draw(Canvas,0,0,Index,true);
end;
ImageList.GetBitmap(Index, Glyph);
end;
begin

View File

@ -2366,9 +2366,10 @@ begin
{$ENDIF}
if not GetWindowRawImageDescription(GdkWindow,@NewRawImage.Description) then
begin
DebugLn('WARNING: TGtkWidgetSet.GetRawImageFromGdkWindow GetWindowRawImageDescription failed');
DebugLn('WARNING: TGtkWidgetSet.GetRawImageFromGdkWindow GetWindowRawImageDescription failed ');
exit;
end;
//DebugLn('TGtkWidgetSet.GetRawImageFromGdkWindow GdkWindow is ... ',RawImageDescriptionAsString(@NewRawImage.Description));
// get intersection
ARect:=SrcRect;

View File

@ -3389,12 +3389,16 @@ end;
procedure TLazIntfImageMask.SetInternalPixel(x, y: integer; Value: integer);
begin
if UsePalette then
SetInternalColor(x,y,Palette.Color[Value])
end;
function TLazIntfImageMask.GetInternalPixel(x, y: integer): integer;
begin
Result:=0;
if UsePalette then
Result := Palette.IndexOf(GetInternalColor(x,y))
else
Result:=0;
end;
constructor TLazIntfImageMask.CreateWithImage(TheImage: TLazIntfImage);