mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-06 09:17:53 +02:00
applies patch from bug #20252: [Patch] BitBtn with Kind<>bkCustom should not save Caption to LFM but be translated via lclstrconsts
git-svn-id: trunk@32648 -
This commit is contained in:
parent
bb022738ee
commit
5e67d91117
@ -141,6 +141,7 @@ type
|
||||
|
||||
TCustomBitBtn = class(TCustomButton)
|
||||
private
|
||||
FDefaultCaption: Boolean;
|
||||
FKind: TBitBtnKind;
|
||||
FLayout: TButtonLayout;
|
||||
FMargin: integer;
|
||||
@ -165,6 +166,8 @@ type
|
||||
procedure ActionChange(Sender: TObject; CheckDefaults: Boolean); override;
|
||||
procedure GlyphChanged(Sender: TObject);
|
||||
procedure InitializeWnd; override;
|
||||
function IsCaptionStored: Boolean;
|
||||
procedure Loaded; override;
|
||||
procedure TextChanged; override;
|
||||
class function GetControlClassDefaultSize: TSize; override;
|
||||
procedure CMAppShowBtnGlyphChanged(var Message: TLMessage); message CM_APPSHOWBTNGLYPHCHANGED;
|
||||
@ -176,6 +179,8 @@ type
|
||||
procedure LoadGlyphFromStock(idButton: Integer);
|
||||
function CanShowGlyph: Boolean;
|
||||
public
|
||||
property Caption stored IsCaptionStored;
|
||||
property DefaultCaption: Boolean read FDefaultCaption write FDefaultCaption default False;
|
||||
property Glyph: TBitmap read GetGlyph write SetGlyph stored IsGlyphStored;
|
||||
property NumGlyphs: Integer read GetNumGlyphs write SetNumGlyphs default 1;
|
||||
property Kind: TBitBtnKind read FKind write SetKind default bkCustom;
|
||||
@ -202,6 +207,7 @@ type
|
||||
property Color;
|
||||
property Constraints;
|
||||
property Default;
|
||||
property DefaultCaption;
|
||||
property Enabled;
|
||||
property Font;
|
||||
property Glyph;
|
||||
|
@ -1008,7 +1008,6 @@ type
|
||||
function GetUndockWidth: Integer;
|
||||
function IsAnchorsStored: boolean;
|
||||
function IsBiDiModeStored: boolean;
|
||||
function IsCaptionStored: Boolean;
|
||||
function IsEnabledStored: Boolean;
|
||||
function IsFontStored: Boolean;
|
||||
function IsHintStored: Boolean;
|
||||
@ -1073,6 +1072,7 @@ type
|
||||
procedure DoBorderSpacingChange(Sender: TObject;
|
||||
InnerSpaceChanged: Boolean); virtual;
|
||||
function IsBorderSpacingInnerBorderStored: Boolean; virtual;
|
||||
function IsCaptionStored: Boolean;
|
||||
procedure SendMoveSizeMessages(SizeChanged, PosChanged: boolean); virtual;
|
||||
procedure ConstrainedResize(var MinWidth, MinHeight,
|
||||
MaxWidth, MaxHeight: TConstraintSize); virtual;
|
||||
|
@ -22,6 +22,7 @@ constructor TCustomBitBtn.Create(TheOwner: TComponent);
|
||||
begin
|
||||
inherited Create(TheOwner);
|
||||
FCompStyle := csBitBtn;
|
||||
FDefaultCaption := False;
|
||||
FKind := bkCustom;
|
||||
FLayout := blGlyphLeft;
|
||||
FSpacing := 3;
|
||||
@ -132,9 +133,10 @@ procedure TCustomBitBtn.SetKind(AValue: TBitBtnKind);
|
||||
begin
|
||||
if FKind = AValue then Exit;
|
||||
FKind := AValue;
|
||||
if FKind = bkCustom then Exit;
|
||||
|
||||
RealizeKind;
|
||||
if FKind <> bkCustom then
|
||||
RealizeKind;
|
||||
if not (csLoading in ComponentState) then
|
||||
DefaultCaption := FKind <> bkCustom;
|
||||
end;
|
||||
|
||||
procedure TCustomBitBtn.SetLayout(AValue: TButtonLayout);
|
||||
@ -256,10 +258,23 @@ begin
|
||||
TWSBitBtnClass(WidgetSetClass).SetSpacing(Self, FSpacing);
|
||||
end;
|
||||
|
||||
function TCustomBitBtn.IsCaptionStored: Boolean;
|
||||
begin
|
||||
Result := inherited IsCaptionStored and not DefaultCaption;
|
||||
end;
|
||||
|
||||
procedure TCustomBitBtn.Loaded;
|
||||
begin
|
||||
inherited Loaded;
|
||||
if (Kind <> bkCustom) and DefaultCaption and (Caption = '') then
|
||||
Caption := GetCaptionOfKind(Kind);
|
||||
end;
|
||||
|
||||
procedure TCustomBitBtn.TextChanged;
|
||||
begin
|
||||
inherited TextChanged;
|
||||
AdjustSize;
|
||||
DefaultCaption := False;
|
||||
end;
|
||||
|
||||
class function TCustomBitBtn.GetControlClassDefaultSize: TSize;
|
||||
|
@ -1048,6 +1048,14 @@ begin
|
||||
Result:=BorderSpacing.InnerBorder<>0;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
TControl IsCaptionStored
|
||||
------------------------------------------------------------------------------}
|
||||
function TControl.IsCaptionStored: Boolean;
|
||||
begin
|
||||
Result := (ActionLink = nil) or not ActionLink.IsCaptionLinked;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
procedure TControl.SendMoveSizeMessages(SizeChanged, PosChanged: boolean);
|
||||
------------------------------------------------------------------------------}
|
||||
@ -2856,14 +2864,6 @@ begin
|
||||
Result := TControlActionLink;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
TControl IsCaptionStored
|
||||
------------------------------------------------------------------------------}
|
||||
function TControl.IsCaptionStored: Boolean;
|
||||
begin
|
||||
Result := (ActionLink = nil) or not ActionLink.IsCaptionLinked;
|
||||
end;
|
||||
|
||||
function TControl.IsClientHeightStored: Boolean;
|
||||
begin
|
||||
Result:=false;
|
||||
|
Loading…
Reference in New Issue
Block a user