MeshLib C++ Docs
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{
10
11
12class RibbonMenu;
13
16{
17public:
18 MRVIEWER_API virtual void draw( float height ) override;
19
20 MRVIEWER_API void initRibbonMenu( RibbonMenu* ribbonMenu );
21
23 void setCloseContextOnChange( bool deselect ) { closeContextOnChange_ = deselect; }
25 bool getCloseContextOnChange() { return closeContextOnChange_; }
26
29protected:
30 MRVIEWER_API virtual void drawCustomObjectPrefixInScene_( const Object& obj, bool opened ) override;
31 MRVIEWER_API virtual void drawSceneContextMenu_( const std::vector<std::shared_ptr<Object>>& selected, const std::string& uniqueStr ) override;
32 MRVIEWER_API virtual bool collapsingHeader_( const std::string& uniqueName, ImGuiTreeNodeFlags flags ) override;
33
34 MRVIEWER_API virtual std::string objectLineStrId_( const Object& object, const std::string& uniqueStr ) override;
35
36 MRVIEWER_API virtual bool drawObject_( Object& object, const std::string& uniqueStr, int depth ) override;
37 MRVIEWER_API virtual bool drawSkippedObject_( Object& object, const std::string& uniqueStr, int depth ) override;
38private:
40 MRVIEWER_API virtual const char* getSceneItemIconByTypeName_( const std::string& typeName ) const;
41
42 bool drawTreeOpenedState_( Object& object, bool leaf, const std::string& uniqueStr, int depth );
43 void drawObjectLine_( Object& object, const std::string& uniqueStr, bool opened );
44 void drawEyeButton_( Object& object, const std::string& uniqueStr, bool frameHovered );
45
46 void drawHierarhyLine_( const Vector2f& startScreenPos, int depth, bool skipped );
47
48 struct LastDepthInfo
49 {
50 float screenPosY{ 0.0f };
51 int id{ 0 };
52 };
54 std::vector<LastDepthInfo> lastDrawnSibling_;
55 int currentElementId_{ 0 };
56 RibbonMenu* ribbonMenu_ = nullptr;
57 bool closeContextOnChange_ = true;
58};
59
60}
named object in the data model
Definition MRObject.h:62
Definition MRRibbonMenu.h:27
class for drawing a list of scene objects in RibbonMenu style
Definition MRRibbonSceneObjectsListDrawer.h:16
class for drawing a list of scene objects (and handling interaction with it)
Definition MRSceneObjectsListDrawer.h:19
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:25
void setCloseContextOnChange(bool deselect)
set closing scene context menu on any change
Definition MRRibbonSceneObjectsListDrawer.h:23
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:28
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
int ImGuiTreeNodeFlags
Definition MRSceneObjectsListDrawer.h:78
virtual MRVIEWER_API void draw(float height) override
only for bindings generation
Definition MRCameraOrientationPlugin.h:8
Definition MRSignal.h:27