Gui: Better visualization of the Active Object

This commit is contained in:
wmayer
2018-08-19 18:14:06 +02:00
parent 3d05a97e90
commit 6e697ddebf
4 changed files with 76 additions and 48 deletions

View File

@@ -29,42 +29,38 @@
#include <map>
#include "Tree.h"
namespace App {
class DocumentObject;
class DocumentObject;
}
namespace Gui
{
class Document;
class ViewProviderDocumentObject;
/** List of active or special objects
* This class holds a list of objects with a special name.
* Its mainly used to points to something like the active Body or Part in a edit session.
* The class is used the viewer (editor) of a document.
* @see Gui::MDIViewer
* @author Jürgen Riegel
*/
class GuiExport ActiveObjectList
{
public:
template<typename _T>
inline _T getObject(const char* name) const
{
std::map<std::string, App::DocumentObject*>::const_iterator pos = _ObjectMap.find(name);
return pos == _ObjectMap.end() ? 0 : dynamic_cast<_T>(pos->second);
}
void setObject(App::DocumentObject*, const char*, const Gui::HighlightMode& m = Gui::LightBlue);
bool hasObject(const char*)const;
void objectDeleted(const ViewProviderDocumentObject& viewProviderIn);
protected:
std::map<std::string, App::DocumentObject*> _ObjectMap;
};
class Document;
class ViewProviderDocumentObject;
/** List of active or special objects
* This class holds a list of objects with a special name.
* Its mainly used to points to something like the active Body or Part in a edit session.
* The class is used the viewer (editor) of a document.
* @see Gui::MDIViewer
* @author Jürgen Riegel
*/
class GuiExport ActiveObjectList
{
public:
template<typename _T>
inline _T getObject(const char* name) const
{
std::map<std::string, App::DocumentObject*>::const_iterator pos = _ObjectMap.find(name);
return pos == _ObjectMap.end() ? 0 : dynamic_cast<_T>(pos->second);
}
void setObject(App::DocumentObject*, const char*, const Gui::HighlightMode& m = Gui::UserDefined);
bool hasObject(const char*)const;
void objectDeleted(const ViewProviderDocumentObject& viewProviderIn);
protected:
std::map<std::string, App::DocumentObject*> _ObjectMap;
};
} //namespace Gui