MeshLib Documentation
Loading...
Searching...
No Matches
MRUIStyle.h
Go to the documentation of this file.
1#pragma once
2#include "MRMesh/MRFinally.h"
3#include "MRPch/MRFmt.h"
4#include "MRViewer/MRUnits.h"
6#include "exports.h"
7#include "imgui.h"
8#include "MRColorTheme.h"
9#include <span>
10#include <string>
11#include <optional>
12
13namespace MR
14{
15
16class ImGuiImage;
17
18namespace UI
19{
20
21// enumeration texture types
22enum class TextureType
23{
24 Mono,
29 Count
30};
31
32// get texture by type
33MRVIEWER_API std::unique_ptr<ImGuiImage>& getTexture( TextureType type );
34
36MRVIEWER_API void init();
37
40{
47
49 bool forceImguiTextColor = false;
51 bool border = false;
52
55
57 bool enableTestEngine = true;
58};
59
61{
62 ImGuiButtonFlags flags = ImGuiButtonFlags_None;
63 // flag for buttonEx, which can be disabled
64 bool active = true;
65 // button without a gradient, always ative, configurable by an external style
66 bool flatBackgroundColor = false;
67 // if false - text is to the right
68 bool textUnderImage = true;
69};
70
72{
73 // the point from which the axes will be drawn
75
76 // size plot by axis
77 float size;
78 // optimal length between dashes
79 float optimalLenth = 10.0f;
80 // the minimum value of the axis
81 float minValue = 0.0f;
82 // the maximal value of the axis
83 float maxValue = 1.0f;
84 // sign every nth dash
86
87 // length dash without text
88 float lenDash = 8.0f;
89 // length dash with text
90 float lenDashWithText = 12.0f;
91 // text offset from dash
92 float textPadding = 3.0f;
93 // the format of the text for labels
95};
96
98MRVIEWER_API bool buttonEx( const char* label, bool active, const Vector2f& size = Vector2f( 0, 0 ),
99 ImGuiButtonFlags flags = ImGuiButtonFlags_None, const ButtonCustomizationParams& custmParams = {} );
102MRVIEWER_API bool button( const char* label, bool active, const Vector2f& size = Vector2f( 0, 0 ), ImGuiKey key = ImGuiKey_None );
105inline bool button( const char* label, const Vector2f& size = Vector2f( 0, 0 ), ImGuiKey key = ImGuiKey_None )
106{
107 return button( label, true, size, key );
108}
111MRVIEWER_API bool buttonCommonSize( const char* label, const Vector2f& size = Vector2f( 0, 0 ), ImGuiKey key = ImGuiKey_None );
113MRVIEWER_API bool buttonUnique( const char* label, int* value, int ownValue, const Vector2f& size = Vector2f( 0, 0 ), ImGuiKey key = ImGuiKey_None );
114
115// draw dash with text along the horizontal axis
116MRVIEWER_API void drawPoltHorizontalAxis( float menuScaling, const PlotAxis& plotAxis );
117// draw dash with text along the vertical axis
118MRVIEWER_API void drawPoltVerticalAxis( float menuScaling, const PlotAxis& plotAxis );
119
120// draw a button with an icon and text under it
121MRVIEWER_API bool buttonIconEx(
122 const std::string& name,
123 const Vector2f& iconSize,
124 const std::string& text,
125 const ImVec2& buttonSize,
126 const ButtonIconCustomizationParams& params = {} );
127// button with a gradient and the ability to make it inactive
128inline bool buttonIcon( const std::string& name, const Vector2f& iconSize, const std::string& text, bool active, const ImVec2& buttonSize )
129{
131 params.active = active;
132 params.flatBackgroundColor = true;
133 return buttonIconEx(name, iconSize, text, buttonSize, params );
134}
135// button with a gradient, always ative
136inline bool buttonIcon( const std::string& name, const Vector2f& iconSize, const std::string& text, const ImVec2& buttonSize )
137{
138 return buttonIconEx( name, iconSize, text, buttonSize );
139}
140// button without a gradient, always ative, configurable by an external style
141inline bool buttonIconFlatBG( const std::string& name, const Vector2f& iconSize, const std::string& text, const ImVec2& buttonSize )
142{
144 params.flatBackgroundColor = true;
145 params.forceImguiTextColor = true;
146 return buttonIconEx( name, iconSize, text, buttonSize, params );
147}
150MRVIEWER_API bool buttonUniqueIcon(
151 const std::string& iconName,
152 const Vector2f& iconSize,
153 const std::string& text,
154 const ImVec2& buttonSize,
155 int* value,
156 int ownValue );
157
159MRVIEWER_API bool checkbox( const char* label, bool* value );
161MRVIEWER_API bool checkboxOrFixedValue( const char* label, bool* value, std::optional<bool> valueOverride );
163MRVIEWER_API bool checkboxValid( const char* label, bool* value, bool valid );
165MRVIEWER_API bool checkboxMixed( const char* label, bool* value, bool mixed );
167template <typename Getter, typename Setter>
168bool checkbox( const char* label, Getter get, Setter set )
169{
170 bool value = get();
171 bool ret = checkbox( label, &value );
172 set( value );
173 return ret;
174}
175
177template <typename T>
178bool checkboxFlags( const char* label, T& target, T flags )
179{
180 bool value = bool( target & flags );
181 bool mixed = value && ( target & flags ) != flags;
182 if ( checkboxMixed( label, &value, mixed ) )
183 {
184 if ( value )
185 target |= flags;
186 else
187 target &= ~flags;
188 return true;
189 }
190 return false;
191}
192
194{
195 // The persistent value of this setting, as set by the user by clicking the checkbox.
196 bool baseValue = false;
197 // Whether the setting is currently inverted because the modifier is held.
198 bool modifierHeld = false;
199
200 // You usually want to read this instead of the variables above.
201 // Returns `baseValue`, but inverted if `modifierHeld` is set.
202 [[nodiscard]] explicit operator bool() const { return baseValue != modifierHeld; }
203};
204
214MRVIEWER_API bool checkboxOrModifier( const char* label, CheckboxOrModifierState& value, int modifiers, int respectedModifiers = -1, std::optional<bool> valueOverride = {} );
215
216
218MRVIEWER_API bool radioButton( const char* label, int* value, int valButton );
220MRVIEWER_API bool radioButtonOrFixedValue( const char* label, int* value, int valButton, std::optional<int> valueOverride );
221
223{
224 // The permanent value of this setting, as set by the user by clicking the radio button.
225 int value{};
226 // The value that is displayed, and to be used - can differ from `value` if modifiers are pressed.
228
229 // The effective value, affected by modifiers.
230 [[nodiscard]] explicit operator int() const
231 {
232 return effectiveValue;
233 }
234};
235
242MRVIEWER_API bool radioButtonOrModifier( const char* label, RadioButtonOrModifierState& value, int valButton, int modifiers, int respectedModifiers = -1, std::optional<int> valueOverride = {} );
243
245MRVIEWER_API bool colorEdit4( const char* label, Vector4f& color, ImGuiColorEditFlags flags = ImGuiColorEditFlags_None );
246MRVIEWER_API bool colorEdit4( const char* label, Color& color, ImGuiColorEditFlags flags = ImGuiColorEditFlags_None );
247
249MRVIEWER_API bool combo( const char* label, int* v, const std::vector<std::string>& options,
250 bool showPreview = true, const std::vector<std::string>& tooltips = {}, const std::string& defaultText = "Not selected" );
251
253MRVIEWER_API bool beginCombo( const char* label, const std::string& text = "Not selected", bool showPreview = true );
254MRVIEWER_API void endCombo( bool showPreview = true );
255
257MRVIEWER_API bool inputText( const char* label, std::string& str, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = nullptr, void* user_data = nullptr );
259MRVIEWER_API bool inputTextIntoArray( const char* label, char* array, std::size_t size, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = nullptr, void* user_data = nullptr );
260
262MRVIEWER_API bool inputTextMultiline( const char* label, std::string& str, const ImVec2& size = ImVec2(), ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = nullptr, void* user_data = nullptr );
264MRVIEWER_API bool inputTextIntoArrayMultiline( const char* label, char* buf, size_t buf_size, const ImVec2& size = ImVec2(), ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = nullptr, void* user_data = nullptr );
265
267{
268 std::optional<ImVec2> cachedSize; // Reset this when manually modifying the text.
269};
271MRVIEWER_API bool inputTextMultilineFullyScrollable( CachedTextSize& cache, const char* label, std::string& str, const ImVec2& size = ImVec2(), ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = nullptr, void* user_data = nullptr );
272MRVIEWER_API bool inputTextIntoArrayMultilineFullyScrollable( CachedTextSize& cache, const char* label, char* buf, size_t buf_size, const ImVec2& size = ImVec2(), ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = nullptr, void* user_data = nullptr );
273
275MRVIEWER_API bool inputTextCentered( const char* label, std::string& str, float width = 0.0f, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = nullptr, void* user_data = nullptr );
276
278MRVIEWER_API void inputTextCenteredReadOnly( const char* label, const std::string& str, float width = 0.0f, const std::optional<ImVec4>& textColor = {}, const std::optional<ImVec4>& labelColor = {} );
279
280
281namespace detail
282{
283 // A type-erased slider.
284 MRVIEWER_API bool genericSlider( const char* label, ImGuiDataType data_type, void* p_data, const void* p_min, const void* p_max, const char* format, ImGuiSliderFlags flags );
285
286 // Whether `T` is a scalar type that we can use with our widgets.
287 template <typename T>
288 concept Scalar = std::is_arithmetic_v<T> && !std::is_same_v<T, bool>;
289
290 // Whether `T` is a scalar or vector that we can use with our widgets.
291 template <typename T>
293
294 // Whether `Bound` is a valid min/max bound for `Target`.
295 // That is, either the same type, or if `Target` is a vector, `Bound` can also be a scalar of the same type.
296 template <typename Bound, typename Target>
298 std::same_as<Bound, Target> ||
299 ( VectorTraits<Bound>::size == 1 && std::same_as<typename VectorTraits<Bound>::BaseType, typename VectorTraits<Target>::BaseType> );
300
301 // Whether `Speed` is a valid drag speed type for `Target`.
302 // That is, either a single/vector of `float` or the same type as target (or its element if it's a vector).
303 template <typename Speed, typename Target>
305 std::same_as<Speed, typename VectorTraits<Target>::BaseType> || std::same_as<Speed, float> ||
306 std::same_as<Speed, Target> || std::same_as<Speed, typename VectorTraits<Target>::template ChangeBase<float>>;
307
308 // A common code for sliders and other widgets dealing with measurement units.
309 // `E` must be explicitly set to a measurement unit enum. The other template parameters are deduced.
310 // `label` is the widget label, `v` is the target value.
311 // `func` draws the widget for an individual scalar. We call it more than once for vectors.
312 // `func` is `( const char* label, auto& elem, int i ) -> bool`.
313 // It receives `elem` already converted to the display units (so you must convert min/max bounds manually). `i` is the element index for vectors.
314 // When `v` is integral, `func` will be instantiated for both integral and floating-point element type. The latter is required if we're doing conversions.
315 // NOTE: For integral `v`, in `func` you must look at the type of `elem` and convert your min/max bounds (etc) to the same type.
316 // Notice `unitParams` being accepted by an lvalue reference. For convenience, we reset the `sourceUnit` in it before calling the user callback,
317 // since at that point no further conversions are necessary.
318 template <UnitEnum E, VectorOrScalar T, typename F>
319 [[nodiscard]] bool unitWidget( const char* label, T& v, UnitToStringParams<E>& unitParams, F&& func );
320
321 // Some default slider parameters. For now they are hardcoded here, but we can move them elsewhere later.
322
323 // Default drag speed for `UI::drag()`.
324 template <UnitEnum E, VectorOrScalar T>
325 requires ( VectorTraits<T>::size == 1 )
326 [[nodiscard]] float getDefaultDragSpeed();
327
328 // Default step speed for `UI::input()`.
329 template <UnitEnum E, VectorOrScalar T, VectorOrScalar TargetType>
330 [[nodiscard]] T getDefaultStep( bool fast );
331}
332
333// Default flags for `slider()` and `drag()` below.
334inline constexpr int defaultSliderFlags = ImGuiSliderFlags_AlwaysClamp;
335
336// Draw a slider.
337// `E` must be specified explicitly, to one of: `NoUnit` `LengthUnit`, `AngleUnit`, ...
338// By default, for angles `v` will be converted to degrees for display (but `vMin`, `vMax` are still in radians, same as `v`),
339// while length and unit-less values will be left as is. This can be customized in `unitParams` or globally (see `MRUnits.h`).
340template <UnitEnum E, detail::VectorOrScalar T, detail::ValidBoundForTargetType<T> U = typename VectorTraits<T>::BaseType>
341bool slider( const char* label, T& v, const U& vMin, const U& vMax, UnitToStringParams<E> unitParams = {}, ImGuiSliderFlags flags = defaultSliderFlags );
342
343// Draw a dragging widget. Also includes [+] and [-] buttons (for integers only by default_, like `ImGui::Input`).
344// `E` must be specified explicitly, to one of: `NoUnit` `LengthUnit`, `AngleUnit`, ...
345// By default, for angles `v` will be converted to degrees for display (but `vSpeed` is still in radians, same as `v`),
346// while length and unit-less values will be left as is. This can be customized in `unitParams` or globally (see `MRUnits.h`).
347// If only the min limit is specified, then the max limit is assumed to be the largest number.
348template <UnitEnum E, detail::VectorOrScalar T, detail::ValidDragSpeedForTargetType<T> SpeedType = float, detail::ValidBoundForTargetType<T> U = typename VectorTraits<T>::BaseType>
349bool drag( const char* label, T& v, SpeedType vSpeed = detail::getDefaultDragSpeed<E, SpeedType>(), const U& vMin = std::numeric_limits<U>::lowest(), const U& vMax = std::numeric_limits<U>::max(), UnitToStringParams<E> unitParams = {}, ImGuiSliderFlags flags = defaultSliderFlags, const U& step = detail::getDefaultStep<E, U, T>( false ), const U& stepFast = detail::getDefaultStep<E, U, T>( true ) );
350
351// Draw a read-only copyable value.
352// `E` must be specified explicitly, to one of: `NoUnit` `LengthUnit`, `AngleUnit`, ...
353// By default, for angles `v` will be converted to degrees for display, while length and unit-less values will be left as is.
354// This can be customized in `unitParams` or globally (see `MRUnits.h`).
355template <UnitEnum E, detail::VectorOrScalar T>
356void readOnlyValue( const char* label, const T& v, std::optional<ImVec4> textColor = {}, UnitToStringParams<E> unitParams = {}, std::optional<ImVec4> labelColor = {} );
357
358
360MRVIEWER_API void transparentText( const char* fmt, ... );
362MRVIEWER_API void transparentTextWrapped( const char* fmt, ... );
363
365MRVIEWER_API void setTooltipIfHovered( const std::string& text, float scaling );
366
371MRVIEWER_API void separator( float scaling, const std::string& text = "", int issueCount = -1 );
372MRVIEWER_API void separator(
373 float scaling,
374 const std::string& text,
375 const ImVec4& color,
376 const std::string& issueCount );
377// separator line with icon and text
378// iconSize icon size without scaling
379MRVIEWER_API void separator( float scaling, const ImGuiImage& icon, const std::string& text, const Vector2f& iconSize = { 24.f, 24.f } );
380MRVIEWER_API void separator( float scaling, const std::string& iconName, const std::string& text, const Vector2f& iconSize = { 24.f, 24.f } );
381
386MRVIEWER_API void progressBar( float scaling, float fraction, const Vector2f& size = Vector2f( -1, 0 ) );
387
388// create and append items into a TabBar: see corresponding ImGui:: functions
389MRVIEWER_API bool beginTabBar( const char* str_id, ImGuiTabBarFlags flags = 0 );
390MRVIEWER_API void endTabBar();
391MRVIEWER_API bool beginTabItem( const char* label, bool* p_open = NULL, ImGuiTabItemFlags flags = 0 );
392MRVIEWER_API void endTabItem();
393
403MRVIEWER_API void alignTextToFramePadding( float padding );
407MRVIEWER_API void alignTextToControl( float controlHeight );
409MRVIEWER_API void alignTextToRadioButton( float scaling );
411MRVIEWER_API void alignTextToCheckBox( float scaling );
413MRVIEWER_API void alignTextToButton( float scaling );
414
418MRVIEWER_API void highlightWindowArea( float scaling, const ImVec2& min = {-1.0f, -1.0f}, const ImVec2& max = { -1.0f, -1.0f } );
419
420} // namespace UI
421
422}
423
424#include "MRUIStyle.ipp"
Definition MRImGuiImage.h:14
Definition MRUIStyle.h:288
Definition MRUIStyle.h:297
Definition MRUIStyle.h:292
auto width(const Box< V > &box)
returns size along x axis
Definition MRMesh/MRBox.h:247
constexpr const V & get(const Box< V > &box) noexcept
get<0> returns min, get<1> returns max
Definition MRMesh/MRBox.h:268
T getDefaultStep(bool fast)
float getDefaultDragSpeed()
MRVIEWER_API bool genericSlider(const char *label, ImGuiDataType data_type, void *p_data, const void *p_min, const void *p_max, const char *format, ImGuiSliderFlags flags)
bool unitWidget(const char *label, T &v, UnitToStringParams< E > &unitParams, F &&func)
MRVIEWER_API bool buttonEx(const char *label, bool active, const Vector2f &size=Vector2f(0, 0), ImGuiButtonFlags flags=ImGuiButtonFlags_None, const ButtonCustomizationParams &custmParams={})
draw gradient button, which can be disabled (active = false)
TextureType
Definition MRUIStyle.h:23
MRVIEWER_API bool checkboxOrModifier(const char *label, CheckboxOrModifierState &value, int modifiers, int respectedModifiers=-1, std::optional< bool > valueOverride={})
MRVIEWER_API std::unique_ptr< ImGuiImage > & getTexture(TextureType type)
MRVIEWER_API void alignTextToRadioButton(float scaling)
Specialization of alignTextToFramePadding for UI::radioButton.
MRVIEWER_API void highlightWindowArea(float scaling, const ImVec2 &min={-1.0f, -1.0f}, const ImVec2 &max={ -1.0f, -1.0f })
MRVIEWER_API bool inputTextMultilineFullyScrollable(CachedTextSize &cache, const char *label, std::string &str, const ImVec2 &size=ImVec2(), ImGuiInputTextFlags flags=0, ImGuiInputTextCallback callback=nullptr, void *user_data=nullptr)
This version adds a horizontal scrollbar. Also it never draws the label, and uses full window width b...
MRVIEWER_API bool radioButtonOrModifier(const char *label, RadioButtonOrModifierState &value, int valButton, int modifiers, int respectedModifiers=-1, std::optional< int > valueOverride={})
bool drag(const char *label, T &v, SpeedType vSpeed=detail::getDefaultDragSpeed< E, SpeedType >(), const U &vMin=std::numeric_limits< U >::lowest(), const U &vMax=std::numeric_limits< U >::max(), UnitToStringParams< E > unitParams={}, ImGuiSliderFlags flags=defaultSliderFlags, const U &step=detail::getDefaultStep< E, U, T >(false), const U &stepFast=detail::getDefaultStep< E, U, T >(true))
MRVIEWER_API void separator(float scaling, const std::string &text="", int issueCount=-1)
bool buttonIconFlatBG(const std::string &name, const Vector2f &iconSize, const std::string &text, const ImVec2 &buttonSize)
Definition MRUIStyle.h:141
MRVIEWER_API void endTabBar()
MRVIEWER_API void transparentTextWrapped(const char *fmt,...)
similar to ImGui::TextWrapped but use current text color with alpha channel = 0.5
MRVIEWER_API bool inputTextIntoArrayMultiline(const char *label, char *buf, size_t buf_size, const ImVec2 &size=ImVec2(), ImGuiInputTextFlags flags=0, ImGuiInputTextCallback callback=nullptr, void *user_data=nullptr)
This overload is for arrays, as opposed to std::strings.
MRVIEWER_API void endTabItem()
MRVIEWER_API bool buttonUniqueIcon(const std::string &iconName, const Vector2f &iconSize, const std::string &text, const ImVec2 &buttonSize, int *value, int ownValue)
MRVIEWER_API bool checkbox(const char *label, bool *value)
draw gradient checkbox
MRVIEWER_API void inputTextCenteredReadOnly(const char *label, const std::string &str, float width=0.0f, const std::optional< ImVec4 > &textColor={}, const std::optional< ImVec4 > &labelColor={})
draw read-only text box with text aligned by center
MRVIEWER_API bool inputTextIntoArrayMultilineFullyScrollable(CachedTextSize &cache, const char *label, char *buf, size_t buf_size, const ImVec2 &size=ImVec2(), ImGuiInputTextFlags flags=0, ImGuiInputTextCallback callback=nullptr, void *user_data=nullptr)
MRVIEWER_API void alignTextToButton(float scaling)
Specialization of alignTextToFramePadding for UI::button with default height.
MRVIEWER_API void alignTextToCheckBox(float scaling)
Specialization of alignTextToFramePadding for UI::checkbox.
MRVIEWER_API void alignTextToControl(float controlHeight)
MRVIEWER_API void drawPoltHorizontalAxis(float menuScaling, const PlotAxis &plotAxis)
MRVIEWER_API void drawPoltVerticalAxis(float menuScaling, const PlotAxis &plotAxis)
MRVIEWER_API bool beginCombo(const char *label, const std::string &text="Not selected", bool showPreview=true)
draw custom content combo box
bool buttonIcon(const std::string &name, const Vector2f &iconSize, const std::string &text, bool active, const ImVec2 &buttonSize)
Definition MRUIStyle.h:128
constexpr int defaultSliderFlags
Definition MRUIStyle.h:334
bool slider(const char *label, T &v, const U &vMin, const U &vMax, UnitToStringParams< E > unitParams={}, ImGuiSliderFlags flags=defaultSliderFlags)
MRVIEWER_API bool combo(const char *label, int *v, const std::vector< std::string > &options, bool showPreview=true, const std::vector< std::string > &tooltips={}, const std::string &defaultText="Not selected")
draw combo box
MRVIEWER_API bool radioButton(const char *label, int *value, int valButton)
draw gradient radio button
MRVIEWER_API void setTooltipIfHovered(const std::string &text, float scaling)
draw tooltip only if current item is hovered
MRVIEWER_API bool checkboxValid(const char *label, bool *value, bool valid)
If valid is false checkbox is disabled. Same as checkboxOrFixedValue( ..., valid ?...
MRVIEWER_API void endCombo(bool showPreview=true)
MRVIEWER_API bool inputTextIntoArray(const char *label, char *array, std::size_t size, ImGuiInputTextFlags flags=0, ImGuiInputTextCallback callback=nullptr, void *user_data=nullptr)
This overload is for arrays, as opposed to std::strings.
MRVIEWER_API void transparentText(const char *fmt,...)
similar to ImGui::Text but use current text color with alpha channel = 0.5
MRVIEWER_API void init()
init internal parameters
MRVIEWER_API bool checkboxOrFixedValue(const char *label, bool *value, std::optional< bool > valueOverride)
If valueOverride is specified, then the checkbox is disabled and that value is displayed instead of v...
void readOnlyValue(const char *label, const T &v, std::optional< ImVec4 > textColor={}, UnitToStringParams< E > unitParams={}, std::optional< ImVec4 > labelColor={})
MRVIEWER_API void progressBar(float scaling, float fraction, const Vector2f &size=Vector2f(-1, 0))
MRVIEWER_API bool colorEdit4(const char *label, Vector4f &color, ImGuiColorEditFlags flags=ImGuiColorEditFlags_None)
draw gradient color edit 4
MRVIEWER_API bool inputTextMultiline(const char *label, std::string &str, const ImVec2 &size=ImVec2(), ImGuiInputTextFlags flags=0, ImGuiInputTextCallback callback=nullptr, void *user_data=nullptr)
Draws multiline text input, should be used instead of ImGui::InputTextMultiline().
MRVIEWER_API bool checkboxMixed(const char *label, bool *value, bool mixed)
draw gradient checkbox with mixed state
MRVIEWER_API bool buttonIconEx(const std::string &name, const Vector2f &iconSize, const std::string &text, const ImVec2 &buttonSize, const ButtonIconCustomizationParams &params={})
MRVIEWER_API bool beginTabBar(const char *str_id, ImGuiTabBarFlags flags=0)
bool checkboxFlags(const char *label, T &target, T flags)
Draw a checkbox toggling one or more bits in the mask.
Definition MRUIStyle.h:178
MRVIEWER_API bool buttonUnique(const char *label, int *value, int ownValue, const Vector2f &size=Vector2f(0, 0), ImGuiKey key=ImGuiKey_None)
draw button with same logic as radioButton
MRVIEWER_API bool button(const char *label, bool active, const Vector2f &size=Vector2f(0, 0), ImGuiKey key=ImGuiKey_None)
MRVIEWER_API bool radioButtonOrFixedValue(const char *label, int *value, int valButton, std::optional< int > valueOverride)
If valueOverride is specified, then the radio button is disabled and that value is displayed instead ...
MRVIEWER_API bool inputText(const char *label, std::string &str, ImGuiInputTextFlags flags=0, ImGuiInputTextCallback callback=nullptr, void *user_data=nullptr)
Draws text input, should be used instead of ImGui::InputText().
MRVIEWER_API void alignTextToFramePadding(float padding)
MRVIEWER_API bool beginTabItem(const char *label, bool *p_open=NULL, ImGuiTabItemFlags flags=0)
MRVIEWER_API bool inputTextCentered(const char *label, std::string &str, float width=0.0f, ImGuiInputTextFlags flags=0, ImGuiInputTextCallback callback=nullptr, void *user_data=nullptr)
draw input text box with text aligned by center
MRVIEWER_API bool buttonCommonSize(const char *label, const Vector2f &size=Vector2f(0, 0), ImGuiKey key=ImGuiKey_None)
Definition MRCameraOrientationPlugin.h:8
ImVec2 size(const ViewportRectangle &rect)
Definition MRViewport.h:32
std::variant< > VarUnitToStringParams
Definition MRUnits.h:312
Definition MRColor.h:9
parameters to customize buttonEx
Definition MRUIStyle.h:40
bool forceImguiTextColor
force use if ImGuiCol_Text for text
Definition MRUIStyle.h:49
ImGuiImage * customTexture
Definition MRUIStyle.h:44
bool border
show border or not
Definition MRUIStyle.h:51
bool underlineFirstLetter
draw line under first letter of label
Definition MRUIStyle.h:54
bool forceImGuiBackground
force use imgui background if !customTexture
Definition MRUIStyle.h:46
bool enableTestEngine
Allow interacting with this button from UI::TestEngine.
Definition MRUIStyle.h:57
Definition MRUIStyle.h:61
bool flatBackgroundColor
Definition MRUIStyle.h:66
bool active
Definition MRUIStyle.h:64
bool textUnderImage
Definition MRUIStyle.h:68
ImGuiButtonFlags flags
Definition MRUIStyle.h:62
Definition MRUIStyle.h:267
std::optional< ImVec2 > cachedSize
Definition MRUIStyle.h:268
Definition MRUIStyle.h:194
bool modifierHeld
Definition MRUIStyle.h:198
bool baseValue
Definition MRUIStyle.h:196
Definition MRUIStyle.h:72
float size
Definition MRUIStyle.h:77
VarUnitToStringParams labelFormatParams
Definition MRUIStyle.h:94
float lenDash
Definition MRUIStyle.h:88
size_t textDashIndicesStep
Definition MRUIStyle.h:85
float minValue
Definition MRUIStyle.h:81
float lenDashWithText
Definition MRUIStyle.h:90
ImVec2 startAxisPoint
Definition MRUIStyle.h:74
float optimalLenth
Definition MRUIStyle.h:79
float maxValue
Definition MRUIStyle.h:83
float textPadding
Definition MRUIStyle.h:92
Definition MRUIStyle.h:223
int value
Definition MRUIStyle.h:225
int effectiveValue
Definition MRUIStyle.h:227
Definition MRUnits.h:260
Definition MRMesh/MRVectorTraits.h:14
static constexpr int size
Definition MRMesh/MRVectorTraits.h:18
T BaseType
Definition MRMesh/MRVectorTraits.h:17