MeshLib Documentation
Loading...
Searching...
No Matches
MRRibbonSceneObjectsListDrawer.h
Go to the documentation of this file.
1#pragma once
2#include "MRMesh/MRMeshFwd.h"
4#include "MRMesh/MRSignal.h"
5
6namespace MR
7{
8
9class RibbonMenu;
10
13{
14public:
15 MRVIEWER_API virtual void draw( float height, float scaling ) override;
16
17 MRVIEWER_API void initRibbonMenu( RibbonMenu* ribbonMenu );
18
20 void setCloseContextOnChange( bool deselect ) { closeContextOnChange_ = deselect; }
22 bool getCloseContextOnChange() { return closeContextOnChange_; }
23
26protected:
27 MRVIEWER_API virtual void drawCustomObjectPrefixInScene_( const Object& obj, bool opened ) override;
28 MRVIEWER_API virtual void drawSceneContextMenu_( const std::vector<std::shared_ptr<Object>>& selected, const std::string& uniqueStr ) override;
29 MRVIEWER_API virtual bool collapsingHeader_( const std::string& uniqueName, ImGuiTreeNodeFlags flags ) override;
30
31 MRVIEWER_API virtual std::string objectLineStrId_( const Object& object, const std::string& uniqueStr ) override;
32
33 MRVIEWER_API virtual bool drawObject_( Object& object, const std::string& uniqueStr, int depth ) override;
34 MRVIEWER_API virtual bool drawSkippedObject_( Object& object, const std::string& uniqueStr, int depth ) override;
35private:
36 // return icon (now it is symbol in icons font) based on typename
37 MRVIEWER_API virtual const char* getSceneItemIconByTypeName_( const std::string& typeName ) const;
38
39 bool drawTreeOpenedState_( Object& object, bool leaf, const std::string& uniqueStr, int depth );
40 void drawObjectLine_( Object& object, const std::string& uniqueStr, bool opened );
41 void drawEyeButton_( Object& object, const std::string& uniqueStr, bool frameHovered );
42
43 void drawHierarhyLine_( const Vector2f& startScreenPos, int depth, bool skipped );
44
45 struct LastDepthInfo
46 {
47 float screenPosY{ 0.0f };
48 int id{ 0 };
49 };
50 // depth -> pos Y of last element of this depth
51 std::vector<LastDepthInfo> lastDrawnSibling_;
52 int currentElementId_{ 0 };
53 RibbonMenu* ribbonMenu_ = nullptr;
54 bool closeContextOnChange_ = true;
55};
56
57}
named object in the data model
Definition MRObject.h:60
Definition MRRibbonMenu.h:32
class for drawing a list of scene objects in RibbonMenu style
Definition MRRibbonSceneObjectsListDrawer.h:13
virtual MRVIEWER_API void drawSceneContextMenu_(const std::vector< std::shared_ptr< Object > > &selected, const std::string &uniqueStr) override
virtual MRVIEWER_API void drawCustomObjectPrefixInScene_(const Object &obj, bool opened) override
MRVIEWER_API void initRibbonMenu(RibbonMenu *ribbonMenu)
bool getCloseContextOnChange()
get flag closing scene context menu on any change
Definition MRRibbonSceneObjectsListDrawer.h:22
void setCloseContextOnChange(bool deselect)
set closing scene context menu on any change
Definition MRRibbonSceneObjectsListDrawer.h:20
virtual MRVIEWER_API bool drawSkippedObject_(Object &object, const std::string &uniqueStr, int depth) override
draw dummy container for skipped object
virtual MRVIEWER_API bool drawObject_(Object &object, const std::string &uniqueStr, int depth) override
override this to customize whole object line
Signal< void()> onDrawContextSignal
this signal is emitted each frame inside scene context window
Definition MRRibbonSceneObjectsListDrawer.h:25
virtual MRVIEWER_API void draw(float height, float scaling) override
virtual MRVIEWER_API std::string objectLineStrId_(const Object &object, const std::string &uniqueStr) override
virtual MRVIEWER_API bool collapsingHeader_(const std::string &uniqueName, ImGuiTreeNodeFlags flags) override
override this to customize CollapsingHeader draw
class for drawing a list of scene objects (and handling interaction with it)
Definition MRSceneObjectsListDrawer.h:16
int ImGuiTreeNodeFlags
Definition MRSceneObjectsListDrawer.h:72
Definition MRCameraOrientationPlugin.h:8
Definition MRSignal.h:24