summaryrefslogtreecommitdiff
path: root/extras/tiopf/mvp/view_impl.pas
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-04-10 21:51:37 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-04-10 21:51:37 +0000
commit2d5b6397c7f583fcaad81bf98c6af5623e759592 (patch)
treefbcd3bdaa81d8c83ab16964577cf4ffa5ded1f9d /extras/tiopf/mvp/view_impl.pas
parent705e7f97da51551ca26986526ebd8f1ed265075e (diff)
downloadfpGUI-2d5b6397c7f583fcaad81bf98c6af5623e759592.tar.xz
* The start of a MVP implementation for tiOPF and fpGUI.
Diffstat (limited to 'extras/tiopf/mvp/view_impl.pas')
-rw-r--r--extras/tiopf/mvp/view_impl.pas66
1 files changed, 66 insertions, 0 deletions
diff --git a/extras/tiopf/mvp/view_impl.pas b/extras/tiopf/mvp/view_impl.pas
new file mode 100644
index 00000000..272da1dc
--- /dev/null
+++ b/extras/tiopf/mvp/view_impl.pas
@@ -0,0 +1,66 @@
+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(Subject: IInterface);
+ end;
+
+
+ TComboBoxView = class(TfpgComboBox, IObserver)
+ private
+ procedure IObserver.Update = ObserverUpdate;
+ procedure ObserverUpdate(Subject: IInterface);
+ end;
+
+
+implementation
+
+{ TListBoxView }
+
+procedure TListBoxView.ObserverUpdate(Subject: IInterface);
+var
+ Obj: IListModel;
+ i: integer;
+begin
+ Subject.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(Subject: IInterface);
+var
+ Obj: IListModel;
+ i: integer;
+begin
+ Subject.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.
+