Commit f26e6ca2 authored by Juha Manninen's avatar Juha Manninen
Browse files

LCL: Add OnPaint and OnPaintButton for TToolBar. Issue #28029, patch from "007".

git-svn-id: trunk@48938 -
parent 54b11708
......@@ -2112,6 +2112,8 @@ type
end;
{ TToolBar }
TToolBarOnPaintButton = procedure(Sender: TToolButton; State: integer) of object;
TToolBarFlag = (
tbfUpdateVisibleBarNeeded,
......@@ -2122,6 +2124,8 @@ type
TToolBar = class(TToolWindow)
private
FOnPaint: TNotifyEvent;
FOnPaintButton: TToolBarOnPaintButton;
FButtonHeight: Integer;
FRealizedButtonHeight,
FRealizedButtonWidth: integer;
......@@ -2257,6 +2261,7 @@ type
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnPaintButton: TToolBarOnPaintButton read FOnPaintButton write FOnPaintButton;
property OnEndDrag;
property OnEnter;
property OnExit;
......@@ -2268,6 +2273,7 @@ type
property OnMouseWheel;
property OnMouseWheelDown;
property OnMouseWheelUp;
property OnPaint: TNotifyEvent read FOnPaint write FOnPaint;
property OnResize;
property OnChangeBounds;
property OnStartDrag;
......
......@@ -80,7 +80,7 @@ end;
Constructor for the class.
------------------------------------------------------------------------------}
constructor TToolbar.Create(TheOwner : TComponent);
constructor TToolBar.Create(TheOwner: TComponent);
var
Details: TThemedElementDetails;
begin
......@@ -425,6 +425,8 @@ begin
Canvas.FrameRect(Clientrect);
end;
inherited Paint;
if Assigned(OnPaint) then
OnPaint(Self);
end;
procedure TToolBar.SetButtonSize(NewButtonWidth, NewButtonHeight: integer);
......
......@@ -248,6 +248,20 @@ begin
ButtonRect := PaintRect;
Details := GetButtonDrawDetail;
// OnDrawItem
if Assigned(FToolBar.OnPaintButton) then
begin
if (Style in [tbsButton, tbsDropDown, tbsCheck]) then
begin
TempDetails := Details;
if ((FToolBar <> nil) and not FToolBar.Flat) and (TempDetails.State in [1, 4]) then
TempDetails.State := 2;
end;
FToolBar.OnPaintButton(Self, TempDetails.State);
exit;
end;
if Style = tbsDropDown then
begin
DropDownButtonRect := ButtonRect;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment