source: cprs/trunk/CPRS-Lib/ORCtrlsDsgn.pas@ 756

Last change on this file since 756 was 456, checked in by Kevin Toppenberg, 16 years ago

Initial Upload of Official WV CPRS 1.0.26.76

File size: 4.8 KB
Line 
1unit ORCtrlsDsgn; // Oct 26, 1997 @ 10:00am
2
3// To Do: eliminate topindex itemtip on mousedown (seen when choosing clinic pts)
4
5interface // --------------------------------------------------------------------------------
6
7uses Classes, DesignIntf, DesignEditors, TypInfo, ORCtrls, SysUtils;
8
9type
10 TORImageIndexesPropertyEditor = class(TPropertyEditor)
11 public
12 procedure Modified;
13 function GetAttributes: TPropertyAttributes; override;
14 procedure GetProperties(Proc: TGetPropProc); override;
15 function GetValue: string; override;
16 procedure SetValue(const Value: string); override;
17 end;
18
19 TORImageIndexesElementPropertyEditor = class(TNestedProperty)
20 private
21 FElement: Integer;
22 FParent: TPropertyEditor;
23 protected
24 constructor Create(Parent: TPropertyEditor; AElement: Integer); reintroduce;
25 function ParentImgIdx(Idx: integer): TORCBImageIndexes;
26 public
27 function GetAttributes: TPropertyAttributes; override;
28 function GetName: string; override;
29 function GetValue: string; override;
30 procedure SetValue(const Value: string); override;
31 end;
32
33procedure Register;
34
35implementation
36
37{ TORImageIndexesPropertyEditor }
38
39type
40 TExposedORCheckBox = class(TORCheckBox)
41 public
42 property CustomImages;
43 end;
44
45procedure TORImageIndexesPropertyEditor.Modified;
46begin
47 inherited Modified;
48end;
49
50function TORImageIndexesPropertyEditor.GetAttributes: TPropertyAttributes;
51begin
52 Result := [paMultiSelect, paSubProperties, paRevertable];
53end;
54
55procedure TORImageIndexesPropertyEditor.GetProperties(Proc: TGetPropProc);
56var
57 i: Integer;
58
59begin
60 for i := 0 to 5 do
61 Proc(TORImageIndexesElementPropertyEditor.Create(Self, i));
62end;
63
64function TORImageIndexesPropertyEditor.GetValue: string;
65begin
66 Result := GetStrValue;
67end;
68
69procedure TORImageIndexesPropertyEditor.SetValue(const Value: string);
70begin
71 SetStrValue(Value);
72end;
73
74{ TORImageIndexesElementPropertyEditor }
75
76constructor TORImageIndexesElementPropertyEditor.Create(Parent: TPropertyEditor; AElement: Integer);
77begin
78 inherited Create(Parent);
79 FElement := AElement;
80 FParent := Parent;
81end;
82
83function TORImageIndexesElementPropertyEditor.ParentImgIdx(Idx: integer): TORCBImageIndexes;
84begin
85 if(FParent.GetComponent(Idx) is TORCheckBox) then
86 Result := TExposedORCheckBox(FParent.GetComponent(Idx)).CustomImages
87 else
88{ if(FParent.GetComponent(Idx) is TORListView) then
89 Result := (FParent.GetComponent(Idx) as TORGEListView).FCustomImages
90 else}
91 Result := nil;
92end;
93
94function TORImageIndexesElementPropertyEditor.GetAttributes: TPropertyAttributes;
95begin
96 Result := [paMultiSelect, paRevertable];
97end;
98
99function TORImageIndexesElementPropertyEditor.GetName: string;
100begin
101 case FElement of
102 0: Result := 'CheckedEnabledIndex';
103 1: Result := 'GrayedEnabledIndex';
104 2: Result := 'UncheckedEnabledIndex';
105 3: Result := 'CheckedDisabledIndex';
106 4: Result := 'GrayedDisabledIndex';
107 5: Result := 'UncheckedDisabledIndex';
108 end;
109end;
110
111function TORImageIndexesElementPropertyEditor.GetValue: string;
112var
113 i :integer;
114
115begin
116 for i := 0 to PropCount-1 do
117 begin
118 with ParentImgIdx(i) do
119 case FElement of
120 0: Result := IntToStr(CheckedEnabledIndex);
121 1: Result := IntToStr(GrayedEnabledIndex);
122 2: Result := IntToStr(UncheckedEnabledIndex);
123 3: Result := IntToStr(CheckedDisabledIndex);
124 4: Result := IntToStr(GrayedDisabledIndex);
125 5: Result := IntToStr(UncheckedDisabledIndex);
126 end;
127 end;
128end;
129
130procedure TORImageIndexesElementPropertyEditor.SetValue(const Value: string);
131var
132 v, i: integer;
133
134begin
135 v := StrToIntDef(Value,-1);
136 for i := 0 to PropCount-1 do
137 begin
138 with ParentImgIdx(i) do
139 case FElement of
140 0: CheckedEnabledIndex := v;
141 1: GrayedEnabledIndex := v;
142 2: UncheckedEnabledIndex := v;
143 3: CheckedDisabledIndex := v;
144 4: GrayedDisabledIndex := v;
145 5: UncheckedDisabledIndex := v;
146 end;
147 end;
148 (FParent as TORImageIndexesPropertyEditor).Modified;
149end;
150
151procedure Register;
152{ used by Delphi to put components on the Palette }
153begin
154 RegisterComponents('CPRS',
155 [TORStaticText, TORListBox, TORComboBox, TORAutoPanel, TOROffsetLabel, TORAlignEdit,
156 TORAlignButton, TORAlignSpeedButton, TORTreeView, TORCheckBox, TORListView,
157 TKeyClickPanel, TKeyClickRadioGroup, TCaptionListBox, TCaptionCheckListBox,
158 TCaptionMemo, TCaptionEdit, TCaptionTreeView, TCaptionComboBox,
159 TCaptionListView, TCaptionStringGrid, TCaptionRichEdit{, TORAlignBitBtn, TORCalendar}]);
160 RegisterPropertyEditor( TypeInfo(string), TORCheckBox, 'ImageIndexes',
161 TORImageIndexesPropertyEditor);
162end;
163
164end.
165
Note: See TracBrowser for help on using the repository browser.