SVN Commit by andreas: r4404 - in trunk/pgadmin3/src: . ctl include/ctl

From: svn(at)pgadmin(dot)org
To: pgadmin-hackers(at)postgresql(dot)org
Subject: SVN Commit by andreas: r4404 - in trunk/pgadmin3/src: . ctl include/ctl
Date: 2005-08-15 09:09:10
Message-ID: 200508150909.j7F99AWb001280@developer.pgadmin.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

Author: andreas
Date: 2005-08-15 10:09:10 +0100 (Mon, 15 Aug 2005)
New Revision: 4404

Added:
trunk/pgadmin3/src/ctl/ctlTree.cpp
trunk/pgadmin3/src/include/ctl/ctlTree.h
Modified:
trunk/pgadmin3/src/Makefile.am
Log:
more class factory refactoring stuff, the rest

Modified: trunk/pgadmin3/src/Makefile.am
===================================================================
--- trunk/pgadmin3/src/Makefile.am 2005-08-15 08:58:47 UTC (rev 4403)
+++ trunk/pgadmin3/src/Makefile.am 2005-08-15 09:09:10 UTC (rev 4404)
@@ -39,7 +39,7 @@
$(srcdir)/agent/dlgJob.cpp $(srcdir)/agent/dlgSchedule.cpp $(srcdir)/agent/dlgStep.cpp \
\
$(srcdir)/ctl/xh_sqlbox.cpp $(srcdir)/ctl/xh_calb.cpp $(srcdir)/ctl/xh_timespin.cpp $(srcdir)/ctl/xh_ctlcombo.cpp \
-$(srcdir)/ctl/ctlSecurityPanel.cpp $(srcdir)/ctl/ctlComboBox.cpp \
+$(srcdir)/ctl/ctlSecurityPanel.cpp $(srcdir)/ctl/ctlComboBox.cpp $(srcdir)/ctl/ctlTree.cpp \
$(srcdir)/ctl/calbox.cpp $(srcdir)/ctl/timespin.cpp $(srcdir)/ctl/ctlListView.cpp \
$(srcdir)/ctl/ctlSQLBox.cpp $(srcdir)/ctl/ctlSQLResult.cpp \
$(srcdir)/ctl/explainCanvas.cpp $(srcdir)/ctl/explainShape.cpp \
@@ -87,7 +87,7 @@
$(srcdir)/include/ctl/ctlListView.h $(srcdir)/include/ctl/calbox.h \
$(srcdir)/include/ctl/timespin.h $(srcdir)/include/ctl/ctlComboBox.h \
$(srcdir)/include/ctl/xh_timespin.h $(srcdir)/include/ctl/xh_calb.h $(srcdir)/include/ctl/xh_sqlbox.h \
-$(srcdir)/include/ctl/xh_ctlcombo.h \
+$(srcdir)/include/ctl/xh_ctlcombo.h $(srcdir)/include/ctl/ctlTree.h \
$(srcdir)/include/parser/parse.h $(srcdir)/include/parser/keywords.h $(srcdir)/include/nodes/parsenodes.h \
$(srcdir)/include/postgres.h $(srcdir)/include/pgDefs.h $(srcdir)/include/pgDatatype.h \
$(srcdir)/include/ctlSecurityPanel.h $(srcdir)/include/dlgClasses.h $(srcdir)/include/frmGrantWizard.h \

Added: trunk/pgadmin3/src/ctl/ctlTree.cpp
===================================================================
--- trunk/pgadmin3/src/ctl/ctlTree.cpp 2005-08-15 08:58:47 UTC (rev 4403)
+++ trunk/pgadmin3/src/ctl/ctlTree.cpp 2005-08-15 09:09:10 UTC (rev 4404)
@@ -0,0 +1,64 @@
+//////////////////////////////////////////////////////////////////////////
+//
+// pgAdmin III - PostgreSQL Tools
+// RCS-ID: $Id: $
+// Copyright (C) 2002 - 2005, The pgAdmin Development Team
+// This software is released under the Artistic Licence
+//
+// ctlTree.cpp - wxTreeCtrl containing pgObjects
+//
+//////////////////////////////////////////////////////////////////////////
+
+// wxWindows headers
+#include <wx/wx.h>
+
+// App headers
+#include "pgAdmin3.h"
+#include "ctl/ctlTree.h"
+
+#include "pgObject.h"
+#include "pgCollection.h"
+
+ctlTree::ctlTree(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
+: wxTreeCtrl(parent, id, pos, size, style)
+{
+}
+
+
+void ctlTree::RemoveDummyChild(pgObject *obj)
+{
+ wxCookieType cookie;
+ wxTreeItemId childItem=GetFirstChild(obj->GetId(), cookie);
+ if (childItem && !GetItemData(childItem))
+ {
+ // The child was a dummy item, which will be replaced by the following ShowTreeDetail by true items
+ Delete(childItem);
+ }
+}
+
+
+wxTreeItemId ctlTree::AppendObject(pgObject *parent, pgObject *object)
+{
+ wxString label;
+ wxTreeItemId item;
+
+ if (object->IsCollection())
+ label = object->GetTypeName();
+ else
+ label = object->GetFullName();
+ item = AppendItem(parent->GetId(), label, object->GetIconId(), -1, object);
+ if (object->IsCollection())
+ object->ShowTreeDetail(this);
+ else if (object->WantDummyChild())
+ AppendItem(object->GetId(), wxT("Dummy"));
+
+ return item;
+}
+
+
+pgCollection *ctlTree::AppendCollection(pgObject *parent, pgaFactory &factory)
+{
+ pgCollection *collection=factory.CreateCollection(parent);
+ AppendObject(parent, collection);
+ return collection;
+}

Added: trunk/pgadmin3/src/include/ctl/ctlTree.h
===================================================================
--- trunk/pgadmin3/src/include/ctl/ctlTree.h 2005-08-15 08:58:47 UTC (rev 4403)
+++ trunk/pgadmin3/src/include/ctl/ctlTree.h 2005-08-15 09:09:10 UTC (rev 4404)
@@ -0,0 +1,34 @@
+//////////////////////////////////////////////////////////////////////////
+//
+// pgAdmin III - PostgreSQL Tools
+// RCS-ID: $Id: $
+// Copyright (C) 2002 - 2005, The pgAdmin Development Team
+// This software is released under the Artistic Licence
+//
+// ctlTree.h - wxTreeCtrl containing pgObjects
+//
+//////////////////////////////////////////////////////////////////////////
+
+#ifndef CTLTREE_H
+#define CTLTREE_H
+
+// wxWindows headers
+#include <wx/wx.h>
+#include <wx/treectrl.h>
+
+
+class pgObject;
+class pgCollection;
+class pgaFactory;
+
+class ctlTree : public wxTreeCtrl
+{
+public:
+ ctlTree(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTR_HAS_BUTTONS);
+ wxTreeItemId AppendObject(pgObject *parent, pgObject *object);
+ void RemoveDummyChild(pgObject *obj);
+ pgCollection *AppendCollection(pgObject *parent, pgaFactory &factory);
+};
+
+
+#endif

Browse pgadmin-hackers by date

  From Date Subject
Next Message svn 2005-08-15 09:10:28 SVN Commit by andreas: r4405 - trunk/pgadmin3/src/include
Previous Message svn 2005-08-11 11:14:44 SVN Commit by dpage: r4398 - trunk/pgadmin3/src/frm