3#include "MRPch/MRFmt.h"
61 ImGuiButtonFlags
flags = ImGuiButtonFlags_None;
97MRVIEWER_API
bool buttonEx(
const char* label,
bool active,
const Vector2f&
size = Vector2f( 0, 0 ),
101MRVIEWER_API
bool button(
const char* label,
bool active,
const Vector2f&
size = Vector2f( 0, 0 ), ImGuiKey key = ImGuiKey_None );
104inline bool button(
const char* label,
const Vector2f&
size = Vector2f( 0, 0 ), ImGuiKey key = ImGuiKey_None )
110MRVIEWER_API
bool buttonCommonSize(
const char* label,
const Vector2f&
size = Vector2f( 0, 0 ), ImGuiKey key = ImGuiKey_None );
112MRVIEWER_API
bool buttonUnique(
const char* label,
int* value,
int ownValue,
const Vector2f&
size = Vector2f( 0, 0 ), ImGuiKey key = ImGuiKey_None );
121 const std::string& name,
122 const Vector2f& iconSize,
123 const std::string& text,
124 const ImVec2& buttonSize,
127inline bool buttonIcon(
const std::string& name,
const Vector2f& iconSize,
const std::string& text,
bool active,
const ImVec2& buttonSize )
132 return buttonIconEx(name, iconSize, text, buttonSize, params );
135inline bool buttonIcon(
const std::string& name,
const Vector2f& iconSize,
const std::string& text,
const ImVec2& buttonSize )
137 return buttonIconEx( name, iconSize, text, buttonSize );
140inline bool buttonIconFlatBG(
const std::string& name,
const Vector2f& iconSize,
const std::string& text,
const ImVec2& buttonSize )
145 return buttonIconEx( name, iconSize, text, buttonSize, params );
149MRVIEWER_API
bool checkbox(
const char* label,
bool* value );
153MRVIEWER_API
bool checkboxValid(
const char* label,
bool* value,
bool valid );
155MRVIEWER_API
bool checkboxMixed(
const char* label,
bool* value,
bool mixed );
157template <
typename Getter,
typename Setter>
161 bool ret =
checkbox( label, &value );
170 bool value = bool( target & flags );
171 bool mixed = value && ( target & flags ) != flags;
208MRVIEWER_API
bool radioButton(
const char* label,
int* value,
int valButton );
220 [[nodiscard]]
explicit operator int()
const
235MRVIEWER_API
bool colorEdit4(
const char* label, Vector4f& color, ImGuiColorEditFlags flags = ImGuiColorEditFlags_None );
236MRVIEWER_API
bool colorEdit4(
const char* label,
Color& color, ImGuiColorEditFlags flags = ImGuiColorEditFlags_None );
239MRVIEWER_API
bool combo(
const char* label,
int* v,
const std::vector<std::string>& options,
240 bool showPreview =
true,
const std::vector<std::string>& tooltips = {},
const std::string& defaultText =
"Not selected" );
243MRVIEWER_API
bool beginCombo(
const char* label,
const std::string& text =
"Not selected",
bool showPreview =
true );
244MRVIEWER_API
void endCombo(
bool showPreview =
true );
247MRVIEWER_API
bool inputText(
const char* label, std::string& str, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback =
nullptr,
void* user_data =
nullptr );
249MRVIEWER_API
bool inputTextIntoArray(
const char* label,
char* array, std::size_t
size, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback =
nullptr,
void* user_data =
nullptr );
252MRVIEWER_API
bool inputTextMultiline(
const char* label, std::string& str,
const ImVec2&
size = ImVec2(), ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback =
nullptr,
void* user_data =
nullptr );
254MRVIEWER_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 );
265MRVIEWER_API
bool inputTextCentered(
const char* label, std::string& str,
float width = 0.0f, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback =
nullptr,
void* user_data =
nullptr );
268MRVIEWER_API
void inputTextCenteredReadOnly(
const char* label,
const std::string& str,
float width = 0.0f,
const std::optional<ImVec4>& textColor = {},
const std::optional<ImVec4>& labelColor = {} );
274 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 );
277 template <
typename T>
278 concept Scalar = std::is_arithmetic_v<T> && !std::is_same_v<T, bool>;
281 template <
typename T>
286 template <
typename Bound,
typename Target>
288 std::same_as<Bound, Target> ||
293 template <
typename Speed,
typename Target>
295 std::same_as<Speed, typename VectorTraits<Target>::BaseType> || std::same_as<Speed, float> ||
296 std::same_as<Speed, Target> || std::same_as<Speed, typename VectorTraits<Target>::template ChangeBase<float>>;
308 template <UnitEnum E, VectorOrScalar T,
typename F>
314 template <UnitEnum E, VectorOrScalar T>
319 template <UnitEnum E, VectorOrScalar T, VectorOrScalar TargetType>
330template <UnitEnum E, detail::VectorOrScalar T, detail::Val
idBoundForTargetType<T> U =
typename VectorTraits<T>::BaseType>
338template <UnitEnum E, detail::VectorOrScalar T, detail::Val
idDragSpeedForTargetType<T> SpeedType =
float, detail::Val
idBoundForTargetType<T> U =
typename VectorTraits<T>::BaseType>
339bool 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 ) );
345template <UnitEnum E, detail::VectorOrScalar T>
361MRVIEWER_API
void separator(
float scaling,
const std::string& text =
"",
int issueCount = -1 );
364 const std::string& text,
366 const std::string& issueCount );
369MRVIEWER_API
void separator(
float scaling,
const ImGuiImage& icon,
const std::string& text,
const Vector2f& iconSize = { 24.f, 24.f } );
370MRVIEWER_API
void separator(
float scaling,
const std::string& iconName,
const std::string& text,
const Vector2f& iconSize = { 24.f, 24.f } );
376MRVIEWER_API
void progressBar(
float scaling,
float fraction,
const Vector2f&
size = Vector2f( -1, 0 ) );
379MRVIEWER_API
bool beginTabBar(
const char* str_id, ImGuiTabBarFlags flags = 0 );
381MRVIEWER_API
bool beginTabItem(
const char* label,
bool* p_open = NULL, ImGuiTabItemFlags flags = 0 );
408MRVIEWER_API
void highlightWindowArea(
float scaling,
const ImVec2& min = {-1.0f, -1.0f},
const ImVec2& max = { -1.0f, -1.0f } );
414#include "MRUIStyle.ipp"
Definition MRImGuiImage.h:14
Definition MRUIStyle.h:278
Definition MRUIStyle.h:287
Definition MRUIStyle.h:294
Definition MRUIStyle.h:282
auto width(const Box< V > &box)
returns size along x axis
Definition MRMesh/MRBox.h:247
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:22
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:140
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 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:127
constexpr int defaultSliderFlags
Definition MRUIStyle.h:324
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 ¶ms={})
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:168
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
constexpr const T & get(const Vector2< T > &v) noexcept
Definition MRTupleBindings.h:83
std::variant< > VarUnitToStringParams
Definition MRUnits.h:310
Definition MRUIStyle.h:257
std::optional< ImVec2 > cachedSize
Definition MRUIStyle.h:258
Definition MRUIStyle.h:184
bool modifierHeld
Definition MRUIStyle.h:188
bool baseValue
Definition MRUIStyle.h:186
Definition MRUIStyle.h:71
float size
Definition MRUIStyle.h:76
VarUnitToStringParams labelFormatParams
Definition MRUIStyle.h:93
float lenDash
Definition MRUIStyle.h:87
size_t textDashIndicesStep
Definition MRUIStyle.h:84
float minValue
Definition MRUIStyle.h:80
float lenDashWithText
Definition MRUIStyle.h:89
ImVec2 startAxisPoint
Definition MRUIStyle.h:73
float optimalLenth
Definition MRUIStyle.h:78
float maxValue
Definition MRUIStyle.h:82
float textPadding
Definition MRUIStyle.h:91
Definition MRMesh/MRVectorTraits.h:14
static constexpr int size
Definition MRMesh/MRVectorTraits.h:18
T BaseType
Definition MRMesh/MRVectorTraits.h:17