[476] | 1 | unit ORCtrlsDsgn; // Oct 26, 1997 @ 10:00am
|
---|
| 2 |
|
---|
| 3 | // To Do: eliminate topindex itemtip on mousedown (seen when choosing clinic pts)
|
---|
| 4 |
|
---|
| 5 | interface // --------------------------------------------------------------------------------
|
---|
| 6 |
|
---|
| 7 | uses Classes, DesignIntf, DesignEditors, TypInfo, ORCtrls, SysUtils;
|
---|
| 8 |
|
---|
| 9 | type
|
---|
| 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 |
|
---|
| 33 | procedure Register;
|
---|
| 34 |
|
---|
| 35 | implementation
|
---|
| 36 |
|
---|
| 37 | { TORImageIndexesPropertyEditor }
|
---|
| 38 |
|
---|
| 39 | type
|
---|
| 40 | TExposedORCheckBox = class(TORCheckBox)
|
---|
| 41 | public
|
---|
| 42 | property CustomImages;
|
---|
| 43 | end;
|
---|
| 44 |
|
---|
| 45 | procedure TORImageIndexesPropertyEditor.Modified;
|
---|
| 46 | begin
|
---|
| 47 | inherited Modified;
|
---|
| 48 | end;
|
---|
| 49 |
|
---|
| 50 | function TORImageIndexesPropertyEditor.GetAttributes: TPropertyAttributes;
|
---|
| 51 | begin
|
---|
| 52 | Result := [paMultiSelect, paSubProperties, paRevertable];
|
---|
| 53 | end;
|
---|
| 54 |
|
---|
| 55 | procedure TORImageIndexesPropertyEditor.GetProperties(Proc: TGetPropProc);
|
---|
| 56 | var
|
---|
| 57 | i: Integer;
|
---|
| 58 |
|
---|
| 59 | begin
|
---|
| 60 | for i := 0 to 5 do
|
---|
| 61 | Proc(TORImageIndexesElementPropertyEditor.Create(Self, i));
|
---|
| 62 | end;
|
---|
| 63 |
|
---|
| 64 | function TORImageIndexesPropertyEditor.GetValue: string;
|
---|
| 65 | begin
|
---|
| 66 | Result := GetStrValue;
|
---|
| 67 | end;
|
---|
| 68 |
|
---|
| 69 | procedure TORImageIndexesPropertyEditor.SetValue(const Value: string);
|
---|
| 70 | begin
|
---|
| 71 | SetStrValue(Value);
|
---|
| 72 | end;
|
---|
| 73 |
|
---|
| 74 | { TORImageIndexesElementPropertyEditor }
|
---|
| 75 |
|
---|
| 76 | constructor TORImageIndexesElementPropertyEditor.Create(Parent: TPropertyEditor; AElement: Integer);
|
---|
| 77 | begin
|
---|
| 78 | inherited Create(Parent);
|
---|
| 79 | FElement := AElement;
|
---|
| 80 | FParent := Parent;
|
---|
| 81 | end;
|
---|
| 82 |
|
---|
| 83 | function TORImageIndexesElementPropertyEditor.ParentImgIdx(Idx: integer): TORCBImageIndexes;
|
---|
| 84 | begin
|
---|
| 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;
|
---|
| 92 | end;
|
---|
| 93 |
|
---|
| 94 | function TORImageIndexesElementPropertyEditor.GetAttributes: TPropertyAttributes;
|
---|
| 95 | begin
|
---|
| 96 | Result := [paMultiSelect, paRevertable];
|
---|
| 97 | end;
|
---|
| 98 |
|
---|
| 99 | function TORImageIndexesElementPropertyEditor.GetName: string;
|
---|
| 100 | begin
|
---|
| 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;
|
---|
| 109 | end;
|
---|
| 110 |
|
---|
| 111 | function TORImageIndexesElementPropertyEditor.GetValue: string;
|
---|
| 112 | var
|
---|
| 113 | i :integer;
|
---|
| 114 |
|
---|
| 115 | begin
|
---|
| 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;
|
---|
| 128 | end;
|
---|
| 129 |
|
---|
| 130 | procedure TORImageIndexesElementPropertyEditor.SetValue(const Value: string);
|
---|
| 131 | var
|
---|
| 132 | v, i: integer;
|
---|
| 133 |
|
---|
| 134 | begin
|
---|
| 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;
|
---|
| 149 | end;
|
---|
| 150 |
|
---|
| 151 | procedure Register;
|
---|
| 152 | { used by Delphi to put components on the Palette }
|
---|
| 153 | begin
|
---|
| 154 | RegisterComponents('CPRS',
|
---|
| 155 | [TORListBox, TORComboBox, TORAutoPanel, TOROffsetLabel, TORAlignEdit,
|
---|
| 156 | TORAlignButton, TORAlignSpeedButton, TORTreeView, TORCheckBox, TORListView,
|
---|
| 157 | TKeyClickPanel, TKeyClickRadioGroup, TCaptionListBox, TCaptionCheckListBox,
|
---|
| 158 | TCaptionMemo, TCaptionEdit, TCaptionTreeView, TCaptionComboBox,
|
---|
| 159 | TCaptionListView, TCaptionStringGrid{, TORAlignBitBtn, TORCalendar}]);
|
---|
| 160 | RegisterPropertyEditor( TypeInfo(string), TORCheckBox, 'ImageIndexes',
|
---|
| 161 | TORImageIndexesPropertyEditor);
|
---|
| 162 | end;
|
---|
| 163 |
|
---|
| 164 | end.
|
---|
| 165 |
|
---|