implemented TMultiPropertyLink

git-svn-id: trunk@6374 -
This commit is contained in:
mattias 2004-12-13 21:30:21 +00:00
parent 545441282f
commit 3737ea01f7
9 changed files with 813 additions and 21 deletions

2
.gitattributes vendored
View File

@ -167,11 +167,13 @@ components/rtticontrols/rttictrls.lrs svneol=native#text/pascal
components/rtticontrols/rttictrls.pas svneol=native#text/pascal
components/rtticontrols/runtimetypeinfocontrols.lpk svneol=native#text/pascal
components/rtticontrols/runtimetypeinfocontrols.pas svneol=native#text/pascal
components/rtticontrols/tmultipropertylink.xpm -text svneol=native#image/x-xpixmap
components/rtticontrols/ttibutton.xpm -text svneol=native#image/x-xpixmap
components/rtticontrols/tticalendar.xpm -text svneol=native#image/x-xpixmap
components/rtticontrols/tticheckbox.xpm -text svneol=native#image/x-xpixmap
components/rtticontrols/tticheckgroup.xpm -text svneol=native#image/x-xpixmap
components/rtticontrols/ttichecklistbox.xpm -text svneol=native#image/x-xpixmap
components/rtticontrols/tticolorbutton.xpm -text svneol=native#image/x-xpixmap
components/rtticontrols/tticombobox.xpm -text svneol=native#image/x-xpixmap
components/rtticontrols/ttiedit.xpm -text svneol=native#image/x-xpixmap
components/rtticontrols/ttigroupbox.xpm -text svneol=native#image/x-xpixmap

View File

@ -49,7 +49,7 @@ type
TBallPropertyEditor = class(TIntegerPropertyEditor)
public
procedure SetValue(const NewValue: ansistring); override;
procedure SetValue(const NewValue: string); override;
end;
@ -116,7 +116,7 @@ end;
{ TBallPropertyEditor }
procedure TBallPropertyEditor.SetValue(const NewValue: ansistring);
procedure TBallPropertyEditor.SetValue(const NewValue: string);
var
L: integer;
Ball: TBall;

View File

@ -18,19 +18,19 @@
<Filename Value="exampleproject3.lpr"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ExampleProject3"/>
<UsageCount Value="21"/>
<UsageCount Value="23"/>
</Unit0>
<Unit1>
<CursorPos X="9" Y="55"/>
<CursorPos X="18" Y="106"/>
<EditorIndex Value="0"/>
<Filename Value="example3.pas"/>
<ComponentName Value="Form1"/>
<IsPartOfProject Value="True"/>
<Loaded Value="True"/>
<ResourceFilename Value="example3.lrs"/>
<TopLine Value="38"/>
<TopLine Value="101"/>
<UnitName Value="Example3"/>
<UsageCount Value="21"/>
<UsageCount Value="23"/>
</Unit1>
</Units>
<PublishOptions>

View File

@ -1,3 +1,76 @@
LazarusResources.Add('tmultipropertylink','XPM',[
'/* XPM */'#10'static char * tmultipropertylink_xpm[] = {'#10'"23 23 173 2",'
+#10'" '#9'c None",'#10'". '#9'c #634C47",'#10'"+ '#9'c #856C66",'#10'"@ '#9
+'c #775E5A",'#10'"# '#9'c #4F3732",'#10'"$ '#9'c #8A5B51",'#10'"% '#9'c #DEB'
+'CB5",'#10'"& '#9'c #E8C8C1",'#10'"* '#9'c #E4C1BA",'#10'"= '#9'c #C3988E",'
+#10'"- '#9'c #4B251C",'#10'"; '#9'c #5D281C",'#10'"> '#9'c #CC8677",'#10'", '
+#9'c #F8EEEC",'#10'"'' '#9'c #DDABA0",'#10'") '#9'c #CC8170",'#10'"! '#9'c #'
+'934737",'#10'"~ '#9'c #7A2E1E",'#10'"{ '#9'c #BA533D",'#10'"] '#9'c #CC8171'
+'",'#10'"^ '#9'c #BF604C",'#10'"/ '#9'c #B84F39",'#10'"( '#9'c #A03F2A",'#10
+'"_ '#9'c #3C160E",'#10'": '#9'c #6E291A",'#10'"< '#9'c #B4452D",'#10'"[ '#9
+'c #B4452E",'#10'"} '#9'c #AC422C",'#10'"| '#9'c #A7402A",'#10'"1 '#9'c #873'
+'625",'#10'"2 '#9'c #6B4941",'#10'"3 '#9'c #846B65",'#10'"4 '#9'c #441910",'
+#10'"5 '#9'c #AC4C37",'#10'"6 '#9'c #C06450",'#10'"7 '#9'c #B35D4C",'#10'"8 '
+#9'c #894639",'#10'"9 '#9'c #8F5B50",'#10'"0 '#9'c #51271E",'#10'"a '#9'c #A'
+'56D61",'#10'"b '#9'c #BD8376",'#10'"c '#9'c #844D41",'#10'"d '#9'c #C88374"'
+','#10'"e '#9'c #25282C",'#10'"f '#9'c #5F6267",'#10'"g '#9'c #43454A",'#10
+'"h '#9'c #362F23",'#10'"i '#9'c #6B6052",'#10'"j '#9'c #733425",'#10'"k '#9
+'c #B8523C",'#10'"l '#9'c #53585F",'#10'"m '#9'c #C9CBD0",'#10'"n '#9'c #CED'
+'0D5",'#10'"o '#9'c #C9CBD1",'#10'"p '#9'c #898D93",'#10'"q '#9'c #1D2025",'
+#10'"r '#9'c #51644D",'#10'"s '#9'c #C5D2C2",'#10'"t '#9'c #C4CFC1",'#10'"u '
+#9'c #7F493A",'#10'"v '#9'c #2A2F39",'#10'"w '#9'c #888D97",'#10'"x '#9'c #E'
+'FF0F1",'#10'"y '#9'c #B0B3BB",'#10'"z '#9'c #9499A3",'#10'"A '#9'c #8E939D"'
+','#10'"B '#9'c #414650",'#10'"C '#9'c #202F1F",'#10'"D '#9'c #8DA987",'#10
+'"E '#9'c #E8EFE7",'#10'"F '#9'c #BACDB6",'#10'"G '#9'c #675946",'#10'"H '#9
+'c #2A303B",'#10'"I '#9'c #575F6F",'#10'"J '#9'c #A6AAB3",'#10'"K '#9'c #686'
+'F7D",'#10'"L '#9'c #525A6B",'#10'"M '#9'c #51596A",'#10'"N '#9'c #404858",'
+#10'"O '#9'c #375335",'#10'"P '#9'c #658F5B",'#10'"Q '#9'c #A6BFA1",'#10'"R '
+#9'c #779C6E",'#10'"S '#9'c #547849",'#10'"T '#9'c #543C2A",'#10'"U '#9'c #A'
+'36D60",'#10'"V '#9'c #250E09",'#10'"W '#9'c #282E39",'#10'"X '#9'c #434C5E"'
+','#10'"Y '#9'c #40495A",'#10'"Z '#9'c #343C4A",'#10'"` '#9'c #2D323B",'#10
+'" .'#9'c #515D56",'#10'"..'#9'c #475948",'#10'"+.'#9'c #33502F",'#10'"@.'#9
+'c #4E7D44",'#10'"#.'#9'c #4F7E44",'#10'"$.'#9'c #36542D",'#10'"%.'#9'c #373'
+'224",'#10'"&.'#9'c #1F242D",'#10'"*.'#9'c #48505F",'#10'"=.'#9'c #5D6474",'
+#10'"-.'#9'c #5D6574",'#10'";.'#9'c #505764",'#10'">.'#9'c #535961",'#10'",.'
+#9'c #888D92",'#10'"''.'#9'c #38493A",'#10'").'#9'c #4A6844",'#10'"!.'#9'c #'
+'52674E",'#10'"~.'#9'c #9A3A25",'#10'"{.'#9'c #31120C",'#10'"].'#9'c #353A43'
+'",'#10'"^.'#9'c #868C97",'#10'"/.'#9'c #9398A2",'#10'"(.'#9'c #5A5F69",'#10
+'"_.'#9'c #878C96",'#10'":.'#9'c #444952",'#10'"<.'#9'c #2E3F2C",'#10'"[.'#9
+'c #C16552",'#10'"}.'#9'c #BD5F4C",'#10'"|.'#9'c #7B2F1F",'#10'"1.'#9'c #0F0'
+'503",'#10'"2.'#9'c #17191E",'#10'"3.'#9'c #31343B",'#10'"4.'#9'c #292F3A",'
+#10'"5.'#9'c #C3877A",'#10'"6.'#9'c #B97F73",'#10'"7.'#9'c #865044",'#10'"8.'
+#9'c #170A06",'#10'"9.'#9'c #766A5A",'#10'"0.'#9'c #5B5143",'#10'"a.'#9'c #1'
+'7130C",'#10'"b.'#9'c #D2DECF",'#10'"c.'#9'c #CCDAC9",'#10'"d.'#9'c #96A891"'
+','#10'"e.'#9'c #1E291B",'#10'"f.'#9'c #BBCEB7",'#10'"g.'#9'c #9CB796",'#10
+'"h.'#9'c #9BB795",'#10'"i.'#9'c #0B130A",'#10'"j.'#9'c #5F8B55",'#10'"k.'#9
+'c #4B7441",'#10'"l.'#9'c #1A2A17",'#10'"m.'#9'c #3C4455",'#10'"n.'#9'c #365'
+'334",'#10'"o.'#9'c #518146",'#10'"p.'#9'c #47713D",'#10'"q.'#9'c #192816",'
+#10'"r.'#9'c #575F6E",'#10'"s.'#9'c #2D333F",'#10'"t.'#9'c #1C2B1A",'#10'"u.'
+#9'c #55804B",'#10'"v.'#9'c #68915E",'#10'"w.'#9'c #699260",'#10'"x.'#9'c #6'
+'48E5B",'#10'"y.'#9'c #395C32",'#10'"z.'#9'c #090E07",'#10'"A.'#9'c #90959F"'
+','#10'"B.'#9'c #5E636E",'#10'"C.'#9'c #111419",'#10'"D.'#9'c #070B06",'#10
+'"E.'#9'c #395033",'#10'"F.'#9'c #89A783",'#10'"G.'#9'c #9BB695",'#10'"H.'#9
+'c #98B491",'#10'"I.'#9'c #6B8964",'#10'"J.'#9'c #162414",'#10'"K.'#9'c #232'
+'62C",'#10'"L.'#9'c #070709",'#10'"M.'#9'c #192517",'#10'"N.'#9'c #364831",'
+#10'"O.'#9'c #293826",'#10'"P.'#9'c #090E08",'#10'" . + @ #'
+' ",'#10'" $ % & * = - '
+'",'#10'" ; > , '' ) ) ! ",'#10'" '
+' ~ { ] ^ / / ( _ ",'#10'" : < [ } | 1 2 3 @ #'
+' ",'#10'" 4 5 6 7 8 9 % & * = - ",'#10'"'
+' 0 a b c d , '' ) ) ! ",'#10'" e f g h '
+'i j k ] ^ / / ( _ ",'#10'" l m n o p q r s t u < [ } | 1 2 3 @ #'
+' ",'#10'"v w x y z A B C D E F G 5 6 7 8 9 % & * = - ",'#10'"H I J K '
+'L M N O P Q R S T U b c d , '' ) ) ! V ",'#10'"W X X X Y Z ` ...+.@.#.$.%.'
+'i j k ] ^ / / ( _ ",'#10'"&.*.=.-.;.>.m n o ,.''.).!.s t u < [ [ [ < ~.{.",'
+#10'" ].^./.(._.x y z A :.<.D E F G 5 6 [.[.}.|.1.",'#10'" 2.3.4.I J K L'
,' M N O P Q R S T U 5.6.7.8. ",'#10'" W X X X Y Z ` ...+.@.#.$.%.9.'
+'0.a. ",'#10'" &.*.=.-.;.>.m n o ,.''.).!.s b.c.d.e. ",'#10'" '
+' ].^./.(._.x y z A :.<.D E f.g.h.).i.",'#10'" 2.3.4.I J K L'
+' M N O P Q R j.j.k.l.",'#10'" W X X X X X m.n.o.o.o.o.o.p.q.'
+'",'#10'" &.*.=.-.-.r.s.t.u.v.w.w.x.y.z.",'#10'" '
+' ].^./.A.B.C.D.E.F.G.H.I.J. ",'#10'" 2.3.K.L. '
+'M.N.O.P. "};'#10
]);
LazarusResources.Add('ttibutton','XPM',[
'/* XPM */'#10'static char * ttibutton_xpm[] = {'#10'"23 23 157 2",'#10'" '#9
+'c None",'#10'". '#9'c #F8F8F8",'#10'"+ '#9'c #FFFFFF",'#10'"@ '#9'c #EFEFEF'
@ -372,6 +445,74 @@ LazarusResources.Add('ttichecklistbox','XPM',[
+'N+O+P+Q+R+S+T+U+V+W+X+ ",'#10'" Y+Z+`+ @ .@+@@@#@ '
+' "};'#10
]);
LazarusResources.Add('tticolorbutton','XPM',[
'/* XPM */'#10'static char * tticolorbutton_xpm[] = {'#10'"23 23 157 2",'#10
+'" '#9'c None",'#10'". '#9'c #F8F8F8",'#10'"+ '#9'c #FFFFFF",'#10'"@ '#9'c '
+'#EFEFEF",'#10'"# '#9'c #F0F0F0",'#10'"$ '#9'c #FCFCFC",'#10'"% '#9'c #03030'
+'3",'#10'"& '#9'c #C1C1C1",'#10'"* '#9'c #BCBCBC",'#10'"= '#9'c #BDBDBD",'#10
+'"- '#9'c #C5C5C5",'#10'"; '#9'c #BBBBBB",'#10'"> '#9'c #BEBEBE",'#10'", '#9
+'c #BFBFBF",'#10'"'' '#9'c #808080",'#10'") '#9'c #000000",'#10'"! '#9'c #F4'
+'F4F4",'#10'"~ '#9'c #C8C8C8",'#10'"{ '#9'c #C6C6C6",'#10'"] '#9'c #C4C4C4",'
+#10'"^ '#9'c #C0C0C0",'#10'"/ '#9'c #FF0000",'#10'"( '#9'c #FFFF00",'#10'"_ '
+#9'c #0000FF",'#10'": '#9'c #B9B9B9",'#10'"< '#9'c #848484",'#10'"[ '#9'c #B'
+'ABABA",'#10'"} '#9'c #775E5A",'#10'"| '#9'c #4F3732",'#10'"1 '#9'c #E4C1BA"'
+','#10'"2 '#9'c #C3988E",'#10'"3 '#9'c #4B251C",'#10'"4 '#9'c #FEFEFE",'#10
+'"5 '#9'c #7C7C7C",'#10'"6 '#9'c #8B8B8B",'#10'"7 '#9'c #767676",'#10'"8 '#9
+'c #828282",'#10'"9 '#9'c #878787",'#10'"0 '#9'c #7A7A7A",'#10'"a '#9'c #7F7'
+'F7F",'#10'"b '#9'c #888888",'#10'"c '#9'c #7D7D7D",'#10'"d '#9'c #898989",'
+#10'"e '#9'c #CC8170",'#10'"f '#9'c #934737",'#10'"g '#9'c #020202",'#10'"h '
+#9'c #050505",'#10'"i '#9'c #010101",'#10'"j '#9'c #B84F39",'#10'"k '#9'c #A'
+'03F2A",'#10'"l '#9'c #3C160E",'#10'"m '#9'c #6E291A",'#10'"n '#9'c #B4452D"'
+','#10'"o '#9'c #B4452E",'#10'"p '#9'c #9A3A25",'#10'"q '#9'c #31120C",'#10
+'"r '#9'c #441910",'#10'"s '#9'c #AC4C37",'#10'"t '#9'c #C06450",'#10'"u '#9
+'c #C16552",'#10'"v '#9'c #BD5F4C",'#10'"w '#9'c #7B2F1F",'#10'"x '#9'c #0F0'
+'503",'#10'"y '#9'c #51271E",'#10'"z '#9'c #A56D61",'#10'"A '#9'c #C3877A",'
+#10'"B '#9'c #B97F73",'#10'"C '#9'c #865044",'#10'"D '#9'c #170A06",'#10'"E '
+#9'c #25282C",'#10'"F '#9'c #5F6267",'#10'"G '#9'c #43454A",'#10'"H '#9'c #3'
+'62F23",'#10'"I '#9'c #766A5A",'#10'"J '#9'c #5B5143",'#10'"K '#9'c #17130C"'
+','#10'"L '#9'c #53585F",'#10'"M '#9'c #C9CBD0",'#10'"N '#9'c #CED0D5",'#10
+'"O '#9'c #C9CBD1",'#10'"P '#9'c #898D93",'#10'"Q '#9'c #1D2025",'#10'"R '#9
+'c #51644D",'#10'"S '#9'c #C5D2C2",'#10'"T '#9'c #D2DECF",'#10'"U '#9'c #CCD'
+'AC9",'#10'"V '#9'c #96A891",'#10'"W '#9'c #1E291B",'#10'"X '#9'c #2A2F39",'
+#10'"Y '#9'c #888D97",'#10'"Z '#9'c #EFF0F1",'#10'"` '#9'c #B0B3BB",'#10'" .'
+#9'c #9499A3",'#10'"..'#9'c #8E939D",'#10'"+.'#9'c #414650",'#10'"@.'#9'c #2'
+'02F1F",'#10'"#.'#9'c #8DA987",'#10'"$.'#9'c #E8EFE7",'#10'"%.'#9'c #BBCEB7"'
+','#10'"&.'#9'c #9CB796",'#10'"*.'#9'c #9BB795",'#10'"=.'#9'c #4A6844",'#10
+'"-.'#9'c #2A303B",'#10'";.'#9'c #575F6F",'#10'">.'#9'c #A6AAB3",'#10'",.'#9
+'c #686F7D",'#10'"''.'#9'c #525A6B",'#10'").'#9'c #51596A",'#10'"!.'#9'c #40'
+'4858",'#10'"~.'#9'c #375335",'#10'"{.'#9'c #658F5B",'#10'"].'#9'c #A6BFA1",'
+#10'"^.'#9'c #779C6E",'#10'"/.'#9'c #5F8B55",'#10'"(.'#9'c #4B7441",'#10'"_.'
+#9'c #1A2A17",'#10'":.'#9'c #282E39",'#10'"<.'#9'c #434C5E",'#10'"[.'#9'c #3'
+'C4455",'#10'"}.'#9'c #365334",'#10'"|.'#9'c #518146",'#10'"1.'#9'c #47713D"'
+','#10'"2.'#9'c #192816",'#10'"3.'#9'c #1F242D",'#10'"4.'#9'c #48505F",'#10
+'"5.'#9'c #5D6474",'#10'"6.'#9'c #5D6574",'#10'"7.'#9'c #575F6E",'#10'"8.'#9
+'c #2D333F",'#10'"9.'#9'c #1C2B1A",'#10'"0.'#9'c #55804B",'#10'"a.'#9'c #689'
+'15E",'#10'"b.'#9'c #699260",'#10'"c.'#9'c #648E5B",'#10'"d.'#9'c #395C32",'
+#10'"e.'#9'c #090E07",'#10'"f.'#9'c #353A43",'#10'"g.'#9'c #868C97",'#10'"h.'
+#9'c #9398A2",'#10'"i.'#9'c #90959F",'#10'"j.'#9'c #5E636E",'#10'"k.'#9'c #1'
+'11419",'#10'"l.'#9'c #070B06",'#10'"m.'#9'c #395033",'#10'"n.'#9'c #89A783"'
+','#10'"o.'#9'c #9BB695",'#10'"p.'#9'c #98B491",'#10'"q.'#9'c #6B8964",'#10
+'"r.'#9'c #162414",'#10'"s.'#9'c #17191E",'#10'"t.'#9'c #31343B",'#10'"u.'#9
+'c #23262C",'#10'"v.'#9'c #070709",'#10'"w.'#9'c #192517",'#10'"x.'#9'c #364'
+'831",'#10'"y.'#9'c #293826",'#10'"z.'#9'c #090E08",'#10'". + @ + + # + + + '
+'+ + + + + + + $ + % ",'#10'"+ & * = - & - ; & > & , = - , & , '' ) '
+' ",'#10'"! ~ > { ) ) ) ) ) ) ) ) ) ) ] & , '' ) ",'#10'"+ * '
+'& ^ ) / / ) ( ( ) _ _ ) : & , '' ) ",'#10'". , - ; ) / / ) ( ( ) _ '
+'_ ) ^ & , '' ) ",'#10'". , - ; ) ) ) ) ) ) ) ) ) ) > & , '' ) '
+' ",'#10'"+ * & ^ ) < < ) + + ) ) ) ) ^ & , '' ) ",'#10'"! ~ > { )'
+' < < ) + + ) ) ) ) ] & , '' ) ",'#10'"+ & * = ) ) ) ) ) ) ) ) ) ) ['
+' & , '' ) } | ",'#10'". , - ; & , - ; & > & , ; & > & , '' ) 1 2 3 ",'
+#10'"4 5 6 7 8 9 0 a a a a a a a a b c d ) e e f ",'#10'") g ) h ) i ) ) )'
+' ) ) ) ) ) ) ) g ) ) j j k l ",'#10'" m n o o '
+'o n p q ",'#10'" r s t u u v w x ",'#10'" '
+' y z A B C D ",'#10'" E F G '
+' H I J K ",'#10'" L M N O P Q R S T U V W "'
+','#10'" X Y Z ` ...+.@.#.$.%.&.*.=. ",'#10'" '
+' -.;.>.,.''.).!.~.{.].^././.(._.",'#10'" :.<.<.<.<.<.[.}.|.'
+'|.|.|.|.1.2.",'#10'" 3.4.5.6.6.7.8.9.0.a.b.b.c.d.e.",'#10'" '
,' f.g.h.i.j.k.l.m.n.o.p.q.r. ",'#10'" s.'
+'t.u.v. w.x.y.z. "};'#10
]);
LazarusResources.Add('tticombobox','XPM',[
'/* XPM */'#10'static char * tticombobox_xpm[] = {'#10'"23 23 255 2",'#10'" '
+#9'c None",'#10'". '#9'c #000200",'#10'"+ '#9'c #121212",'#10'"@ '#9'c #0000'

View File

@ -242,6 +242,41 @@ Type
function CreateDlg(s: TStrings): TStringsPropEditorDlg; override;
end;
{ TMultiPropertyLink
A component to switch the TIObjects of multiple RTTI controls at once. }
TMultiPropertyLink = class(TComponent)
private
FTIObject: TPersistent;
FMaintainGrandChilds: boolean;
FMaintainSiblings: boolean;
FOnSetTIObject: TNotifyEvent;
FParentControl: TWinControl;
FRootComponent: TComponent;
procedure SetTIObject(const AValue: TPersistent);
procedure SetMaintainGrandChilds(const AValue: boolean);
procedure SetMaintainSiblings(const AValue: boolean);
procedure SetParentControl(const AValue: TWinControl);
procedure SetRootComponent(const AValue: TComponent);
public
constructor Create(TheOwner: TComponent); override;
procedure SetLinks;
procedure SetLinksForChildControls(AParent: TWinControl;
WithGrandChilds: boolean);
procedure SetLinksForChildComponents(AComponent: TComponent);
procedure Loaded; override;
published
property TIObject: TPersistent read FTIObject write SetTIObject;
property OnSetTIObject: TNotifyEvent Read FOnSetTIObject Write FOnSetTIObject;
property ParentControl: TWinControl read FParentControl write SetParentControl;
property RootComponent: TComponent read FRootComponent write SetRootComponent;
property MaintainGrandChilds: boolean read FMaintainGrandChilds
write SetMaintainGrandChilds;
property MaintainSiblings: boolean read FMaintainSiblings
write SetMaintainSiblings default true;
end;
{ TTICustomEdit }
@ -1158,6 +1193,49 @@ Type
end;
{ TTICustomColorButton }
TTICustomColorButton = class(TColorButton)
private
FLink: TPropertyLink;
procedure SetLink(const AValue: TPropertyLink);
protected
procedure LinkLoadFromProperty(Sender: TObject); virtual;
procedure LinkSaveToProperty(Sender: TObject); virtual;
function LinkTestEditor(const ATestEditor: TPropertyEditor): Boolean;
procedure ShowColorDialog; override;
public
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
procedure Loaded; override;
procedure EditingDone; override;
property Link: TPropertyLink read FLink write SetLink;
end;
{ TTIColorButton }
TTIColorButton = class(TTICustomColorButton)
published
property Align;
property Anchors;
property BorderWidth;
property ButtonColor;
property Hint;
property OnChangeBounds;
property OnColorChanged;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnPaint;
property OnResize;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property Visible;
end;
{ TTICustomPropertyGrid }
TTICustomPropertyGrid = class(TCustomPropertiesGrid)
@ -1199,7 +1277,9 @@ Type
property ValueFont;
property Visible;
end;
function GetPropertyLinkOfComponent(AComponent: TComponent
): TCustomPropertyLink;
procedure Register;
@ -1207,12 +1287,24 @@ procedure Register;
implementation
function GetPropertyLinkOfComponent(AComponent: TComponent
): TCustomPropertyLink;
begin
Result:=nil;
if AComponent=nil then exit;
try
Result:=TCustomPropertyLink(GetObjectProp(AComponent,'Link',
TCustomPropertyLink));
except
end;
end;
procedure Register;
begin
RegisterComponents('RTTI',[TTIEdit,TTIComboBox,TTIButton,TTICheckBox,
TTILabel,TTIGroupBox,TTIRadioGroup,TTICheckGroup,TTICheckListBox,
TTIListBox,TTIMemo,TTICalendar,TTIImage,TTISpinEdit,TTITrackBar,
TTIMaskEdit,TTIPropertyGrid]);
TTIMaskEdit,TTIColorButton,TTIPropertyGrid,TMultiPropertyLink]);
end;
{ TAliasStrings }
@ -3142,6 +3234,171 @@ begin
FLink:=TheLink;
end;
{ TTICustomColorButton }
procedure TTICustomColorButton.SetLink(const AValue: TPropertyLink);
begin
if FLink=AValue then exit;
FLink.Assign(AValue);
end;
procedure TTICustomColorButton.LinkLoadFromProperty(Sender: TObject);
begin
if Sender=nil then ;
if (FLink.Editor=nil) then exit;
ButtonColor:=TColor(FLink.GetAsInt);
end;
procedure TTICustomColorButton.LinkSaveToProperty(Sender: TObject);
begin
if Sender=nil then ;
if (FLink.Editor=nil) then exit;
FLink.SetAsInt(ButtonColor);
end;
function TTICustomColorButton.LinkTestEditor(const ATestEditor: TPropertyEditor
): Boolean;
begin
Result:=(ATestEditor is TColorPropertyEditor)
and (paDialog in ATestEditor.GetAttributes);
end;
procedure TTICustomColorButton.ShowColorDialog;
begin
if Link.Editor<>nil then
Link.Editor.Edit;
FLink.LoadFromProperty;
end;
constructor TTICustomColorButton.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
FLink:=TPropertyLink.Create(Self);
FLink.Filter:=[{tkUnknown,}tkInteger{,tkChar,tkEnumeration,
tkFloat,tkSet,tkMethod,tkSString,tkLString,tkAString,
tkWString,tkVariant,tkArray,tkRecord,tkInterface,
tkClass,tkObject,tkWChar,tkBool,tkInt64,
tkQWord,tkDynArray,tkInterfaceRaw}];
FLink.OnLoadFromProperty:=@LinkLoadFromProperty;
FLink.OnSaveToProperty:=@LinkSaveToProperty;
FLink.OnTestEditor:=@LinkTestEditor;
end;
destructor TTICustomColorButton.Destroy;
begin
FreeThenNil(FLink);
inherited Destroy;
end;
procedure TTICustomColorButton.Loaded;
begin
inherited Loaded;
FLink.LoadFromProperty;
end;
procedure TTICustomColorButton.EditingDone;
begin
inherited EditingDone;
FLink.EditingDone;
end;
{ TMultiPropertyLink }
procedure TMultiPropertyLink.SetTIObject(const AValue: TPersistent);
begin
if FTIObject=AValue then exit;
FTIObject:=AValue;
if Assigned(OnSetTIObject) then OnSetTIObject(Self);
SetLinks;
end;
procedure TMultiPropertyLink.SetMaintainGrandChilds(const AValue: boolean);
begin
if FMaintainGrandChilds=AValue then exit;
FMaintainGrandChilds:=AValue;
if FMaintainGrandChilds then SetLinks;
end;
procedure TMultiPropertyLink.SetMaintainSiblings(const AValue: boolean);
begin
if FMaintainSiblings=AValue then exit;
FMaintainSiblings:=AValue;
if FMaintainSiblings then SetLinks;
end;
procedure TMultiPropertyLink.SetParentControl(const AValue: TWinControl);
begin
if FParentControl=AValue then exit;
FParentControl:=AValue;
if FParentControl<>nil then SetLinks;
end;
procedure TMultiPropertyLink.SetRootComponent(const AValue: TComponent);
begin
if FRootComponent=AValue then exit;
FRootComponent:=AValue;
if FRootComponent<>nil then SetLinks;
end;
constructor TMultiPropertyLink.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
FMaintainSiblings:=true;
end;
procedure TMultiPropertyLink.SetLinks;
begin
if [csLoading,csDestroying]*ComponentState<>[] then exit;
if RootComponent<>nil then
SetLinksForChildComponents(RootComponent);
if ParentControl<>nil then
SetLinksForChildControls(ParentControl,MaintainGrandChilds);
if MaintainSiblings and (Owner<>nil) then
SetLinksForChildComponents(Owner);
end;
procedure TMultiPropertyLink.SetLinksForChildControls(AParent: TWinControl;
WithGrandChilds: boolean);
var
i: Integer;
CurControl: TControl;
CurLink: TCustomPropertyLink;
begin
if AParent<>nil then begin
for i:=0 to AParent.ControlCount-1 do begin
CurControl:=AParent.Controls[i];
CurLink:=GetPropertyLinkOfComponent(CurControl);
if CurLink<>nil then
CurLink.TIObject:=TIObject;
if WithGrandChilds and (CurControl is TWinControl) then
SetLinksForChildControls(TWinControl(CurControl),true);
end;
end;
end;
procedure TMultiPropertyLink.SetLinksForChildComponents(AComponent: TComponent
);
var
i: Integer;
CurComponent: TComponent;
CurLink: TCustomPropertyLink;
begin
if AComponent<>nil then begin
for i:=0 to AComponent.ComponentCount-1 do begin
CurComponent:=AComponent.Components[i];
CurLink:=GetPropertyLinkOfComponent(CurComponent);
if CurLink<>nil then
CurLink.TIObject:=TIObject;
end;
end;
end;
procedure TMultiPropertyLink.Loaded;
begin
inherited Loaded;
SetLinks;
end;
initialization
{$I rttictrls.lrs}
// TPropertyLink
@ -3159,5 +3416,8 @@ initialization
// property editor for TTICustomPropertyGrid.TIObject
RegisterPropertyEditor(ClassTypeInfo(TPersistent),
TTICustomPropertyGrid, 'TIObject', TTIObjectPropertyEditor);
// property editor for TMultiPropertyLink.TIObject
RegisterPropertyEditor(ClassTypeInfo(TPersistent),
TMultiPropertyLink, 'TIObject', TTIObjectPropertyEditor);
end.

View File

@ -0,0 +1,199 @@
/* XPM */
static char * tmultipropertylink_xpm[] = {
"23 23 173 2",
" c None",
". c #634C47",
"+ c #856C66",
"@ c #775E5A",
"# c #4F3732",
"$ c #8A5B51",
"% c #DEBCB5",
"& c #E8C8C1",
"* c #E4C1BA",
"= c #C3988E",
"- c #4B251C",
"; c #5D281C",
"> c #CC8677",
", c #F8EEEC",
"' c #DDABA0",
") c #CC8170",
"! c #934737",
"~ c #7A2E1E",
"{ c #BA533D",
"] c #CC8171",
"^ c #BF604C",
"/ c #B84F39",
"( c #A03F2A",
"_ c #3C160E",
": c #6E291A",
"< c #B4452D",
"[ c #B4452E",
"} c #AC422C",
"| c #A7402A",
"1 c #873625",
"2 c #6B4941",
"3 c #846B65",
"4 c #441910",
"5 c #AC4C37",
"6 c #C06450",
"7 c #B35D4C",
"8 c #894639",
"9 c #8F5B50",
"0 c #51271E",
"a c #A56D61",
"b c #BD8376",
"c c #844D41",
"d c #C88374",
"e c #25282C",
"f c #5F6267",
"g c #43454A",
"h c #362F23",
"i c #6B6052",
"j c #733425",
"k c #B8523C",
"l c #53585F",
"m c #C9CBD0",
"n c #CED0D5",
"o c #C9CBD1",
"p c #898D93",
"q c #1D2025",
"r c #51644D",
"s c #C5D2C2",
"t c #C4CFC1",
"u c #7F493A",
"v c #2A2F39",
"w c #888D97",
"x c #EFF0F1",
"y c #B0B3BB",
"z c #9499A3",
"A c #8E939D",
"B c #414650",
"C c #202F1F",
"D c #8DA987",
"E c #E8EFE7",
"F c #BACDB6",
"G c #675946",
"H c #2A303B",
"I c #575F6F",
"J c #A6AAB3",
"K c #686F7D",
"L c #525A6B",
"M c #51596A",
"N c #404858",
"O c #375335",
"P c #658F5B",
"Q c #A6BFA1",
"R c #779C6E",
"S c #547849",
"T c #543C2A",
"U c #A36D60",
"V c #250E09",
"W c #282E39",
"X c #434C5E",
"Y c #40495A",
"Z c #343C4A",
"` c #2D323B",
" . c #515D56",
".. c #475948",
"+. c #33502F",
"@. c #4E7D44",
"#. c #4F7E44",
"$. c #36542D",
"%. c #373224",
"&. c #1F242D",
"*. c #48505F",
"=. c #5D6474",
"-. c #5D6574",
";. c #505764",
">. c #535961",
",. c #888D92",
"'. c #38493A",
"). c #4A6844",
"!. c #52674E",
"~. c #9A3A25",
"{. c #31120C",
"]. c #353A43",
"^. c #868C97",
"/. c #9398A2",
"(. c #5A5F69",
"_. c #878C96",
":. c #444952",
"<. c #2E3F2C",
"[. c #C16552",
"}. c #BD5F4C",
"|. c #7B2F1F",
"1. c #0F0503",
"2. c #17191E",
"3. c #31343B",
"4. c #292F3A",
"5. c #C3877A",
"6. c #B97F73",
"7. c #865044",
"8. c #170A06",
"9. c #766A5A",
"0. c #5B5143",
"a. c #17130C",
"b. c #D2DECF",
"c. c #CCDAC9",
"d. c #96A891",
"e. c #1E291B",
"f. c #BBCEB7",
"g. c #9CB796",
"h. c #9BB795",
"i. c #0B130A",
"j. c #5F8B55",
"k. c #4B7441",
"l. c #1A2A17",
"m. c #3C4455",
"n. c #365334",
"o. c #518146",
"p. c #47713D",
"q. c #192816",
"r. c #575F6E",
"s. c #2D333F",
"t. c #1C2B1A",
"u. c #55804B",
"v. c #68915E",
"w. c #699260",
"x. c #648E5B",
"y. c #395C32",
"z. c #090E07",
"A. c #90959F",
"B. c #5E636E",
"C. c #111419",
"D. c #070B06",
"E. c #395033",
"F. c #89A783",
"G. c #9BB695",
"H. c #98B491",
"I. c #6B8964",
"J. c #162414",
"K. c #23262C",
"L. c #070709",
"M. c #192517",
"N. c #364831",
"O. c #293826",
"P. c #090E08",
" . + @ # ",
" $ % & * = - ",
" ; > , ' ) ) ! ",
" ~ { ] ^ / / ( _ ",
" : < [ } | 1 2 3 @ # ",
" 4 5 6 7 8 9 % & * = - ",
" 0 a b c d , ' ) ) ! ",
" e f g h i j k ] ^ / / ( _ ",
" l m n o p q r s t u < [ } | 1 2 3 @ # ",
"v w x y z A B C D E F G 5 6 7 8 9 % & * = - ",
"H I J K L M N O P Q R S T U b c d , ' ) ) ! V ",
"W X X X Y Z ` ...+.@.#.$.%.i j k ] ^ / / ( _ ",
"&.*.=.-.;.>.m n o ,.'.).!.s t u < [ [ [ < ~.{.",
" ].^./.(._.x y z A :.<.D E F G 5 6 [.[.}.|.1.",
" 2.3.4.I J K L M N O P Q R S T U 5.6.7.8. ",
" W X X X Y Z ` ...+.@.#.$.%.9.0.a. ",
" &.*.=.-.;.>.m n o ,.'.).!.s b.c.d.e. ",
" ].^./.(._.x y z A :.<.D E f.g.h.).i.",
" 2.3.4.I J K L M N O P Q R j.j.k.l.",
" W X X X X X m.n.o.o.o.o.o.p.q.",
" &.*.=.-.-.r.s.t.u.v.w.w.x.y.z.",
" ].^./.A.B.C.D.E.F.G.H.I.J. ",
" 2.3.K.L. M.N.O.P. "};

View File

@ -0,0 +1,183 @@
/* XPM */
static char * tticolorbutton_xpm[] = {
"23 23 157 2",
" c None",
". c #F8F8F8",
"+ c #FFFFFF",
"@ c #EFEFEF",
"# c #F0F0F0",
"$ c #FCFCFC",
"% c #030303",
"& c #C1C1C1",
"* c #BCBCBC",
"= c #BDBDBD",
"- c #C5C5C5",
"; c #BBBBBB",
"> c #BEBEBE",
", c #BFBFBF",
"' c #808080",
") c #000000",
"! c #F4F4F4",
"~ c #C8C8C8",
"{ c #C6C6C6",
"] c #C4C4C4",
"^ c #C0C0C0",
"/ c #FF0000",
"( c #FFFF00",
"_ c #0000FF",
": c #B9B9B9",
"< c #848484",
"[ c #BABABA",
"} c #775E5A",
"| c #4F3732",
"1 c #E4C1BA",
"2 c #C3988E",
"3 c #4B251C",
"4 c #FEFEFE",
"5 c #7C7C7C",
"6 c #8B8B8B",
"7 c #767676",
"8 c #828282",
"9 c #878787",
"0 c #7A7A7A",
"a c #7F7F7F",
"b c #888888",
"c c #7D7D7D",
"d c #898989",
"e c #CC8170",
"f c #934737",
"g c #020202",
"h c #050505",
"i c #010101",
"j c #B84F39",
"k c #A03F2A",
"l c #3C160E",
"m c #6E291A",
"n c #B4452D",
"o c #B4452E",
"p c #9A3A25",
"q c #31120C",
"r c #441910",
"s c #AC4C37",
"t c #C06450",
"u c #C16552",
"v c #BD5F4C",
"w c #7B2F1F",
"x c #0F0503",
"y c #51271E",
"z c #A56D61",
"A c #C3877A",
"B c #B97F73",
"C c #865044",
"D c #170A06",
"E c #25282C",
"F c #5F6267",
"G c #43454A",
"H c #362F23",
"I c #766A5A",
"J c #5B5143",
"K c #17130C",
"L c #53585F",
"M c #C9CBD0",
"N c #CED0D5",
"O c #C9CBD1",
"P c #898D93",
"Q c #1D2025",
"R c #51644D",
"S c #C5D2C2",
"T c #D2DECF",
"U c #CCDAC9",
"V c #96A891",
"W c #1E291B",
"X c #2A2F39",
"Y c #888D97",
"Z c #EFF0F1",
"` c #B0B3BB",
" . c #9499A3",
".. c #8E939D",
"+. c #414650",
"@. c #202F1F",
"#. c #8DA987",
"$. c #E8EFE7",
"%. c #BBCEB7",
"&. c #9CB796",
"*. c #9BB795",
"=. c #4A6844",
"-. c #2A303B",
";. c #575F6F",
">. c #A6AAB3",
",. c #686F7D",
"'. c #525A6B",
"). c #51596A",
"!. c #404858",
"~. c #375335",
"{. c #658F5B",
"]. c #A6BFA1",
"^. c #779C6E",
"/. c #5F8B55",
"(. c #4B7441",
"_. c #1A2A17",
":. c #282E39",
"<. c #434C5E",
"[. c #3C4455",
"}. c #365334",
"|. c #518146",
"1. c #47713D",
"2. c #192816",
"3. c #1F242D",
"4. c #48505F",
"5. c #5D6474",
"6. c #5D6574",
"7. c #575F6E",
"8. c #2D333F",
"9. c #1C2B1A",
"0. c #55804B",
"a. c #68915E",
"b. c #699260",
"c. c #648E5B",
"d. c #395C32",
"e. c #090E07",
"f. c #353A43",
"g. c #868C97",
"h. c #9398A2",
"i. c #90959F",
"j. c #5E636E",
"k. c #111419",
"l. c #070B06",
"m. c #395033",
"n. c #89A783",
"o. c #9BB695",
"p. c #98B491",
"q. c #6B8964",
"r. c #162414",
"s. c #17191E",
"t. c #31343B",
"u. c #23262C",
"v. c #070709",
"w. c #192517",
"x. c #364831",
"y. c #293826",
"z. c #090E08",
". + @ + + # + + + + + + + + + + $ + % ",
"+ & * = - & - ; & > & , = - , & , ' ) ",
"! ~ > { ) ) ) ) ) ) ) ) ) ) ] & , ' ) ",
"+ * & ^ ) / / ) ( ( ) _ _ ) : & , ' ) ",
". , - ; ) / / ) ( ( ) _ _ ) ^ & , ' ) ",
". , - ; ) ) ) ) ) ) ) ) ) ) > & , ' ) ",
"+ * & ^ ) < < ) + + ) ) ) ) ^ & , ' ) ",
"! ~ > { ) < < ) + + ) ) ) ) ] & , ' ) ",
"+ & * = ) ) ) ) ) ) ) ) ) ) [ & , ' ) } | ",
". , - ; & , - ; & > & , ; & > & , ' ) 1 2 3 ",
"4 5 6 7 8 9 0 a a a a a a a a b c d ) e e f ",
") g ) h ) i ) ) ) ) ) ) ) ) ) ) g ) ) j j k l ",
" m n o o o n p q ",
" r s t u u v w x ",
" y z A B C D ",
" E F G H I J K ",
" L M N O P Q R S T U V W ",
" X Y Z ` ...+.@.#.$.%.&.*.=. ",
" -.;.>.,.'.).!.~.{.].^././.(._.",
" :.<.<.<.<.<.[.}.|.|.|.|.|.1.2.",
" 3.4.5.6.6.7.8.9.0.a.b.b.c.d.e.",
" f.g.h.i.j.k.l.m.n.o.p.q.r. ",
" s.t.u.v. w.x.y.z. "};

View File

@ -241,10 +241,10 @@ type
FOnColorChanged: TNotifyEvent;
procedure SetBorderWidth(const AValue: integer);
protected
procedure MouseUp(Button: TMouseButton; Shift: TShiftState;
X, Y: Integer); override;
procedure Click; override;
procedure Paint; override;
procedure SetButtonColor(Value: TColor);
procedure ShowColorDialog; virtual;
public
constructor Create(AnOwner: TComponent); override;
destructor Destroy; Override;
@ -420,6 +420,9 @@ end.
{ =============================================================================
$Log$
Revision 1.55 2004/12/13 21:30:21 mattias
implemented TMultiPropertyLink
Revision 1.54 2004/09/27 21:45:44 vincents
splitted off unit FileUtil, it doesn't depend on other LCL units

View File

@ -55,18 +55,9 @@ begin
Invalidate;
end;
procedure TColorButton.SetBorderWidth(const AValue: integer);
procedure TColorButton.ShowColorDialog;
var NewColor: TColor;
begin
if FBorderWidth=AValue then exit;
FBorderWidth:=AValue;
Invalidate;
end;
procedure TColorButton.MouseUp(Button: TMouseButton; Shift: TShiftState;
X, Y: Integer);
var NewColor:TColor;
begin
inherited MouseUp(Button,Shift,X,Y);
if FColorDialog<>nil then exit;
if not Enabled then exit;
NewColor:=ButtonColor;
@ -82,5 +73,18 @@ begin
ButtonColor:=NewColor;
end;
procedure TColorButton.SetBorderWidth(const AValue: integer);
begin
if FBorderWidth=AValue then exit;
FBorderWidth:=AValue;
Invalidate;
end;
procedure TColorButton.Click;
begin
inherited Click;
ShowColorDialog;
end;
// included by buttons.pp