SVN Commit by andreas: r4390 - trunk/pgadmin3/src/include/base
От | svn@pgadmin.org |
---|---|
Тема | SVN Commit by andreas: r4390 - trunk/pgadmin3/src/include/base |
Дата | |
Msg-id | 200508092029.j79KT1fm030721@developer.pgadmin.org обсуждение исходный текст |
Список | pgadmin-hackers |
Author: andreas Date: 2005-08-09 21:29:01 +0100 (Tue, 09 Aug 2005) New Revision: 4390 Added: trunk/pgadmin3/src/include/base/factory.h Log: Refactoring object and tool handling using class factories to make extensions easier Added: trunk/pgadmin3/src/include/base/factory.h =================================================================== --- trunk/pgadmin3/src/include/base/factory.h 2005-08-09 20:28:39 UTC (rev 4389) +++ trunk/pgadmin3/src/include/base/factory.h 2005-08-09 20:29:01 UTC (rev 4390) @@ -0,0 +1,105 @@ +////////////////////////////////////////////////////////////////////////// +// +// pgAdmin III - PostgreSQL Tools +// RCS-ID: $Id: $ +// Copyright (C) 2002 - 2005, The pgAdmin Development Team +// This software is released under the Artistic Licence +// +// factory.h - Object classes factory +// +////////////////////////////////////////////////////////////////////////// + +#ifndef FACTORY_H +#define FACTORY_H + +// wxWindows headers +#include <wx/wx.h> + +#ifdef WIN32 +#pragma warning(disable:4183) +#endif + +class pgObject; +class frmMain; +class dlgProperty; +class wxTreeCtrl; +class pgCollection; +class pgSchema; +class pgaCollectionFactory; + + +class pgaFactory +{ +public: + virtual dlgProperty *CreateDialog(frmMain *frame, pgObject *node, pgObject *parent)=0; + virtual pgObject *CreateObjects(pgCollection *obj, wxTreeCtrl *browser, const wxString &restr=wxEmptyString) { return0; } + virtual bool IsCollection() { return false; } + virtual void AppendMenu(wxMenu *menu); + bool IsCollectionFor(pgaFactory &f) { return f.GetCollectionFactory() == (pgaCollectionFactory*)this; } + + static pgaFactory *GetFactory(int id); + static pgaFactory *GetFactory(const wxString &name); + int GetId() { return id; } + int GetMetaType(); + wxChar *GetTypeName() { return typeName; } + wxChar *GetNewString() { return newString; } + wxChar *GetNewLongString() { return newLongString; } + pgaCollectionFactory *GetCollectionFactory() { return collectionFactory; } + + virtual int GetIconId() { return iconId; } + static void RegisterMenu(wxWindow *w, wxObjectEventFunction func); + char **GetImage() const { return image; } + +protected: + pgaFactory(wxChar *tn=0, wxChar *ns=0, wxChar *nls=0, char **img=0); + + int addImage(char **img); + + int id, metaType; + wxChar *typeName; + wxChar *newString, *newLongString; + int iconId; + char **image; + + pgaCollectionFactory *collectionFactory; + friend class pgaCollectionFactory; +}; + + +class pgaCollectionFactory : public pgaFactory +{ +public: + pgaCollectionFactory(pgaFactory *f, wxChar *tn=0, char **img=0); + wxChar *GetItemTypeName() { return itemFactory->GetTypeName(); } + pgaFactory *GetItemFactory() { return itemFactory; } + pgObject *CreateObjects(pgCollection *obj, wxTreeCtrl *browser, const wxString &restr=wxEmptyString); + +protected: + virtual bool IsCollection() { return true; } + dlgProperty *CreateDialog(frmMain *frame, pgObject *node, pgObject *parent); + + pgaFactory *itemFactory; +}; + + +class actionFactory +{ +public: + virtual wxWindow *StartDialog(frmMain *form, pgObject *obj)=0; + virtual bool CheckEnable(pgObject *obj)=0; + + int GetId() { return id; } + + static void CheckMenu(pgObject *obj, wxMenuBar *menubar, wxToolBar *toolbar); + static void AppendEnabledMenus(wxMenuBar *menuBar, wxMenu *treeContextMenu); + static actionFactory *GetFactory(int id); + static void RegisterMenu(wxWindow *w, wxObjectEventFunction func); + +protected: + actionFactory(); + + int id; +}; + + +#endif
В списке pgadmin-hackers по дате отправления:
Предыдущее
От: svn@pgadmin.orgДата:
Сообщение: SVN Commit by andreas: r4387 - trunk/pgadmin3/docs/en_US
Следующее
От: svn@pgadmin.orgДата:
Сообщение: SVN Commit by andreas: r4389 - trunk/pgadmin3/src/base