|
@@ -53,7 +53,7 @@ uses
|
|
|
{off $DEFINE DEBUG}
|
|
{off $DEFINE DEBUG}
|
|
|
|
|
|
|
|
type
|
|
type
|
|
|
-
|
|
|
|
|
|
|
+ TBCButtonMemoryUsage = (bmuLow, bmuMedium, bmuHigh);
|
|
|
TBCButtonState = class;
|
|
TBCButtonState = class;
|
|
|
TBCButtonStyle = (bbtButton, bbtDropDown);
|
|
TBCButtonStyle = (bbtButton, bbtDropDown);
|
|
|
TOnAfterRenderBCButton = procedure(Sender: TObject; const ABGRA: TBGRABitmap;
|
|
TOnAfterRenderBCButton = procedure(Sender: TObject; const ABGRA: TBGRABitmap;
|
|
@@ -105,6 +105,7 @@ type
|
|
|
FFlipArrow: boolean;
|
|
FFlipArrow: boolean;
|
|
|
FActiveButt: TBCButtonStyle;
|
|
FActiveButt: TBCButtonStyle;
|
|
|
FBGRANormal, FBGRAHover, FBGRAClick: TBGRABitmapEx;
|
|
FBGRANormal, FBGRAHover, FBGRAClick: TBGRABitmapEx;
|
|
|
|
|
+ FMemoryUsage: TBCButtonMemoryUsage;
|
|
|
FRounding: TBCRounding;
|
|
FRounding: TBCRounding;
|
|
|
FRoundingDropDown: TBCRounding;
|
|
FRoundingDropDown: TBCRounding;
|
|
|
FStateClicked: TBCButtonState;
|
|
FStateClicked: TBCButtonState;
|
|
@@ -157,6 +158,7 @@ type
|
|
|
procedure SetGlyphMargin(const AValue: integer);
|
|
procedure SetGlyphMargin(const AValue: integer);
|
|
|
procedure SetImageIndex(AValue: integer);
|
|
procedure SetImageIndex(AValue: integer);
|
|
|
procedure SetImages(AValue: TCustomImageList);
|
|
procedure SetImages(AValue: TCustomImageList);
|
|
|
|
|
+ procedure SetMemoryUsage(AValue: TBCButtonMemoryUsage);
|
|
|
procedure SetRounding(AValue: TBCRounding);
|
|
procedure SetRounding(AValue: TBCRounding);
|
|
|
procedure SetRoundingDropDown(AValue: TBCRounding);
|
|
procedure SetRoundingDropDown(AValue: TBCRounding);
|
|
|
procedure SetShowCaption(AValue: boolean);
|
|
procedure SetShowCaption(AValue: boolean);
|
|
@@ -170,6 +172,7 @@ type
|
|
|
procedure ImageListChange(ASender: TObject);
|
|
procedure ImageListChange(ASender: TObject);
|
|
|
protected
|
|
protected
|
|
|
{ Protected declarations }
|
|
{ Protected declarations }
|
|
|
|
|
+ procedure LimitMemoryUsage;
|
|
|
procedure CalculatePreferredSize(var PreferredWidth, PreferredHeight: integer;
|
|
procedure CalculatePreferredSize(var PreferredWidth, PreferredHeight: integer;
|
|
|
WithThemeSpace: boolean); override;
|
|
WithThemeSpace: boolean); override;
|
|
|
class function GetControlClassDefaultSize: TSize; override;
|
|
class function GetControlClassDefaultSize: TSize; override;
|
|
@@ -235,6 +238,7 @@ type
|
|
|
property OnAfterRenderBCButton: TOnAfterRenderBCButton
|
|
property OnAfterRenderBCButton: TOnAfterRenderBCButton
|
|
|
read FOnAfterRenderBCButton write FOnAfterRenderBCButton;
|
|
read FOnAfterRenderBCButton write FOnAfterRenderBCButton;
|
|
|
property OnButtonClick: TNotifyEvent read FOnButtonClick write FOnButtonClick;
|
|
property OnButtonClick: TNotifyEvent read FOnButtonClick write FOnButtonClick;
|
|
|
|
|
+ property MemoryUsage: TBCButtonMemoryUsage read FMemoryUsage write SetMemoryUsage;
|
|
|
public
|
|
public
|
|
|
{ Public declarations }
|
|
{ Public declarations }
|
|
|
constructor Create(AOwner: TComponent); override;
|
|
constructor Create(AOwner: TComponent); override;
|
|
@@ -301,6 +305,7 @@ type
|
|
|
property Images;
|
|
property Images;
|
|
|
property ImageIndex;
|
|
property ImageIndex;
|
|
|
property ShowCaption;
|
|
property ShowCaption;
|
|
|
|
|
+ property MemoryUsage;
|
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
{ TBCButtonActionLink }
|
|
{ TBCButtonActionLink }
|
|
@@ -796,6 +801,16 @@ begin
|
|
|
end;
|
|
end;
|
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
+procedure TCustomBCButton.LimitMemoryUsage;
|
|
|
|
|
+begin
|
|
|
|
|
+ if (FMemoryUsage = bmuLow) and Assigned(FBGRANormal) then FBGRANormal.Discard;
|
|
|
|
|
+ if (FMemoryUsage <> bmuHigh) then
|
|
|
|
|
+ begin
|
|
|
|
|
+ if Assigned(FBGRAHover) then FBGRAHover.Discard;
|
|
|
|
|
+ if Assigned(FBGRAClick) then FBGRAClick.Discard;
|
|
|
|
|
+ end;
|
|
|
|
|
+end;
|
|
|
|
|
+
|
|
|
procedure TCustomBCButton.SeTBCButtonStateClicked(const AValue: TBCButtonState);
|
|
procedure TCustomBCButton.SeTBCButtonStateClicked(const AValue: TBCButtonState);
|
|
|
begin
|
|
begin
|
|
|
if FStateClicked = AValue then
|
|
if FStateClicked = AValue then
|
|
@@ -942,6 +957,13 @@ begin
|
|
|
Invalidate;
|
|
Invalidate;
|
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
+procedure TCustomBCButton.SetMemoryUsage(AValue: TBCButtonMemoryUsage);
|
|
|
|
|
+begin
|
|
|
|
|
+ if FMemoryUsage=AValue then Exit;
|
|
|
|
|
+ FMemoryUsage:=AValue;
|
|
|
|
|
+ LimitMemoryUsage;
|
|
|
|
|
+end;
|
|
|
|
|
+
|
|
|
procedure TCustomBCButton.SetRounding(AValue: TBCRounding);
|
|
procedure TCustomBCButton.SetRounding(AValue: TBCRounding);
|
|
|
begin
|
|
begin
|
|
|
if FRounding = AValue then
|
|
if FRounding = AValue then
|
|
@@ -1505,6 +1527,8 @@ begin
|
|
|
end;
|
|
end;
|
|
|
end;
|
|
end;
|
|
|
end;
|
|
end;
|
|
|
|
|
+
|
|
|
|
|
+ LimitMemoryUsage;
|
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
procedure TCustomBCButton.RenderControl;
|
|
procedure TCustomBCButton.RenderControl;
|
|
@@ -1539,6 +1563,7 @@ begin
|
|
|
{$IFDEF DEBUG}
|
|
{$IFDEF DEBUG}
|
|
|
FRenderCount := 0;
|
|
FRenderCount := 0;
|
|
|
{$ENDIF}
|
|
{$ENDIF}
|
|
|
|
|
+ FMemoryUsage := bmuHigh;
|
|
|
DisableAutoSizing;
|
|
DisableAutoSizing;
|
|
|
Include(FControlState, csCreating);
|
|
Include(FControlState, csCreating);
|
|
|
//{$IFDEF WINDOWS}
|
|
//{$IFDEF WINDOWS}
|