diff options
author | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2010-10-14 12:45:22 +0200 |
---|---|---|
committer | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2010-10-14 12:45:22 +0200 |
commit | ecc152d7debac7cd78e3239c148fc873910d21f1 (patch) | |
tree | 1dfe78c449aa919680964a33327345d29a574149 /extras | |
parent | ff7f64d95ca92b644e0d66e2195a69344895b2ce (diff) | |
download | fpGUI-ecc152d7debac7cd78e3239c148fc873910d21f1.tar.xz |
Moved the remaineder of tiOPF support units to tiOPF repository.
Diffstat (limited to 'extras')
-rw-r--r-- | extras/tiopf/mvp/basic_impl.pas | 720 | ||||
-rw-r--r-- | extras/tiopf/mvp/basic_intf.pas | 205 | ||||
-rw-r--r-- | extras/tiopf/mvp/fpgui_intf.pas | 22 | ||||
-rw-r--r-- | extras/tiopf/mvp/gg_mvp.lpk | 53 | ||||
-rw-r--r-- | extras/tiopf/mvp/gg_mvp.pas | 20 | ||||
-rw-r--r-- | extras/tiopf/mvp/readme.txt | 11 | ||||
-rw-r--r-- | extras/tiopf/mvp/view_impl.pas | 66 | ||||
-rw-r--r-- | extras/tiopf/readme.txt | 12 |
8 files changed, 0 insertions, 1109 deletions
diff --git a/extras/tiopf/mvp/basic_impl.pas b/extras/tiopf/mvp/basic_impl.pas deleted file mode 100644 index 8ce4b80b..00000000 --- a/extras/tiopf/mvp/basic_impl.pas +++ /dev/null @@ -1,720 +0,0 @@ -unit basic_impl; - -{$mode objfpc}{$H+} - -interface - -uses - Classes, basic_intf; - -type - - TSubject = class(TInterfacedObject, ISubject) - private - fController: Pointer; - fObservers: IInterfaceList; - fUpdateCount: integer; - function GetController: IInterface; - procedure Attach(Observer: IObserver); - procedure Detach(Observer: IObserver); - procedure Notify; - procedure BeginUpdate; - procedure EndUpdate; - public - constructor Create(const Controller: IInterface); - end; - - - TString = class(TInterfacedObject, IString, IVisited) - private - fString: string; - // IString - function GetAsString: string; - procedure SetAsString(const AValue: string); - // IVisited - procedure Accept(const Visitor: IVisitor); - end; - - - TStringSelection = class(TInterfacedObject, ISelection, IVisited) - private - fModel: IStringListModel; - fItems: IInterfaceList; - // ISelection - procedure AddItem(const Item: IInterface); - procedure Clear; - function GetCount: integer; - procedure RemoveItem(const Item: IInterface); - procedure SelectModel; - // IVisited - procedure Accept(const Visitor: IVisitor); - public - constructor Create(const Model: IStringListModel); virtual; - end; - - - TCommand = class(TInterfacedObject, ICommand, IVisited) - private - fEnabled: Boolean; - fSelection: ISelection; - procedure BindSelection(const Selection: ISelection); - function GetEnabled: Boolean; - protected - property Selection: ISelection read fSelection; - // IVisited - procedure Accept(const Visitor: IVisitor); virtual; - // ICommand - function Execute: Boolean; virtual; abstract; - function GetText: string; virtual; abstract; - public - constructor Create(Enabled: Boolean); virtual; - end; - - - TCommandSet = class(TInterfacedObject, ICommandSet, IObserver, ISubject, IVisited) - private - fItems: IInterfaceList; - fSubject: ISubject; - function GetCount: integer; - // IVisited - procedure Accept(const Visitor: IVisitor); - protected - property Count: integer read GetCount; - property Items: IInterfaceList read fItems; - // IObserver - procedure Update(const ASubject: IInterface); virtual; - // ISubject - property Subject: ISubject read fSubject implements ISubject; - public - constructor Create; virtual; - end; - - - TMVPModel = class(TInterfacedObject, IMVPModel, ISubject) - private - fCommandSet: ICommandSet; - fCurrentSelection: ISelection; - fSubject: ISubject; - // IMVPModel - function GetCommandSet: ICommandSet; - function GetCurrentSelection: ISelection; - protected - property CommandSet: ICommandSet read GetCommandSet; - property CurrentSelection: ISelection read GetCurrentSelection; - // 3 methods to be called by the constructor - procedure BindSelection; virtual; - procedure CreateCommandSet(var ACommandSet: ICommandSet); virtual; abstract; - procedure CreateSelection(var ASelection: ISelection); virtual; abstract; - // ISubject - property Subject: ISubject read fSubject implements ISubject; - public - constructor Create; virtual; - destructor Destroy; override; - end; - - - TListModel = class(TMVPModel, IListModel) - private - fItems: IInterfaceList; - protected - property Items: IInterfaceList read fItems; - // IListModel - function GetCount: Integer; virtual; - function GetItem(Idx: Integer): IInterface; virtual; - procedure Add(const Item: IInterface); virtual; - procedure Clear; virtual; - function IndexOf(const Item: IInterface): Integer; virtual; - procedure Insert(const Item, Before: IInterface); virtual; - procedure Move(const Item, Before: IInterface); virtual; - procedure Remove(const Item: IInterface); virtual; - public - destructor Destroy; override; - end; - - - TStringListModel = class(TListModel, IStringListModel, IVisited) - private - // IStringListModel - function IStringListModel.GetItem = StringListModelGetItem; - function StringListModelGetItem(Idx: Integer): IString; - // IVisited - procedure Accept(const Visitor: IVisitor); virtual; - protected - // IMVPModel - procedure CreateCommandSet(var ACommandSet: ICommandSet); override; - procedure CreateSelection(var ASelection: ISelection); override; - public - destructor Destroy; override; - end; - - - TStringModelCommandSet = class(TCommandSet) - protected - // IObserver - procedure Update(const ASubject: IInterface); override; - public - destructor Destroy; override; - end; - - - TStringVisitor = class(TInterfacedObject, IStringVisitor) - private - fTheString: IString; - protected - // IStringVisitor - function GetTheString: IString; virtual; - procedure VisitString(const Str: IString); virtual; - end; - - - TStringMoveVisitor = class(TStringVisitor, IStringMoveVisitor) - private - fCanDemote: Boolean; - fCanPromote: Boolean; - fModel: IStringListModel; - function GetCanDemote: Boolean; - function GetCanPromote: Boolean; - protected - procedure VisitString(const Str: IString); override; - public - constructor Create(const Model: IStringListModel); virtual; - end; - - - TPromoteStringCommand = class(TCommand) - private - fModel: Pointer; - function GetModel: IStringListModel; - protected - function Execute: Boolean; override; - function GetText: string; override; - public - constructor Create(Enabled: Boolean; const Model: IStringListModel); reintroduce; virtual; - end; - - - TDemoteStringCommand = class(TCommand) - private - fModel: Pointer; - function GetModel: IStringListModel; - protected - function Execute: Boolean; override; - function GetText: string; override; - public - constructor Create(Enabled: Boolean; const Model: IStringListModel); reintroduce; virtual; - end; - - - -implementation - -uses - Math; - -{ TSubject } - -function TSubject.GetController: IInterface; -begin - Result := IInterface(fController); -end; - -procedure TSubject.Attach(Observer: IObserver); -begin - if fObservers = nil then - fObservers := TInterfaceList.Create; - if fObservers.IndexOf(Observer) < 0 then - fObservers.Add(Observer); -end; - -procedure TSubject.Detach(Observer: IObserver); -begin - if fObservers <> nil then - begin - if fObservers.IndexOf(Observer) >= 0 then - fObservers.Remove(Observer); - if fObservers.Count = 0 then - fObservers := nil; - end; -end; - -procedure TSubject.Notify; -var - i: integer; -begin - if fObservers <> nil then - for i := 0 to fObservers.Count-1 do - (fObservers[i] as IObserver).Update(GetController); -end; - -procedure TSubject.BeginUpdate; -begin - Inc(fUpdateCount); -end; - -procedure TSubject.EndUpdate; -begin - Dec(fUpdateCount); - if fUpdateCount = 0 then - Notify; -end; - -constructor TSubject.Create(const Controller: IInterface); -begin - inherited Create; - fController := Pointer(Controller); -end; - -{ TListModel } - -function TListModel.GetCount: Integer; -begin - Result := fItems.Count; -end; - -function TListModel.GetItem(Idx: Integer): IInterface; -begin - Result := fItems[Idx]; -end; - -procedure TListModel.Add(const Item: IInterface); -begin - Subject.BeginUpdate; - if fItems = nil then - fItems := TInterfaceList.Create; -// fItems.Add(Item as IInterface); - fItems.Add(Item); - Subject.EndUpdate; -end; - -procedure TListModel.Clear; -begin - Subject.BeginUpdate; - fItems.Clear; - Subject.EndUpdate; -end; - -function TListModel.IndexOf(const Item: IInterface): Integer; -begin - if fItems <> nil then -// Result := fItems.IndexOf(Item as IInterface) - Result := fItems.IndexOf(Item) - else - Result := -1; -end; - -procedure TListModel.Insert(const Item, Before: IInterface); -var - InsertIdx: integer; -begin - if fItems = nil then - fItems := TInterfaceList.Create; - if fItems.IndexOf(Item) < 0 then - begin - Subject.BeginUpdate; - InsertIdx := fItems.IndexOf(Before); - if InsertIdx < 0 then - InsertIdx := 0; - fItems.Insert(InsertIdx, Item); - Subject.EndUpdate; - end; -end; - -procedure TListModel.Move(const Item, Before: IInterface); -var - IdxItem: integer; - IdxBefore: integer; - MoveItem: IInterface; -begin - if fItems <> nil then - begin - IdxItem := fItems.IndexOf(Item); - if IdxItem >= 0 then - begin - Subject.BeginUpdate; - MoveItem := fItems[IdxItem]; - fItems.Delete(IdxItem); - IdxBefore := fItems.IndexOf(Before); - if IdxBefore >0 then - fItems.Insert(IdxBefore, MoveItem); - Subject.EndUpdate; - end; - end; { if } -end; - -procedure TListModel.Remove(const Item: IInterface); -begin - if fItems <> nil then - begin - Subject.BeginUpdate; - fItems.Remove(Item); - Subject.EndUpdate; - end; -end; - -destructor TListModel.Destroy; -begin - inherited Destroy; -end; - -{ TString } - -function TString.GetAsString: string; -begin - -end; - -procedure TString.SetAsString(const AValue: string); -begin - -end; - -procedure TString.Accept(const Visitor: IVisitor); -begin - -end; - -{ TStringListModel } - -function TStringListModel.StringListModelGetItem(Idx: Integer): IString; -begin - Result := Items[Idx] as IString; -end; - -procedure TStringListModel.Accept(const Visitor: IVisitor); -begin - -end; - -procedure TStringListModel.CreateCommandSet(var ACommandSet: ICommandSet); -begin - -end; - -procedure TStringListModel.CreateSelection(var ASelection: ISelection); -begin - -end; - -destructor TStringListModel.Destroy; -begin - inherited Destroy; -end; - -{ TStringSelection } - -procedure TStringSelection.AddItem(const Item: IInterface); -begin - if fItems = nil then - fItems := TInterfaceList.Create; - if fItems.IndexOf(Item) < 0 then - fItems.Add(Item); -end; - -procedure TStringSelection.Clear; -begin - -end; - -function TStringSelection.GetCount: integer; -begin - Result := fItems.Count; -end; - -procedure TStringSelection.RemoveItem(const Item: IInterface); -begin - if fItems <> nil then - begin - if fItems.IndexOf(Item) >= 0 then - fItems.Remove(Item); - if fItems.Count = 0 then - fItems := nil; - end; -end; - -procedure TStringSelection.SelectModel; -var - i: integer; -begin - for i := 0 to (fModel as IListModel).Count-1 do - fItems.Add(fModel.Item[i]); -end; - -procedure TStringSelection.Accept(const Visitor: IVisitor); -var - i: integer; -begin - for i := 0 to fItems.Count-1 do - (fItems[i] as IVisited).Accept(Visitor); -end; - -constructor TStringSelection.Create(const Model: IStringListModel); -begin - inherited Create; - fModel := Model; -end; - -{ TCommand } - -procedure TCommand.BindSelection(const Selection: ISelection); -begin - fSelection := Selection; -end; - -function TCommand.GetEnabled: Boolean; -begin - Result := fEnabled; -end; - -procedure TCommand.Accept(const Visitor: IVisitor); -begin - (Visitor as ICommandVisitor).VisitComand(self); -end; - -constructor TCommand.Create(Enabled: Boolean); -begin - inherited Create; - fEnabled := Enabled; -end; - -{ TCommandSet } - -function TCommandSet.GetCount: integer; -begin - if fItems <> nil then - Result := fItems.Count - else - Result := 0; -end; - -procedure TCommandSet.Accept(const Visitor: IVisitor); -var - i: integer; -begin - for i := 0 to fItems.Count-1 do - (fItems[i] as IVisited).Accept(Visitor); -end; - -procedure TCommandSet.Update(const ASubject: IInterface); -begin - // do nothing yet -end; - -constructor TCommandSet.Create; -begin - inherited Create; - fItems := TInterfaceList.Create; -end; - -{ TMVPModel } - -function TMVPModel.GetCommandSet: ICommandSet; -begin - Result := fCommandSet; -end; - -function TMVPModel.GetCurrentSelection: ISelection; -begin - Result := fCurrentSelection; -end; - -procedure TMVPModel.BindSelection; -begin - (fCurrentSelection as ISubject).Attach(fCommandSet as IObserver); -end; - -constructor TMVPModel.Create; -begin - inherited Create; - fSubject := TSubject.Create(self); - CreateSelection(fCurrentSelection); - CreateCommandSet(fCommandSet); - BindSelection; -end; - -destructor TMVPModel.Destroy; -begin - inherited Destroy; -end; - -{ TStringModelCommandSet } - -procedure TStringModelCommandSet.Update(const ASubject: IInterface); -var - ObjSelection: ISelection; - ObjVisited: IVisited; - ObjModel: IStringListModel; - Visitor: IStringMoveVisitor; - Command: ICommand; -begin - ASubject.QueryInterface(ISelection, ObjSelection); - if ObjSelection <> nil then - begin - Items.Clear; - // We are only interested in a single selection. We don't have a - // mechanism for multi-select yet. - if ObjSelection.Count = 1 then - begin - ObjSelection.QueryInterface(IVisited, ObjVisited); - if ObjVisited <> nil then - begin - ObjVisited.QueryInterface(IStringListModel, ObjModel); - if ObjModel <> nil then - begin - Visitor := TStringMoveVisitor.Create(ObjModel); - ObjVisited.Accept(Visitor); - // This will only give commands that are applicable. So in a Menu the - // available items will keep changing. -{ - if Visitor.CanPromote then - begin - Command := TPromoteStringCommand.Create(True, ObjModel); - Command.BindSelection(ObjSelection); - Items.Add(Command); - end; - if Visitor.CanDemote then - begin - Command := TDemoteStringCommand.Create(True, ObjModel); - Command.BindSelection(ObjSelection); - Items.Add(Command); - end; -} - - // In this case it will return all commands, but only the applicable - // ones will be Enabled. I like this idea more. - Command := TPromoteStringCommand.Create(Visitor.CanPromote, ObjModel); - Command.BindSelection(ObjSelection); - Items.Add(Command); - - Command := TDemoteStringCommand.Create(Visitor.CanDemote, ObjModel); - Command.BindSelection(ObjSelection); - Items.Add(Command); - end; - end; - end; - Subject.Notify; - end; -end; - -destructor TStringModelCommandSet.Destroy; -begin - inherited Destroy; -end; - -{ TStringVisitor } - -function TStringVisitor.GetTheString: IString; -begin - Result := fTheString; -end; - -procedure TStringVisitor.VisitString(const Str: IString); -begin - fTheString := Str; -end; - -{ TStringMoveVisitor } - -function TStringMoveVisitor.GetCanDemote: Boolean; -begin - Result := fCanDemote; -end; - -function TStringMoveVisitor.GetCanPromote: Boolean; -begin - Result := fCanPromote; -end; - -procedure TStringMoveVisitor.VisitString(const Str: IString); -begin - inherited VisitString(Str); - fCanPromote := fModel.IndexOf(Str) > 0; - fCanDemote := fModel.IndexOf(Str) < (fModel.Count - 1) -end; - -constructor TStringMoveVisitor.Create(const Model: IStringListModel); -begin - inherited Create; - fModel := Model; -end; - - -{ TPromoteStringCommand } - -function TPromoteStringCommand.GetModel: IStringListModel; -begin - Result := IStringListModel(fModel); -end; - -function TPromoteStringCommand.Execute: Boolean; -var - Visitor: IStringVisitor; - BeforeIdx: Integer; -begin - Visitor := TStringVisitor.Create; - try - (Selection as IVisited).Accept(Visitor); - BeforeIdx := Max(GetModel.IndexOf(Visitor.TheString) - 1, 0); - GetModel.Move(Visitor.TheString, GetModel.Item[BeforeIdx]); - Result := True; - except - Result := False; - end; -end; - -function TPromoteStringCommand.GetText: string; -begin - Result := 'Promote String'; -end; - -constructor TPromoteStringCommand.Create(Enabled: Boolean; - const Model: IStringListModel); -begin - inherited Create(Enabled); - fModel := Pointer(Model); -end; - -{ TDemoteStringCommand } - -function TDemoteStringCommand.GetModel: IStringListModel; -begin - Result := IStringListModel(fModel); -end; - -function TDemoteStringCommand.Execute: Boolean; -var - Visitor: IStringVisitor; - BeforeIdx: Integer; -begin - Visitor := TStringVisitor.Create; - try - (Selection as IVisited).Accept(Visitor); - BeforeIdx := GetModel.IndexOf(Visitor.TheString) + 2; - if BeforeIdx > GetModel.Count - 1 then - begin - (GetModel as ISubject).BeginUpdate; - GetModel.Remove(Visitor.TheString); - GetModel.Add(Visitor.TheString); - (GetModel as ISubject).EndUpdate; - end - else - GetModel.Move(Visitor.TheString, GetModel.Item[BeforeIdx]); - Result := True; - except - Result := False; - end; -end; - -function TDemoteStringCommand.GetText: string; -begin - Result := 'Demote String'; -end; - -constructor TDemoteStringCommand.Create(Enabled: Boolean; - const Model: IStringListModel); -begin - inherited Create(Enabled); - fModel := Pointer(Model); -end; - -end. - diff --git a/extras/tiopf/mvp/basic_intf.pas b/extras/tiopf/mvp/basic_intf.pas deleted file mode 100644 index a569db9a..00000000 --- a/extras/tiopf/mvp/basic_intf.pas +++ /dev/null @@ -1,205 +0,0 @@ -unit basic_intf; - -{$mode objfpc}{$H+} - -interface - -type - // forward declarations - ISubject = interface; - IMVPView = interface; - ICommandMenuItem = interface; - IString = interface; - - - // event types - TSelectStringEvent = procedure(const AString: IString) of object; - - - IObserver = interface(IInterface) - ['{16CD208B-5F37-41FC-82A4-BFDD16DB3203}'] - procedure Update(const ASubject: IInterface); - end; - - - ISubject = interface(IInterface) - ['{004B3299-C221-4A44-87A7-7657D90B6493}'] - procedure Attach(Observer: IObserver); - procedure Detach(Observer: IObserver); - procedure Notify; - procedure BeginUpdate; - procedure EndUpdate; - end; - - - IVisitor = interface(IInterface) - ['{35E154D2-6573-42DA-9854-156F3B19C95F}'] - // empty interface - end; - - IVisited = interface(IInterface) - ['{7CF62F51-9412-445C-9E8C-DE94F2B1E280}'] - procedure Accept(const Visitor: IVisitor); - end; - - - IListModel = interface(IInterface) - ['{1A772375-1263-4790-8827-F7BEA358674A}'] - function GetCount: Integer; - function GetItem(Idx: Integer): IInterface; - procedure Add(const Item: IInterface); - procedure Clear; - function IndexOf(const Item: IInterface): Integer; - procedure Insert(const Item, Before: IInterface); - procedure Move(const Item, Before: IInterface); - procedure Remove(const Item: IInterface); - property Count: Integer read GetCount; - property Item[Idx: Integer]: IInterface read GetItem; - end; - -(* - IController = interface(IInterface) - ['{4A99C01A-D025-4562-8E94-3A0C873CE894}'] - function GetModel: IModel; - function GetView: IView; - procedure SetModel(const AValue: IModel); - procedure SetView(const AValue: IView); - property Model: IModel read GetModel write SetModel; - property View: IView read GetView write SetView; - end; -*) - - IString = interface(IInterface) - ['{E76984A4-1287-4353-8370-A7332B9FB1CB}'] - function GetAsString: string; - procedure SetAsString(const AValue: string); - property AsString: string read GetAsString write SetAsString; - end; - - - IStringListModel = interface(IListModel) - ['{769804CD-89E4-43C7-B8EF-783BFE27214E}'] - function GetItem(Idx: Integer): IString; overload; - property Item[Idx: Integer]: IString read GetItem; - end; - - - ISelection = interface(IInterface) - ['{F4DDA0EA-E982-4785-8602-5B32E8DD6DA2}'] - procedure AddItem(const Item: IInterface); - procedure Clear; - function GetCount: integer; - procedure RemoveItem(const Item: IInterface); - property Count: integer read GetCount; - end; - - - ICommand = interface(IInterface) - ['{B333C7E1-B124-4D08-A640-DC02F36264C7}'] - procedure BindSelection(const Selection: ISelection); - function Execute: Boolean; - function GetEnabled: Boolean; - function GetText: string; - property Enabled: Boolean read GetEnabled; - property Text: string read GetText; - end; - - - ICommandSet = interface(IInterface) - ['{1622FF69-3104-47EA-8741-9C1B05ADA30B}'] - // empty interface - end; - - - ICommandVisitor = interface(IVisitor) - ['{628B3A4A-30D1-48D3-8B46-090F08AD2AC8}'] - procedure VisitComand(const Command: ICommand); - end; - - - ICommandMenu = interface(IInterface) - ['{3C666D8F-6BED-454B-8BFE-28422943B300}'] - function AddItem(const Caption: string; Enabled: Boolean): ICommandMenuItem; - end; - - - ICommandMenuItem = interface(IInterface) - ['{7DFCF2BD-70DA-4DAC-B8D5-C6FB882267CF}'] - function GetCaption: string; - function GetChecked: Boolean; - function GetCommand: ICommand; - procedure SetCaption(const AValue: string); - procedure SetChecked(const AValue: Boolean); - procedure SetCommand(const AValue: ICommand); - property Caption: string read GetCaption write SetCaption; - property Checked: Boolean read GetChecked write SetChecked; - property Command: ICommand read GetCommand write SetCommand; - end; - - - IStringVisitor = interface(IVisitor) - ['{DA12355F-0727-41B3-9080-DDAF20797FC5}'] - function GetTheString: IString; - procedure VisitString(const Str: IString); - property TheString: IString - read GetTheString; - end; - - - IMVPModel = interface(IInterface) - ['{85223140-B263-4413-89E3-BFA37E9D3112}'] - function GetCommandSet: ICommandSet; - function GetCurrentSelection: ISelection; - property CommandSet: ICommandSet read GetCommandSet; - property CurrentSelection: ISelection read GetCurrentSelection; - end; - - - IMVPPresenter = interface(IInterface) - ['{5B8477DA-A006-4DE1-B304-9512BFAD7507}'] - function GetCommandMenu: ICommandMenu; - function GetModel: IMVPModel; - function GetView: IMVPView; - procedure SetCommandMenu(const AValue: ICommandMenu); - procedure SetModel(const AValue: IMVPModel); - procedure SetView(const AValue: IMVPView); - property CommandMenu: ICommandMenu read GetCommandMenu write SetCommandMenu; - property Model: IMVPModel read GetModel write SetModel; - property View: IMVPView read GetView write SetView; - end; - - - IMVPView = interface(IInterface) - ['{2C575FE7-BACD-46EC-9D72-AEDA44836B20}'] - procedure AdoptCommandMenu(const Value: ICommandMenu); - procedure OrphanCommandMenu(const Value: ICommandMenu); - end; - - - IStringListView = interface(IMVPView) - ['{D834710A-9C1A-42D1-A29B-7F9F8FB46426}'] - function GetOnSelectString: TSelectStringEvent; - procedure SetOnSelectString(const AValue: TSelectStringEvent); - property OnSelectString: TSelectStringEvent read GetOnSelectString write SetOnSelectString; - end; - - - IStringMoveVisitor = interface(IStringVisitor) - ['{DB89C96F-DA90-43ED-A621-51B70E6C600E}'] - function GetCanDemote: Boolean; - function GetCanPromote: Boolean; - property CanDemote: Boolean read GetCanDemote; - property CanPromote: Boolean read GetCanPromote; - end; - - - - - -implementation - - - - -end. - diff --git a/extras/tiopf/mvp/fpgui_intf.pas b/extras/tiopf/mvp/fpgui_intf.pas deleted file mode 100644 index fea8b153..00000000 --- a/extras/tiopf/mvp/fpgui_intf.pas +++ /dev/null @@ -1,22 +0,0 @@ -unit fpgui_intf; - -{$mode objfpc}{$H+} - -interface - -uses - gui_menu, basic_intf; - -type - - IPopupCommandMenu = interface(IInterface) - ['{812C1940-A8BD-4BB4-AE8D-37A912D44A6D}'] - function GetMenu: TfpgPopupMenu; - procedure SetMenu(const AValue: TfpgPopupMenu); - property Menu: TfpgPopupMenu read GetMenu write SetMenu; - end; - -implementation - -end. - diff --git a/extras/tiopf/mvp/gg_mvp.lpk b/extras/tiopf/mvp/gg_mvp.lpk deleted file mode 100644 index 3c335171..00000000 --- a/extras/tiopf/mvp/gg_mvp.lpk +++ /dev/null @@ -1,53 +0,0 @@ -<?xml version="1.0"?> -<CONFIG> - <Package Version="3"> - <Name Value="gg_mvp"/> - <CompilerOptions> - <Version Value="5"/> - <SearchPaths> - <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> - </SearchPaths> - <CodeGeneration> - <Generate Value="Faster"/> - </CodeGeneration> - <Other> - <CompilerPath Value="$(CompPath)"/> - </Other> - </CompilerOptions> - <Files Count="4"> - <Item1> - <Filename Value="basic_intf.pas"/> - <UnitName Value="basic_intf"/> - </Item1> - <Item2> - <Filename Value="basic_impl.pas"/> - <UnitName Value="basic_impl"/> - </Item2> - <Item3> - <Filename Value="view_impl.pas"/> - <UnitName Value="view_impl"/> - </Item3> - <Item4> - <Filename Value="fpgui_intf.pas"/> - <UnitName Value="fpgui_intf"/> - </Item4> - </Files> - <Type Value="RunAndDesignTime"/> - <RequiredPkgs Count="2"> - <Item1> - <PackageName Value="fpgui_package"/> - </Item1> - <Item2> - <PackageName Value="FCL"/> - <MinVersion Major="1" Valid="True"/> - </Item2> - </RequiredPkgs> - <UsageOptions> - <UnitPath Value="$(PkgOutDir)"/> - </UsageOptions> - <PublishOptions> - <Version Value="2"/> - <IgnoreBinaries Value="False"/> - </PublishOptions> - </Package> -</CONFIG> diff --git a/extras/tiopf/mvp/gg_mvp.pas b/extras/tiopf/mvp/gg_mvp.pas deleted file mode 100644 index c8981b1a..00000000 --- a/extras/tiopf/mvp/gg_mvp.pas +++ /dev/null @@ -1,20 +0,0 @@ -{ This file was automatically created by Lazarus. Do not edit! -This source is only used to compile and install the package. - } - -unit gg_mvp; - -interface - -uses - basic_intf, basic_impl, view_impl, fpgui_intf, LazarusPackageIntf; - -implementation - -procedure Register; -begin -end; - -initialization - RegisterPackage('gg_mvp', @Register); -end. diff --git a/extras/tiopf/mvp/readme.txt b/extras/tiopf/mvp/readme.txt deleted file mode 100644 index d4f097cd..00000000 --- a/extras/tiopf/mvp/readme.txt +++ /dev/null @@ -1,11 +0,0 @@ - - Model-View-Presenter (MVP) implementation for tiOPF and fpGUI - ------------------------------------------------------------- - - This is very early stages, so the code is still unusable. - - - Regards, - - Graeme - - -
\ No newline at end of file diff --git a/extras/tiopf/mvp/view_impl.pas b/extras/tiopf/mvp/view_impl.pas deleted file mode 100644 index 478ca9f9..00000000 --- a/extras/tiopf/mvp/view_impl.pas +++ /dev/null @@ -1,66 +0,0 @@ -unit view_impl; - -{$mode objfpc}{$H+} - -interface - -uses - Classes, gui_listbox, gui_combobox, basic_intf; - -type - - TListBoxView = class(TfpgListBox, IObserver) - private - procedure IObserver.Update = ObserverUpdate; - procedure ObserverUpdate(const ASubject: IInterface); - end; - - - TComboBoxView = class(TfpgComboBox, IObserver) - private - procedure IObserver.Update = ObserverUpdate; - procedure ObserverUpdate(const ASubject: IInterface); - end; - - -implementation - -{ TListBoxView } - -procedure TListBoxView.ObserverUpdate(const ASubject: IInterface); -var - Obj: IListModel; - i: integer; -begin - ASubject.QueryInterface(IListModel, Obj); - if Obj <> nil then - begin - Items.BeginUpdate; - Items.Clear; -// for i := 0 to Obj.Count-1 do -// Items.Add(Obj.Item[i]); - Items.EndUpdate; - end; -end; - -{ TComboBoxView } - -procedure TComboBoxView.ObserverUpdate(const ASubject: IInterface); -var - Obj: IListModel; - i: integer; -begin - ASubject.QueryInterface(IListModel, Obj); - if Obj <> nil then - begin - Items.BeginUpdate; - Items.Clear; -// for i := 0 to Obj.Count-1 do -// Items.Add(Obj.Item[i]); - FocusItem := 1; - Items.EndUpdate; - end; -end; - -end. - diff --git a/extras/tiopf/readme.txt b/extras/tiopf/readme.txt deleted file mode 100644 index c42ea0d9..00000000 --- a/extras/tiopf/readme.txt +++ /dev/null @@ -1,12 +0,0 @@ - - tiOPF2 support units - ==================== - -This directory is for all the GUI related units required for tiOPF to work -with fpGUI based applications. tiOPF is a Object Persistent Framework handling -all persistance of Objects to databases or flat files. - -For more details on tiOPF go to the project home page at: - http://www.tiopf.com - - |