mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 18:19:34 +02:00
Improved TSpeedButton (Glyph, Spacing, Margin, drawing)
Added PageCount to TNotebook Optimized component selection buttons a bit. git-svn-id: trunk@1456 -
This commit is contained in:
parent
b84b0b9b70
commit
8d718a011d
@ -26,13 +26,14 @@ program checkbox;
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
classes, stdctrls, forms, buttons, menus, comctrls, sysutils,
|
classes, stdctrls, forms, buttons, menus, comctrls, sysutils,
|
||||||
extctrls, graphtype, controls;
|
extctrls, graphtype, graphics, controls;
|
||||||
|
|
||||||
type
|
type
|
||||||
TForm1 = class(TFORM)
|
TForm1 = class(TFORM)
|
||||||
public
|
public
|
||||||
Button2: TButton;
|
Button2: TButton;
|
||||||
Button3: TButton;
|
Button3: TButton;
|
||||||
|
Button11, Button12, Button13 : TSpeedButton;
|
||||||
Panel1: TPanel;
|
Panel1: TPanel;
|
||||||
mnuMain: TMainMenu;
|
mnuMain: TMainMenu;
|
||||||
itmFileQuit: TMenuItem;
|
itmFileQuit: TMenuItem;
|
||||||
@ -46,6 +47,7 @@ type
|
|||||||
ToggleBox : TToggleBox;
|
ToggleBox : TToggleBox;
|
||||||
label1 : TLabel;
|
label1 : TLabel;
|
||||||
label2 : TLabel;
|
label2 : TLabel;
|
||||||
|
FPixmap : TPixMap;
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
procedure LoadMainMenu;
|
procedure LoadMainMenu;
|
||||||
Procedure FormKill(Sender : TObject);
|
Procedure FormKill(Sender : TObject);
|
||||||
@ -215,6 +217,44 @@ begin
|
|||||||
Button2.Caption := 'Toggle checkbox';
|
Button2.Caption := 'Toggle checkbox';
|
||||||
Button2.OnClick := @Button2Click;
|
Button2.OnClick := @Button2Click;
|
||||||
|
|
||||||
|
FPixMap:= TPixmap.Create;
|
||||||
|
FPixmap.LoadFromFile('../images/btn_newform.xpm');
|
||||||
|
|
||||||
|
Button11 := TSpeedButton.Create(Self);
|
||||||
|
Button11.GroupIndex:= 1;
|
||||||
|
Button11.Layout:= blGlyphTop;
|
||||||
|
// Button11.Caption:= 'Option 1';
|
||||||
|
Button11.Parent := Self;
|
||||||
|
Button11.Left := 5;
|
||||||
|
Button11.Top := 5;
|
||||||
|
Button11.Width:= 45;
|
||||||
|
Button11.Height:= 55;
|
||||||
|
Button11.Flat:= true;
|
||||||
|
Button11.Glyph:= FPixmap;
|
||||||
|
// Button11.Spacing:= -1;
|
||||||
|
// Button11.Margin:= 4;
|
||||||
|
Button11.Visible:= true;
|
||||||
|
|
||||||
|
Button12 := TSpeedButton.Create(Self);
|
||||||
|
Button12.GroupIndex:= 1;
|
||||||
|
Button12.Caption:= '2';
|
||||||
|
Button12.Parent := Self;
|
||||||
|
Button12.Left := 55;
|
||||||
|
Button12.Top := 5;
|
||||||
|
// Button12.Flat:= true;
|
||||||
|
Button12.Visible:= true;
|
||||||
|
|
||||||
|
Button13 := TSpeedButton.Create(Self);
|
||||||
|
Button13.GroupIndex:= 1;
|
||||||
|
Button13.Caption:= '3';
|
||||||
|
Button13.Parent := Self;
|
||||||
|
Button13.Left := 95;
|
||||||
|
Button13.Top := 5;
|
||||||
|
Button13.Flat:= true;
|
||||||
|
Button13.AllowAllUp:= true;
|
||||||
|
Button13.Visible:= true;
|
||||||
|
|
||||||
|
|
||||||
{ Create a label which shows the caption of the active radiobutton }
|
{ Create a label which shows the caption of the active radiobutton }
|
||||||
label2 := TLabel.Create(Self);
|
label2 := TLabel.Create(Self);
|
||||||
label2.Parent := self;
|
label2.Parent := self;
|
||||||
@ -365,6 +405,11 @@ end.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.3 2002/02/24 20:51:23 lazarus
|
||||||
|
Improved TSpeedButton (Glyph, Spacing, Margin, drawing)
|
||||||
|
Added PageCount to TNotebook
|
||||||
|
Optimized component selection buttons a bit.
|
||||||
|
|
||||||
Revision 1.2 2002/02/03 00:24:00 lazarus
|
Revision 1.2 2002/02/03 00:24:00 lazarus
|
||||||
TPanel implemented.
|
TPanel implemented.
|
||||||
Basic graphic primitives split into GraphType package, so that we can
|
Basic graphic primitives split into GraphType package, so that we can
|
||||||
|
110
ide/main.pp
110
ide/main.pp
@ -642,7 +642,7 @@ begin
|
|||||||
GlobalMouseSpeedButton := TSpeedButton.Create(Self);
|
GlobalMouseSpeedButton := TSpeedButton.Create(Self);
|
||||||
SelectionPointerPixmap:=LoadSpeedBtnPixMap('tmouse');
|
SelectionPointerPixmap:=LoadSpeedBtnPixMap('tmouse');
|
||||||
with GlobalMouseSpeedButton do
|
with GlobalMouseSpeedButton do
|
||||||
Begin
|
begin
|
||||||
Parent := ComponentNotebook.Page[PageCount];
|
Parent := ComponentNotebook.Page[PageCount];
|
||||||
Parent.OnMouseMove := @MainMouseMoved; //this is for the hints
|
Parent.OnMouseMove := @MainMouseMoved; //this is for the hints
|
||||||
Enabled := True;
|
Enabled := True;
|
||||||
@ -652,6 +652,7 @@ begin
|
|||||||
Glyph := SelectionPointerPixmap;
|
Glyph := SelectionPointerPixmap;
|
||||||
Visible := True;
|
Visible := True;
|
||||||
Flat := True;
|
Flat := True;
|
||||||
|
GroupIndex:= 1;
|
||||||
Down := True;
|
Down := True;
|
||||||
Name := 'GlobalMouseSpeedButton'+IntToStr(PageCount);
|
Name := 'GlobalMouseSpeedButton'+IntToStr(PageCount);
|
||||||
Hint := 'Selection tool';
|
Hint := 'Selection tool';
|
||||||
@ -668,6 +669,7 @@ begin
|
|||||||
IDEComponent.SpeedButton.Hint := RegComp.ComponentClass.ClassName;
|
IDEComponent.SpeedButton.Hint := RegComp.ComponentClass.ClassName;
|
||||||
IDEComponent.SpeedButton.Name := IDEComponent.SpeedButton.Hint;
|
IDEComponent.SpeedButton.Name := IDEComponent.SpeedButton.Hint;
|
||||||
IDEComponent.SpeedButton.ShowHint := True;
|
IDEComponent.SpeedButton.ShowHint := True;
|
||||||
|
IDEComponent.SpeedButton.GroupIndex := 1;
|
||||||
IDECompList.Add(IDEComponent);
|
IDECompList.Add(IDEComponent);
|
||||||
end;
|
end;
|
||||||
inc(PageCount);
|
inc(PageCount);
|
||||||
@ -1634,118 +1636,31 @@ end;
|
|||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
}
|
}
|
||||||
|
|
||||||
Procedure TMainIDE.ControlClick(Sender : TObject);
|
procedure TMainIDE.ControlClick(Sender : TObject);
|
||||||
var
|
var
|
||||||
I : Integer;
|
|
||||||
IDECOmp : TIDEComponent;
|
IDECOmp : TIDEComponent;
|
||||||
Speedbutton : TSpeedbutton;
|
Speedbutton : TSpeedbutton;
|
||||||
Temp : TControl;
|
i : integer;
|
||||||
begin
|
begin
|
||||||
if Sender is TSpeedButton then
|
if Sender is TSpeedButton then
|
||||||
Begin
|
begin
|
||||||
// Writeln('sender is a speedbutton');
|
|
||||||
// Writeln('The name is '+TSpeedbutton(sender).name);
|
|
||||||
SpeedButton := TSpeedButton(Sender);
|
SpeedButton := TSpeedButton(Sender);
|
||||||
// Writeln('Speedbutton s Name is '+SpeedButton.name);
|
|
||||||
//find the IDECOmponent that has this speedbutton
|
//find the IDECOmponent that has this speedbutton
|
||||||
IDEComp := IDECompList.FindCompBySpeedButton(SpeedButton);
|
IDEComp := IDECompList.FindCompBySpeedButton(SpeedButton);
|
||||||
if SelectedComponent <> nil then
|
if IDECOmp <> nil then begin
|
||||||
TIDeComponent(
|
|
||||||
IdeCompList.FindCompByRegComponent(SelectedComponent)).SpeedButton.Down
|
|
||||||
:= False
|
|
||||||
else begin
|
|
||||||
Temp := nil;
|
|
||||||
for i := 0 to
|
|
||||||
ComponentNotebook.Page[ComponentNotebook.Pageindex].ControlCount-1
|
|
||||||
do begin
|
|
||||||
if CompareText(
|
|
||||||
TControl(ComponentNotebook.
|
|
||||||
Page[ComponentNotebook.Pageindex].Controls[I]).Name
|
|
||||||
,'GlobalMouseSpeedButton'
|
|
||||||
+IntToStr(ComponentNotebook.Pageindex)) = 0 then
|
|
||||||
begin
|
|
||||||
temp := TControl(ComponentNotebook.
|
|
||||||
Page[ComponentNotebook.Pageindex].Controls[i]);
|
|
||||||
Break;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
if temp <> nil then
|
|
||||||
TSpeedButton(Temp).down := False
|
|
||||||
else begin
|
|
||||||
Writeln('[TMainIDE.ControlClick] ERROR - Control ',
|
|
||||||
'GlobalMouseSpeedButton',
|
|
||||||
IntToStr(ComponentNotebook.PageIndex),' not found');
|
|
||||||
Halt;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
if IDECOmp <> nil then Begin
|
|
||||||
//draw this button down
|
|
||||||
SpeedButton.Down := True;
|
|
||||||
SelectedComponent := IDEComp.RegisteredComponent;
|
SelectedComponent := IDEComp.RegisteredComponent;
|
||||||
end else begin
|
end else begin
|
||||||
SelectedComponent := nil;
|
SelectedComponent := nil;
|
||||||
Temp := nil;
|
|
||||||
for i := 0 to
|
|
||||||
ComponentNotebook.Page[ComponentNotebook.Pageindex].ControlCount-1 do
|
|
||||||
begin
|
|
||||||
if CompareText(
|
|
||||||
TControl(ComponentNotebook.
|
|
||||||
Page[ComponentNotebook.Pageindex].Controls[I]).Name
|
|
||||||
,'GlobalMouseSpeedButton'
|
|
||||||
+IntToStr(ComponentNotebook.Pageindex)) = 0 then
|
|
||||||
begin
|
|
||||||
temp := TControl(ComponentNotebook.
|
|
||||||
Page[ComponentNotebook.Pageindex].Controls[i]);
|
|
||||||
Break;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
if temp <> nil then
|
|
||||||
TSpeedButton(Temp).down := True
|
|
||||||
else begin
|
|
||||||
Writeln('[TMainIDE.ControlClick] ERROR - Control '
|
|
||||||
+'GlobalMouseSpeedButton'
|
|
||||||
+IntToStr(ComponentNotebook.Pageindex)+' not found');
|
|
||||||
Halt;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
Begin
|
begin
|
||||||
// Writeln('must be nil');
|
|
||||||
//draw old speedbutton up
|
|
||||||
if SelectedComponent <> nil then
|
|
||||||
TIDeComponent(
|
|
||||||
IdeCompList.FindCompByRegComponent(SelectedComponent)).SpeedButton.Down
|
|
||||||
:= False;
|
|
||||||
SelectedComponent := nil;
|
SelectedComponent := nil;
|
||||||
Temp := nil;
|
for i:= 0 to ComponentNotebook.PageCount - 1 do begin
|
||||||
for i := 0 to
|
(ComponentNotebook.Page[i].Controls[0] as TSpeedButton).Down:= true;
|
||||||
ComponentNotebook.Page[ComponentNotebook.Pageindex].ControlCount-1 do
|
|
||||||
begin
|
|
||||||
if CompareText(
|
|
||||||
TControl(ComponentNotebook.
|
|
||||||
Page[ComponentNotebook.Pageindex].Controls[I]).Name
|
|
||||||
,'GlobalMouseSpeedButton'
|
|
||||||
+IntToStr(ComponentNotebook.Pageindex)) = 0 then
|
|
||||||
begin
|
|
||||||
temp := TControl(ComponentNotebook.
|
|
||||||
Page[ComponentNotebook.Pageindex].Controls[i]);
|
|
||||||
Break;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
if temp <> nil then
|
|
||||||
TSpeedButton(Temp).down := True
|
|
||||||
else begin
|
|
||||||
Writeln('[TMainIDE.ControlClick] ERROR - Control '
|
|
||||||
+'GlobalMouseSpeedButton'
|
|
||||||
+IntToStr(ComponentNotebook.Pageindex)+' not found');
|
|
||||||
Halt;
|
|
||||||
end;
|
end;
|
||||||
end;
|
|
||||||
// Writeln('Exiting ControlClick');
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
procedure TMainIDE.mnuFindDeclarationClicked(Sender : TObject);
|
procedure TMainIDE.mnuFindDeclarationClicked(Sender : TObject);
|
||||||
@ -6107,6 +6022,11 @@ end.
|
|||||||
|
|
||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.231 2002/02/24 20:51:22 lazarus
|
||||||
|
Improved TSpeedButton (Glyph, Spacing, Margin, drawing)
|
||||||
|
Added PageCount to TNotebook
|
||||||
|
Optimized component selection buttons a bit.
|
||||||
|
|
||||||
Revision 1.230 2002/02/22 17:39:40 lazarus
|
Revision 1.230 2002/02/22 17:39:40 lazarus
|
||||||
MG: improved LinkScanner error messages
|
MG: improved LinkScanner error messages
|
||||||
|
|
||||||
|
@ -33,7 +33,8 @@ interface
|
|||||||
{$ASSERTIONS ON}
|
{$ASSERTIONS ON}
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
uses stdctrls, vclglobals, classes, LCLType, LCLLinux,graphics,sysutils, controls, lMessages,Forms, messages;
|
uses StdCtrls, VCLGlobals, Classes, LCLType, LCLLinux,
|
||||||
|
GraphType, Graphics, SysUtils, Controls, lMessages, Forms, Messages;
|
||||||
|
|
||||||
type
|
type
|
||||||
TButtonLayout = (blGlyphLeft, blGlyphRight, blGlyphTop, blGlyphBottom);
|
TButtonLayout = (blGlyphLeft, blGlyphRight, blGlyphTop, blGlyphBottom);
|
||||||
@ -96,16 +97,14 @@ type
|
|||||||
FNumGlyphs : TNumGlyphs;
|
FNumGlyphs : TNumGlyphs;
|
||||||
|
|
||||||
FOnChange : TNotifyEvent;
|
FOnChange : TNotifyEvent;
|
||||||
|
procedure SetGlyph(Value : TBitmap);
|
||||||
Procedure SetGlyph(Value : TBitmap);
|
procedure SetNumGlyphs(Value : TNumGlyphs);
|
||||||
Procedure SetNumGlyphs(Value : TNumGlyphs);
|
|
||||||
protected
|
protected
|
||||||
public
|
public
|
||||||
constructor Create;
|
constructor Create;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
|
|
||||||
function Draw(Canvas: TCanvas; const Client: TRect; const Offset: TPoint;
|
function Draw(Canvas: TCanvas; const Client: TRect; const Offset: TPoint;
|
||||||
const Caption: string; Layout: TButtonLayout; Margin, Spacing: Integer;
|
|
||||||
State: TButtonState; Transparent: Boolean; BiDiFlags: Longint): TRect;
|
State: TButtonState; Transparent: Boolean; BiDiFlags: Longint): TRect;
|
||||||
property Glyph : TBitmap read FOriginal write SetGlyph;
|
property Glyph : TBitmap read FOriginal write SetGlyph;
|
||||||
property NumGlyphs : TNumGlyphs read FNumGlyphs write SetNumGlyphs;
|
property NumGlyphs : TNumGlyphs read FNumGlyphs write SetNumGlyphs;
|
||||||
@ -155,48 +154,55 @@ type
|
|||||||
FGlyph: TButtonGlyph;
|
FGlyph: TButtonGlyph;
|
||||||
FGroupIndex : Integer;
|
FGroupIndex : Integer;
|
||||||
FLayout: TButtonLayout;
|
FLayout: TButtonLayout;
|
||||||
FMargin : Integer;
|
FMargin : integer;
|
||||||
FMouseInControl : Boolean;
|
FMouseInControl : Boolean;
|
||||||
FSpacing : Integer;
|
FSpacing : integer;
|
||||||
FState : TButtonState;
|
FState : TButtonState;
|
||||||
FTransparent : Boolean;
|
FTransparent : Boolean;
|
||||||
Function GetGlyph : TBitmap;
|
function GetGlyph : TBitmap;
|
||||||
Procedure UpdateExclusive;
|
procedure UpdateExclusive;
|
||||||
Procedure UpdateTracking;
|
procedure UpdateTracking;
|
||||||
Procedure SetAllowAllUp(Value : Boolean);
|
procedure SetAllowAllUp(Value : Boolean);
|
||||||
Procedure SetGlyph(value : TBitmap);
|
procedure SetGlyph(value : TBitmap);
|
||||||
//there should be a procedure called settransparent but it's not used at this point
|
procedure SetLayout(const Value : TButtonLayout);
|
||||||
Procedure CMButtonPressed(var MEssage : TLMessage); message CM_BUTTONPRESSED;
|
procedure SetTransparent(const Value : boolean);
|
||||||
Procedure CMMouseEnter(var Message :TLMessage); message CM_MouseEnter;
|
procedure CMButtonPressed(var MEssage : TLMessage); message CM_BUTTONPRESSED;
|
||||||
Procedure CMMouseLeave(var Message :TLMessage); message CM_MouseLeave;
|
procedure CMMouseEnter(var Message :TLMessage); message CM_MouseEnter;
|
||||||
Procedure CMEnabledChanged(var Message: TLMessage); message CM_ENABLEDCHANGED;
|
procedure CMMouseLeave(var Message :TLMessage); message CM_MouseLeave;
|
||||||
|
procedure CMEnabledChanged(var Message: TLMessage); message CM_ENABLEDCHANGED;
|
||||||
protected
|
protected
|
||||||
function GetNumGlyphs : Integer;
|
function GetNumGlyphs : Integer;
|
||||||
Procedure GlyphChanged(Sender : TObject);
|
procedure GlyphChanged(Sender : TObject);
|
||||||
procedure MouseDown(Button: TMouseButton; Shift: TShiftState;
|
procedure MouseDown(Button: TMouseButton; Shift: TShiftState;
|
||||||
X, Y: Integer); override;
|
X, Y: Integer); override;
|
||||||
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
|
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
|
||||||
procedure MouseUp(Button: TMouseButton; Shift: TShiftState;
|
procedure MouseUp(Button: TMouseButton; Shift: TShiftState;
|
||||||
X, Y: Integer); override;
|
X, Y: Integer); override;
|
||||||
Procedure Paint; override;
|
procedure Paint; override;
|
||||||
procedure SetDown(Value : Boolean);
|
procedure SetDown(Value : Boolean);
|
||||||
procedure SetGroupIndex(Value : Integer);
|
procedure SetGroupIndex(const Value : Integer);
|
||||||
procedure SetFlat(Value : Boolean);
|
procedure SetFlat(const Value : Boolean);
|
||||||
procedure SetNumGlyphs(Value : Integer);
|
procedure SetMargin(const Value : integer);
|
||||||
|
procedure SetNumGlyphs(Value : integer);
|
||||||
|
procedure SetSpacing(const Value : integer);
|
||||||
property MouseInControl : Boolean read FMOuseInControl;
|
property MouseInControl : Boolean read FMOuseInControl;
|
||||||
public
|
public
|
||||||
constructor Create(AOwner : TComponent); override;
|
constructor Create(AOwner : TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
procedure Click; override;
|
procedure Click; override;
|
||||||
property Down : Boolean read FDown write SetDown default false;
|
|
||||||
property GroupIndex : Integer read FGroupIndex write SetGroupIndex default 0;
|
|
||||||
property Flat : Boolean read FFlat write SetFlat default false;
|
|
||||||
property NumGlyphs : Integer read GetNumGlyphs write SetNumGlyphs default 1;
|
|
||||||
published
|
published
|
||||||
property AllowAllUp : Boolean read FAllowAllUp write SetAllowAllUp default false;
|
property AllowAllUp : Boolean read FAllowAllUp write SetAllowAllUp default false;
|
||||||
|
property Caption;
|
||||||
|
property Down : Boolean read FDown write SetDown default false;
|
||||||
property Enabled;
|
property Enabled;
|
||||||
|
property Flat : Boolean read FFlat write SetFlat default false;
|
||||||
property Glyph : TBitmap read GetGlyph write SetGlyph;
|
property Glyph : TBitmap read GetGlyph write SetGlyph;
|
||||||
property Transparent : Boolean read FTransparent write FTransparent default false;
|
property GroupIndex : Integer read FGroupIndex write SetGroupIndex default 0;
|
||||||
|
property Layout : TButtonLayout read FLayout write SetLayout default blGlyphLeft;
|
||||||
|
property Margin : integer read FMargin write SetMargin default -1;
|
||||||
|
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;
|
||||||
property Visible;
|
property Visible;
|
||||||
property OnClick;
|
property OnClick;
|
||||||
end;
|
end;
|
||||||
@ -237,6 +243,11 @@ end.
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.13 2002/02/24 20:51:23 lazarus
|
||||||
|
Improved TSpeedButton (Glyph, Spacing, Margin, drawing)
|
||||||
|
Added PageCount to TNotebook
|
||||||
|
Optimized component selection buttons a bit.
|
||||||
|
|
||||||
Revision 1.12 2002/02/06 08:58:29 lazarus
|
Revision 1.12 2002/02/06 08:58:29 lazarus
|
||||||
MG: fixed compiler warnings and asking to create non existing files
|
MG: fixed compiler warnings and asking to create non existing files
|
||||||
|
|
||||||
|
@ -121,6 +121,7 @@ type
|
|||||||
Procedure CNNotify(var Message : TLMNotify); message CN_NOTIFY;
|
Procedure CNNotify(var Message : TLMNotify); message CN_NOTIFY;
|
||||||
function GetActivePage: String;
|
function GetActivePage: String;
|
||||||
function GetPage(aIndex: Integer): TPage;
|
function GetPage(aIndex: Integer): TPage;
|
||||||
|
function GetPageCount : integer;
|
||||||
function GetPageIndex: Integer;
|
function GetPageIndex: Integer;
|
||||||
//function InternalSetMultiLine(Value: boolean): boolean;
|
//function InternalSetMultiLine(Value: boolean): boolean;
|
||||||
procedure SetActivePage(const Value: String);
|
procedure SetActivePage(const Value: String);
|
||||||
@ -141,6 +142,7 @@ type
|
|||||||
property ActivePage: String read GetActivePage write SetActivePage;
|
property ActivePage: String read GetActivePage write SetActivePage;
|
||||||
//property MultiLine: boolean read fMultiLine write SetMultiLine default false;
|
//property MultiLine: boolean read fMultiLine write SetMultiLine default false;
|
||||||
property Page[Index: Integer]: TPage read GetPage;
|
property Page[Index: Integer]: TPage read GetPage;
|
||||||
|
property PageCount : integer read GetPageCount;
|
||||||
property PageIndex: Integer read GetPageIndex write SetPageIndex default 0;
|
property PageIndex: Integer read GetPageIndex write SetPageIndex default 0;
|
||||||
property PageList: TList read fPageList;
|
property PageList: TList read fPageList;
|
||||||
property Pages: TStrings read fAccess write SetPages;
|
property Pages: TStrings read fAccess write SetPages;
|
||||||
@ -163,6 +165,7 @@ type
|
|||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
property Page;
|
property Page;
|
||||||
|
property PageCount;
|
||||||
property Pages;
|
property Pages;
|
||||||
published
|
published
|
||||||
property ActivePage;
|
property ActivePage;
|
||||||
@ -432,6 +435,11 @@ end.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.18 2002/02/24 20:51:23 lazarus
|
||||||
|
Improved TSpeedButton (Glyph, Spacing, Margin, drawing)
|
||||||
|
Added PageCount to TNotebook
|
||||||
|
Optimized component selection buttons a bit.
|
||||||
|
|
||||||
Revision 1.17 2002/02/03 00:24:00 lazarus
|
Revision 1.17 2002/02/03 00:24:00 lazarus
|
||||||
TPanel implemented.
|
TPanel implemented.
|
||||||
Basic graphic primitives split into GraphType package, so that we can
|
Basic graphic primitives split into GraphType package, so that we can
|
||||||
|
@ -19,21 +19,28 @@ end;
|
|||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
{ TButtonGlyph SetGlyph }
|
{ TButtonGlyph SetGlyph }
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
Procedure TButtonGlyph.SetGlyph(Value : TBitmap);
|
procedure TButtonGlyph.SetGlyph(Value : TBitmap);
|
||||||
Begin
|
var GlyphCount : integer;
|
||||||
|
begin
|
||||||
if FOriginal = Value then exit;
|
if FOriginal = Value then exit;
|
||||||
//Invalidate;
|
// FOriginal.Assign(Value);
|
||||||
FOriginal.Free;
|
FOriginal.Free;
|
||||||
FOriginal:= Value;
|
FOriginal:= Value;
|
||||||
//FOriginal.Assign(Value);
|
if (Value <> nil) and (Value.Height > 0) then begin
|
||||||
|
if Value.Width mod Value.Height = 0 then begin
|
||||||
|
GlyphCount:= Value.Width div Value.Height;
|
||||||
|
if GlyphCount > 4 then GlyphCount:= 1;
|
||||||
|
NumGlyphs:= GlyphCount;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
//Invalidate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
{ TButtonGlyph Draw }
|
{ TButtonGlyph Draw }
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
Function TButtonGlyph.Draw(Canvas: TCanvas; const Client: TRect;
|
Function TButtonGlyph.Draw(Canvas: TCanvas; const Client: TRect;
|
||||||
const Offset: TPoint; const Caption: string; Layout: TButtonLayout;
|
const Offset: TPoint; State: TButtonState; Transparent: Boolean;
|
||||||
Margin, Spacing: Integer; State: TButtonState; Transparent: Boolean;
|
|
||||||
BiDiFlags: Longint): TRect;
|
BiDiFlags: Longint): TRect;
|
||||||
var
|
var
|
||||||
gWidth : integer;
|
gWidth : integer;
|
||||||
@ -41,6 +48,9 @@ var
|
|||||||
DestRect: TRect;
|
DestRect: TRect;
|
||||||
ImgID: integer;
|
ImgID: integer;
|
||||||
begin
|
begin
|
||||||
|
if FOriginal = nil then Exit;
|
||||||
|
if (FOriginal.Width = 0) or (FOriginal.Height = 0) then Exit;
|
||||||
|
|
||||||
gWidth := TPixMap(FOriginal).Width;
|
gWidth := TPixMap(FOriginal).Width;
|
||||||
gHeight := TPixMap(FOriginal).Height;
|
gHeight := TPixMap(FOriginal).Height;
|
||||||
if NumGlyphs > 1 then
|
if NumGlyphs > 1 then
|
||||||
@ -68,13 +78,10 @@ end;
|
|||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
{ TButtonGlyph SetNumGlyphs }
|
{ TButtonGlyph SetNumGlyphs }
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
Procedure TButtonGlyph.SetNumGlyphs(Value : TNumGlyphs);
|
procedure TButtonGlyph.SetNumGlyphs(Value : TNumGlyphs);
|
||||||
Begin
|
begin
|
||||||
if Value <> FNumGlyphs then
|
if Value <> FNumGlyphs then begin
|
||||||
Begin
|
|
||||||
FNumGlyphs := Value;
|
FNumGlyphs := Value;
|
||||||
if Assigned(FOnChange) then FOnChange(Glyph);
|
if Assigned(FOnChange) then FOnChange(Glyph);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -348,6 +348,15 @@ begin
|
|||||||
Result := fPageIndex;
|
Result := fPageIndex;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------
|
||||||
|
TCustomNotebook GetPageCount
|
||||||
|
------------------------------------------------------------------------------}
|
||||||
|
function TCustomNotebook.GetPageCount: Integer;
|
||||||
|
begin
|
||||||
|
Result := fPageList.Count;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
TCustomNotebook SetPages
|
TCustomNotebook SetPages
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
@ -526,6 +535,11 @@ end;}
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.13 2002/02/24 20:51:24 lazarus
|
||||||
|
Improved TSpeedButton (Glyph, Spacing, Margin, drawing)
|
||||||
|
Added PageCount to TNotebook
|
||||||
|
Optimized component selection buttons a bit.
|
||||||
|
|
||||||
Revision 1.12 2002/01/01 15:50:14 lazarus
|
Revision 1.12 2002/01/01 15:50:14 lazarus
|
||||||
MG: fixed initial component aligning
|
MG: fixed initial component aligning
|
||||||
|
|
||||||
|
@ -28,6 +28,8 @@ begin
|
|||||||
|
|
||||||
{set default alignment}
|
{set default alignment}
|
||||||
Align := alNone;
|
Align := alNone;
|
||||||
|
FLayout:= blGlyphLeft;
|
||||||
|
FAllowAllUp:= false;
|
||||||
FMouseInControl := False;
|
FMouseInControl := False;
|
||||||
FDragging := False;
|
FDragging := False;
|
||||||
FSpacing := 4;
|
FSpacing := 4;
|
||||||
@ -82,15 +84,14 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
procedure TSpeedButton.SetDown(Value : Boolean);
|
procedure TSpeedButton.SetDown(Value : Boolean);
|
||||||
begin
|
begin
|
||||||
if FDown <> value
|
if FGroupIndex = 0 then Value:= false;
|
||||||
then begin
|
if FDown <> Value then begin
|
||||||
|
if FDown and not FAllowAllUp then Exit;
|
||||||
FDown := Value;
|
FDown := Value;
|
||||||
if FDown
|
if FDown then begin
|
||||||
then begin
|
|
||||||
if FState = bsUp then Invalidate;
|
if FState = bsUp then Invalidate;
|
||||||
fState := bsExclusive;
|
fState := bsExclusive;
|
||||||
end
|
end else begin
|
||||||
else begin
|
|
||||||
FState := bsUp;
|
FState := bsUp;
|
||||||
Repaint;
|
Repaint;
|
||||||
end;
|
end;
|
||||||
@ -104,11 +105,13 @@ end;
|
|||||||
Returns: nothing
|
Returns: nothing
|
||||||
|
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
procedure TSpeedButton.SetFlat(Value : Boolean);
|
procedure TSpeedButton.SetFlat(const Value : boolean);
|
||||||
begin
|
begin
|
||||||
|
if FFlat <> Value then begin
|
||||||
FFlat := Value;
|
FFlat := Value;
|
||||||
Invalidate;
|
Invalidate;
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Method: TSpeedButton.SetGlyph
|
Method: TSpeedButton.SetGlyph
|
||||||
@ -128,7 +131,7 @@ end;
|
|||||||
Returns: nothing
|
Returns: nothing
|
||||||
|
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
procedure TSpeedButton.SetGroupIndex(Value : Integer);
|
procedure TSpeedButton.SetGroupIndex(const Value : Integer);
|
||||||
begin
|
begin
|
||||||
if FGroupIndex <> Value
|
if FGroupIndex <> Value
|
||||||
then begin
|
then begin
|
||||||
@ -137,13 +140,27 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------
|
||||||
|
Method: TSpeedButton.SetMargin
|
||||||
|
Params: Value:
|
||||||
|
Returns: nothing
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------}
|
||||||
|
procedure TSpeedButton.SetMargin(const Value : Integer);
|
||||||
|
begin
|
||||||
|
if FMargin <> Value then begin
|
||||||
|
FMargin := Value;
|
||||||
|
Invalidate;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Method: TSpeedButton.SetNumGlyphs
|
Method: TSpeedButton.SetNumGlyphs
|
||||||
Params: Value : Integer = Number of glyphs in the file/resource
|
Params: Value : Integer = Number of glyphs in the file/resource
|
||||||
Returns: nothing
|
Returns: nothing
|
||||||
|
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
procedure TSpeedButton.SetNumGlyphs(Value : Integer);
|
procedure TSpeedButton.SetNumGlyphs(Value : integer);
|
||||||
Begin
|
Begin
|
||||||
if Value < 0 then Value := 1;
|
if Value < 0 then Value := 1;
|
||||||
if Value > 4 then Value := 4;
|
if Value > 4 then Value := 4;
|
||||||
@ -155,6 +172,19 @@ Begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------
|
||||||
|
Method: TSpeedButton.SetSpacing
|
||||||
|
Params: Value:
|
||||||
|
Returns: nothing
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------}
|
||||||
|
procedure TSpeedButton.SetSpacing(const Value : Integer);
|
||||||
|
begin
|
||||||
|
if FSpacing <> Value then begin
|
||||||
|
FSpacing := Value;
|
||||||
|
Invalidate;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Method: TSpeedButton.UpdateExclusive
|
Method: TSpeedButton.UpdateExclusive
|
||||||
@ -219,23 +249,21 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
procedure TSpeedbutton.Paint;
|
procedure TSpeedbutton.Paint;
|
||||||
const
|
const
|
||||||
// DownStyles: array[Boolean] of Integer = (BDR_RAISEDINNER, BDR_SUNKENOUTER);
|
|
||||||
DownStyles: array[Boolean] of Integer = (BDR_RAISEDINNER, BDR_SUNKENINNER);
|
DownStyles: array[Boolean] of Integer = (BDR_RAISEDINNER, BDR_SUNKENINNER);
|
||||||
FillStyles: array[Boolean] of Integer = (BF_MIDDLE, 0);
|
FillStyles: array[Boolean] of Integer = (BF_MIDDLE, 0);
|
||||||
var
|
var
|
||||||
PaintRect: TRect;
|
PaintRect: TRect;
|
||||||
DrawFlags, GlyphWidth, GlyphHeight: Integer;
|
DrawFlags, GlyphWidth, GlyphHeight: Integer;
|
||||||
//R : TRect;
|
Offset, OffsetCap: TPoint;
|
||||||
Offset: TPoint;
|
ClientSize, TotalSize, TextSize: TSize;
|
||||||
|
BrushStyle : TBrushStyle;
|
||||||
|
M, S : integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if not Enabled
|
if not Enabled then begin
|
||||||
then begin
|
|
||||||
FState := bsDisabled;
|
FState := bsDisabled;
|
||||||
FDragging := False;
|
FDragging := False;
|
||||||
end
|
end else begin
|
||||||
// else
|
|
||||||
// if not Visible then exit
|
|
||||||
else begin
|
|
||||||
if FState = bsDisabled
|
if FState = bsDisabled
|
||||||
then begin
|
then begin
|
||||||
if FDown and (GroupIndex <> 0)
|
if FDown and (GroupIndex <> 0)
|
||||||
@ -248,64 +276,126 @@ begin
|
|||||||
PaintRect := Bounds(Left, Top, Width, Height);
|
PaintRect := Bounds(Left, Top, Width, Height);
|
||||||
// PaintRect := Rect(0, 0, Width, Height);
|
// PaintRect := Rect(0, 0, Width, Height);
|
||||||
|
|
||||||
if not FFlat then
|
if Transparent and not (csDesigning in ComponentState) then
|
||||||
begin
|
BrushStyle:= bsClear
|
||||||
DrawFlags := DFCS_BUTTONPUSH or DFCS_ADJUSTRECT;
|
else
|
||||||
if FState in [bsDown, bsExclusive]
|
BrushStyle:= bsSolid;
|
||||||
then DrawFlags := DrawFlags or DFCS_PUSHED;
|
|
||||||
DrawFrameControl(Canvas.Handle, PaintRect, DFC_BUTTON, DrawFlags);
|
Canvas.Brush.Color:= clBtnFace;
|
||||||
end
|
Canvas.FillRect(PaintRect);
|
||||||
else begin //flat
|
|
||||||
|
if FFlat then begin
|
||||||
if (FState in [bsDown, bsExclusive])
|
if (FState in [bsDown, bsExclusive])
|
||||||
or (FMouseInControl and (FState <> bsDisabled))
|
or (FMouseInControl and (FState <> bsDisabled))
|
||||||
or (csDesigning in ComponentState)
|
or (csDesigning in ComponentState)
|
||||||
then begin
|
then begin
|
||||||
Canvas.Brush.Color := clbtnface;//color;
|
|
||||||
// Fillrect doesnt paint the outer right and bottom border
|
|
||||||
Canvas.FillRect(PaintRect);
|
|
||||||
DrawEdge(Canvas.Handle, PaintRect,
|
DrawEdge(Canvas.Handle, PaintRect,
|
||||||
DOWNSTYLES[FState in [bsDown, bsExclusive]],
|
DOWNSTYLES[FState in [bsDown, bsExclusive]],
|
||||||
FILLSTYLES[Transparent] or BF_RECT)
|
FILLSTYLES[Transparent] or BF_RECT)
|
||||||
end else
|
|
||||||
if not Transparent
|
|
||||||
then begin
|
|
||||||
Canvas.Brush.Color := clbtnface;//color;
|
|
||||||
// Fillrect doesnt paint the outer right and bottom border
|
|
||||||
Canvas.FillRect(PaintRect);
|
|
||||||
end;
|
end;
|
||||||
InflateRect(PaintRect, -1, -1);
|
InflateRect(PaintRect, -1, -1);
|
||||||
|
end else begin
|
||||||
|
DrawFlags := DFCS_BUTTONPUSH or DFCS_ADJUSTRECT;
|
||||||
|
if FState in [bsDown, bsExclusive]
|
||||||
|
then DrawFlags := DrawFlags or DFCS_PUSHED;
|
||||||
|
DrawFrameControl(Canvas.Handle, PaintRect, DFC_BUTTON, DrawFlags);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if FState in [bsDown, bsExclusive] then begin
|
if FState in [bsDown, bsExclusive] then begin
|
||||||
if (FState = bsExclusive)
|
if (FState = bsExclusive) and (not FFlat or not FMouseInControl)
|
||||||
and (not FFlat or not FMouseInControl)
|
|
||||||
then begin
|
then begin
|
||||||
//this needs to be done yet.
|
//this needs to be done yet.
|
||||||
Assert(False,'Trace:TODO: ALLOCPATTERNBITMAP');
|
Assert(False,'Trace:TODO: ALLOCPATTERNBITMAP');
|
||||||
// Canvas.Brush.Bitmap := AllocPatternBitmap(clBtnFace, clBtnHighlight);
|
// Canvas.Brush.Bitmap := AllocPatternBitmap(clBtnFace, clBtnHighlight);
|
||||||
|
Canvas.Brush.Color:= clBtnHighlight;
|
||||||
Canvas.FillRect(PaintRect);
|
Canvas.FillRect(PaintRect);
|
||||||
end;
|
end;
|
||||||
Offset.X := 1;
|
|
||||||
Offset.Y := 1;
|
|
||||||
end
|
|
||||||
else begin
|
|
||||||
Offset.X := 0;
|
|
||||||
Offset.Y := 0;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
GlyphWidth:= TButtonGlyph(FGlyph).Glyph.Width;
|
GlyphWidth:= TButtonGlyph(FGlyph).Glyph.Width;
|
||||||
if TButtonGlyph(FGlyph).NumGlyphs > 1 then
|
if TButtonGlyph(FGlyph).NumGlyphs > 1 then
|
||||||
GlyphWidth:=GlyphWidth div NumGlyphs;
|
GlyphWidth:=GlyphWidth div NumGlyphs;
|
||||||
GlyphHeight:=TButtonGlyph(FGlyph).Glyph.Height;
|
GlyphHeight:=TButtonGlyph(FGlyph).Glyph.Height;
|
||||||
|
|
||||||
inc(Offset.X,(PaintRect.Right-PaintRect.Left-GlyphWidth) div 2);
|
ClientSize.cx:= PaintRect.Right - PaintRect.Left;
|
||||||
inc(Offset.Y,(PaintRect.Bottom-PaintRect.Top-GlyphHeight) div 2);
|
ClientSize.cy:= PaintRect.Bottom - PaintRect.Top;
|
||||||
|
|
||||||
|
if Caption <> '' then
|
||||||
|
TextSize:= Canvas.TextExtent(Caption)
|
||||||
|
else begin
|
||||||
|
TextSize.cx:= 0;
|
||||||
|
TextSize.cy:= 0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
if (GlyphWidth = 0) or (GlyphHeight = 0) or (TextSize.cx = 0) or (TextSize.cy = 0) then
|
||||||
|
S:= 0
|
||||||
|
else
|
||||||
|
S:= Spacing;
|
||||||
|
|
||||||
|
{ Calculate caption and glyph layout }
|
||||||
|
|
||||||
|
if Margin = -1 then begin
|
||||||
|
if S = -1 then begin
|
||||||
|
TotalSize.cx:= TextSize.cx + GlyphWidth;
|
||||||
|
TotalSize.cy:= TextSize.cy + GlyphHeight;
|
||||||
|
if Layout in [blGlyphLeft, blGlyphRight] then
|
||||||
|
M:= (ClientSize.cx - TotalSize.cx) div 3
|
||||||
|
else
|
||||||
|
M:= (ClientSize.cy - TotalSize.cy) div 3;
|
||||||
|
S:= M;
|
||||||
|
end else begin
|
||||||
|
TotalSize.cx:= GlyphWidth + S + TextSize.cx;
|
||||||
|
TotalSize.cy:= GlyphHeight + S + TextSize.cy;
|
||||||
|
if Layout in [blGlyphLeft, blGlyphRight] then
|
||||||
|
M:= (ClientSize.cx - TotalSize.cx + 1) div 2
|
||||||
|
else
|
||||||
|
M:= (ClientSize.cy - TotalSize.cy + 1) div 2
|
||||||
|
end;
|
||||||
|
end else begin
|
||||||
|
if S = -1 then begin
|
||||||
|
TotalSize.cx:= ClientSize.cx - (Margin + GlyphWidth);
|
||||||
|
TotalSize.cy:= ClientSize.cy - (Margin + GlyphHeight);
|
||||||
|
if Layout in [blGlyphLeft, blGlyphRight] then
|
||||||
|
S:= (TotalSize.cx - TextSize.cx) div 2
|
||||||
|
else
|
||||||
|
S:= (TotalSize.cy - TextSize.cy) div 2;
|
||||||
|
end;
|
||||||
|
M:= Margin
|
||||||
|
end;
|
||||||
|
|
||||||
|
case Layout of
|
||||||
|
blGlyphLeft : begin
|
||||||
|
Offset.X:= M;
|
||||||
|
Offset.Y:= (ClientSize.cy - GlyphHeight + 1) div 2;
|
||||||
|
OffsetCap.X:= Offset.X + GlyphWidth + S;
|
||||||
|
OffsetCap.Y:= (ClientSize.cy - TextSize.cy) div 2;
|
||||||
|
end;
|
||||||
|
blGlyphRight : begin
|
||||||
|
Offset.X:= ClientSize.cx - M - GlyphWidth;
|
||||||
|
Offset.Y:= (ClientSize.cy - GlyphHeight + 1) div 2;
|
||||||
|
OffsetCap.X:= Offset.X - S - TextSize.cx;
|
||||||
|
OffsetCap.Y:= (ClientSize.cy - TextSize.cy) div 2;
|
||||||
|
end;
|
||||||
|
blGlyphTop : begin
|
||||||
|
Offset.X:= (ClientSize.cx - GlyphWidth + 1) div 2;
|
||||||
|
Offset.Y:= M;
|
||||||
|
OffsetCap.X:= (ClientSize.cx - TextSize.cx + 1) div 2;
|
||||||
|
OffsetCap.Y:= Offset.Y + GlyphHeight + S;
|
||||||
|
end;
|
||||||
|
blGlyphBottom : begin
|
||||||
|
Offset.X:= (ClientSize.cx - GlyphWidth + 1) div 2;
|
||||||
|
Offset.Y:= ClientSize.cy - M - GlyphHeight;
|
||||||
|
OffsetCap.X:= (ClientSize.cx - TextSize.cx + 1) div 2;
|
||||||
|
OffsetCap.Y:= Offset.Y - S - TextSize.cy;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
//this needs to be done yet.
|
//this needs to be done yet.
|
||||||
Assert(False,'Trace:TODO: DRAWTEXTBIDIMODEFLAGS');
|
//Assert(False,'Trace:TODO: DRAWTEXTBIDIMODEFLAGS');
|
||||||
TButtonGlyph(FGlyph).Draw(Canvas, PaintRect, Offset, Caption, FLayout, FMargin,
|
|
||||||
FSpacing, FState, Transparent, (0));
|
FGlyph.Draw(Canvas, PaintRect, Offset, FState, Transparent, 0);
|
||||||
|
if Caption <> '' then
|
||||||
|
Canvas.TextOut(PaintRect.Left + OffsetCap.X, PaintRect.Top + OffsetCap.Y, Caption);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -443,6 +533,36 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------
|
||||||
|
Method: TSpeedButton.SetLayout
|
||||||
|
Params: Value: new layout value
|
||||||
|
Returns: nothing
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------}
|
||||||
|
procedure TSpeedButton.SetLayout(const Value : TButtonLayout);
|
||||||
|
begin
|
||||||
|
if Value <> FLayout then begin
|
||||||
|
FLayout:= Value;
|
||||||
|
Invalidate;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------
|
||||||
|
Method: TSpeedButton.SetTransparent
|
||||||
|
Params: Value: new transparency value
|
||||||
|
Returns: nothing
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------}
|
||||||
|
procedure TSpeedButton.SetTransparent(const Value : boolean);
|
||||||
|
begin
|
||||||
|
if Value <> FTransparent then begin
|
||||||
|
FTransparent:= Value;
|
||||||
|
if Value then ControlStyle:= ControlStyle + [csOpaque]
|
||||||
|
else ControlStyle:= ControlStyle - [csOpaque];
|
||||||
|
Invalidate;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Method: TSpeedButton.CMButtonPressed
|
Method: TSpeedButton.CMButtonPressed
|
||||||
Params: Message:
|
Params: Message:
|
||||||
@ -533,6 +653,11 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.12 2002/02/24 20:51:24 lazarus
|
||||||
|
Improved TSpeedButton (Glyph, Spacing, Margin, drawing)
|
||||||
|
Added PageCount to TNotebook
|
||||||
|
Optimized component selection buttons a bit.
|
||||||
|
|
||||||
Revision 1.11 2001/11/22 14:33:26 lazarus
|
Revision 1.11 2001/11/22 14:33:26 lazarus
|
||||||
MG: fixed painting background of flat speedbuttons
|
MG: fixed painting background of flat speedbuttons
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user