| 1 |
{%MainUnit castlepropedits.pas} |
| 2 |
{ |
| 3 |
Copyright 2010-2023 Michalis Kamburelis. |
| 4 |
|
| 5 |
This file is part of "Castle Game Engine". |
| 6 |
|
| 7 |
"Castle Game Engine" is free software; see the file COPYING.txt, |
| 8 |
included in this distribution, for details about the copyright. |
| 9 |
|
| 10 |
"Castle Game Engine" is distributed in the hope that it will be useful, |
| 11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 13 |
|
| 14 |
---------------------------------------------------------------------------- |
| 15 |
} |
| 16 |
|
| 17 |
{ Editors for TColorChannels (TCastleRenderOptions.InternalColorChannels property), |
| 18 |
unused now (as property is no longer published). } |
| 19 |
|
| 20 |
type |
| 21 |
{ Property editor for TColorChannels } |
| 22 |
TColorChannelsRangeSetPropertyEditor = class(TRangeSetPropertyEditor) |
| 23 |
public |
| 24 |
procedure GetProperties(Proc: TGetPropEditProc); override; |
| 25 |
end; |
| 26 |
|
| 27 |
{ Row editor for TColorChannels } |
| 28 |
TColorChannelsRangeSetElementPropertyEditor = class (TRangeSetElementPropertyEditor) |
| 29 |
function GetName: shortstring; override; |
| 30 |
end; |
| 31 |
|
| 32 |
{ TColorChannelsRangeSetPropertyEditor -------------------------------------------- } |
| 33 |
|
| 34 |
procedure TColorChannelsRangeSetPropertyEditor.GetProperties(Proc: TGetPropEditProc); |
| 35 |
var |
| 36 |
I: Integer; |
| 37 |
begin |
| 38 |
with GetTypeData(GetTypeData(GetPropType)^.CompType)^ do |
| 39 |
for I := MinValue to MaxValue do |
| 40 |
Proc(TColorChannelsRangeSetElementPropertyEditor.Create(Self, I)); |
| 41 |
end; |
| 42 |
|
| 43 |
{ TColorChannelsRangeSetElementPropertyEditor ------------------------------------- } |
| 44 |
|
| 45 |
function TColorChannelsRangeSetElementPropertyEditor.GetName: shortstring; |
| 46 |
begin |
| 47 |
case FElementToShow of |
| 48 |
// Write digit first, as these strings are sorted alphabetically in Object Inspector |
| 49 |
0: Result := '0 - Red'; |
| 50 |
1: Result := '1 - Green'; |
| 51 |
2: Result := '2 - Blue'; |
| 52 |
3: Result := '3 - Alpha'; |
| 53 |
else |
| 54 |
Result := IntToStr(FElementToShow); |
| 55 |
end; |
| 56 |
end; |