|
#ifndef HierarchyBrowser_H
#define HierarchyBrowser_H
#include <Model/HierarchyLoader.h>
#include <Model/MetaModel/MetaModelUtilities.h>
#include <Controller/Browsers/OutlineBrowser.h>
#include <Controller/Browsers/SelectionListener.h>
#include <Renderer/MFC/Browsers/HierarchyBrowserRenderer.h>
#include <smart_ptr.h>
class HierarchyBrowserRenderer;
class HierarchyBrowser;
class MouseEvent;
class HierarchyBrowser
{
public:
typedef std::list<smart_ptr<Inheritable> > History;
private:
class OutlineListener : public MultiSelectionListener
{
private:
HierarchyBrowser *mBrowser;
public:
OutlineListener(HierarchyBrowser *b);
void selectionChanged(const std::list<CppTag*> &selection) const;
};
friend class OutlineListener;
class HierarchyListener : public SingleSelectionListener
{
private:
HierarchyBrowser *mBrowser;
public:
HierarchyListener(HierarchyBrowser *b);
void selectionChanged(const CppTag&, const MouseEvent&) const;
};
friend class HierarchyListener;
class EventForwarder : public SingleSelectionListener
{
private:
HierarchyBrowser *mBrowser;
public:
EventForwarder(HierarchyBrowser *b);
void selectionChanged(const CppTag&, const MouseEvent&) const;
};
friend class EventForwarder;
private:
smart_ptr<Inheritable> mModel;
History mHistory;
mutable smart_ptr<Inheritable> mRoot; //lazy initialized
smart_ptr<HierarchyBrowserRenderer> mRenderer;
OutlineBrowser mMemberOutline;
std::list<CppTag*> mMembers;
Inheritable *mTypeSelection;
HierarchyViewType mHierarchyType;
bool mShowInheritedMembers;
bool mIsHierarchyLocked;
smart_ptr<EventForwarder> mForwarder;
smart_ptr<MultiSelectionListener> mOutlineListener;
smart_ptr<SelectionListener> mHierarchySelectionStrategy;
std::list<smart_ptr<SelectionListener> > mSelectionListeners;
public:
HierarchyBrowser();
bool show(bool isModal = false);
void setModel(const smart_ptr<Inheritable> &);
void addSelectionListener(const smart_ptr<SingleSelectionListener>& listener)
{ mSelectionListeners.push_back(listener); }
void removeSelectionListener(const smart_ptr<SingleSelectionListener>& listener)
{ mSelectionListeners.remove_if(std::bind2nd(std::equal_to<smart_ptr<SelectionListener> >(), listener)); }
Inheritable* getSelection() { return mTypeSelection; }
void hierarchyFilterChanged(HierarchyViewType hierarchyType);
void hierarchySelectionChanged(CppTag*, const MouseEvent&);
void hierarchyLockChanged(bool);
void memberFilterChanged(bool);
void historyEntrySelectionChanged(size_t id);
void focusOn(Inheritable*);
std::list<smart_ptr<CppTag> > getHierarchyOf(CppTag*) const;
std::list<smart_ptr<CppTag> > getHierarchyOf(const Inheritable&) const;
int getSelectionState(const CppTag&) const;
const OutlineRenderer& getOutlineRenderer();
HierarchyBrowserRenderer& getRenderer();
private:
void updateMemberOutline(const Inheritable&);
void updateHierarchyView();
std::list<std::list<smart_ptr<CppTag> > > getMembersOf(const CppType&);
Inheritable& getModel() { return *mModel; }
const Inheritable& getModel() const { return *mModel; }
OutlineBrowser& getMemberOutline() { return mMemberOutline; }
void swapMemberOutlineListeners(bool);
smart_ptr<Inheritable> getRoot() const;
void fireSelectionChanged(const CppTag& tag, const MouseEvent &e) const;
//void setSelection(Inheritable *s) { mTypeSelection = s; }
};
#endif
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.