MeshLib C++ Docs
Loading...
Searching...
No Matches
MRRenderClickableRect.h
Go to the documentation of this file.
1#pragma once
2
4#include "MRViewer/exports.h"
5
6#include "MRViewer/MRImGui.h"
7
8namespace MR
9{
10
11// This is a helper base class for writing `BasicUiRenderTask`s that let you click a rectangle in the scene.
12// Note, this task relies on preserving state between the frames.
14{
15public:
17
18 // Don't assign the memebers (except the base), because we want to preserve the state across frames.
20 BasicClickableRectUiRenderTask& operator=( const BasicClickableRectUiRenderTask& other ) { BasicUiRenderTask::operator=( other ); return *this; }
21
23
24 // This is called when the click happens.
25 virtual void onClick() = 0;
26
27 // This is what ultimately calls `onClick()` if the certain conditions hold.
28 MRVIEWER_API void earlyBackwardPass( const BackwardPassParams& backParams ) override;
29
30 // Set those to set the clickable area. Zero both to hovers and clicks.
33
34 // Set to false to disable hovers and clicks (`isHovered` will always be false),
35 // but still consume the mouse hover to prevent other buttons below this one from being clicked.
36 bool enabled = true;
37
38 // Read these to decide how to render.
39 bool isHovered = false;
40 bool isActive = false;
41};
42
43}
Definition MRRenderClickableRect.h:14
ImVec2 clickableCornerA
Definition MRRenderClickableRect.h:31
MRVIEWER_API void earlyBackwardPass(const BackwardPassParams &backParams) override
virtual ~BasicClickableRectUiRenderTask()=default
BasicClickableRectUiRenderTask(const BasicClickableRectUiRenderTask &other)
Definition MRRenderClickableRect.h:19
ImVec2 clickableCornerB
Definition MRRenderClickableRect.h:32
BasicClickableRectUiRenderTask & operator=(const BasicClickableRectUiRenderTask &other)
Definition MRRenderClickableRect.h:20
Definition MRCameraOrientationPlugin.h:8
Definition MRIRenderObject.h:81
IRenderObject::renderUi() can emit zero or more or more of those tasks. They are sorted by depth ever...
Definition MRIRenderObject.h:61