diff --git a/components/spktoolbar/SpkGUITools/SpkGUITools.pas b/components/spktoolbar/SpkGUITools/SpkGUITools.pas index d6e00dda0..55d4d5213 100644 --- a/components/spktoolbar/SpkGUITools/SpkGUITools.pas +++ b/components/spktoolbar/SpkGUITools/SpkGUITools.pas @@ -12,7 +12,8 @@ interface {$MESSAGE HINT 'Every rect in this module are exact rectanges (not like in WINAPI without right and bottom)'} uses - LCLType, Graphics, SysUtils, Classes, Controls, StdCtrls, SpkGraphTools, SpkMath; + LCLType, LCLVersion, Graphics, SysUtils, Classes, Controls, StdCtrls, + SpkGraphTools, SpkMath; type TCornerPos = (cpLeftTop, cpRightTop, cpLeftBottom, cpRightBottom); @@ -273,6 +274,13 @@ type ImageIndex : integer; Point : T2DIntVector; ClipRect : T2DIntRect); overload; + class procedure DrawImage(ACanvas: TCanvas; + Imagelist: TImageList; + ImageIndex: integer; + Point : T2DIntVector; + ClipRect: T2DIntRect; + AImageWidthAt96PPI, ATargetPPI: Integer; + ACanvasFactor: Double); overload; class procedure DrawDisabledImage(ABitmap : TBitmap; Imagelist : TImageList; @@ -1907,12 +1915,15 @@ begin CombineRgn(ClipRgn, ClipRgn, OrgRgn, RGN_AND); SelectClipRgn(ACanvas.Handle, ClipRgn); + ImageList.Draw(ACanvas, Point.X, Point.Y, ImageIndex); + (* { wp: Next part fixes issue https://sourceforge.net/p/lazarus-ccr/bugs/35/ } ImageBitmap := TBitmap.Create; ImageList.GetBitmap(ImageIndex, ImageBitmap); ACanvas.Draw(Point.x, Point.y, ImageBitmap); ImageBitmap.Free; + *) { wp: The following lines were removed and replaced by the "ImageBitmap" lines above in order to fix the "handle leak" of @@ -1937,6 +1948,64 @@ begin DeleteObject(ClipRgn); end; +class procedure TGUITools.DrawImage(ACanvas: TCanvas; Imagelist: TImageList; + ImageIndex: integer; Point : T2DIntVector; ClipRect: T2DIntRect; + AImageWidthAt96PPI, ATargetPPI: Integer; ACanvasFactor: Double); +var + UseOrgClipRgn: Boolean; + OrgRgn: HRGN; + ClipRgn: HRGN; + //ImageIcon: TIcon; // wp: no longer needed -- see below + ImageBitmap: TBitmap; +begin + // Storing original ClipRgn and applying a new one + SaveClipRgn(ACanvas.Handle, UseOrgClipRgn, OrgRgn); + + ClipRgn := CreateRectRgn(ClipRect.left, ClipRect.Top, ClipRect.Right+1, ClipRect.Bottom+1); + if UseOrgClipRgn then + CombineRgn(ClipRgn, ClipRgn, OrgRgn, RGN_AND); + + SelectClipRgn(ACanvas.Handle, ClipRgn); + + {$IF LCL_FULLVERSION >= 1090000} + ImageList.DrawForPPI(ACanvas, Point.X, Point.Y, ImageIndex, + AImageWidthAt96PPI, ATargetPPI, ACanvasFactor); + {$ELSE} + ImageList.Draw(ACanvas, Point.X, Point.Y, ImageIndex); + {$ENDIF} + + (* + { wp: Next part fixes issue https://sourceforge.net/p/lazarus-ccr/bugs/35/ } + ImageBitmap := TBitmap.Create; + ImageList.GetBitmap(ImageIndex, ImageBitmap); + ACanvas.Draw(Point.x, Point.y, ImageBitmap); + ImageBitmap.Free; + *) + +{ wp: The following lines were removed and replaced by the "ImageBitmap" lines + above in order to fix the "handle leak" of + https://sourceforge.net/p/lazarus-ccr/bugs/35/ + Not daring to touch the ImageList.Draw which would have worked as well. } +(* + // avoid exclusive draw. draw with local canvas itself. + //ImageList.Draw(ACanvas, Point.x, Point.y, ImageIndex); + {$IfDef LCLWin32} + ImageIcon := TIcon.Create; + ImageList.GetIcon(ImageIndex, ImageIcon); + ACanvas.Draw(Point.x, Point.y, ImageIcon); + ImageIcon.Free; + {$Else} + ImageBitmap := TBitmap.Create; + ImageList.GetBitmap(ImageIndex, ImageBitmap); + ACanvas.Draw(Point.x, Point.y, ImageBitmap); + ImageBitmap.Free; + {$EndIf} +*) + RestoreClipRgn(ACanvas.Handle, UseOrgClipRgn, OrgRgn); + DeleteObject(ClipRgn); +end; + + class procedure TGUITools.DrawMarkedText(ACanvas: TCanvas; x, y: integer; const AText, AMarkPhrase: string; TextColor : TColor; ClipRect: T2DIntRect; CaseSensitive: boolean); var diff --git a/components/spktoolbar/SpkToolbar/SpkToolbar.pas b/components/spktoolbar/SpkToolbar/SpkToolbar.pas index 11067d025..78d57b557 100644 --- a/components/spktoolbar/SpkToolbar/SpkToolbar.pas +++ b/components/spktoolbar/SpkToolbar/SpkToolbar.pas @@ -182,6 +182,12 @@ type automatically } FDisabledLargeImages: TImageList; + { Unscaled width of the small images } + FImagesWidth: Integer; + + { Unscaled width of the large images } + FLargeImagesWidth: Integer; + function DoTabChanging(OldIndex, NewIndex: integer): boolean; // ***************************************************** @@ -326,8 +332,23 @@ type {$ENDIF} {$ENDIF} + { Hi-DPI image list support } + procedure SetImagesWidth(const AValue: Integer); + procedure SetLargeImagesWidth(const AValue: Integer); + public + // ********************************** + // *** Constructor and Destructor *** + // ********************************** + + { Constructor } + constructor Create(AOwner: TComponent); override; + + { Destructor } + destructor Destroy; override; + + // ************************* // *** Dispatcher events *** // ************************* @@ -347,15 +368,6 @@ type { Method gives back the instance of supporting bitmap } function GetTempBitmap: TBitmap; - // ********************************** - // *** Constructor and Destructor *** - // ********************************** - - { Constructor } - constructor Create(AOwner: TComponent); override; - - { Destructor } - destructor Destroy; override; // *************** // *** Drawing *** @@ -425,6 +437,12 @@ type property DisabledLargeImages: TImageList read FDisabledLargeImages write SetDisabledLargeImages; + { Unscaled size of the small images } + property ImagesWidth: Integer read FImagesWidth write SetImagesWidth default 16; + + { Unscaled size of the large images } + property LargeImagesWidth: Integer read FLargeImagesWidth write SetLargeImagesWidth default 32; + { Events called before and after another tab is selected } property OnTabChanging: TSpkTabChangingEvent read FOnTabChanging write FOnTabChanging; @@ -541,6 +559,9 @@ constructor TSpkToolbar.Create(AOwner: TComponent); begin inherited Create(AOwner); + FImagesWidth := 16; + FLargeImagesWidth := 32; + // Initialization of inherited property Align := alTop; DoubleBuffered := true; // required after Laz 1.9 @@ -564,7 +585,7 @@ begin FTemporary := TBitmap.Create; FTemporary.Pixelformat := pf24bit; - setlength(FTabRects, 0); + SetLength(FTabRects, 0); {$IFDEF EnhancedRecordSupport} FTabClipRect := T2DIntRect.Create(0, 0, 0, 0); @@ -585,6 +606,8 @@ begin FTabs := TSpkTabs.Create(self); FTabs.ToolbarDispatch := FToolbarDispatch; FTabs.Appearance := FAppearance; + FTabs.ImagesWidth := FImagesWidth; + FTabs.LargeImagesWidth := FLargeImagesWidth; FTabIndex := -1; Color := clSkyBlue; @@ -1751,7 +1774,7 @@ begin TabAppearance := FTabs[i].CustomAppearance else TabAppearance := FAppearance; - FBuffer.Canvas.font.Assign(TabAppearance.Tab.TabHeaderFont); + FBuffer.Canvas.Font.Assign(TabAppearance.Tab.TabHeaderFont); TabWidth := 2 + // Frame 2 * TabCornerRadius + @@ -1915,4 +1938,21 @@ end; {$ENDIF} {$ENDIF} +{ Hi-DPI image list support } + +procedure TSpkToolbar.SetImagesWidth(const AValue: Integer); +begin + if FImagesWidth = AValue then Exit; + FImagesWidth := AValue; + NotifyMetricsChanged +end; + +procedure TSpkToolbar.SetLargeImagesWidth(const AValue: Integer); +begin + if FLargeImagesWidth = AValue then Exit; + FLargeImagesWidth := AValue; + NotifyMetricsChanged +end; + + end. diff --git a/components/spktoolbar/SpkToolbar/spkt_BaseItem.pas b/components/spktoolbar/SpkToolbar/spkt_BaseItem.pas index b79095b32..bb8311cac 100644 --- a/components/spktoolbar/SpkToolbar/spkt_BaseItem.pas +++ b/components/spktoolbar/SpkToolbar/spkt_BaseItem.pas @@ -36,6 +36,8 @@ type FDisabledImages: TImageList; FLargeImages: TImageList; FDisabledLargeImages: TImageList; + FImagesWidth: Integer; + FLargeImagesWidth: Integer; FVisible: boolean; FEnabled: boolean; @@ -47,6 +49,8 @@ type procedure SetLargeImages(const Value: TImageList); virtual; procedure SetDisabledLargeImages(const Value: TImageList); virtual; procedure SetAppearance(const Value: TSpkToolbarAppearance); + procedure SetImagesWidth(const Value: Integer); + procedure SetLargeImagesWidth(const Value: Integer); public constructor Create(AOwner: TComponent); override; @@ -72,6 +76,8 @@ type property DisabledImages: TImageList read FDisabledImages write SetDisabledImages; property LargeImages: TImageList read FLargeImages write SetLargeImages; property DisabledLargeImages: TImageList read FDisabledLargeImages write SetDisabledLargeImages; + property ImagesWidth: Integer read FImagesWidth write SetImagesWidth; + property LargeImagesWidth: Integer read FLargeImagesWidth write SetLargeImagesWidth; property Rect: T2DIntRect read FRect write SetRect; published @@ -144,11 +150,21 @@ begin FImages := Value; end; +procedure TSpkBaseItem.SetImagesWidth(const Value: Integer); +begin + FImagesWidth := Value; +end; + procedure TSpkBaseItem.SetLargeImages(const Value: TImageList); begin FLargeImages := Value; end; +procedure TSpkBaseItem.SetLargeImagesWidth(const Value: Integer); +begin + FLargeImagesWidth := Value; +end; + procedure TSpkBaseItem.SetRect(const Value: T2DIntRect); begin FRect := Value; diff --git a/components/spktoolbar/SpkToolbar/spkt_Buttons.pas b/components/spktoolbar/SpkToolbar/spkt_Buttons.pas index 0a9ed8ba7..68baaac2d 100644 --- a/components/spktoolbar/SpkToolbar/spkt_Buttons.pas +++ b/components/spktoolbar/SpkToolbar/spkt_Buttons.pas @@ -203,7 +203,7 @@ type implementation uses - LCLType, LCLIntf, LCLProc, SysUtils, + LCLType, LCLIntf, LCLProc, LCLVersion, SysUtils, spkt_Pane, spkt_Appearance; @@ -987,11 +987,13 @@ var delta: Integer; cornerRadius: Integer; imgList: TImageList; + imgSize: TSize; txtHeight: Integer; breakPos, breakWidth: Integer; s: String; P: T2DIntPoint; drawBtn: Boolean; + ppi: Integer; R: TRect; begin if FToolbarDispatch = nil then @@ -1151,17 +1153,19 @@ begin if (imgList <> nil) and (FLargeImageIndex >= 0) and (FLargeImageIndex < imgList.Count) then begin + ppi := FAppearance.Element.CaptionFont.PixelsPerInch; + {$IF LCL_FULLVERSION >= 1090000} + imgSize := imgList.SizeForPPI[FLargeImagesWidth, ppi]; + {$ELSE} + imgSize := Size(imgList.Width, imgList.Height); + {$ENDIF} + P := {$IFDEF EnhancedRecordSupport}T2DIntPoint.Create{$ELSE}Create2DIntPoint{$ENDIF}( - FButtonRect.Left + (FButtonRect.Width - imgList.Width) div 2, + FButtonRect.Left + (FButtonRect.Width - imgSize.CX) div 2, FButtonRect.Top + LargeButtonBorderSize + LargeButtonGlyphMargin ); - TGUITools.DrawImage( - ABuffer.Canvas, - imgList, - FLargeImageIndex, - P, - ClipRect - ); + TGUITools.DrawImage(ABuffer.Canvas, imgList, FLargeImageIndex, P, ClipRect, + FLargeImagesWidth, ppi, 1.0); end; // Text @@ -1506,9 +1510,11 @@ var delta: Integer; cornerRadius: Integer; imgList: TImageList; + imgSize: TSize; drawBtn: Boolean; R: TRect; dx: Integer; + ppi: Integer; begin if (FToolbarDispatch = nil) or (FAppearance = nil) then exit; @@ -1585,18 +1591,27 @@ begin if (imgList <> nil) and (FImageIndex >= 0) and (FImageIndex < imgList.Count) then begin + ppi := FAppearance.Element.CaptionFont.PixelsPerInch; + {$IF LCL_FULLVERSION >= 1090000} + imgSize := imgList.SizeForPPI[FImagesWidth, ppi]; + {$ELSE} + imgSize := Size(imgList.Width, imgList.Height); + {$ENDIF} + if (FGroupBehaviour in [gbContinuesGroup, gbEndsGroup]) then x := FButtonRect.Left + SmallButtonHalfBorderWidth + SmallButtonPadding else x := FButtonRect.Left + SmallButtonBorderWidth + SmallButtonPadding; - y := FButtonRect.top + (FButtonRect.height - imgList.Height) div 2; + y := FButtonRect.top + (FButtonRect.height - imgSize.CY) div 2; P := {$IFDEF EnhancedRecordSupport}T2DIntPoint.Create{$ELSE}Create2DIntPoint{$ENDIF}(x, y); TGUITools.DrawImage( ABuffer.Canvas, imgList, FImageIndex, P, - ClipRect + ClipRect, + FImagesWidth, + ppi, 1.0 ); end; diff --git a/components/spktoolbar/SpkToolbar/spkt_Items.pas b/components/spktoolbar/SpkToolbar/spkt_Items.pas index c5da587c5..c1b49e8f9 100644 --- a/components/spktoolbar/SpkToolbar/spkt_Items.pas +++ b/components/spktoolbar/SpkToolbar/spkt_Items.pas @@ -29,6 +29,8 @@ type FDisabledImages: TImageList; FLargeImages: TImageList; FDisabledLargeImages: TImageList; + FImagesWidth: Integer; + FLargeImagesWidth: Integer; // *** Gettery i settery *** procedure SetToolbarDispatch(const Value: TSpkBaseToolbarDispatch); @@ -38,6 +40,8 @@ type procedure SetDisabledImages(const Value: TImageList); procedure SetLargeImages(const Value: TImageList); procedure SetDisabledLargeImages(const Value: TImageList); + procedure SetImagesWidth(const Value: Integer); + procedure SetLargeImagesWidth(const Value: Integer); public function AddLargeButton: TSpkLargeButton; @@ -56,6 +60,8 @@ type property DisabledImages: TImageList read FDisabledImages write SetDisabledImages; property LargeImages: TImageList read FLargeImages write SetLargeImages; property DisabledLargeImages: TImageList read FDisabledLargeImages write SetDisabledLargeImages; + property ImagesWidth: Integer read FImagesWidth write SetImagesWidth; + property LargeImagesWidth: Integer read FLargeImagesWidth write SetLargeImagesWidth; end; implementation @@ -110,6 +116,8 @@ begin TSpkBaseItem(Item).DisabledImages := FDisabledImages; TSpkBaseItem(Item).LargeImages := FLargeImages; TSpkBaseItem(Item).DisabledLargeImages := FDisabledLargeImages; + TSpkBaseItem(Item).ImagesWidth := FImagesWidth; + TSpkBaseItem(Item).LargeImagesWidth := FLargeImagesWidth; TSpkBaseItem(Item).ToolbarDispatch := FToolbarDispatch; end; @@ -122,6 +130,8 @@ begin TSpkBaseItem(Item).DisabledImages := nil; TSpkBaseItem(Item).LargeImages := nil; TSpkBaseItem(Item).DisabledLargeImages := nil; +// TSpkBaseitem(Item).ImagesWidth := 0; +// TSpkBaseItem(Item).LargeImagesWidth := 0; end; end; end; @@ -162,6 +172,15 @@ begin Items[i].Images := Value; end; +procedure TSpkItems.SetImagesWidth(const Value: Integer); +var + i: Integer; +begin + FImagesWidth := Value; + for i := 0 to Count - 1 do + Items[i].ImagesWidth := Value; +end; + procedure TSpkItems.SetLargeImages(const Value: TImageList); var i: Integer; @@ -171,6 +190,15 @@ begin Items[i].LargeImages := Value; end; +procedure TSpkItems.SetLargeImagesWidth(const Value: Integer); +var + i: Integer; +begin + FLargeImagesWidth := Value; + for i := 0 to Count - 1 do + Items[i].LargeImagesWidth := Value; +end; + procedure TSpkItems.SetToolbarDispatch(const Value: TSpkBaseToolbarDispatch); var i : integer; diff --git a/components/spktoolbar/SpkToolbar/spkt_Pane.pas b/components/spktoolbar/SpkToolbar/spkt_Pane.pas index da80824f8..41aa47f7a 100644 --- a/components/spktoolbar/SpkToolbar/spkt_Pane.pas +++ b/components/spktoolbar/SpkToolbar/spkt_Pane.pas @@ -54,6 +54,8 @@ type FDisabledImages: TImageList; FLargeImages: TImageList; FDisabledLargeImages: TImageList; + FImagesWidth: Integer; + FLargeImagesWidth: Integer; FVisible: boolean; FItems: TSpkItems; @@ -73,6 +75,8 @@ type procedure SetDisabledImages(const Value: TImageList); procedure SetLargeImages(const Value: TImageList); procedure SetDisabledLargeImages(const Value: TImageList); + procedure SetImagesWidth(const Value: Integer); + procedure SetLargeImagesWidth(const Value: Integer); procedure SetRect(ARect : T2DIntRect); procedure SetToolbarDispatch(const Value: TSpkBaseToolbarDispatch); @@ -102,6 +106,8 @@ type property DisabledImages: TImageList read FDisabledImages write SetDisabledImages; property LargeImages: TImageList read FLargeImages write SetLargeImages; property DisabledLargeImages: TImageList read FDisabledLargeImages write SetDisabledLargeImages; + property ImagesWidth: Integer read FImagesWidth write SetImagesWidth; + property LargeImagesWidth: Integer read FLargeImagesWidth write SetLargeImagesWidth; property Items: TSpkItems read FItems; published @@ -118,6 +124,8 @@ type FDisabledImages: TImageList; FLargeImages: TImageList; FDisabledLargeImages: TImageList; + FImagesWidth: Integer; + FLargeImagesWidth: Integer; // *** Gettery i settery *** procedure SetToolbarDispatch(const Value: TSpkBaseToolbarDispatch); @@ -127,6 +135,8 @@ type procedure SetDisabledImages(const Value: TImageList); procedure SetLargeImages(const Value: TImageList); procedure SetDisabledLargeImages(const Value: TImageList); + procedure SetImagesWidth(const Value: Integer); + procedure SetLargeImagesWidth(const Value: Integer); public // *** Dodawanie i wstawianie elementów *** @@ -144,6 +154,8 @@ type property DisabledImages: TImageList read FDisabledImages write SetDisabledImages; property LargeImages: TImageList read FLargeImages write SetLargeImages; property DisabledLargeImages: TImageList read FDisabledLargeImages write SetDisabledLargeImages; + property ImagesWidth: Integer read FImagesWidth write SetImagesWidth; + property LargeImagesWidth: Integer read FLargeImagesWidth write SetLargeImagesWidth; end; @@ -179,6 +191,8 @@ begin FItems := TSpkItems.Create(self); FItems.ToolbarDispatch := FToolbarDispatch; FItems.Appearance := FAppearance; + FItems.ImagesWidth := FImagesWidth; + FItems.LargeImagesWidth := FLargeImagesWidth; end; destructor TSpkPane.Destroy; @@ -950,12 +964,24 @@ begin FItems.Images := FImages; end; +procedure TSpkPane.SetImagesWidth(const Value: Integer); +begin + FImagesWidth := Value; + FItems.ImagesWidth := FImagesWidth; +end; + procedure TSpkPane.SetLargeImages(const Value: TImageList); begin FLargeImages := Value; FItems.LargeImages := FLargeImages; end; +procedure TSpkPane.SetLargeImagesWidth(const Value: Integer); +begin + FLargeImagesWidth := Value; + FItems.LargeImagesWidth := FLargeImagesWidth; +end; + procedure TSpkPane.SetVisible(const Value: boolean); begin FVisible := Value; @@ -1025,6 +1051,8 @@ begin TSpkPane(Item).DisabledImages := FDisabledImages; TSpkPane(Item).LargeImages := FLargeImages; TSpkPane(Item).DisabledLargeImages := FDisabledLargeImages; + TSpkPane(Item).ImagesWidth := FImagesWidth; + TSpkPane(Item).LargeImagesWidth := FLargeImagesWidth; TSpkPane(Item).ToolbarDispatch := FToolbarDispatch; end; opRemove: @@ -1036,6 +1064,8 @@ begin TSpkPane(Item).DisabledImages := nil; TSpkPane(Item).LargeImages := nil; TSpkPane(Item).DisabledLargeImages := nil; +// TSpkPane(Item).ImagesWidth := 0; +// TSpkPane(Item).LargeImagesWidth := 0; end; end; end; @@ -1049,6 +1079,15 @@ begin Items[i].Images := Value; end; +procedure TSpkPanes.SetImagesWidth(const Value: Integer); +var + I: Integer; +begin + FImagesWidth := Value; + for I := 0 to Count - 1 do + Items[i].ImagesWidth := Value; +end; + procedure TSpkPanes.SetLargeImages(const Value: TImageList); var I: Integer; @@ -1058,6 +1097,15 @@ begin Items[i].LargeImages := Value; end; +procedure TSpkPanes.SetLargeImagesWidth(const Value: Integer); +var + I: Integer; +begin + FLargeImagesWidth := Value; + for I := 0 to Count - 1 do + Items[i].LargeImagesWidth := Value; +end; + procedure TSpkPanes.SetToolbarDispatch(const Value: TSpkBaseToolbarDispatch); var i: integer; diff --git a/components/spktoolbar/SpkToolbar/spkt_Tab.pas b/components/spktoolbar/SpkToolbar/spkt_Tab.pas index 739f454f7..7d67d55e6 100644 --- a/components/spktoolbar/SpkToolbar/spkt_Tab.pas +++ b/components/spktoolbar/SpkToolbar/spkt_Tab.pas @@ -62,6 +62,8 @@ type FDisabledImages: TImageList; FLargeImages: TImageList; FDisabledLargeImages: TImageList; + FImagesWidth: Integer; + FLargeImagesWidth: Integer; // *** Makro ustawia odpowiednie appearance taflom *** procedure SetPaneAppearance; inline; @@ -84,6 +86,8 @@ type procedure SetDisabledImages(const Value: TImageList); procedure SetLargeImages(const Value: TImageList); procedure SetDisabledLargeImages(const Value: TImageList); + procedure SetImagesWidth(const Value: Integer); + procedure SetLargeImagesWidth(const Value: Integer); procedure SetRect(ARect: T2DIntRect); procedure SetToolbarDispatch(const Value: TSpkBaseToolbarDispatch); @@ -118,6 +122,8 @@ type property DisabledImages: TImageList read FDisabledImages write SetDisabledImages; property LargeImages: TImageList read FLargeImages write SetLargeImages; property DisabledLargeImages: TImageList read FDisabledLargeImages write SetDisabledLargeImages; + property ImagesWidth: Integer read FImagesWidth write SetImagesWidth; + property LargeImagesWidth: Integer read FLargeImagesWidth write SetLargeImagesWidth; published property CustomAppearance: TSpkToolbarAppearance read FCustomAppearance write SetCustomAppearance; @@ -135,6 +141,8 @@ type FDisabledImages: TImageList; FLargeImages: TImageList; FDisabledLargeImages: TImageList; + FImagesWidth: Integer; + FLargeImagesWidth: Integer; procedure SetToolbarDispatch(const Value: TSpkBaseToolbarDispatch); function GetItems(AIndex: integer): TSpkTab; reintroduce; procedure SetAppearance(const Value: TSpkToolbarAppearance); @@ -142,6 +150,8 @@ type procedure SetDisabledImages(const Value: TImageList); procedure SetLargeImages(const Value: TImageList); procedure SetDisabledLargeImages(const Value: TImageList); + procedure SetImagesWidth(const Value: Integer); + procedure SetLargeImagesWidth(const Value: Integer); public function Add: TSpkTab; function Insert(AIndex: integer): TSpkTab; @@ -155,6 +165,8 @@ type property DisabledImages: TImageList read FDisabledImages write SetDisabledImages; property LargeImages: TImageList read FLargeImages write SetLargeImages; property DisabledLargeImages: TImageList read FDisabledLargeImages write SetDisabledLargeImages; + property ImagesWidth: Integer read FImagesWidth write SetImagesWidth; + property LargeImagesWidth: Integer read FLargeImagesWidth write SetLargeImagesWidth; end; @@ -190,6 +202,8 @@ begin FCustomAppearance := TSpkToolbarAppearance.Create(FAppearanceDispatch); FPanes := TSpkPanes.Create(self); FPanes.ToolbarDispatch := FToolbarDispatch; + FPanes.ImagesWidth := FImagesWidth; + FPanes.LargeImagesWidth := FLargeImagesWidth; {$IFDEF EnhancedRecordSupport} FRect := T2DIntRect.Create(0,0,0,0); {$ELSE} @@ -532,12 +546,24 @@ begin FPanes.Images := Value; end; +procedure TSpkTab.SetImagesWidth(const Value: Integer); +begin + FImagesWidth := Value; + FPanes.ImagesWidth := Value; +end; + procedure TSpkTab.SetLargeImages(const Value: TImageList); begin FLargeImages := Value; FPanes.LargeImages := Value; end; +procedure TSpkTab.SetLargeImagesWidth(const Value: Integer); +begin + FLargeImagesWidth := Value; + FPanes.LargeImagesWidth := Value; +end; + procedure TSpkTab.SetAppearance(const Value: TSpkToolbarAppearance); begin FAppearance := Value; @@ -598,7 +624,7 @@ var i: Integer; begin if (AIndex < 0) or (AIndex >= self.Count) then - raise InternalException.create('TSpkTabs.Insert: Nieprawid³owy indeks!'); + raise InternalException.Create('TSpkTabs.Insert: Nieprawid³owy indeks!'); if FRootComponent<>nil then begin @@ -611,7 +637,7 @@ begin lParent := nil; end; - Result := TSpkTab.create(lOwner); + Result := TSpkTab.Create(lOwner); Result.Parent := lParent; if FRootComponent<>nil then @@ -640,6 +666,8 @@ begin TSpkTab(Item).DisabledImages := self.FDisabledImages; TSpkTab(Item).LargeImages := self.FLargeImages; TSpkTab(Item).DisabledLargeImages := self.FDisabledLargeImages; + TSpkTab(Item).ImagesWidth := self.FImagesWidth; + TSpkTab(Item).LargeImagesWidth := self.FLargeImagesWidth; TSpkTab(Item).ToolbarDispatch := self.FToolbarDispatch; end; opRemove: @@ -651,6 +679,8 @@ begin TSpkTab(Item).DisabledImages := nil; TSpkTab(Item).LargeImages := nil; TSpkTab(Item).DisabledLargeImages := nil; + // TSpkTab(Item).ImagesWidth := 0; +// TSpkTab(Item).LargeImagesWidth := 0; end; end; end; @@ -691,6 +721,15 @@ begin Items[i].Images := Value; end; +procedure TSpkTabs.SetImagesWidth(const Value: Integer); +var + i: Integer; +begin + FImagesWidth := Value; + for i := 0 to Count - 1 do + Items[i].ImagesWidth := Value; +end; + procedure TSpkTabs.SetLargeImages(const Value: TImageList); var i: Integer; @@ -700,6 +739,15 @@ begin Items[i].LargeImages := Value; end; +procedure TSpkTabs.SetLargeImagesWidth(const Value: Integer); +var + i: Integer; +begin + FLargeImagesWidth := Value; + for i := 0 to Count - 1 do + Items[i].LargeImagesWidth := Value; +end; + procedure TSpkTabs.SetToolbarDispatch(const Value: TSpkBaseToolbarDispatch); var i: integer;