added TBitBtn.Margin

git-svn-id: trunk@5315 -
This commit is contained in:
mattias 2004-03-17 13:10:01 +00:00
parent aeff605972
commit 38f2d182a4
2 changed files with 17 additions and 1 deletions

View File

@ -143,12 +143,14 @@ type
FButtonGlyph: TButtonGlyph; FButtonGlyph: TButtonGlyph;
FKind: TBitBtnKind; FKind: TBitBtnKind;
FLayout: TButtonLayout; FLayout: TButtonLayout;
FMargin: integer;
FSpacing: Integer; FSpacing: Integer;
Function GetGlyph: TBitmap; Function GetGlyph: TBitmap;
Function IsGlyphStored: Boolean; Function IsGlyphStored: Boolean;
Procedure SetGlyph(AValue: TBitmap); Procedure SetGlyph(AValue: TBitmap);
Procedure SetKind(AValue: TBitBtnKind); Procedure SetKind(AValue: TBitBtnKind);
Procedure SetLayout(AValue: TButtonLayout); Procedure SetLayout(AValue: TButtonLayout);
procedure SetMargin(const AValue: integer);
Procedure SetSpacing(AValue: Integer); Procedure SetSpacing(AValue: Integer);
procedure RealizeKind; procedure RealizeKind;
@ -170,6 +172,7 @@ type
property Glyph: TBitmap read GetGlyph write SetGlyph stored IsGlyphStored; property Glyph: TBitmap read GetGlyph write SetGlyph stored IsGlyphStored;
property Kind: TBitBtnKind read FKind write SetKind default bkCustom; property Kind: TBitBtnKind read FKind write SetKind default bkCustom;
property Layout: TButtonLayout read FLayout write SetLayout default blGlyphLeft; property Layout: TButtonLayout read FLayout write SetLayout default blGlyphLeft;
property Margin: integer read FMargin write SetMargin default -1;
property ModalResult; property ModalResult;
property OnChangeBounds; property OnChangeBounds;
property OnClick; property OnClick;
@ -327,6 +330,9 @@ end.
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.62 2004/03/17 13:10:01 mattias
added TBitBtn.Margin
Revision 1.61 2004/02/27 00:42:41 marc Revision 1.61 2004/02/27 00:42:41 marc
* Interface CreateComponent splitup * Interface CreateComponent splitup
* Implemented CreateButtonHandle on GTK interface * Implemented CreateButtonHandle on GTK interface

View File

@ -25,10 +25,11 @@ begin
FKind := bkCustom; FKind := bkCustom;
FLayout := blGlyphLeft; FLayout := blGlyphLeft;
FSpacing := 3; FSpacing := 3;
fMargin:=-1;
FButtonGlyph := TButtonGlyph.Create; FButtonGlyph := TButtonGlyph.Create;
FButtonGlyph.OnChange := @GlyphChanged; FButtonGlyph.OnChange := @GlyphChanged;
Align := alNone; Align := alNone;
SetInitialBounds(1,1,75,25); SetInitialBounds(0,0,75,25);
RealizeKind; RealizeKind;
end; end;
@ -125,6 +126,15 @@ Begin
CNSendMessage(LM_LAYOUTCHANGED,Self,nil); CNSendMessage(LM_LAYOUTCHANGED,Self,nil);
end; end;
procedure TBitBtn.SetMargin(const AValue: integer);
begin
if FMargin=AValue then exit;
FMargin:=AValue;
if HandleAllocated then
//still send the layout message because it still calls the same procedure
CNSendMessage(LM_LAYOUTCHANGED,Self,nil);
end;
Procedure TBitBtn.SetSpacing(AValue: Integer); Procedure TBitBtn.SetSpacing(AValue: Integer);
Begin Begin
if (FSpacing = AValue) or (AValue < 0) then Exit; if (FSpacing = AValue) or (AValue < 0) then Exit;