added TCustomButton, TCustomBitBtn, TCustomSpeedButton

git-svn-id: trunk@5682 -
This commit is contained in:
mattias 2004-07-15 10:43:39 +00:00
parent 7e646879e5
commit cd9a3b8c9f
23 changed files with 314 additions and 218 deletions

View File

@ -4284,60 +4284,77 @@ type
private
procedure MemoChanged(Sender: TObject);
public
Memo : TMemo;
OKButton, CancelButton : TBitBtn;
Bevel : TBevel;
StatusLabel : TLabel;
constructor Create(AOwner : TComponent); override;
Memo: TMemo;
OKButton, CancelButton: TBitBtn;
Bevel: TBevel;
StatusLabel: TLabel;
constructor Create(AOwner: TComponent); override;
end;
constructor TStringsPropEditorDlg.Create(AOwner : TComponent);
var
x: Integer;
y: Integer;
MaxX: LongInt;
MaxY: LongInt;
w: Integer;
begin
inherited Create(AOwner);
Position := poScreenCenter;
Height := 250;
Width := 350;
Height := 250;
Caption := 'Strings Editor Dialog';
Bevel:= TBevel.Create(Self);
x:=4;
y:=4;
MaxX:=Self.ClientWidth;
MaxY:=Self.ClientHeight;
with Bevel do begin
Parent:= Self;
SetBounds(4, 4, 342, 213);
Anchors:= [akLeft, akTop, akRight, akBottom];
Shape:= bsFrame;
SetBounds(x, y, MaxX-2*x, MaxY-y-34);
Anchors:= [akLeft, akTop, akRight, akBottom];
end;
StatusLabel:= TLabel.Create(Self);
x:=8;
y:=8;
with StatusLabel do begin
Parent:= Self;
SetBounds(x,y,MaxX-2*x, Height);
Anchors:= [akLeft, akTop, akRight];
Caption:= '0 lines, 0 chars';
end;
Memo := TMemo.Create(self);
y:=StatusLabel.Top+StatusLabel.Height;
with Memo do begin
Parent:= Self;
SetBounds(12, 32, 326, 176);
SetBounds(x,y,MaxX-2*x,MaxY-y-38);
Anchors:= [akLeft, akTop, akRight, akBottom];
// Scrollbars:= ssVertical; // GTK 1.x does not implement horizontal scrollbars for GtkText
Memo.OnChange:= @MemoChanged;
end;
StatusLabel:= TLabel.Create(Self);
with StatusLabel do begin
Parent:= Self;
SetBounds(12, 12, 326, 17);
Caption:= '0 lines, 0 chars';
end;
OKButton := TBitBtn.Create(Self);
x:=MaxX;
y:=MaxY-30;
w:=80;
with OKButton do Begin
Parent := Self;
Kind:= bkOK;
Left := 192;
Top := 221;
dec(x,w+8);
SetBounds(x,y,w,Height);
Anchors:= [akRight, akBottom];
end;
CancelButton := TBitBtn.Create(self);
with CancelButton do Begin
Parent := self;
Parent := Self;
Kind:= bkCancel;
Left := 271;
Top := 221;
dec(x,w+8);
SetBounds(x,y,w,Height);
Anchors:= [akRight, akBottom];
end;
end;

View File

@ -54,8 +54,8 @@ type
{TNumGlyphs holds the number of glyphs in an image.
We restrict it to 4 to stay compatible but we don't NEED to.
If we change this the code in SetNumGlyphs for @link(TSpeedButton) needs to
be changed }
If we change this the code in SetNumGlyphs for @link(TCustomSpeedButton)
needs to be changed }
TNumGlyphs = 1..4;
TCustomButton = class(TButtonControl)
@ -146,7 +146,7 @@ type
end;
{ TBitBtn }
{ TCustomBitBtn }
// when adding items here, also update TBitBtn.GetCaptionOfKind
TBitBtnKind = (bkCustom, bkOK, bkCancel, bkHelp, bkYes, bkNo,
@ -154,7 +154,7 @@ type
bkNoToAll, bkYesToAll);
TBitBtnKinds = set of TBitBtnKind;
TBitBtn = class(TButton)
TCustomBitBtn = class(TCustomButton)
private
FButtonGlyph: TButtonGlyph;
FKind: TBitBtnKind;
@ -180,16 +180,28 @@ type
public
constructor Create(TheOwner: TComponent); override;
destructor Destroy; Override;
published
property Glyph: TBitmap read GetGlyph write SetGlyph stored IsGlyphStored;
property Kind: TBitBtnKind read FKind write SetKind default bkCustom;
property Layout: TButtonLayout read FLayout write SetLayout default blGlyphLeft;
property Margin: integer read FMargin write SetMargin default -1;
property Spacing: Integer read FSpacing write SetSpacing default 3;
end;
{ TBitBtn }
TBitBtn = class(TCustomBitBtn)
published
property Action;
property Align;
property Anchors;
property Constraints;
property Default;
property Glyph: TBitmap read GetGlyph write SetGlyph stored IsGlyphStored;
property Kind: TBitBtnKind read FKind write SetKind default bkCustom;
property Layout: TButtonLayout read FLayout write SetLayout default blGlyphLeft;
property Margin: integer read FMargin write SetMargin default -1;
property Glyph;
property Kind;
property Layout;
property Margin;
property ModalResult;
property OnChangeBounds;
property OnClick;
@ -202,7 +214,7 @@ type
property ParentShowHint;
property PopupMenu;
property ShowHint;
property Spacing : Integer read FSpacing write SetSpacing default 3;
property Spacing;
property Visible;
end;
@ -219,9 +231,9 @@ type
end;
{ TSpeedButton }
{ TCustomSpeedButton }
TSpeedButton = class(TGraphicControl)
TCustomSpeedButton = class(TGraphicControl)
private
FAllowAllUp : Boolean;
FDown : Boolean;
@ -273,14 +285,8 @@ type
destructor Destroy; override;
procedure Click; override;
published
property Action;
property Align;
property Anchors;
property AllowAllUp: Boolean read FAllowAllUp write SetAllowAllUp default false;
property Constraints;
property Caption;
property Down: Boolean read FDown write SetDown default false;
property Enabled;
property Flat: Boolean read FFlat write SetFlat default false;
property Glyph: TBitmap read GetGlyph write SetGlyph;
property GroupIndex: Integer read FGroupIndex write SetGroupIndex default 0;
@ -289,6 +295,29 @@ type
property NumGlyphs: Integer read GetNumGlyphs write SetNumGlyphs default 1;
property Spacing: integer read FSpacing write SetSpacing default 4;
property Transparent: Boolean read FTransparent write SetTransparent default false;
end;
{ TSpeedButton }
TSpeedButton = class(TCustomSpeedButton)
published
property Action;
property Align;
property Anchors;
property AllowAllUp;
property Constraints;
property Caption;
property Down;
property Enabled;
property Flat;
property Glyph;
property GroupIndex;
property Layout;
property Margin;
property NumGlyphs;
property Spacing;
property Transparent;
property Visible;
property OnClick;
property OnMouseDown;
@ -343,6 +372,9 @@ end.
{ =============================================================================
$Log$
Revision 1.74 2004/07/15 10:43:38 mattias
added TCustomButton, TCustomBitBtn, TCustomSpeedButton
Revision 1.73 2004/07/13 17:47:14 mattias
fixed mouse enter/leave for TSpeedButton

View File

@ -504,7 +504,7 @@ end;
{ TCalcButton }
type
TCalcButton = class(TSpeedButton)
TCalcButton = class(TCustomSpeedButton)
private
FKind: TCalcBtnKind;
public
@ -579,7 +579,7 @@ type
procedure SetDisplay(R: Double);
function GetDisplay: Double;
procedure UpdateMemoryLabel;
function FindButton(Key: Char): TSpeedButton;
function FindButton(Key: Char): TCustomSpeedButton;
procedure BtnClick(Sender: TObject);
protected
procedure ErrorBeep;
@ -854,7 +854,7 @@ end;
procedure TCalculatorPanel.CalcKeyPress(Sender: TObject; var Key: Char);
var
Btn: TSpeedButton;
Btn: TCustomSpeedButton;
begin
Btn:=FindButton(Key);
@ -864,7 +864,7 @@ begin
CalcKey(Key);
end;
function TCalculatorPanel.FindButton(Key: Char): TSpeedButton;
function TCalculatorPanel.FindButton(Key: Char): TCustomSpeedButton;
const
ButtonChars = '0123456789_./*-+Q%R='#8'C';
var
@ -884,9 +884,9 @@ begin
I:=0;
While (Result=Nil) and (I<ControlCount) do
begin
if Controls[I] is TSpeedButton then
If BtnTag=TSpeedButton(Controls[I]).Tag then
Result:=TSpeedButton(Controls[I]);
if Controls[I] is TCustomSpeedButton then
If BtnTag=TCustomSpeedButton(Controls[I]).Tag then
Result:=TCustomSpeedButton(Controls[I]);
Inc(I);
end;
end;

View File

@ -16,9 +16,9 @@
}
{------------------------------------------------------------------------------}
{ TBitBtn Constructor }
{ TCustomBitBtn Constructor }
{------------------------------------------------------------------------------}
constructor TBitBtn.Create(TheOwner: TComponent);
constructor TCustomBitBtn.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
FCompStyle := csBitBtn;
@ -34,15 +34,15 @@ begin
end;
{------------------------------------------------------------------------------}
{ TBitBtn destructor }
{ TCustomBitBtn destructor }
{------------------------------------------------------------------------------}
destructor TBitBtn.Destroy;
destructor TCustomBitBtn.Destroy;
Begin
FreeThenNil(FButtonGlyph);
inherited Destroy;
end;
Procedure TBitBtn.Click;
Procedure TCustomBitBtn.Click;
var
Form : TCustomForm;
Begin
@ -56,30 +56,30 @@ Begin
inherited Click;
End;
Function TBitBtn.GetGlyph : TBitmap;
Function TCustomBitBtn.GetGlyph : TBitmap;
Begin
Result := FButtonGlyph.Glyph;
end;
Function TBitBtn.IsGlyphStored: Boolean;
Function TCustomBitBtn.IsGlyphStored: Boolean;
begin
Result := (Kind = bkCustom) and (FButtonGlyph.Glyph <> nil)
and (not FButtonGlyph.Glyph.Empty)
and (FButtonGlyph.Glyph.Width>0) and (FButtonGlyph.Glyph.Height>0);
end;
Procedure TBitBtn.SetGlyph(AValue: TBitmap);
Procedure TCustomBitBtn.SetGlyph(AValue: TBitmap);
Begin
FButtonGlyph.Glyph := AValue;
end;
procedure TBitBtn.GlyphChanged(Sender: TObject);
procedure TCustomBitBtn.GlyphChanged(Sender: TObject);
begin
if HandleAllocated
then TWSBitBtnClass(WidgetSetClass).SetGlyph(Self, Glyph);
end;
procedure TBitBtn.ActionChange(Sender: TObject; CheckDefaults: Boolean);
procedure TCustomBitBtn.ActionChange(Sender: TObject; CheckDefaults: Boolean);
procedure CopyImage(ImageList: TCustomImageList; Index: Integer);
var
@ -107,7 +107,7 @@ begin
end;
end;
procedure TBitBtn.SetKind(AValue: TBitBtnKind);
procedure TCustomBitBtn.SetKind(AValue: TBitBtnKind);
Begin
if FKind = AValue then Exit;
FKind := AValue;
@ -116,7 +116,7 @@ Begin
RealizeKind;
end;
procedure TBitBtn.SetLayout(AValue: TButtonLayout);
procedure TCustomBitBtn.SetLayout(AValue: TButtonLayout);
Begin
if FLayout = AValue then Exit;
FLayout := AValue;
@ -124,7 +124,7 @@ Begin
then TWSBitBtnClass(WidgetSetClass).SetLayout(Self, FLayout);
end;
procedure TBitBtn.SetMargin(const AValue: integer);
procedure TCustomBitBtn.SetMargin(const AValue: integer);
begin
if FMargin = AValue then Exit;
FMargin := AValue;
@ -132,7 +132,7 @@ begin
then TWSBitBtnClass(WidgetSetClass).SetMargin(Self, FMargin);
end;
Procedure TBitBtn.SetSpacing(AValue: Integer);
Procedure TCustomBitBtn.SetSpacing(AValue: Integer);
Begin
if (FSpacing = AValue) or (AValue < 0) then Exit;
FSpacing := AValue;
@ -140,7 +140,7 @@ Begin
then TWSBitBtnClass(WidgetSetClass).SetSpacing(Self, FSpacing);
end;
procedure TBitBtn.RealizeKind;
procedure TCustomBitBtn.RealizeKind;
var
ABitmap: TBitmap;
begin
@ -164,7 +164,7 @@ end;
{ Return the caption associated with the akind value.
This function replaces BitBtnCaption const because the localizing
dont work with an const array }
function TBitBtn.GetCaptionOfKind(aKind: TBitBtnKind): String;
function TCustomBitBtn.GetCaptionOfKind(aKind: TBitBtnKind): String;
begin
Result:='';
case aKind of
@ -183,7 +183,7 @@ begin
end;
end;
procedure TBitBtn.InitializeWnd;
procedure TCustomBitBtn.InitializeWnd;
begin
inherited;
TWSBitBtnClass(WidgetSetClass).SetGlyph(Self, Glyph);

View File

@ -1,6 +1,6 @@
{%MainUnit ../buttons.pp}
{******************************************************************************
TButton
TCustomButton
******************************************************************************
*****************************************************************************
@ -227,6 +227,9 @@ end;
{ =============================================================================
$Log$
Revision 1.33 2004/07/15 10:43:38 mattias
added TCustomButton, TCustomBitBtn, TCustomSpeedButton
Revision 1.32 2004/07/13 10:34:15 mattias
fixed lcl package unit file name checklist.pas

View File

@ -40,7 +40,6 @@ procedure TControlCanvas.CreateFont;
begin
inherited CreateFont;
//DebugLn('TControlCanvas.CreateFont A ',ClassName,' Control=',Control.Name,':',Control.ClassName,' ',Font.Name,' ',Font.Height);
//if Control.ClassName='TSpeedButton' then RaiseGDBException('ARRGH');
end;
{------------------------------------------------------------------------------
@ -114,6 +113,9 @@ end;
{ =============================================================================
$Log$
Revision 1.8 2004/07/15 10:43:38 mattias
added TCustomButton, TCustomBitBtn, TCustomSpeedButton
Revision 1.7 2004/05/11 12:16:47 mattias
replaced writeln by debugln

View File

@ -368,10 +368,10 @@ begin
Case Key of
VK_Up,
VK_Right:
TSpeedButton(MaxBtn).Click;
TCustomSpeedButton(MaxBtn).Click;
VK_Down,
VK_Left:
TSpeedButton(MinBtn).Click;
TCustomSpeedButton(MinBtn).Click;
end;
end;

View File

@ -70,13 +70,14 @@ begin
// search old focused button
OldFocusControl:=FindOwnerControl(LCLIntf.GetFocus);
if (OldFocusControl=nil) or (GetParentForm(OldFocusControl)<>Self)
or (not (OldFocusControl is TButton)) then
or (not (OldFocusControl is TCustomButton)) then
begin
OldFocusControl:=nil;
for i:=0 to ComponentCount-1 do
if (Components[i] is TButton) and (TButton(Components[i]).Default) then
if (Components[i] is TCustomButton)
and (TCustomButton(Components[i]).Default) then
begin
OldFocusControl:=TButton(Components[i]);
OldFocusControl:=TCustomButton(Components[i]);
break;
end;
end;
@ -100,7 +101,7 @@ begin
inc(i);
if i>=ComponentCount then i:=0;
end;
if Components[i] is TButton then begin
if Components[i] is TCustomButton then begin
NewFocusControl:=TWinControl(Components[i]);
break;
end;
@ -337,9 +338,10 @@ begin
end;
for i:=0 to ComponentCount-1 do begin
if (Components[i] is TBitBtn) and (TBitBtn(Components[i]).Default) then
if (Components[i] is TCustomBitBtn)
and (TCustomBitBtn(Components[i]).Default) then
begin
ActiveControl:=TBitBtn(Components[i]);
ActiveControl:=TCustomBitBtn(Components[i]);
break;
end;
end;
@ -379,6 +381,9 @@ end;
{
$Log$
Revision 1.16 2004/07/15 10:43:38 mattias
added TCustomButton, TCustomBitBtn, TCustomSpeedButton
Revision 1.15 2004/04/20 09:18:44 micha
reserve enough space for glyph on button in message dialogs

View File

@ -1,7 +1,7 @@
{%MainUnit ../buttons.pp}
{******************************************************************************
TSpeedButton
TCustomSpeedButton
******************************************************************************
*****************************************************************************
@ -25,13 +25,13 @@
{$ENDIF}
{------------------------------------------------------------------------------
Method: TSpeedbutton.Create
Method: TCustomSpeedButton.Create
Params: none
Returns: Nothing
Constructor for the class.
------------------------------------------------------------------------------}
constructor TSpeedbutton.Create(AOwner: TComponent);
constructor TCustomSpeedButton.Create(AOwner: TComponent);
begin
Inherited Create(AOwner);
FCompStyle := csSpeedButton;
@ -51,36 +51,36 @@ begin
end;
{------------------------------------------------------------------------------
Method: TSpeedbutton.Destroy
Method: TCustomSpeedButton.Destroy
Params: None
Returns: Nothing
Destructor for the class.
------------------------------------------------------------------------------}
destructor TSpeedbutton.Destroy;
destructor TCustomSpeedButton.Destroy;
begin
FreeAndNil(FGlyph);
inherited Destroy;
end;
{------------------------------------------------------------------------------
Method: TSpeedbutton.Click
Method: TCustomSpeedButton.Click
Params:
Returns: nothing
------------------------------------------------------------------------------}
procedure TSpeedbutton.Click;
procedure TCustomSpeedButton.Click;
begin
inherited Click;
end;
{------------------------------------------------------------------------------
Method: TSpeedButton.SetAllowAllUp
Method: TCustomSpeedButton.SetAllowAllUp
Params: Value:
Returns: nothing
------------------------------------------------------------------------------}
procedure TSpeedButton.SetAllowAllUp(Value : Boolean);
procedure TCustomSpeedButton.SetAllowAllUp(Value : Boolean);
begin
if FAllowAllUp <> Value
then begin
@ -90,12 +90,12 @@ begin
end;
{------------------------------------------------------------------------------
Method: TSpeedButton.SetDown
Method: TCustomSpeedButton.SetDown
Params: Value:
Returns: nothing
------------------------------------------------------------------------------}
procedure TSpeedButton.SetDown(Value : Boolean);
procedure TCustomSpeedButton.SetDown(Value : Boolean);
var
OldState: TButtonState;
OldDown: Boolean;
@ -117,12 +117,12 @@ begin
end;
{------------------------------------------------------------------------------
Method: TSpeedButton.SetFlat
Method: TCustomSpeedButton.SetFlat
Params: Value:
Returns: nothing
------------------------------------------------------------------------------}
procedure TSpeedButton.SetFlat(const Value : boolean);
procedure TCustomSpeedButton.SetFlat(const Value : boolean);
begin
if FFlat <> Value then begin
FFlat := Value;
@ -131,24 +131,24 @@ begin
end;
{------------------------------------------------------------------------------
Method: TSpeedButton.SetGlyph
Method: TCustomSpeedButton.SetGlyph
Params: Value:
Returns: nothing
------------------------------------------------------------------------------}
procedure TSpeedButton.SetGlyph(Value : TBitmap);
procedure TCustomSpeedButton.SetGlyph(Value : TBitmap);
begin
FGlyph.Glyph := Value;
Invalidate;
end;
{------------------------------------------------------------------------------
Method: TSpeedButton.SetGroupIndex
Method: TCustomSpeedButton.SetGroupIndex
Params: Value:
Returns: nothing
------------------------------------------------------------------------------}
procedure TSpeedButton.SetGroupIndex(const Value : Integer);
procedure TCustomSpeedButton.SetGroupIndex(const Value : Integer);
begin
if FGroupIndex <> Value
then begin
@ -158,12 +158,12 @@ begin
end;
{------------------------------------------------------------------------------
Method: TSpeedButton.SetMargin
Method: TCustomSpeedButton.SetMargin
Params: Value:
Returns: nothing
------------------------------------------------------------------------------}
procedure TSpeedButton.SetMargin(const Value : Integer);
procedure TCustomSpeedButton.SetMargin(const Value : Integer);
begin
if FMargin <> Value then begin
FMargin := Value;
@ -172,12 +172,12 @@ begin
end;
{------------------------------------------------------------------------------
Method: TSpeedButton.SetNumGlyphs
Method: TCustomSpeedButton.SetNumGlyphs
Params: Value : Integer = Number of glyphs in the file/resource
Returns: nothing
------------------------------------------------------------------------------}
procedure TSpeedButton.SetNumGlyphs(Value : integer);
procedure TCustomSpeedButton.SetNumGlyphs(Value : integer);
Begin
if Value < 0 then Value := 1;
if Value > 4 then Value := 4;
@ -190,12 +190,12 @@ Begin
end;
{------------------------------------------------------------------------------
Method: TSpeedButton.SetSpacing
Method: TCustomSpeedButton.SetSpacing
Params: Value:
Returns: nothing
------------------------------------------------------------------------------}
procedure TSpeedButton.SetSpacing(const Value : Integer);
procedure TCustomSpeedButton.SetSpacing(const Value : Integer);
begin
if FSpacing <> Value then begin
FSpacing := Value;
@ -204,9 +204,9 @@ begin
end;
{------------------------------------------------------------------------------
procedure TSpeedButton.RealSetText(const Value: TCaption);
procedure TCustomSpeedButton.RealSetText(const Value: TCaption);
------------------------------------------------------------------------------}
procedure TSpeedButton.RealSetText(const Value: TCaption);
procedure TCustomSpeedButton.RealSetText(const Value: TCaption);
begin
if Caption=Value then exit;
inherited RealSetText(Value);
@ -214,9 +214,9 @@ begin
end;
{------------------------------------------------------------------------------
procedure TSpeedButton.UpdateState(InvalidateOnChange: boolean);
procedure TCustomSpeedButton.UpdateState(InvalidateOnChange: boolean);
------------------------------------------------------------------------------}
procedure TSpeedButton.UpdateState(InvalidateOnChange: boolean);
procedure TCustomSpeedButton.UpdateState(InvalidateOnChange: boolean);
var
OldState: TButtonState;
begin
@ -243,9 +243,9 @@ begin
end;
{------------------------------------------------------------------------------
function TSpeedButton.GetDrawFlags: integer;
function TCustomSpeedButton.GetDrawFlags: integer;
------------------------------------------------------------------------------}
function TSpeedButton.GetDrawFlags: integer;
function TCustomSpeedButton.GetDrawFlags: integer;
begin
// if flat and not mouse in control and not down, don't draw anything
if FFlat and not FMouseInControl and not (FState in [bsDown, bsExclusive]) then
@ -262,7 +262,7 @@ begin
end;
end;
procedure TSpeedButton.ActionChange(Sender: TObject; CheckDefaults: Boolean);
procedure TCustomSpeedButton.ActionChange(Sender: TObject; CheckDefaults: Boolean);
procedure CopyImage(ImageList: TCustomImageList; Index: Integer);
begin
@ -289,18 +289,18 @@ begin
end;
end;
function TSpeedButton.GetActionLinkClass: TControlActionLinkClass;
function TCustomSpeedButton.GetActionLinkClass: TControlActionLinkClass;
begin
Result := TSpeedButtonActionLink;
end;
{------------------------------------------------------------------------------
Method: TSpeedButton.UpdateExclusive
Method: TCustomSpeedButton.UpdateExclusive
Params: none
Returns: nothing
------------------------------------------------------------------------------}
procedure TSpeedButton.UpdateExclusive;
procedure TCustomSpeedButton.UpdateExclusive;
var
msg : TLMessage;
begin
@ -315,46 +315,46 @@ begin
end;
{------------------------------------------------------------------------------
Function: TSpeedButton.GetGlyph
Function: TCustomSpeedButton.GetGlyph
Params: none
Returns: The bitmap
------------------------------------------------------------------------------}
function TSpeedbutton.GetGlyph : TBitmap;
function TCustomSpeedButton.GetGlyph : TBitmap;
begin
Result := FGlyph.Glyph;
end;
{------------------------------------------------------------------------------
Method: TSpeedButton.GetNumGlyphs
Method: TCustomSpeedButton.GetNumGlyphs
Params: none
Returns: The number stored in TButtonGlyph(FGlyph).NumGlyphs
------------------------------------------------------------------------------}
Function TSpeedButton.GetNumGlyphs : Integer;
Function TCustomSpeedButton.GetNumGlyphs : Integer;
Begin
Result := TButtonGlyph(fGlyph).NumGlyphs;
end;
{------------------------------------------------------------------------------
Method: TSpeedButton.GlyphChanged
Method: TCustomSpeedButton.GlyphChanged
Params: Sender - The glyph that changed
Returns: zippo
------------------------------------------------------------------------------}
Procedure TSpeedButton.GlyphChanged(Sender : TObject);
Procedure TCustomSpeedButton.GlyphChanged(Sender : TObject);
Begin
//redraw the button;
Invalidate;
end;
{------------------------------------------------------------------------------
Method: TSpeedbutton.Paint
Method: TCustomSpeedButton.Paint
Params: none
Returns: nothing
------------------------------------------------------------------------------}
procedure TSpeedbutton.Paint;
procedure TCustomSpeedButton.Paint;
var
PaintRect: TRect;
GlyphWidth, GlyphHeight: Integer;
@ -377,13 +377,13 @@ begin
BrushStyle:= bsSolid;}
FLastDrawFlags:=GetDrawFlags;
//DebugLn('TSpeedbutton.Paint ',Name,':',ClassName,' Parent.Name=',Parent.Name);
//DebugLn('TCustomSpeedButton.Paint ',Name,':',ClassName,' Parent.Name=',Parent.Name);
// do not draw anything if flat and mouse not in control (simplified)
if FLastDrawFlags <> 0 then
DrawFrameControl(Canvas.GetUpdatedHandle([csBrushValid,csPenValid]),
PaintRect, DFC_BUTTON, FLastDrawFlags);
//writeln('TSpeedbutton.Paint ',Name,':',ClassName,' Parent.Name=',Parent.Name,
//writeln('TCustomSpeedButton.Paint ',Name,':',ClassName,' Parent.Name=',Parent.Name,
// ' DFCS_BUTTONPUSH=',FLastDrawFlags and DFCS_BUTTONPUSH,
// ' DFCS_PUSHED=',FLastDrawFlags and DFCS_PUSHED,
// ' DFCS_INACTIVE=',FLastDrawFlags and DFCS_INACTIVE,
@ -499,7 +499,7 @@ begin
end
else
Canvas.Font.Color := clBtnText;
//DebugLn('TSpeedButton.Paint PaintRect=',PaintRect.Left,',',PaintRect.TOp,',',PaintRect.Right,',',PaintRect.Bottom);
//DebugLn('TCustomSpeedButton.Paint PaintRect=',PaintRect.Left,',',PaintRect.TOp,',',PaintRect.Right,',',PaintRect.Bottom);
Canvas.TextRect(PaintRect, 0, 0, Caption, TXTStyle);
end;
@ -507,14 +507,14 @@ begin
end;
{------------------------------------------------------------------------------
Method: TSpeedButton.MouseDown
Method: TCustomSpeedButton.MouseDown
Params: Button:
Shift:
X, Y:
Returns: nothing
------------------------------------------------------------------------------}
procedure TSpeedButton.MouseDown(Button: TMouseButton; Shift: TShiftState;
procedure TCustomSpeedButton.MouseDown(Button: TMouseButton; Shift: TShiftState;
X, Y: Integer);
begin
inherited MouseDown(Button, Shift, X, Y);
@ -534,13 +534,13 @@ begin
end;
{------------------------------------------------------------------------------
Method: TSpeedButton.MouseMove
Method: TCustomSpeedButton.MouseMove
Params: Shift:
X, Y:
Returns: nothing
------------------------------------------------------------------------------}
procedure TSpeedButton.MouseMove(Shift: TShiftState; X, Y: Integer);
procedure TCustomSpeedButton.MouseMove(Shift: TShiftState; X, Y: Integer);
var
NewState: TButtonState;
begin
@ -573,14 +573,14 @@ begin
end;
{------------------------------------------------------------------------------
Method: TSpeedButton.MouseUp
Method: TCustomSpeedButton.MouseUp
Params: Button:
Shift:
X, Y:
Returns: nothing
------------------------------------------------------------------------------}
procedure TSpeedButton.MouseUp(Button: TMouseButton; Shift: TShiftState;
procedure TCustomSpeedButton.MouseUp(Button: TMouseButton; Shift: TShiftState;
X, Y: Integer);
var
OldState: TButtonState;
@ -603,12 +603,12 @@ begin
end;
{------------------------------------------------------------------------------
Method: TSpeedButton.SetLayout
Method: TCustomSpeedButton.SetLayout
Params: Value: new layout value
Returns: nothing
------------------------------------------------------------------------------}
procedure TSpeedButton.SetLayout(const Value : TButtonLayout);
procedure TCustomSpeedButton.SetLayout(const Value : TButtonLayout);
begin
if Value <> FLayout then begin
FLayout:= Value;
@ -617,12 +617,12 @@ begin
end;
{------------------------------------------------------------------------------
Method: TSpeedButton.SetTransparent
Method: TCustomSpeedButton.SetTransparent
Params: Value: new transparency value
Returns: nothing
------------------------------------------------------------------------------}
procedure TSpeedButton.SetTransparent(const Value : boolean);
procedure TCustomSpeedButton.SetTransparent(const Value : boolean);
begin
if Value <> FTransparent then begin
FTransparent:= Value;
@ -635,18 +635,18 @@ begin
end;
{------------------------------------------------------------------------------
Method: TSpeedButton.CMButtonPressed
Method: TCustomSpeedButton.CMButtonPressed
Params: Message:
Returns: nothing
------------------------------------------------------------------------------}
procedure TSpeedButton.CMButtonPressed(var Message : TLMessage);
procedure TCustomSpeedButton.CMButtonPressed(var Message : TLMessage);
var
Sender : TSpeedButton;
Sender : TCustomSpeedButton;
begin
if Message.WParam = WParam(FGroupIndex)
then begin
Sender := TSpeedButton(Message.LParam);
Sender := TCustomSpeedButton(Message.LParam);
if Sender <> Self
then begin
if Sender.Down and FDown
@ -662,24 +662,24 @@ end;
{------------------------------------------------------------------------------
Method: TSpeedButton.CMEnabledChanged
Method: TCustomSpeedButton.CMEnabledChanged
Params: Message:
Returns: nothing
------------------------------------------------------------------------------}
procedure TSpeedButton.CMEnabledChanged(var Message: TLMEssage);
procedure TCustomSpeedButton.CMEnabledChanged(var Message: TLMEssage);
Begin
//Should create a new glyph based on the new state
Invalidate;
end;
{------------------------------------------------------------------------------
Method: TSpeedButton.MouseEnter
Method: TCustomSpeedButton.MouseEnter
Params:
Returns: nothing
------------------------------------------------------------------------------}
procedure TSpeedButton.MouseEnter;
procedure TCustomSpeedButton.MouseEnter;
begin
inherited MouseEnter;
if csDesigning in ComponentState then exit;
@ -693,12 +693,12 @@ begin
end;
{------------------------------------------------------------------------------
Method: TSpeedButton.MouseLeave
Method: TCustomSpeedButton.MouseLeave
Params:
Returns: nothing
------------------------------------------------------------------------------}
procedure TSpeedButton.MouseLeave;
procedure TCustomSpeedButton.MouseLeave;
begin
inherited MouseLeave;
if csDesigning in ComponentState then exit;
@ -716,14 +716,14 @@ end;
procedure TSpeedButtonActionLink.AssignClient(AClient: TObject);
begin
inherited AssignClient(AClient);
FClient := AClient as TSpeedButton;
FClient := AClient as TCustomSpeedButton;
end;
function TSpeedButtonActionLink.IsCheckedLinked: Boolean;
var
SpeedButton: TSpeedButton;
SpeedButton: TCustomSpeedButton;
begin
SpeedButton:=TSpeedButton(FClient);
SpeedButton:=TCustomSpeedButton(FClient);
Result := inherited IsCheckedLinked
and (SpeedButton.GroupIndex <> 0)
and SpeedButton.AllowAllUp
@ -732,21 +732,21 @@ end;
function TSpeedButtonActionLink.IsGroupIndexLinked: Boolean;
var
SpeedButton: TSpeedButton;
SpeedButton: TCustomSpeedButton;
begin
SpeedButton:=TSpeedButton(FClient);
Result := (SpeedButton is TSpeedButton) and
SpeedButton:=TCustomSpeedButton(FClient);
Result := (SpeedButton is TCustomSpeedButton) and
(SpeedButton.GroupIndex = (Action as TCustomAction).GroupIndex);
end;
procedure TSpeedButtonActionLink.SetGroupIndex(Value: Integer);
begin
if IsGroupIndexLinked then TSpeedButton(FClient).GroupIndex := Value;
if IsGroupIndexLinked then TCustomSpeedButton(FClient).GroupIndex := Value;
end;
procedure TSpeedButtonActionLink.SetChecked(Value: Boolean);
begin
if IsCheckedLinked then TSpeedButton(FClient).Down := Value;
if IsCheckedLinked then TCustomSpeedButton(FClient).Down := Value;
end;
@ -761,8 +761,11 @@ end;
{ =============================================================================
$Log$
Revision 1.59 2004/07/15 10:43:38 mattias
added TCustomButton, TCustomBitBtn, TCustomSpeedButton
Revision 1.58 2004/07/13 17:47:15 mattias
fixed mouse enter/leave for TSpeedButton
fixed mouse enter/leave for TCustomSpeedButton
Revision 1.57 2004/06/28 20:03:33 mattias
fixed TGtkWidgetSet.DrawFrameControl
@ -797,13 +800,13 @@ end;
started new TToolBar
Revision 1.47 2004/02/10 00:05:03 mattias
TSpeedButton now uses MaskBlt
TCustomSpeedButton now uses MaskBlt
Revision 1.46 2004/02/05 09:45:33 mattias
implemented Actions for TSpeedButton, TMenuItem, TCheckBox
implemented Actions for TCustomSpeedButton, TMenuItem, TCheckBox
Revision 1.45 2004/02/02 18:01:31 mattias
added TSpeedButton.Action and TBitBtn.Action
added TCustomSpeedButton.Action and TBitBtn.Action
Revision 1.44 2003/12/29 14:22:22 micha
fix a lot of range check errors win32
@ -923,10 +926,10 @@ end;
MG: small bugfixes
Revision 1.25 2002/09/06 16:14:19 lazarus
MG: fixed removing TSpeedButton
MG: fixed removing TCustomSpeedButton
Revision 1.24 2002/09/03 22:31:25 lazarus
MG: removed old workaround in TSpeedButton
MG: removed old workaround in TCustomSpeedButton
Revision 1.23 2002/09/03 08:07:20 lazarus
MG: image support, TScrollBox, and many other things from Andrew
@ -944,7 +947,7 @@ end;
MG: fixed speedbutton in designmode
Revision 1.18 2002/08/24 13:41:29 lazarus
MG: fixed TSpeedButton.SetDown and Invalidate
MG: fixed TCustomSpeedButton.SetDown and Invalidate
Revision 1.17 2002/08/22 16:43:35 lazarus
MG: improved theme support from Andrew
@ -962,7 +965,7 @@ end;
MG: reduced hints
Revision 1.12 2002/02/24 20:51:24 lazarus
Improved TSpeedButton (Glyph, Spacing, Margin, drawing)
Improved TCustomSpeedButton (Glyph, Spacing, Margin, drawing)
Added PageCount to TNotebook
Optimized component selection buttons a bit.
@ -982,7 +985,7 @@ end;
MG: fixed many unreleased DC and GDIObj bugs
Revision 1.5 2001/02/06 14:52:47 lazarus
Changed TSpeedbutton in gtkobject so it erases itself when it's set to visible=false;
Changed TCustomSpeedButton in gtkobject so it erases itself when it's set to visible=false;
Shane
Revision 1.4 2001/01/12 18:46:50 lazarus

View File

@ -199,7 +199,8 @@ var
//Caption : AnsiString;
StrTemp : PChar; // same as "caption" but as PChar
p : pointer; // ptr to the newly created GtkWidget
Box : Pointer; // currently only used for TBitBtn and TForm and TListView
Box : Pointer; // currently only used for TCustomBitBtn
// and TCustomForm and TCustomListView
ParentForm: TCustomForm;
CompStyle : Longint;
DoFinishComp,
@ -277,6 +278,9 @@ end.
{
$Log$
Revision 1.26 2004/07/15 10:43:38 mattias
added TCustomButton, TCustomBitBtn, TCustomSpeedButton
Revision 1.25 2004/03/26 21:20:54 vincents
Fixed line endings

View File

@ -74,8 +74,8 @@ initialization
// To improve speed, register only classes
// which actually implement something
////////////////////////////////////////////////////
// RegisterWSComponent(TButton, TGnomeWSButton);
// RegisterWSComponent(TBitBtn, TGnomeWSBitBtn);
// RegisterWSComponent(TSpeedButton, TGnomeWSSpeedButton);
// RegisterWSComponent(TCustomButton, TGnomeWSButton);
// RegisterWSComponent(TCustomBitBtn, TGnomeWSBitBtn);
// RegisterWSComponent(TCustomSpeedButton, TGnomeWSSpeedButton);
////////////////////////////////////////////////////
end.

View File

@ -179,7 +179,7 @@ end;
{$IFDEF NoStyle}
exit;
{$ENDIF}
if not (AWinControl is TButton) then exit;
if not (AWinControl is TCustomButton) then exit;
DebugLn('ModifyWidgetStyle A ',AWinControl.Name,':',AWinControl.ClassName,' AWidget=',HexStr(Cardinal(AWidget),8));
RCStyle:=gtk_rc_style_new;
g_free(RCStyle^.font_name);
@ -3114,6 +3114,9 @@ end;
{ =============================================================================
$Log$
Revision 1.239 2004/07/15 10:43:38 mattias
added TCustomButton, TCustomBitBtn, TCustomSpeedButton
Revision 1.238 2004/07/10 18:17:30 mattias
added Delphi ToDo support, Application.WndProc, small bugfixes from Colin

View File

@ -3187,11 +3187,11 @@ begin
LM_BTNDEFAULT_CHANGED :
Begin
if (TButton(Sender).Default)
if (TCustomButton(Sender).Default)
and (GTK_WIDGET_CAN_DEFAULT(pgtkwidget(handle))) then
//gtk_widget_grab_default(pgtkwidget(handle))
else begin
{DebugLn('LM_BTNDEFAULT_CHANGED ',TButton(Sender).Name,':',Sender.ClassName,' widget can not grab default ',
{DebugLn('LM_BTNDEFAULT_CHANGED ',TCustomButton(Sender).Name,':',Sender.ClassName,' widget can not grab default ',
' visible=',GTK_WIDGET_VISIBLE(PGtkWidget(Handle)),
' realized=',GTK_WIDGET_REALIZED(PGtkWidget(Handle)),
' mapped=',GTK_WIDGET_MAPPED(PGtkWidget(Handle)),
@ -4646,7 +4646,7 @@ begin
LM_ENTER :
begin
if ALCLObject is TButton then
if ALCLObject is TCustomButton then
ConnectSenderSignal(gObject, 'enter', @gtkenterCB)
else
ConnectSenderSignal(gObject, 'focus-in-event', @gtkFocusInNotifyCB); //TODO: check this focus in is mapped to focus
@ -4654,7 +4654,7 @@ begin
LM_EXIT :
begin
if ALCLObject is TButton then
if ALCLObject is TCustomButton then
ConnectSenderSignal(gObject, 'leave', @gtkleaveCB)
else
ConnectSenderSignal(gObject, 'focus-out-event', @gtkFocusOutNotifyCB);
@ -9197,6 +9197,9 @@ end;
{ =============================================================================
$Log$
Revision 1.514 2004/07/15 10:43:39 mattias
added TCustomButton, TCustomBitBtn, TCustomSpeedButton
Revision 1.513 2004/07/11 17:20:47 marc
* Implemented most of TListColoum/Item in the Ws for gtk and win32

View File

@ -71,10 +71,10 @@ type
class procedure UpdateMargin(const AInfo: PBitBtnWidgetInfo; const ALayout: TButtonLayout; const AMargin: Integer);
public
class function CreateHandle(const AComponent: TComponent; const AParams: TCreateParams): THandle; override;
class procedure SetGlyph(const ABitBtn: TBitBtn; const AValue: TBitmap); override;
class procedure SetLayout(const ABitBtn: TBitBtn; const AValue: TButtonLayout); override;
class procedure SetMargin(const ABitBtn: TBitBtn; const AValue: Integer); override;
class procedure SetSpacing(const ABitBtn: TBitBtn; const AValue: Integer); override;
class procedure SetGlyph(const ABitBtn: TCustomBitBtn; const AValue: TBitmap); override;
class procedure SetLayout(const ABitBtn: TCustomBitBtn; const AValue: TButtonLayout); override;
class procedure SetMargin(const ABitBtn: TCustomBitBtn; const AValue: Integer); override;
class procedure SetSpacing(const ABitBtn: TCustomBitBtn; const AValue: Integer); override;
class procedure SetText(const AWinControl: TWinControl; const AText: String); override;
end;
@ -109,13 +109,14 @@ begin
end;
function TGtkWSButton.CreateHandle(const AComponent: TComponent; const AParams: TCreateParams): THandle;
function TGtkWSButton.CreateHandle(const AComponent: TComponent;
const AParams: TCreateParams): THandle;
var
Button: TButton;
Button: TCustomButton;
WidgetInfo: PWidgetInfo;
Allocation: TGTKAllocation;
begin
Button := AComponent as TButton;
Button := AComponent as TCustomButton;
Result := THandle(gtk_button_new_with_label('button'));
if Result = 0 then Exit;
@ -186,12 +187,12 @@ end;
function TGtkWSBitBtn.CreateHandle(const AComponent: TComponent; const AParams: TCreateParams): THandle;
var
BitBtn: TBitBtn;
BitBtn: TCustomBitBtn;
WidgetInfo: PWidgetInfo;
BitBtnInfo: PBitBtnWidgetInfo;
Allocation: TGTKAllocation;
begin
BitBtn := AComponent as TBitBtn;
BitBtn := AComponent as TCustomBitBtn;
Result := THandle(gtk_button_new);
if Result = 0 then Exit;
@ -229,7 +230,8 @@ begin
TGtkWSButton.SetCallbacks(PGtkWidget(Result), WidgetInfo);
end;
procedure TGtkWSBitBtn.SetGlyph(const ABitBtn: TBitBtn; const AValue: TBitmap);
procedure TGtkWSBitBtn.SetGlyph(const ABitBtn: TCustomBitBtn;
const AValue: TBitmap);
var
WidgetInfo: PWidgetInfo;
BitBtnInfo: PBitBtnWidgetInfo;
@ -267,7 +269,8 @@ begin
end;
end;
procedure TGtkWSBitBtn.SetLayout(const ABitBtn: TBitBtn; const AValue: TButtonLayout);
procedure TGtkWSBitBtn.SetLayout(const ABitBtn: TCustomBitBtn;
const AValue: TButtonLayout);
var
WidgetInfo: PWidgetInfo;
BitBtnInfo: PBitBtnWidgetInfo;
@ -280,7 +283,8 @@ begin
UpdateLayout(BitBtnInfo, AValue, ABitBtn.Margin);
end;
procedure TGtkWSBitBtn.SetMargin(const ABitBtn: TBitBtn; const AValue: Integer);
procedure TGtkWSBitBtn.SetMargin(const ABitBtn: TCustomBitBtn;
const AValue: Integer);
var
WidgetInfo: PWidgetInfo;
BitBtnInfo: PBitBtnWidgetInfo;
@ -293,7 +297,8 @@ begin
UpdateMargin(BitBtnInfo, ABitBtn.Layout, AValue);
end;
procedure TGtkWSBitBtn.SetSpacing(const ABitBtn: TBitBtn; const AValue: Integer);
procedure TGtkWSBitBtn.SetSpacing(const ABitBtn: TCustomBitBtn;
const AValue: Integer);
var
WidgetInfo: PWidgetInfo;
BitBtnInfo: PBitBtnWidgetInfo;
@ -451,8 +456,8 @@ initialization
// To improve speed, register only classes
// which actually implement something
////////////////////////////////////////////////////
RegisterWSComponent(TButton, TGtkWSButton);
RegisterWSComponent(TBitBtn, TGtkWSBitBtn); // register it to fallback to default
// RegisterWSComponent(TSpeedButton, TGtkWSSpeedButton);
RegisterWSComponent(TCustomButton, TGtkWSButton);
RegisterWSComponent(TCustomBitBtn, TGtkWSBitBtn); // register it to fallback to default
// RegisterWSComponent(TCustomSpeedButton, TGtkWSSpeedButton);
////////////////////////////////////////////////////
end.

View File

@ -213,9 +213,9 @@ var
CompStyle, // componentstyle (type) of GtkWidget which will be created
TempInt : Integer; // local use when neccessary
// - for csBitBtn
Box : Pointer; // currently only used for TBitBtn
pixmapwid : pGtkWidget; // currently only used for TBitBtn
label1 : pgtkwidget; // currently only used for TBitBtn
Box : Pointer; // currently only used for TCustomBitBtn
pixmapwid : pGtkWidget; // currently only used for TCustomBitBtn
label1 : pgtkwidget; // currently only used for TCustomBitBtn
ParentForm: TCustomForm;
AccelText : PChar;
AccelKey : guint;
@ -1380,6 +1380,9 @@ end;
{ =============================================================================
$Log$
Revision 1.13 2004/07/15 10:43:39 mattias
added TCustomButton, TCustomBitBtn, TCustomSpeedButton
Revision 1.12 2004/05/22 14:35:33 mattias
fixed button return key

View File

@ -74,8 +74,8 @@ initialization
// To improve speed, register only classes
// which actually implement something
////////////////////////////////////////////////////
// RegisterWSComponent(TButton, TGtk2WSButton);
// RegisterWSComponent(TBitBtn, TGtk2WSBitBtn);
// RegisterWSComponent(TSpeedButton, TGtk2WSSpeedButton);
// RegisterWSComponent(TCustomButton, TGtk2WSButton);
// RegisterWSComponent(TCUstomBitBtn, TGtk2WSBitBtn);
// RegisterWSComponent(TCustomSpeedButton, TGtk2WSSpeedButton);
////////////////////////////////////////////////////
end.

View File

@ -74,8 +74,8 @@ initialization
// To improve speed, register only classes
// which actually implement something
////////////////////////////////////////////////////
// RegisterWSComponent(TButton, TQtWSButton);
// RegisterWSComponent(TBitBtn, TQtWSBitBtn);
// RegisterWSComponent(TSpeedButton, TQtWSSpeedButton);
// RegisterWSComponent(TCustomButton, TQtWSButton);
// RegisterWSComponent(TCustomBitBtn, TQtWSBitBtn);
// RegisterWSComponent(TCustomSpeedButton, TQtWSSpeedButton);
////////////////////////////////////////////////////
end.

View File

@ -418,7 +418,7 @@ Begin
begin
if (Hi(WParam) = 0) or (Hi(WParam) = 1) then
LMessage.Msg := LM_ACTIVATE;
end else if OwnerObject is TButton then
end else if OwnerObject is TCustomButton then
case Hi(WParam) of
BN_CLICKED: LMessage.Msg := LM_CLICKED;
BN_KILLFOCUS: LMessage.Msg := LM_EXIT;
@ -1276,6 +1276,9 @@ end;
{
$Log$
Revision 1.128 2004/07/15 10:43:39 mattias
added TCustomButton, TCustomBitBtn, TCustomSpeedButton
Revision 1.127 2004/07/12 13:04:14 micha
cleanup: move default handling to DefaultHandler

View File

@ -137,7 +137,7 @@ Type
Procedure ResizeChild(Sender: TWinControl; Left, Top, Width, Height: Integer);
Procedure AssignSelf(Window: HWnd; Data: Pointer);
Procedure ReDraw(Child: TObject);
procedure DrawBitBtnImage(BitBtn: TBitBtn; ButtonCaption: PChar);
procedure DrawBitBtnImage(BitBtn: TCustomBitBtn; ButtonCaption: PChar);
Procedure SetLimitText(Window: HWND; Limit: Word);
Procedure ShowHide(Sender: TObject);
@ -285,6 +285,9 @@ End.
{ =============================================================================
$Log$
Revision 1.91 2004/07/15 10:43:39 mattias
added TCustomButton, TCustomBitBtn, TCustomSpeedButton
Revision 1.90 2004/07/11 17:20:47 marc
* Implemented most of TListColoum/Item in the Ws for gtk and win32

View File

@ -342,7 +342,7 @@ Begin
Case TControl(Sender).FCompStyle Of
csBitBtn:
DrawBitBtnImage(TBitBtn(Sender), PChar(Data));
DrawBitBtnImage(TCustomBitBtn(Sender), PChar(Data));
csFileDialog, csOpenFileDialog, csSaveFileDialog, csSelectDirectoryDialog,
csColorDialog, csFontDialog:
Begin
@ -598,7 +598,7 @@ Begin
LM_BTNDEFAULT_CHANGED:
Begin
WindowStyle := Windows.GetWindowLong(Handle, GWL_STYLE) and not (BS_DEFPUSHBUTTON or BS_PUSHBUTTON);
If TButton(Sender).Default then
If TCustomButton(Sender).Default then
WindowStyle := WindowStyle or BS_DEFPUSHBUTTON
else
WindowStyle := WindowStyle or BS_PUSHBUTTON;
@ -642,8 +642,8 @@ Begin
//TBitBtn
LM_IMAGECHANGED, LM_LAYOUTCHANGED:
Begin
if Sender is TBitBtn then
DrawBitBtnImage(TBitBtn(Sender), PChar(TBitBtn(Sender).Caption));
if Sender is TCustomBitBtn then
DrawBitBtnImage(TCustomBitBtn(Sender), PChar(TCustomBitBtn(Sender).Caption));
End;
{Displays a menu and makes it available for selection. Applications can use this function to display context-sensitive menus,
and will typically supply NULL for the parent_menu_shell, parent_menu_item, func and data parameters.
@ -739,15 +739,15 @@ activate_time : the time at which the activation event occurred.
Assert(False, Format('Trace:[TWin32WidgetSet.IntSendMessage3] %S --> Redraw', [Sender.ClassName]));
If Sender Is TCanvas Then
ReDraw(TCanvas(Sender))
Else If Not (Sender Is TSpeedbutton) Then
Else If Not (Sender Is TCustomSpeedbutton) Then
ReDraw(Sender)
Else If Sender Is TSpeedButton Then
If TSpeedbutton(Sender).Visible Then
TSpeedButton(Sender).Perform(LM_PAINT, 0, 0)
Else If Sender Is TCustomSpeedButton Then
If TCustomSpeedButton(Sender).Visible Then
TCustomSpeedButton(Sender).Perform(LM_PAINT, 0, 0)
Else
Begin
SizeRect := TSpeedButton(sender).BoundsRect;
InvalidateRect(TSpeedButton(Sender).Parent.Handle, @SizeRect, True);
SizeRect := TCustomSpeedButton(sender).BoundsRect;
InvalidateRect(TCustomSpeedButton(Sender).Parent.Handle, @SizeRect, True);
End;
End;
LM_ADDPAGE:
@ -1357,13 +1357,14 @@ type
{------------------------------------------------------------------------------
Method: TWin32WidgetSet.DrawBitBtnImage
Params: BitBtn: The TBitBtn to update the image of
Params: BitBtn: The TCustomBitBtn to update the image of
ButtonCaption: new button caption
Returns: Nothing
Updates the button image combining the glyph and caption
------------------------------------------------------------------------------}
procedure TWin32WidgetSet.DrawBitBtnImage(BitBtn: TBitBtn; ButtonCaption: PChar);
procedure TWin32WidgetSet.DrawBitBtnImage(BitBtn: TCustomBitBtn;
ButtonCaption: PChar);
var
BitmapHandle: HBITMAP; // Handle of the button glyph
BitBtnLayout: TButtonLayout; // Layout of button and glyph
@ -2172,7 +2173,7 @@ Begin
csBitBtn:
Begin
pClassName := 'BUTTON';
if TBitBtn(Sender).Default Then
if TCustomBitBtn(Sender).Default Then
Flags := Flags or BS_DEFPUSHBUTTON
else
Flags := Flags or BS_PUSHBUTTON;
@ -2182,7 +2183,7 @@ Begin
csButton:
Begin
Assert(False, 'Trace:CreateComponent - Creating Button');
if TButton(Sender).Default Then
if TCustomButton(Sender).Default Then
Flags := Flags or BS_DEFPUSHBUTTON
else
Flags := Flags or BS_PUSHBUTTON;
@ -3341,6 +3342,9 @@ End;
{
$Log$
Revision 1.222 2004/07/15 10:43:39 mattias
added TCustomButton, TCustomBitBtn, TCustomSpeedButton
Revision 1.221 2004/07/08 20:42:24 micha
cleanup: do not free nil resource

View File

@ -74,8 +74,8 @@ initialization
// To improve speed, register only classes
// which actually implement something
////////////////////////////////////////////////////
// RegisterWSComponent(TButton, TWin32WSButton);
// RegisterWSComponent(TBitBtn, TWin32WSBitBtn);
// RegisterWSComponent(TSpeedButton, TWin32WSSpeedButton);
// RegisterWSComponent(TCustomButton, TWin32WSButton);
// RegisterWSComponent(TCustomBitBtn, TWin32WSBitBtn);
// RegisterWSComponent(TCustomSpeedButton, TWin32WSSpeedButton);
////////////////////////////////////////////////////
end.

View File

@ -58,10 +58,10 @@ type
TWSBitBtnClass = class of TWSBitBtn;
TWSBitBtn = class(TWSButton)
class procedure SetGlyph(const ABitBtn: TBitBtn; const AValue: TBitmap); virtual;
class procedure SetLayout(const ABitBtn: TBitBtn; const AValue: TButtonLayout); virtual;
class procedure SetMargin(const ABitBtn: TBitBtn; const AValue: Integer); virtual;
class procedure SetSpacing(const ABitBtn: TBitBtn; const AValue: Integer); virtual;
class procedure SetGlyph(const ABitBtn: TCustomBitBtn; const AValue: TBitmap); virtual;
class procedure SetLayout(const ABitBtn: TCustomBitBtn; const AValue: TButtonLayout); virtual;
class procedure SetMargin(const ABitBtn: TCustomBitBtn; const AValue: Integer); virtual;
class procedure SetSpacing(const ABitBtn: TCustomBitBtn; const AValue: Integer); virtual;
end;
{ TWSSpeedButton }
@ -79,26 +79,30 @@ uses
{ TWSBitBtn }
procedure TWSBitBtn.SetGlyph(const ABitBtn: TBitBtn; const AValue: TBitmap);
procedure TWSBitBtn.SetGlyph(const ABitBtn: TCustomBitBtn;
const AValue: TBitmap);
begin
//TODO: remove when implemented for win32
CNSendMessage(LM_IMAGECHANGED, ABitBtn, nil);
ABitBtn.Invalidate;
end;
procedure TWSBitBtn.SetLayout(const ABitBtn: TBitBtn; const AValue: TButtonLayout);
procedure TWSBitBtn.SetLayout(const ABitBtn: TCustomBitBtn;
const AValue: TButtonLayout);
begin
//TODO: remove when implemented for win32
CNSendMessage(LM_LAYOUTCHANGED, ABitBtn, nil);
end;
procedure TWSBitBtn.SetMargin(const ABitBtn: TBitBtn; const AValue: Integer);
procedure TWSBitBtn.SetMargin(const ABitBtn: TCustomBitBtn;
const AValue: Integer);
begin
//TODO: remove when implemented for win32
CNSendMessage(LM_LAYOUTCHANGED, ABitBtn, nil);
end;
procedure TWSBitBtn.SetSpacing(const ABitBtn: TBitBtn; const AValue: Integer);
procedure TWSBitBtn.SetSpacing(const ABitBtn: TCustomBitBtn;
const AValue: Integer);
begin
//TODO: remove when implemented for win32
CNSendMessage(LM_LAYOUTCHANGED, ABitBtn, nil);
@ -111,8 +115,8 @@ initialization
// To improve speed, register only classes
// which actually implement something
////////////////////////////////////////////////////
// RegisterWSComponent(TButton, TWSButton);
RegisterWSComponent(TBitBtn, TWSBitBtn);
// RegisterWSComponent(TSpeedButton, TWSSpeedButton);
// RegisterWSComponent(CustomTButton, TWSButton);
RegisterWSComponent(TCustomBitBtn, TWSBitBtn);
// RegisterWSComponent(TCustomSpeedButton, TWSSpeedButton);
////////////////////////////////////////////////////
end.

View File

@ -49,7 +49,9 @@ fi
TmpDir=/tmp/fpc_patchdir
if [ "$WithTempDir" = "yes" ]; then
rm -rf $TmpDir
cp -a $FPCSourceDir $TmpDir
mkdir $TmpDir
rsync -aq --exclude="*.ppu" --exclude="*.o" --exclude="*.ppw" --exclude="CVS" \
--exclude="cvslog" $FPCSourceDir $TmpDir
else
TmpDir=$FPCSourceDir
fi