From 2b6d88598547771a87c508d2aac421164583a337 Mon Sep 17 00:00:00 2001 From: mattias Date: Tue, 23 Dec 2003 23:38:11 +0000 Subject: [PATCH] added TCalendarDialog and TCalculatorDialog from Michael V.C. git-svn-id: trunk@4949 - --- .gitattributes | 2 + images/components/tcalculatordialog.xpm | 48 ++++++++++++++++++++++++ images/components/tcalendardialog.xpm | 49 +++++++++++++++++++++++++ images/components_images.lrs | 38 +++++++++++++++++++ lcl/editbtn.pas | 38 +++++++++++++------ lcl/extdlgs.pas | 19 +++++----- 6 files changed, 172 insertions(+), 22 deletions(-) create mode 100644 images/components/tcalculatordialog.xpm create mode 100644 images/components/tcalendardialog.xpm diff --git a/.gitattributes b/.gitattributes index 936f23e53e..7a39ef5182 100644 --- a/.gitattributes +++ b/.gitattributes @@ -537,8 +537,10 @@ images/components/tbitbtn.xpm -text svneol=native#image/x-xpixmap images/components/tbutton.ico -text svneol=unset#image/x-icon images/components/tbutton.xpm -text svneol=native#image/x-xpixmap images/components/tcalcedit.xpm -text svneol=native#image/x-xpixmap +images/components/tcalculatordialog.xpm -text svneol=native#image/x-xpixmap images/components/tcalendar.ico -text svneol=unset#image/x-icon images/components/tcalendar.xpm -text svneol=native#image/x-xpixmap +images/components/tcalendardialog.xpm -text svneol=native#image/x-xpixmap images/components/tcheckbox.ico -text svneol=unset#image/x-icon images/components/tcheckbox.xpm -text svneol=native#image/x-xpixmap images/components/tcheckgroup.xpm -text svneol=native#image/x-xpixmap diff --git a/images/components/tcalculatordialog.xpm b/images/components/tcalculatordialog.xpm new file mode 100644 index 0000000000..50dba162a5 --- /dev/null +++ b/images/components/tcalculatordialog.xpm @@ -0,0 +1,48 @@ +/* XPM */ +static char * tcalculator_xpm[] = { +"22 20 25 1", +" c None", +". c #848484", +"+ c #FFFFFF", +"@ c #000000", +"# c #0000FF", +"$ c #D6D6CE", +"% c #018467", +"& c #00A98B", +"* c #00AC8D", +"= c #00AE8B", +"- c #00AF8C", +"; c #00B18A", +"> c #00B68D", +", c #00B78E", +"' c #00B98C", +") c #00BC89", +"! c #00BF90", +"~ c #00C18D", +"{ c #00C48E", +"] c #00C68B", +"^ c #00A66D", +"/ c #CECECE", +"( c #00A78A", +"_ c #00C78D", +": c #F4EDE7", +"......................", +".+@##############@+@+@", +".@@@@@@@@@@@@@@@@@@@@@", +".+$+$+$+$+$+$+$+$+$+$@", +".$+%&*=-;>,'')!~{]^$+@", +".+/(&*=-;>,'')!~{]_+$@", +"./+::::::::::::::::$+@", +".+$((((((((((((((((+$@", +"./+(^_(^_(^_(^_(^_($+@", +".+$(__(__(__(__(__(+$@", +"./+(((((((((((((((($+@", +".+$(^_(^_(^_(^_(^_(+$@", +"./+(__(__(__(__(__($+@", +".+$((((((((((((((((+$@", +"./+(^_(^_(^_(^_(^_($+@", +".+$(__(__(__(__(__(+$@", +"./+(((((((((((((((($+@", +".+$+$+$+$+$+$+$+$+$+$@", +"./+$+$+$+$+$+$+$+$+$+@", +".@@@@@@@@@@@@@@@@@@@@@"}; diff --git a/images/components/tcalendardialog.xpm b/images/components/tcalendardialog.xpm new file mode 100644 index 0000000000..367698b011 --- /dev/null +++ b/images/components/tcalendardialog.xpm @@ -0,0 +1,49 @@ +/* XPM */ +static char * tcalendardialog_xpm[] = { +"22 20 26 1", +" c None", +". c #848484", +"+ c #FFFFFF", +"@ c #000000", +"# c #0000FF", +"$ c #D6D6CE", +"% c #1A506D", +"& c #1B618F", +"* c #1B6391", +"= c #1B6694", +"- c #1B6896", +"; c #1B6B97", +"> c #1C6D9A", +", c #1C709C", +"' c #1C729E", +") c #1C749F", +"! c #1C77A1", +"~ c #1D79A4", +"{ c #1D7CA6", +"] c #1D7EA7", +"^ c #1D81AA", +"/ c #1A718C", +"( c #CECECE", +"_ c #1B5F8E", +": c #1D83AC", +"< c #F2F2EA", +"......................", +".+@##############@+@+@", +".@@@@@@@@@@@@@@@@@@@@@", +".+$+$+$+$+$+$+$+$+$+$@", +".$+%&*=-;>,')!~{]^/$+@", +".+(_&*=-;>,')!~{]^:+$@", +".(+<<<<<<<<<<<<<<<<$+@", +".+$________________+$@", +".(+_/:_/:_/:_/:_/:_$+@", +".+$_::_::_::_::_::_+$@", +".(+________________$+@", +".+$_/:_/:_/:_/:_/:_+$@", +".(+_::_::_::_::_::_$+@", +".+$________________+$@", +".(+_/:_/:_/:_/:_/:_$+@", +".+$_::_::_::_::_::_+$@", +".(+________________$+@", +".+$+$+$+$+$+$+$+$+$+$@", +".(+$+$+$+$+$+$+$+$+$+@", +".@@@@@@@@@@@@@@@@@@@@@"}; diff --git a/images/components_images.lrs b/images/components_images.lrs index 3c20a055f8..b3e1b6a0ba 100644 --- a/images/components_images.lrs +++ b/images/components_images.lrs @@ -144,6 +144,44 @@ LazarusResources.Add('tcalcedit','XPM',[ +'O o",'#10'"ooooooo@:@@@@@@@@@@@@O o",'#10'"ooooooo@@OOOOOOOOOOOOO o",'#10'"' +'oooooooo oo",'#10'"oooooooooooooooooooooooo"'#10'};'#10 ]); +LazarusResources.Add('tcalculatordialog','XPM',[ + '/* XPM */'#10'static char * tcalculator_xpm[] = {'#10'"22 20 25 1",'#10'" '#9 + +'c None",'#10'".'#9'c #848484",'#10'"+'#9'c #FFFFFF",'#10'"@'#9'c #000000",' + +#10'"#'#9'c #0000FF",'#10'"$'#9'c #D6D6CE",'#10'"%'#9'c #018467",'#10'"&'#9 + +'c #00A98B",'#10'"*'#9'c #00AC8D",'#10'"='#9'c #00AE8B",'#10'"-'#9'c #00AF8C' + +'",'#10'";'#9'c #00B18A",'#10'">'#9'c #00B68D",'#10'",'#9'c #00B78E",'#10'"' + +''''#9'c #00B98C",'#10'")'#9'c #00BC89",'#10'"!'#9'c #00BF90",'#10'"~'#9'c #' + +'00C18D",'#10'"{'#9'c #00C48E",'#10'"]'#9'c #00C68B",'#10'"^'#9'c #00A66D",' + +#10'"/'#9'c #CECECE",'#10'"('#9'c #00A78A",'#10'"_'#9'c #00C78D",'#10'":'#9 + +'c #F4EDE7",'#10'"......................",'#10'".+@##############@+@+@",'#10 + +'".@@@@@@@@@@@@@@@@@@@@@",'#10'".+$+$+$+$+$+$+$+$+$+$@",'#10'".$+%&*=-;>,''' + +''')!~{]^$+@",'#10'".+/(&*=-;>,'''')!~{]_+$@",'#10'"./+::::::::::::::::$+@",' + +#10'".+$((((((((((((((((+$@",'#10'"./+(^_(^_(^_(^_(^_($+@",'#10'".+$(__(__(_' + +'_(__(__(+$@",'#10'"./+(((((((((((((((($+@",'#10'".+$(^_(^_(^_(^_(^_(+$@",' + +#10'"./+(__(__(__(__(__($+@",'#10'".+$((((((((((((((((+$@",'#10'"./+(^_(^_(^' + +'_(^_(^_($+@",'#10'".+$(__(__(__(__(__(+$@",'#10'"./+(((((((((((((((($+@",' + +#10'".+$+$+$+$+$+$+$+$+$+$@",'#10'"./+$+$+$+$+$+$+$+$+$+@",'#10'".@@@@@@@@@@' + +'@@@@@@@@@@@"};'#10 +]); +LazarusResources.Add('tcalendardialog','XPM',[ + '/* XPM */'#10'static char * tcalendardialog_xpm[] = {'#10'"22 20 26 1",'#10 + +'" '#9'c None",'#10'".'#9'c #848484",'#10'"+'#9'c #FFFFFF",'#10'"@'#9'c #000' + +'000",'#10'"#'#9'c #0000FF",'#10'"$'#9'c #D6D6CE",'#10'"%'#9'c #1A506D",'#10 + +'"&'#9'c #1B618F",'#10'"*'#9'c #1B6391",'#10'"='#9'c #1B6694",'#10'"-'#9'c #' + +'1B6896",'#10'";'#9'c #1B6B97",'#10'">'#9'c #1C6D9A",'#10'",'#9'c #1C709C",' + +#10'"'''#9'c #1C729E",'#10'")'#9'c #1C749F",'#10'"!'#9'c #1C77A1",'#10'"~'#9 + +'c #1D79A4",'#10'"{'#9'c #1D7CA6",'#10'"]'#9'c #1D7EA7",'#10'"^'#9'c #1D81AA' + +'",'#10'"/'#9'c #1A718C",'#10'"('#9'c #CECECE",'#10'"_'#9'c #1B5F8E",'#10'":' + +#9'c #1D83AC",'#10'"<'#9'c #F2F2EA",'#10'"......................",'#10'".+@#' + +'#############@+@+@",'#10'".@@@@@@@@@@@@@@@@@@@@@",'#10'".+$+$+$+$+$+$+$+$+$' + +'+$@",'#10'".$+%&*=-;>,'')!~{]^/$+@",'#10'".+(_&*=-;>,'')!~{]^:+$@",'#10'".(' + +'+<<<<<<<<<<<<<<<<$+@",'#10'".+$________________+$@",'#10'".(+_/:_/:_/:_/:_/' + +':_$+@",'#10'".+$_::_::_::_::_::_+$@",'#10'".(+________________$+@",'#10'".+' + +'$_/:_/:_/:_/:_/:_+$@",'#10'".(+_::_::_::_::_::_$+@",'#10'".+$______________' + +'__+$@",'#10'".(+_/:_/:_/:_/:_/:_$+@",'#10'".+$_::_::_::_::_::_+$@",'#10'".(' + +'+________________$+@",'#10'".+$+$+$+$+$+$+$+$+$+$@",'#10'".(+$+$+$+$+$+$+$+' + +'$+$+@",'#10'".@@@@@@@@@@@@@@@@@@@@@"};'#10 +]); LazarusResources.Add('tcalendar','XPM',[ '/* XPM */'#10'static char *tcalendar[]={'#10'"20 19 53 1",'#10'"k c #000000"' +','#10'"A c #000004",'#10'"a c #000005",'#10'"M c #000007",'#10'"X c #000009' diff --git a/lcl/editbtn.pas b/lcl/editbtn.pas index 9d1617ef88..c63f64413d 100644 --- a/lcl/editbtn.pas +++ b/lcl/editbtn.pas @@ -27,10 +27,12 @@ unit EditBtn; interface uses - Classes, SysUtils, LCLStrConsts, LCLType, LMessages, Graphics, Controls, - Forms, Dialogs, StdCtrls, Buttons, Calendar, ExtDlgs; + Classes, SysUtils, LResources, LCLStrConsts, LCLType, LMessages, Graphics, + Controls, Forms, Dialogs, StdCtrls, Buttons, Calendar, ExtDlgs; type + { TCustomEditButton } + TCustomEditButton = class(TEdit) private FButton: TSpeedButton; @@ -73,6 +75,9 @@ type Property ButtonOnlyWhenFocused : Boolean Read FButtonNeedsFocus Write SetButtonNeedsFocus; end; + + { TEditButton } + TEditButton = Class(TCustomEditButton) Public Property Button; @@ -121,6 +126,9 @@ type property OnStartDrag; end; + + { TFileNameEdit } + TAcceptFileNameEvent = Procedure (Sender : TObject; Var Value : String) of Object; TDialogKind = (dkOpen,dkSave,dkPictureOpen,dkPictureSave); @@ -200,6 +208,9 @@ type property OnStartDrag; end; + + { TDirectoryEdit } + TDirectoryEdit = Class(TCustomEditButton) private FDialogTitle: String; @@ -267,6 +278,9 @@ type property OnStartDrag; end; + + { TDateEdit } + TAcceptDateEvent = Procedure (Sender : TObject; Var ADate : TDateTime; Var Action : Boolean) of Object; TDateEdit = Class(TCustomEditButton) private @@ -332,6 +346,9 @@ type property OnStartDrag; end; + + { TCalcEdit } + TAcceptValueEvent = Procedure (Sender : TObject; Var AValue : Double; Var Action : Boolean) of Object; TCalcEdit = Class(TCustomEditButton) private @@ -401,8 +418,6 @@ type property OnStartDrag; end; -procedure Register; - Var FileOpenGlyph : TBitmap; DateGlyph : TBitmap; @@ -414,12 +429,12 @@ Const ResBtnCalendar = 'btncalendar'; ResBtnCalculator = 'btncalculator'; +procedure Register; + implementation -uses lresources; - -Function GlyphFromBitmapOrResource(B : TBitmap; ResourceName : String) : TBitmap; - +Function GlyphFromBitmapOrResource(B : TBitmap; + const ResourceName : String) : TBitmap; begin Result:=TBitmap.Create; If Assigned(B) then @@ -454,7 +469,6 @@ end; { TEditBtn } - constructor TCustomEditButton.Create(AOwner: TComponent); begin inherited Create(AOwner); @@ -523,17 +537,17 @@ end; function TCustomEditButton.GetGlyph : TBitmap; Begin - Result:=FButton.Glyph; + Result:=FButton.Glyph; end; procedure TCustomEditButton.SetNumGlyphs(ANumber: Integer); Begin - FButton.NumGlyphs:=ANumber; + FButton.NumGlyphs:=ANumber; end; function TCustomEditButton.GetNumGlyphs:Integer; begin - Result:=FButton.NumGlyphs; + Result:=FButton.NumGlyphs; end; procedure TCustomEditButton.Notification(AComponent: TComponent; Operation: TOperation); diff --git a/lcl/extdlgs.pas b/lcl/extdlgs.pas index a265704f5f..186ccac957 100644 --- a/lcl/extdlgs.pas +++ b/lcl/extdlgs.pas @@ -251,7 +251,8 @@ implementation procedure Register; begin - RegisterComponents('Dialogs',[TOpenPictureDialog,TSavePictureDialog]); + RegisterComponents('Dialogs',[TOpenPictureDialog,TSavePictureDialog, + TCalendarDialog,TCalculatorDialog]); end; { TPreviewFileControl } @@ -1208,19 +1209,17 @@ end; procedure TCalendarDialogForm.InitForm; begin - ClientHeight:=150; - ClientWidth:=200; + Height:=150; + Width:=200; + Position:=poScreenCenter; BorderStyle:=bsDialog; FCalendar:=TCalendar.Create(Self); With FCalendar do begin Parent:=Self; - Top:=0; - Left:=0; - Width:=Width; - Height:=98; + SetBounds(0,0,Self.Width,98); Align:=alClient; - Anchors:=[akLeft,akRight,aktop,akbottom]; + //Anchors:=[akLeft,akRight,akTop,akBottom]; end; FPanel:=TPanel.Create(Self); With FPanel do @@ -1230,7 +1229,7 @@ begin Height:=32; Width:=200; Align:=alBottom; - Anchors:=[akLeft,akRight,akbottom]; + Anchors:=[akLeft,akRight,akBottom]; Caption:=''; BevelOuter:=bvLowered; end; @@ -1243,7 +1242,7 @@ begin Height:=24; Width:=50; Left:=Self.Width-FOK.Width-4; - Anchors:=[akright,aktop]; + Anchors:=[akRight,akTop]; Default:=True; ModalResult:=MrOK; end;