unit cmdlinecfgui; interface uses Classes, SysUtils, contnrs, cmdlinecfg; type { TCmdLineLayoutInfo } // Section names are assumed to be . separated. // Anything after to . is expected to be a "sub section" of the section. { TLayoutSection } TLayoutElementType = (letSwitch, letSection); TLayoutElementTypes = set of TLayoutElementType; TLayoutSection = class(TObject) //level : integer; // number of "dots" in the name public fName : string; fElementType: TLayoutElementType; public Display : string; GUIHint : string; Elements : array of TLayoutSection; ElemCount : integer; function AddElement(const AName: string; AElementType: TLayoutElementType): TLayoutSection; constructor Create(const AName: string = ''; AElementType: TLayoutElementType = letSection); destructor Destroy; override; property Name: string read fName; property ElementType: TLayoutElementType read fElementType; end; TCmdLineLayoutInfo = class(TObject) public RootElement : TLayoutSection; constructor Create; destructor Destroy; override; end; { TCmdLineUIControl } TCmdLineUIControl = class(TObject) private FValueChanged: TNotifyEvent; protected procedure ValueChanged; virtual; public procedure Init(cfg: TCmdLineCfg; layout: TCmdLineLayoutInfo; const ASection : string = ''); virtual; abstract; procedure SetValues(list: TList {of TCmdLineOptionValue}); virtual; abstract; procedure Serialize(list: TList {of TCmdLineOptionValue}); virtual; abstract; property OnValueChanged: TNotifyEvent read FValueChanged write fValueChanged; end; function LayoutFindElement(aparent: TLayoutSection; const Name: string; LookFor: TLayoutElementTypes = [letSection] ): TLayoutSection; procedure LayoutEnumElement(aparent: TLayoutSection; list: TList; LookFor: TLayoutElementTypes = [letSection] ); procedure LayoutGetUnused(cmd: TCmdLineCfg; layout: TLayoutSection; list: TList); implementation procedure LayoutGetSwitches(root: TLayoutSection; hash: TFPHashObjectList); var sct : TList; i : Integer; j : Integer; el : TLayoutSection; sel : TLayoutSection; begin sct:=TList.Create; try sct.Add(root); j:=0; while j