MeshLib C++ Docs
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"
5#include "exports.h"
6#include "MRUnits.h"
7#include "MRVectorTraits.h"
8#include "MRImGui.h"
9#include "MRColorTheme.h"
10#include <span>
11#include <string>
12#include <optional>
13
14namespace MR
15{
16
17class ImGuiImage;
18
19namespace UI
20{
21
22// enumeration texture types
33
34// get texture by type
35MRVIEWER_API std::unique_ptr<ImGuiImage>& getTexture( TextureType type );
36
38MRVIEWER_API void init();
39
42{
49
51 bool forceImguiTextColor = false;
53 bool border = false;
54
57
59 bool enableTestEngine = true;
60};
61
63{
64 ImGuiButtonFlags flags = ImGuiButtonFlags_None;
65 // flag for buttonEx, which can be disabled
66 bool active = true;
67 // button without a gradient, always active, configurable by an external style
68 bool flatBackgroundColor = false;
69 // if false - text is to the right
70 bool textUnderImage = true;
71};
72
74{
75 // the point from which the axes will be drawn
77
78 // size plot by axis
79 float size;
80 // optimal length between dashes
81 float optimalLenth = 10.0f;
82 // the minimum value of the axis
83 float minValue = 0.0f;
84 // the maximal value of the axis
85 float maxValue = 1.0f;
86 // sign every nth dash
88
89 // length dash without text
90 float lenDash = 8.0f;
91 // length dash with text
92 float lenDashWithText = 12.0f;
93 // text offset from dash
94 float textPadding = 3.0f;
95 // the format of the text for labels
97};
98
100MRVIEWER_API bool checkKey( ImGuiKey passedKey );
101
103MRVIEWER_API bool buttonEx( const char* label, bool active, const Vector2f& size = Vector2f( 0, 0 ),
104 ImGuiButtonFlags flags = ImGuiButtonFlags_None, const ButtonCustomizationParams& custmParams = {} );
107MRVIEWER_API bool button( const char* label, bool active, const Vector2f& size = Vector2f( 0, 0 ), ImGuiKey key = ImGuiKey_None );
110inline bool button( const char* label, const Vector2f& size = Vector2f( 0, 0 ), ImGuiKey key = ImGuiKey_None )
111{
112 return button( label, true, size, key );
113}
116MRVIEWER_API bool buttonCommonSize( const char* label, const Vector2f& size = Vector2f( 0, 0 ), ImGuiKey key = ImGuiKey_None );
118MRVIEWER_API bool buttonUnique( const char* label, int* value, int ownValue, const Vector2f& size = Vector2f( 0, 0 ), ImGuiKey key = ImGuiKey_None );
119
120// draw dash with text along the horizontal axis
121MRVIEWER_API void drawPoltHorizontalAxis( float menuScaling, const PlotAxis& plotAxis );
122// draw dash with text along the vertical axis
123MRVIEWER_API void drawPoltVerticalAxis( float menuScaling, const PlotAxis& plotAxis );
124
125// draw a button with an icon and text under it
126MRVIEWER_API bool buttonIconEx(
127 const std::string& name,
128 const Vector2f& iconSize,
129 const std::string& text,
130 const ImVec2& buttonSize,
131 const ButtonIconCustomizationParams& params = {} );
132// button with a gradient and the ability to make it inactive
133inline bool buttonIcon( const std::string& name, const Vector2f& iconSize, const std::string& text, bool active, const ImVec2& buttonSize )
134{
136 params.active = active;
137 params.flatBackgroundColor = true;
138 return buttonIconEx(name, iconSize, text, buttonSize, params );
139}
140// button with a gradient, always active
141inline bool buttonIcon( const std::string& name, const Vector2f& iconSize, const std::string& text, const ImVec2& buttonSize )
142{
143 return buttonIconEx( name, iconSize, text, buttonSize );
144}
145// button without a gradient, always active, configurable by an external style
146inline bool buttonIconFlatBG(
147 const std::string& name,
148 const Vector2f& iconSize,
149 const std::string& text,
150 const ImVec2& buttonSize,
151 bool textUnderIcon = true,
152 ImGuiKey key = ImGuiKey_None )
153{
155 params.flatBackgroundColor = true;
156 params.forceImguiTextColor = true;
157 params.textUnderImage = textUnderIcon;
158 params.underlineFirstLetter = std::string_view( ImGui::GetKeyName( key ) ) == std::string_view( text.c_str(), 1 );
159 return buttonIconEx( name, iconSize, text, buttonSize, params ) || checkKey( key );
160}
163MRVIEWER_API bool buttonUniqueIcon(
164 const std::string& iconName,
165 const Vector2f& iconSize,
166 const std::string& text,
167 const ImVec2& buttonSize,
168 int* value,
169 int ownValue,
170 bool textUnderIcon = true,
171 ImGuiKey key = ImGuiKey_None );
172
173
175MRVIEWER_API bool toggle( const char* label, bool* value );
177MRVIEWER_API bool checkbox( const char* label, bool* value );
179MRVIEWER_API bool checkboxOrFixedValue( const char* label, bool* value, std::optional<bool> valueOverride );
181MRVIEWER_API bool checkboxValid( const char* label, bool* value, bool valid );
183MRVIEWER_API bool checkboxMixed( const char* label, bool* value, bool mixed );
185template <typename Getter, typename Setter>
186bool checkbox( const char* label, Getter get, Setter set )
187{
188 bool value = get();
189 bool ret = checkbox( label, &value );
190 set( value );
191 return ret;
192}
193template <typename Getter, typename Setter>
194bool checkboxValid( const char* label, Getter get, Setter set, bool valid )
195{
196 bool value = get();
197 bool ret = checkboxValid( label, &value, valid );
198 set( value );
199 return ret;
200}
201
203template <typename T>
204bool checkboxFlags( const char* label, T& target, T flags )
205{
206 bool value = bool( target & flags );
207 bool mixed = value && ( target & flags ) != flags;
208 if ( checkboxMixed( label, &value, mixed ) )
209 {
210 if ( value )
211 target |= flags;
212 else
213 target &= ~flags;
214 return true;
215 }
216 return false;
217}
218
220{
221 // The persistent value of this setting, as set by the user by clicking the checkbox.
222 bool baseValue = false;
223 // Whether the setting is currently inverted because the modifier is held.
224 bool modifierHeld = false;
225
226 // You usually want to read this instead of the variables above.
227 // Returns `baseValue`, but inverted if `modifierHeld` is set.
228 [[nodiscard]] explicit operator bool() const { return baseValue != modifierHeld; }
229};
230
240MRVIEWER_API bool checkboxOrModifier( const char* label, CheckboxOrModifierState& value, int modifiers, int respectedModifiers = -1, std::optional<bool> valueOverride = {} );
241
242
244MRVIEWER_API bool radioButton( const char* label, int* value, int valButton );
246MRVIEWER_API bool radioButtonOrFixedValue( const char* label, int* value, int valButton, std::optional<int> valueOverride );
247
249{
250 // The permanent value of this setting, as set by the user by clicking the radio button.
251 int value{};
252 // The value that is displayed, and to be used - can differ from `value` if modifiers are pressed.
254
255 // The effective value, affected by modifiers.
256 [[nodiscard]] explicit operator int() const
257 {
258 return effectiveValue;
259 }
260};
261
268MRVIEWER_API bool radioButtonOrModifier( const char* label, RadioButtonOrModifierState& value, int valButton, int modifiers, int respectedModifiers = -1, std::optional<int> valueOverride = {} );
269
271MRVIEWER_API bool colorEdit4( const char* label, Vector4f& color, ImGuiColorEditFlags flags = ImGuiColorEditFlags_None );
272MRVIEWER_API bool colorEdit4( const char* label, Color& color, ImGuiColorEditFlags flags = ImGuiColorEditFlags_None );
273
275MRVIEWER_API bool combo( const char* label, int* v, const std::vector<std::string>& options,
276 bool showPreview = true, const std::vector<std::string>& tooltips = {}, const std::string& defaultText = "Not selected" );
277
279MRVIEWER_API bool beginCombo( const char* label, const std::string& text = "Not selected", bool showPreview = true );
280MRVIEWER_API void endCombo( bool showPreview = true );
281
283MRVIEWER_API bool inputText( const char* label, std::string& str, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = nullptr, void* user_data = nullptr );
285MRVIEWER_API bool inputTextIntoArray( const char* label, char* array, std::size_t size, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = nullptr, void* user_data = nullptr );
286
288MRVIEWER_API bool inputTextMultiline( const char* label, std::string& str, const ImVec2& size = ImVec2(), ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = nullptr, void* user_data = nullptr );
290MRVIEWER_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 );
291
293{
294 std::optional<ImVec2> cachedSize; // Reset this when manually modifying the text.
295};
297MRVIEWER_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 );
298MRVIEWER_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 );
299
301MRVIEWER_API bool inputTextCentered( const char* label, std::string& str, float width = 0.0f, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = nullptr, void* user_data = nullptr );
302
304MRVIEWER_API void inputTextCenteredReadOnly( const char* label, const std::string& str, float width = 0.0f, const std::optional<ImVec4>& textColor = {}, const std::optional<ImVec4>& labelColor = {} );
305
306
307namespace detail
308{
309 // A type-erased slider.
310 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 );
311
312 // Whether `T` is a scalar type that we can use with our widgets.
313 template <typename T>
314 concept Scalar = std::is_arithmetic_v<T> && !std::is_same_v<T, bool>;
315
316 // Whether `T` is a scalar or vector that we can use with our widgets.
317 template <typename T>
319
320 // Whether `Bound` is a valid min/max bound for `Target`.
321 // That is, either the same type, or if `Target` is a vector, `Bound` can also be a scalar of the same type.
322 template <typename Bound, typename Target>
324 std::same_as<Bound, Target> ||
325 ( VectorTraits<Bound>::size == 1 && std::same_as<typename VectorTraits<Bound>::BaseType, typename VectorTraits<Target>::BaseType> );
326
327 // Whether `Speed` is a valid drag speed type for `Target`.
328 // That is, either a single/vector of `float` or the same type as target (or its element if it's a vector).
329 template <typename Speed, typename Target>
331 std::same_as<Speed, typename VectorTraits<Target>::BaseType> || std::same_as<Speed, float> ||
332 std::same_as<Speed, Target> || std::same_as<Speed, typename VectorTraits<Target>::template ChangeBase<float>>;
333
334 // A common code for sliders and other widgets dealing with measurement units.
335 // `E` must be explicitly set to a measurement unit enum. The other template parameters are deduced.
336 // `label` is the widget label, `v` is the target value.
337 // `func` draws the widget for an individual scalar. We call it more than once for vectors.
338 // `func` is `( const char* label, auto& elem, int i ) -> bool`.
339 // It receives `elem` already converted to the display units (so you must convert min/max bounds manually). `i` is the element index for vectors.
340 // 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.
341 // 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.
342 // Notice `unitParams` being accepted by an lvalue reference. For convenience, we reset the `sourceUnit` in it before calling the user callback,
343 // since at that point no further conversions are necessary.
344 template <UnitEnum E, VectorOrScalar T, typename F>
345 [[nodiscard]] bool unitWidget( const char* label, T& v, UnitToStringParams<E>& unitParams, F&& func );
346
347 // Some default slider parameters. For now they are hardcoded here, but we can move them elsewhere later.
348
349 // Default drag speed for `UI::drag()`.
350 template <UnitEnum E, VectorOrScalar T>
351 requires ( VectorTraits<T>::size == 1 )
352 [[nodiscard]] float getDefaultDragSpeed();
353
354 // Default step speed for `UI::input()`.
355 template <UnitEnum E, VectorOrScalar T, VectorOrScalar TargetType>
356 [[nodiscard]] T getDefaultStep( bool fast );
357}
358
359// Default flags for `slider()` and `drag()` below.
360inline constexpr int defaultSliderFlags = ImGuiSliderFlags_AlwaysClamp;
361
362// Draw a slider.
363// `E` must be specified explicitly, to one of: `NoUnit` `LengthUnit`, `AngleUnit`, ...
364// By default, for angles `v` will be converted to degrees for display (but `vMin`, `vMax` are still in radians, same as `v`),
365// while length and unit-less values will be left as is. This can be customized in `unitParams` or globally (see `MRUnits.h`).
366template <UnitEnum E, detail::VectorOrScalar T, detail::ValidBoundForTargetType<T> U = typename VectorTraits<T>::BaseType>
367bool slider( const char* label, T& v, const U& vMin, const U& vMax, UnitToStringParams<E> unitParams = {}, ImGuiSliderFlags flags = defaultSliderFlags );
368
369// Draw a dragging widget. Also includes [+] and [-] buttons (for integers only by default_, like `ImGui::Input`).
370// `E` must be specified explicitly, to one of: `NoUnit` `LengthUnit`, `AngleUnit`, ...
371// By default, for angles `v` will be converted to degrees for display (but `vSpeed` is still in radians, same as `v`),
372// while length and unit-less values will be left as is. This can be customized in `unitParams` or globally (see `MRUnits.h`).
373// If only the min limit is specified, then the max limit is assumed to be the largest number.
374template <UnitEnum E, detail::VectorOrScalar T, detail::ValidDragSpeedForTargetType<T> SpeedType = float, detail::ValidBoundForTargetType<T> U = typename VectorTraits<T>::BaseType>
375bool 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 ) );
376
377// Draw a read-only copyable value.
378// `E` must be specified explicitly, to one of: `NoUnit` `LengthUnit`, `AngleUnit`, ...
379// By default, for angles `v` will be converted to degrees for display, while length and unit-less values will be left as is.
380// This can be customized in `unitParams` or globally (see `MRUnits.h`).
381template <UnitEnum E, detail::VectorOrScalar T>
382void readOnlyValue( const char* label, const T& v, std::optional<ImVec4> textColor = {}, UnitToStringParams<E> unitParams = {}, std::optional<ImVec4> labelColor = {} );
383
384
386MRVIEWER_API const std::pair<const char*, ImU32>& notificationChar( NotificationType type );
387
389MRVIEWER_API void transparentText( const char* fmt, ... );
391MRVIEWER_API void transparentTextWrapped( const char* fmt, ... );
393MRVIEWER_API void notificationFrame( NotificationType type, const std::string& str, float scaling );
394
396MRVIEWER_API void setTooltipIfHovered( const std::string& text, float scaling );
397
402MRVIEWER_API void separator( float scaling, const std::string& text = "", int issueCount = -1 );
403MRVIEWER_API void separator(
404 float scaling,
405 const std::string& text,
406 const ImVec4& color,
407 const std::string& issueCount );
408// separator line with icon and text
409// iconSize icon size without scaling
410MRVIEWER_API void separator( float scaling, const ImGuiImage& icon, const std::string& text, const Vector2f& iconSize = { 24.f, 24.f } );
411MRVIEWER_API void separator( float scaling, const std::string& iconName, const std::string& text, const Vector2f& iconSize = { 24.f, 24.f } );
412
417MRVIEWER_API void progressBar( float scaling, float fraction, const Vector2f& size = Vector2f( -1, 0 ) );
418
419// create and append items into a TabBar: see corresponding ImGui:: functions
420MRVIEWER_API bool beginTabBar( const char* str_id, ImGuiTabBarFlags flags = 0 );
421MRVIEWER_API void endTabBar();
422MRVIEWER_API bool beginTabItem( const char* label, bool* p_open = NULL, ImGuiTabItemFlags flags = 0 );
423MRVIEWER_API void endTabItem();
424
434MRVIEWER_API void alignTextToFramePadding( float padding );
438MRVIEWER_API void alignTextToControl( float controlHeight );
440MRVIEWER_API void alignTextToRadioButton( float scaling );
442MRVIEWER_API void alignTextToCheckBox( float scaling );
444MRVIEWER_API void alignTextToButton( float scaling );
445
449MRVIEWER_API void highlightWindowArea( float scaling, const ImVec2& min = {-1.0f, -1.0f}, const ImVec2& max = { -1.0f, -1.0f } );
450
451} // namespace UI
452
453}
454
455#include "MRUIStyle.ipp"
Definition MRImGuiImage.h:14
Definition MRUIStyle.h:314
Definition MRUIStyle.h:323
Definition MRUIStyle.h:318
auto width(const Box< V > &box)
returns size along x axis
Definition MRMesh/MRBox.h:304
constexpr const V & get(const Box< V > &box) noexcept
get<0> returns min, get<1> returns max
Definition MRMesh/MRBox.h:350
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:24
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)
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()
bool buttonIconFlatBG(const std::string &name, const Vector2f &iconSize, const std::string &text, const ImVec2 &buttonSize, bool textUnderIcon=true, ImGuiKey key=ImGuiKey_None)
Definition MRUIStyle.h:146
MRVIEWER_API bool checkbox(const char *label, bool *value)
draw gradient checkbox
MRVIEWER_API void notificationFrame(NotificationType type, const std::string &str, float scaling)
similar to ImGui::TextWrapped but also have styled background and notification type indicator
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 bool checkKey(ImGuiKey passedKey)
returns true if button is pressed in this frame, preserve its further processing in viewer keyboard e...
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:133
constexpr int defaultSliderFlags
Definition MRUIStyle.h:360
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 const std::pair< const char *, ImU32 > & notificationChar(NotificationType type)
returns icons font character for given notification type, and its color
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 buttonUniqueIcon(const std::string &iconName, const Vector2f &iconSize, const std::string &text, const ImVec2 &buttonSize, int *value, int ownValue, bool textUnderIcon=true, ImGuiKey key=ImGuiKey_None)
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:204
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 toggle(const char *label, bool *value)
draws checkbox-like toggle (enabled/disabled states)(O=)/(=O)
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:29
NotificationType
Definition MRNotificationType.h:7
std::variant< > VarUnitToStringParams
Definition MRUnits.h:321
Definition MRMesh/MRColor.h:9
parameters to customize buttonEx
Definition MRUIStyle.h:42
bool forceImguiTextColor
force use if ImGuiCol_Text for text
Definition MRUIStyle.h:51
ImGuiImage * customTexture
Definition MRUIStyle.h:46
bool border
show border or not
Definition MRUIStyle.h:53
bool underlineFirstLetter
draw line under first letter of label
Definition MRUIStyle.h:56
bool forceImGuiBackground
force use imgui background if !customTexture
Definition MRUIStyle.h:48
bool enableTestEngine
Allow interacting with this button from UI::TestEngine.
Definition MRUIStyle.h:59
Definition MRUIStyle.h:63
bool flatBackgroundColor
Definition MRUIStyle.h:68
bool active
Definition MRUIStyle.h:66
bool textUnderImage
Definition MRUIStyle.h:70
ImGuiButtonFlags flags
Definition MRUIStyle.h:64
Definition MRUIStyle.h:293
std::optional< ImVec2 > cachedSize
Definition MRUIStyle.h:294
Definition MRUIStyle.h:220
bool modifierHeld
Definition MRUIStyle.h:224
bool baseValue
Definition MRUIStyle.h:222
Definition MRUIStyle.h:74
float size
Definition MRUIStyle.h:79
VarUnitToStringParams labelFormatParams
Definition MRUIStyle.h:96
float lenDash
Definition MRUIStyle.h:90
size_t textDashIndicesStep
Definition MRUIStyle.h:87
float minValue
Definition MRUIStyle.h:83
float lenDashWithText
Definition MRUIStyle.h:92
ImVec2 startAxisPoint
Definition MRUIStyle.h:76
float optimalLenth
Definition MRUIStyle.h:81
float maxValue
Definition MRUIStyle.h:85
float textPadding
Definition MRUIStyle.h:94
Definition MRUIStyle.h:249
int value
Definition MRUIStyle.h:251
int effectiveValue
Definition MRUIStyle.h:253
Definition MRUnits.h:269
Definition MRMesh/MRVectorTraits.h:15
static constexpr int size
Definition MRMesh/MRVectorTraits.h:19
T BaseType
Definition MRMesh/MRVectorTraits.h:18