The Speedbutton now has a numglyphs setting.

I started the TStringPropertyEditor

git-svn-id: trunk@91 -
This commit is contained in:
lazarus 2001-01-03 18:44:54 +00:00
parent 4187ae3f25
commit 2f4f81f07e
11 changed files with 440 additions and 23 deletions

View File

@ -286,6 +286,7 @@ begin
Visible:=false; Visible:=false;
Enabled:=false; Enabled:=false;
OnClick:=@ValueButtonClick; OnClick:=@ValueButtonClick;
Caption := '...';
Parent:=Self; Parent:=Self;
end; end;

View File

@ -583,6 +583,19 @@ type
function GetAttributes: TPropertyAttributes; override; function GetAttributes: TPropertyAttributes; override;
end; end;
{ TStringsPropertyEditor
PropertyEditor editor for the TStrings property. Brings up the dialog for entering test. }
TStringsPropertyEditor = class(TClassPropertyEditor)
public
procedure Edit; override;
function GetValue: string; override;
function GetAttributes: TPropertyAttributes; override;
procedure GetValues(Proc: TGetStringProc);
procedure SetValue(const NewValue: string); override;
end;
//============================================================================== //==============================================================================
@ -802,6 +815,7 @@ type
FPenStyle:TPenStyle; FPenStyle:TPenStyle;
FTabOrder:integer; FTabOrder:integer;
FCaption:TCaption; FCaption:TCaption;
FLines:TStrings;
function PTypeInfos(const PropName:string):PTypeInfo; function PTypeInfos(const PropName:string):PTypeInfo;
constructor Create; constructor Create;
destructor Destroy; override; destructor Destroy; override;
@ -814,6 +828,7 @@ type
property PenStyle:TPenStyle read FPenStyle; property PenStyle:TPenStyle read FPenStyle;
property TabOrder:integer read FTabOrder; property TabOrder:integer read FTabOrder;
property Caption:TCaption read FCaption; property Caption:TCaption read FCaption;
property Lines:TStrings read FLines;
end; end;
//============================================================================== //==============================================================================
@ -920,10 +935,8 @@ const
TBoolPropertyEditor, // tkBool TBoolPropertyEditor, // tkBool
TInt64PropertyEditor, // tkInt64 TInt64PropertyEditor, // tkInt64
nil // tkQWord nil // tkQWord
{$IFDEF VER1_1_0}
,nil // tkDynArray ,nil // tkDynArray
,nil // tkInterfaceRaw ,nil // tkInterfaceRaw
{$ENDIF}
); );
// XXX ToDo: There are bugs in the typinfo.pp. Thus this workaround ------- // XXX ToDo: There are bugs in the typinfo.pp. Thus this workaround -------
@ -2894,6 +2907,137 @@ begin
Result := [paMultiSelect, paAutoUpdate, paRevertable]; Result := [paMultiSelect, paAutoUpdate, paRevertable];
end; end;
{ TStringsPropertyEditor }
type
TStringsPropEditor = class(TForm)
public
Memo1 : TMemo;
OKButton : TButton;
CancelButton : TButton;
constructor Create(AOwner : TComponent); override;
end;
constructor TStringsPropEditor.Create(AOwner : TComponent);
Begin
inherited;
position := poScreenCenter;
Height := 200;
Width := 300;
Memo1 := TMemo.Create(self);
Memo1.Parent := Self;
Memo1.Left := 0;
Memo1.Top := 0;
memo1.Height := Height-50;
Memo1.Width := Width -1;
memo1.Visible := true;
OKButton := TButton.Create(self);
with OKButton do
Begin
Parent := self;
Caption := '&OK';
ModalResult := mrOK;
Left := self.width div 2;
top := self.height -45;
Visible := true;
end;
CancelButton := TButton.Create(self);
with CancelButton do
Begin
Parent := self;
Caption := '&Cancel';
ModalResult := mrCancel;
Left := (self.width div 2) + 75;
top := self.height -45;
Visible := true;
end;
end;
procedure TStringsPropertyEditor.Edit;
type
TGetStrFunc=function(const StrValue:string):Integer of object;
var
TheDialog: TStringsPropEditor;
I:Integer;
Values:TStringList;
AddValue:TGetStrFunc;
StringsType: PTypeInfo;
Count : Integer;
begin
Writeln('edit');
Count := 0;
Values:=TStringList.Create;
try
AddValue:=@Values.Add;
GetValues(TGetStringProc(AddValue));
writeln('Create the TheDialog');
TheDialog:=TStringsPropEditor.Create(Application);
writeln('Created the TheDialog');
TheDialog.Memo1.Lines.Assign(Values);
TheDialog.Caption:='Strings Editor Dialog';
try
if (TheDialog.ShowModal = mrOK) then
begin
//what do I do here?
end;
finally
TheDialog.Free;
end;
finally
Values.Free;
end;
end;
procedure TStringsPropertyEditor.GetValues(Proc: TGetStringProc);
var
I: Integer;
StringsType: PTypeInfo;
begin
Writeln('GETVALUES');
//what do I do here?
StringsType := GetPropType;
with GetTypeData(StringsType)^ do
for I := MinValue to MaxValue do Proc(GetStrValueAt(I));
end;
function TStringsPropertyEditor.GetAttributes: TPropertyAttributes;
begin
Result := [paMultiSelect,paDialog, paRevertable];
end;
function TStringsPropertyEditor.GetValue: string;
Begin
Writeln('GETVALUE');
Result := '(TStrings)';
end;
procedure TStringsPropertyEditor.SetValue(const NewValue: string);
var
I: Integer;
begin
Writeln('SETVALUES');
{ I := GetStrValueA(GetPropType, NewValue);
if I < 0 then begin
{raise EPropertyError.CreateRes(@SInvalidPropertyValue)};
exit;
end;
SetStrValue(I);
}
end;
//============================================================================== //==============================================================================
@ -3188,6 +3332,8 @@ initialization
nil,'',TTabOrderPropertyEditor); nil,'',TTabOrderPropertyEditor);
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('shortstring'), RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('shortstring'),
nil,'',TCaptionPropertyEditor); nil,'',TCaptionPropertyEditor);
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('TStrings'),
nil,'Lines',TStringsPropertyEditor);
finalization finalization
PropertyEditorMapperList.Free; PropertyEditorMapperList:=nil; PropertyEditorMapperList.Free; PropertyEditorMapperList:=nil;

View File

@ -33,42 +33,69 @@ uses
type type
{-------------------------------------------- {--------------------------------------------
Created by Shane Miller
This class is used for adding controls to the toolbar to be This class is used for adding controls to the toolbar to be
dropped onto a form dropped onto a form
---------------------------------------------} ---------------------------------------------}
TIDEComponent = class(TObject) TIDEComponent = class(TObject)
private private
{The speedbutton that's displayed on the IDE control bar}
FSpeedButton : TSpeedButton; FSpeedButton : TSpeedButton;
{This is the @link(TRegisteredComponent) from compreg.pp.}
FRegisteredComponent : TRegisteredComponent; FRegisteredComponent : TRegisteredComponent;
protected protected
{Loads the image (from a resource) into a @link(TPixMap)}
Function LoadImageintoPixmap : TPixmap; Function LoadImageintoPixmap : TPixmap;
public public
constructor Create; constructor Create;
destructor Destroy; override; destructor Destroy; override;
Function _Speedbutton(AOwner : TComponent; nParent: TWinControl): TSpeedButton; Virtual; {Public access to create the Speedbutton.}
Function _Speedbutton(AOwner : TComponent; nParent: TWinControl): TSpeedButton;
{Public access to @link(FSpeedbutton)}
property SpeedButton : TSpeedButton read FSpeedButton write FSPeedbutton; property SpeedButton : TSpeedButton read FSpeedButton write FSPeedbutton;
{Public access to @link(FRegisteredComponent)}
property RegisteredComponent : TRegisteredComponent read FRegisteredComponent write FRegisteredComponent; property RegisteredComponent : TRegisteredComponent read FRegisteredComponent write FRegisteredComponent;
end; end;
{------------------------------------------- {-------------------------------------------
Created by Shane Miller
This class keeps a list of TIDeComponents This class keeps a list of TIDeComponents
--------------------------------------------} --------------------------------------------}
TIdeCompList = Class(TObject) TIdeCompList = Class(TObject)
private private
{The list of @link(TIdeComponent)s used in the IDE.}
FItems : TList; FItems : TList;
{The count of @link(TIdeComponent)s used in the IDE.}
FCount : Integer; FCount : Integer;
{Used to count the @link(TIdeComponent)s used in the IDE. Checks FItems.Count}
Function GetCount : Integer; Function GetCount : Integer;
public public
constructor Create; constructor Create;
destructor Destroy; override; destructor Destroy; override;
{You can pass the Speedbutton and find the @link(TIdeComponent).
This can be used when the Speedbutton is clicked and you want to find out
what the @link(TRegisteredComponent) is.}
function FindCompbySpeedbutton(Value : TSpeedButton) : TIDEComponent; function FindCompbySpeedbutton(Value : TSpeedButton) : TIDEComponent;
{You can pass the index and find the @link(TIdeComponent).
This is used because the tag of the speedbutton stores it's index
in this list}
function FindCompbyIndex(Value : Integer) : TIDEComponent; function FindCompbyIndex(Value : Integer) : TIDEComponent;
{You can pass the @link(TRegisteredComponent) and it'll return the @link(TIdeComponent).
This can be used if you are running through the list of RegisteredComponents and
want to find the speedbutton associated with it.}
function FindCompbyRegComponent(Value : TRegisteredComponent) : TIDEComponent; function FindCompbyRegComponent(Value : TRegisteredComponent) : TIDEComponent;
{This is used to add a @link(TIdeComponent) to the @link(FItems).}
function Add(Value : TObject) : Integer; function Add(Value : TObject) : Integer;
{This is used to delete a @link(TIdeComponent) from the @link(FItems).}
function Delete(Value : TObject) : Boolean; function Delete(Value : TObject) : Boolean;
{Calls @link(GetCount)}
property Count : Integer read GetCount; property Count : Integer read GetCount;
end; end;

View File

@ -276,7 +276,6 @@ begin
LoadMainMenu; LoadMainMenu;
MouseDownControl:=nil; MouseDownControl:=nil;
Bitmap1 := TBitmap.Create; Bitmap1 := TBitmap.Create;
Bitmap1.Handle := CreatePixmapIndirect(@IMGOK_Check, ColorToRGB(clBtnFace)); Bitmap1.Handle := CreatePixmapIndirect(@IMGOK_Check, ColorToRGB(clBtnFace));
@ -315,7 +314,6 @@ begin
For I := 0 to RegCompList.PageCount-1 do For I := 0 to RegCompList.PageCount-1 do
Begin Begin
Writeln('I = '+inttostr(i));
RegCompPage := RegCompList.Pages[i]; RegCompPage := RegCompList.Pages[i];
if I = 0 then if I = 0 then
Notebook1.Pages.Strings[i] := RegCompPage.Name Notebook1.Pages.Strings[i] := RegCompPage.Name
@ -339,6 +337,7 @@ begin
for x := 0 to RegCompPage.Count-1 do //for every component on the page.... for x := 0 to RegCompPage.Count-1 do //for every component on the page....
begin begin
writeln('X = '+inttostr(x));
RegComp := RegCompPage.Items[x]; RegComp := RegCompPage.Items[x];
IDEComponent := TIDEComponent.Create; IDEComponent := TIDEComponent.Create;
IdeComponent.RegisteredComponent := RegComp; IdeComponent.RegisteredComponent := RegComp;
@ -489,6 +488,7 @@ begin
Left := Speedbutton4_2.Left + 13; Left := Speedbutton4_2.Left + 13;
OnClick := @mnuSaveCLicked; OnClick := @mnuSaveCLicked;
Glyph := Pixmap1; Glyph := Pixmap1;
NumGlyphs := 2;
Visible := True; Visible := True;
Flat := true; Flat := true;
Name := 'Speedbutton5'; Name := 'Speedbutton5';
@ -510,6 +510,7 @@ begin
Left := Speedbutton5.left + 26; Left := Speedbutton5.left + 26;
OnClick := @mnuSaveAllCLicked; OnClick := @mnuSaveAllCLicked;
Glyph := Pixmap1; Glyph := Pixmap1;
NumGlyphs := 2;
Visible := True; Visible := True;
Flat := true; Flat := true;
Name := 'Speedbutton6'; Name := 'Speedbutton6';
@ -573,6 +574,7 @@ begin
Left := Speedbutton8.Left + 26; Left := Speedbutton8.Left + 26;
//OnClick := @mnuNewFormCLicked; //OnClick := @mnuNewFormCLicked;
Glyph := Pixmap1; Glyph := Pixmap1;
NumGlyphs := 2;
Visible := True; Visible := True;
Flat := true; Flat := true;
Name := 'RunSpeedbutton'; Name := 'RunSpeedbutton';
@ -1772,6 +1774,10 @@ end.
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.30 2001/01/03 18:44:54 lazarus
The Speedbutton now has a numglyphs setting.
I started the TStringPropertyEditor
Revision 1.29 2000/12/29 20:43:17 lazarus Revision 1.29 2000/12/29 20:43:17 lazarus
I added the run button with an Enable and disable icon I added the run button with an Enable and disable icon

View File

@ -39,6 +39,11 @@ type
TButtonLayout = (blGlyphLeft, blGlyphRight, blGlyphTop, blGlyphBottom); TButtonLayout = (blGlyphLeft, blGlyphRight, blGlyphTop, blGlyphBottom);
TButtonState = (bsUp, bsDisabled, bsDown, bsExclusive); TButtonState = (bsUp, bsDisabled, bsDown, bsExclusive);
{TNumGlyphs holds the number of glyphs in an image. We restrict it to 4 to stay compatable
but we don't NEED to.
If we change this the code in SetNumGlyphs for @link(TSpeedButton) needs to be changed}
TNumGlyphs = 1..4;
TButton = class(TButtonControl) //TButtoncontrol is declared in stdctrls.pp TButton = class(TButtonControl) //TButtoncontrol is declared in stdctrls.pp
private private
FCancel : Boolean; FCancel : Boolean;
@ -86,7 +91,12 @@ type
TButtonGlyph = class TButtonGlyph = class
private private
FOriginal : TBitmap; FOriginal : TBitmap;
FNumGlyphs : TNumGlyphs;
FOnChange : TNotifyEvent;
Procedure SetGlyph(Value : TBitmap); Procedure SetGlyph(Value : TBitmap);
Procedure SetNumGlyphs(Value : TNumGlyphs);
protected protected
public public
constructor Create; constructor Create;
@ -96,6 +106,9 @@ type
const Caption: string; Layout: TButtonLayout; Margin, Spacing: Integer; 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 OnChange : TNotifyEvent read FOnChange write FOnChange;
end; end;
@ -145,6 +158,7 @@ type
FSpacing : Integer; FSpacing : Integer;
FTransparent : Boolean; FTransparent : Boolean;
Function GetGlyph : TBitmap; Function GetGlyph : TBitmap;
Function GetNumGlyphs : Integer;
Procedure UpdateExclusive; Procedure UpdateExclusive;
Procedure UpdateTracking; Procedure UpdateTracking;
Procedure SetAllowAllUp(Value : Boolean); Procedure SetAllowAllUp(Value : Boolean);
@ -152,6 +166,7 @@ type
Procedure SetFlat(Value : Boolean); Procedure SetFlat(Value : Boolean);
Procedure SetGlyph(value : TBitmap); Procedure SetGlyph(value : TBitmap);
Procedure SetGroupIndex(value : Integer); Procedure SetGroupIndex(value : Integer);
Procedure SetNumGlyphs(value : Integer);
//there should be a procedure called settransparent but it's not used at this point //there should be a procedure called settransparent but it's not used at this point
Procedure CMButtonPressed(var MEssage : TLMessage); message CM_BUTTONPRESSED; Procedure CMButtonPressed(var MEssage : TLMessage); message CM_BUTTONPRESSED;
Procedure CMMouseEnter(var Message :TLMessage); message CM_MouseEnter; Procedure CMMouseEnter(var Message :TLMessage); message CM_MouseEnter;
@ -159,6 +174,7 @@ type
Procedure CMEnabledChanged(var Message: TLMessage); message CM_ENABLEDCHANGED; Procedure CMEnabledChanged(var Message: TLMessage); message CM_ENABLEDCHANGED;
protected protected
FState : TButtonState; FState : TButtonState;
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;
@ -177,6 +193,7 @@ type
property Enabled; property Enabled;
property Flat : Boolean read FFlat write SetFlat default False; property Flat : Boolean read FFlat write SetFlat default False;
property GroupIndex : Integer read FGroupIndex write SetGroupIndex default 0; property GroupIndex : Integer read FGroupIndex write SetGroupIndex default 0;
property NumGlyphs : Integer read GetNumGlyphs write SetNumGlyphs default 1;
property Transparent : Boolean read FTransparent write FTransparent default false; property Transparent : Boolean read FTransparent write FTransparent default false;
property Visible; property Visible;
end; end;
@ -217,6 +234,10 @@ end.
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.6 2001/01/03 18:44:54 lazarus
The Speedbutton now has a numglyphs setting.
I started the TStringPropertyEditor
Revision 1.5 2000/12/01 18:12:40 lazarus Revision 1.5 2000/12/01 18:12:40 lazarus
Modified Gloabal so TDesignForm isn't included anymore. Modified Gloabal so TDesignForm isn't included anymore.
Shane Shane

View File

@ -273,6 +273,9 @@ function KeysToShiftState(Keys:Word): TShiftState;
function KeyDataToShiftState(KeyData: Longint): TShiftState; function KeyDataToShiftState(KeyData: Longint): TShiftState;
function GetParentForm(Control:TControl): TCustomForm; function GetParentForm(Control:TControl): TCustomForm;
function IsAccel(VK : Word; const Str : String): Boolean; function IsAccel(VK : Word; const Str : String): Boolean;
function CreateLFM(AForm:TCustomForm):integer;
function InitResourceComponent(Instance: TComponent; RootAncestor: TClass):Boolean;
var var
Application : TApplication; Application : TApplication;
@ -284,7 +287,7 @@ implementation
uses uses
buttons,stdctrls,interfaces {,designer}; buttons,stdctrls,interfaces,lresources {,designer};
var var
FocusMessages : Boolean; //Should set it to TRUE by defualt but fpc does not handle that yet. FocusMessages : Boolean; //Should set it to TRUE by defualt but fpc does not handle that yet.
@ -322,6 +325,123 @@ begin
Result := true; Result := true;
end; end;
//==============================================================================
{
This function creates a LFM file from any form.
To create the LFC file use the program lazres or the
LFMtoLFCfile function.
}
function CreateLFM(AForm:TCustomForm):integer;
// 0 = ok
// -1 = error while streaming AForm to binary stream
// -2 = error while streaming binary stream to text file
var BinStream,TxtMemStream:TMemoryStream;
Driver: TAbstractObjectWriter;
Writer:TWriter;
TxtFileStream:TFileStream;
begin
BinStream:=TMemoryStream.Create;
try
try
Driver:=TBinaryObjectWriter.Create(BinStream,4096);
try
Writer:=TWriter.Create(Driver);
try
Writer.WriteDescendent(AForm,nil);
finally
Writer.Free;
end;
finally
Driver.Free;
end;
except
Result:=-1;
exit;
end;
try
// transform binary to text and save LFM file
TxtMemStream:=TMemoryStream.Create;
TxtFileStream:=TFileStream.Create(lowercase(AForm.ClassName)+'.lfm',fmCreate);
try
BinStream.Position:=0;
ObjectBinaryToText(BinStream,TxtMemStream);
TxtMemStream.Position:=0;
TxtFileStream.CopyFrom(TxtMemStream,TxtMemStream.Size);
finally
TxtMemStream.Free;
TxtFileStream.Free;
end;
except
Result:=-2;
exit;
end;
finally
BinStream.Free;
end;
end;
//==============================================================================
//==============================================================================
function InitResourceComponent(Instance: TComponent;
RootAncestor: TClass):Boolean;
function InitComponent(ClassType: TClass): Boolean;
var CompResource:LResource;
a:integer;
begin
Result:=false;
if (ClassType=TComponent) or (ClassType=RootAncestor) then exit;
if Assigned(ClassType.ClassParent) then
Result:=InitComponent(ClassType.ClassParent);
CompResource:=LazarusResources.Find(Instance.ClassName);
if (CompResource.Value='') then exit;
if (ClassType.InheritsFrom(TForm))
and (CompResource.ValueType<>'FORMDATA') then exit;
with TMemoryStream.Create do
try
Write(CompResource.Value[1],length(CompResource.Value));
Position:=0;
writeln('Signature=',copy(CompResource.Value,1,4));
Instance:=ReadComponent(Instance);
// MG: workaround til Visible=true is default
if Instance is TControl then
for a:=0 to Instance.ComponentCount-1 do
if Instance.Components[a] is TControl then
TControl(Instance.Components[a]).Visible:=true;
// MG end of workaround
finally
Free;
end;
Result:=true;
end;
// InitResourceComponent
//var LocalizedLoading: Boolean;
begin
//GlobalNameSpace.BeginWrite; // hold lock across all ancestor loads (performance)
try
//LocalizedLoading:=(Instance.ComponentState * [csInline,csLoading])=[];
//if LocalizedLoading then BeginGloabelLoading; // push new loadlist onto stack
try
Result:=InitComponent(Instance.ClassType);
//if LocalizedLoading then NotifyGloablLoading; // call Loaded
finally
//if LocalizedLoading then EndGloablLoading; // pop loadlist off stack
end;
finally
//GlobalNameSpace.EndWrite;
end;
end;
//==============================================================================
{$I form.inc} {$I form.inc}
{$I Customform.inc} {$I Customform.inc}
{$I screen.inc} {$I screen.inc}

View File

@ -19,6 +19,9 @@ inherited Destroy;
end; end;
{------------------------------------------------------------------------------}
{ TButtonGlyph SetGlyph }
{------------------------------------------------------------------------------}
Procedure TButtonGlyph.SetGlyph(Value : TBitmap); Procedure TButtonGlyph.SetGlyph(Value : TBitmap);
Begin Begin
if FOriginal = Value then exit; if FOriginal = Value then exit;
@ -27,19 +30,45 @@ FOriginal := Value;
//FOriginal.Assign(Value); //FOriginal.Assign(Value);
end; end;
{------------------------------------------------------------------------------}
{ TButtonGlyph Draw }
{------------------------------------------------------------------------------}
Function TButtonGlyph.Draw(Canvas: TCanvas; const Client: TRect; const Offset: TPoint; Function TButtonGlyph.Draw(Canvas: TCanvas; const Client: TRect; const Offset: TPoint;
const Caption: string; Layout: TButtonLayout; Margin, Spacing: Integer; const Caption: string; Layout: TButtonLayout; Margin, Spacing: Integer;
State: TButtonState; Transparent: Boolean; BiDiFlags: Longint): TRect; State: TButtonState; Transparent: Boolean; BiDiFlags: Longint): TRect;
var
W,H : Integer;
Begin Begin
if NumGlyphs > 1 then
if State= bsDisabled then
Begin Begin
if (TPixMap(FOriginal).Width > 25) then W := TPixMap(FOriginal).Width;
Canvas.Copyrect(Client, TPixmap(FOriginal).Canvas, Rect(25, 0, 50, 25)) W := W div NumGlyphs;
else
Canvas.Copyrect(Client, TPixmap(FOriginal).Canvas, Rect(0, 0, 25, 25));
H := TPixMap(FOriginal).Height;
if (State=bsDown) and (NumGlyphs < 3) then State := bsUp;
if State= bsDisabled then
Canvas.Copyrect(Client, TPixmap(FOriginal).Canvas, Rect(W, 0, (2*W)-1, H-1))
else
if State=bsDown then
Canvas.Copyrect(Client, TPixmap(FOriginal).Canvas, Rect(2*W, 0, (3*W)-1, H-1))
else
Canvas.Copyrect(Client, TPixmap(FOriginal).Canvas, Rect(0, 0, w-1, H-1));
end end
else else
Canvas.Copyrect(Client, TPixmap(FOriginal).Canvas, Rect(0, 0, 25, 25)); Canvas.Copyrect(Client, TPixmap(FOriginal).Canvas, Rect(0, 0, 25, 25));
end; end;
{------------------------------------------------------------------------------}
{ TButtonGlyph SetNumGlyphs }
{------------------------------------------------------------------------------}
Procedure TButtonGlyph.SetNumGlyphs(Value : TNumGlyphs);
Begin
if Value <> FNumGlyphs then
Begin
FNumGlyphs := Value;
if Assigned(FOnChange) then FOnChange(Glyph);
end;
end;

View File

@ -544,8 +544,12 @@ begin
begin begin
Include(FFormState, fsCreating); Include(FFormState, fsCreating);
try try
// if not InitInheritedComponent(Self, TForm) then // *** New
// raise EResNotFound.CreateFmt('Resource %s not found', [ClassName]); if not InitResourceComponent(Self, TForm) then begin
writeln('[TCustomForm.Create] Resource '''+ClassName+''' not found');
end;
// ***
finally finally
Exclude(FFormState, fsCreating); Exclude(FFormState, fsCreating);
end; end;
@ -820,6 +824,10 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.8 2001/01/03 18:44:54 lazarus
The Speedbutton now has a numglyphs setting.
I started the TStringPropertyEditor
Revision 1.7 2000/12/19 18:43:13 lazarus Revision 1.7 2000/12/19 18:43:13 lazarus
Removed IDEEDITOR. This causes the PROJECT class to not function. Removed IDEEDITOR. This causes the PROJECT class to not function.
Saving projects no longer works. Saving projects no longer works.

View File

@ -22,6 +22,8 @@ var
n, BufIndex: Integer; n, BufIndex: Integer;
t : String; t : String;
begin begin
writeln('Entering');
FreeContext; FreeContext;
// Convert a XPM filedata format to a XPM memory format // Convert a XPM filedata format to a XPM memory format
@ -76,11 +78,16 @@ begin
finally finally
S.Free; S.Free;
end; end;
writeln('leaving');
end; end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.4 2001/01/03 18:44:54 lazarus
The Speedbutton now has a numglyphs setting.
I started the TStringPropertyEditor
Revision 1.3 2000/12/29 20:32:33 lazarus Revision 1.3 2000/12/29 20:32:33 lazarus
Speedbuttons can now draw disabled images. Speedbuttons can now draw disabled images.
Shane Shane

View File

@ -20,10 +20,14 @@ begin
Inherited Create(AOwner); Inherited Create(AOwner);
FCompStyle := csSpeedButton; FCompStyle := csSpeedButton;
FGlyph := TButtonGlyph.Create;
FGlyph.OnChange := @GlyphChanged;
SetBounds(0, 0, 23, 22); SetBounds(0, 0, 23, 22);
ControlStyle := [csCaptureMouse, csDoubleClicks]; ControlStyle := [csCaptureMouse, csDoubleClicks];
FGlyph := TButtonGlyph.Create;
{set default alignment} {set default alignment}
Align := alNone; Align := alNone;
FMouseInControl := False; FMouseInControl := False;
@ -117,7 +121,6 @@ end;
procedure TSpeedButton.SetGlyph(Value : TBitmap); procedure TSpeedButton.SetGlyph(Value : TBitmap);
begin begin
FGlyph.Glyph := Value; FGlyph.Glyph := Value;
//SendMessage(LM_IMAGECHANGED,Self,nil);
Invalidate; Invalidate;
end; end;
@ -137,7 +140,26 @@ begin
end; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
Method: TSpeedButton.SetGroupIndex Method: TSpeedButton.SetNumGlyphs
Params: Value : Integer = Number of glyphs in the file/resource
Returns: nothing
------------------------------------------------------------------------------}
procedure TSpeedButton.SetNumGlyphs(Value : Integer);
Begin
if Value < 0 then Value := 1;
if Value > 4 then Value := 4;
if Value <> TButtonGlyph(fGlyph).NumGlyphs then
Begin
TButtonGlyph(fGlyph).NumGlyphs := Value;
Invalidate;
end;
end;
{------------------------------------------------------------------------------
Method: TSpeedButton.UpdateExclusive
Params: none Params: none
Returns: nothing Returns: nothing
@ -169,6 +191,29 @@ begin
Result := FGlyph.Glyph; Result := FGlyph.Glyph;
end; end;
{------------------------------------------------------------------------------
Method: TSpeedButton.GetNumGlyphs
Params: none
Returns: The number stored in TButtonGlyph(FGlyph).NumGlyphs
------------------------------------------------------------------------------}
Function TSpeedButton.GetNumGlyphs : Integer;
Begin
Result := TButtonGlyph(fGlyph).NumGlyphs;
end;
{------------------------------------------------------------------------------
Method: TSpeedButton.GlyphChanged
Params: Sender - The glyph that changed
Returns: zippo
------------------------------------------------------------------------------}
Procedure TSpeedButton.GlyphChanged(Sender : TObject);
Begin
//redraw the button;
Invalidate;
end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
Method: TSpeedbutton.Paint Method: TSpeedbutton.Paint
Params: none Params: none
@ -479,6 +524,10 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.2 2001/01/03 18:44:54 lazarus
The Speedbutton now has a numglyphs setting.
I started the TStringPropertyEditor
Revision 1.1 2000/07/13 10:28:28 michael Revision 1.1 2000/07/13 10:28:28 michael
+ Initial import + Initial import

View File

@ -794,7 +794,6 @@ begin
Assert(False, 'Trace:************************************************'); Assert(False, 'Trace:************************************************');
Assert(False, 'Trace:DRAWFRAMECONTROL'); Assert(False, 'Trace:DRAWFRAMECONTROL');
Assert(False, 'Trace:************************************************'); Assert(False, 'Trace:************************************************');
case uType of case uType of
DFC_CAPTION: DFC_CAPTION:
begin //all draw CAPTION commands here begin //all draw CAPTION commands here
@ -3117,6 +3116,10 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.10 2001/01/03 18:44:54 lazarus
The Speedbutton now has a numglyphs setting.
I started the TStringPropertyEditor
Revision 1.9 2000/10/09 22:50:33 lazarus Revision 1.9 2000/10/09 22:50:33 lazarus
MWE: MWE:
* fixed some selection code * fixed some selection code