23[[nodiscard]] MRVIEWER_API
float scale();
38[[nodiscard]] MRVIEWER_API
bool readBool( std::string_view key,
bool defaultValue =
false );
39MRVIEWER_API
void writeBool( std::string_view key,
bool value );
68 ImGuiButtonFlags
flags = ImGuiButtonFlags_None;
138[[deprecated(
"Use UI::buttonEx( label, size, params ) instead" )]]
139MRVIEWER_API
bool buttonEx(
const char* label,
bool active,
const Vector2f&
size = Vector2f( 0, 0 ),
146MRVIEWER_API
bool button(
const char* label,
bool active,
const Vector2f&
size = Vector2f( 0, 0 ), ImGuiKey key = ImGuiKey_None );
149inline bool button(
const char* label,
const Vector2f&
size = Vector2f( 0, 0 ), ImGuiKey key = ImGuiKey_None )
155MRVIEWER_API
bool buttonCommonSize(
const char* label,
const Vector2f&
size = Vector2f( 0, 0 ), ImGuiKey key = ImGuiKey_None );
157MRVIEWER_API
bool buttonUnique(
const char* label,
int* value,
int ownValue,
const Vector2f&
size = Vector2f( 0, 0 ), ImGuiKey key = ImGuiKey_None );
166 const std::string& name,
167 const Vector2f& iconSize,
168 const std::string& text,
169 const ImVec2& buttonSize,
173inline bool buttonIcon(
const std::string& name,
const Vector2f& iconSize,
const std::string& text,
const ImVec2& buttonSize )
175 return buttonIconEx( name, iconSize, text, buttonSize );
179 const std::string& name,
180 const Vector2f& iconSize,
181 const std::string& text,
182 const ImVec2& buttonSize,
183 bool textUnderIcon =
true,
184 ImGuiKey key = ImGuiKey_None )
196 const std::string& iconName,
197 const Vector2f& iconSize,
198 const std::string& text,
199 const ImVec2& buttonSize,
202 bool textUnderIcon =
true,
203 ImGuiKey key = ImGuiKey_None );
207MRVIEWER_API
bool toggle(
const char* label,
bool* value );
209MRVIEWER_API
bool checkbox(
const char* label,
bool* value );
213MRVIEWER_API
bool checkboxValid(
const char* label,
bool* value,
bool valid );
215MRVIEWER_API
bool checkboxMixed(
const char* label,
bool* value,
bool mixed );
217template <
typename Getter,
typename Setter>
221 bool ret =
checkbox( label, &value );
225template <
typename Getter,
typename Setter>
238 bool value = bool( target & flags );
239 bool mixed = value && ( target & flags ) != flags;
280MRVIEWER_API
bool radioButton(
const char* label,
int* value,
int valButton );
292 [[nodiscard]]
explicit operator int()
const
307MRVIEWER_API
bool colorEdit4(
const char* label, Vector4f& color, ImGuiColorEditFlags flags = ImGuiColorEditFlags_None );
308MRVIEWER_API
bool colorEdit4(
const char* label,
Color& color, ImGuiColorEditFlags flags = ImGuiColorEditFlags_None );
311MRVIEWER_API
bool combo(
const char* label,
int* v,
const std::vector<std::string>& options,
312 bool showPreview =
true,
const std::vector<std::string>& tooltips = {},
const std::string& defaultText =
"Not selected" );
315MRVIEWER_API
bool beginCombo(
const char* label,
const std::string& text =
"Not selected",
bool showPreview =
true );
316MRVIEWER_API
void endCombo(
bool showPreview =
true );
319MRVIEWER_API
bool inputText(
const char* label, std::string& str, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback =
nullptr,
void* user_data =
nullptr );
321MRVIEWER_API
bool inputTextIntoArray(
const char* label,
char* array, std::size_t
size, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback =
nullptr,
void* user_data =
nullptr );
324MRVIEWER_API
bool inputTextMultiline(
const char* label, std::string& str,
const ImVec2&
size = ImVec2(), ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback =
nullptr,
void* user_data =
nullptr );
326MRVIEWER_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 );
337MRVIEWER_API
bool inputTextCentered(
const char* label, std::string& str,
float width = 0.0f, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback =
nullptr,
void* user_data =
nullptr );
340MRVIEWER_API
void inputTextCenteredReadOnly(
const char* label,
const std::string& str,
float width = 0.0f,
const std::optional<ImVec4>& textColor = {},
const std::optional<ImVec4>& labelColor = {} );
346 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 );
349 template <
typename T>
350 concept Scalar = std::is_arithmetic_v<T> && !std::is_same_v<T, bool>;
353 template <
typename T>
358 template <
typename Bound,
typename Target>
360 std::same_as<Bound, Target> ||
365 template <
typename Speed,
typename Target>
367 std::same_as<Speed, typename VectorTraits<Target>::BaseType> || std::same_as<Speed, float> ||
368 std::same_as<Speed, Target> || std::same_as<Speed, typename VectorTraits<Target>::template ChangeBase<float>>;
380 template <UnitEnum E, VectorOrScalar T,
typename F>
389template <UnitEnum E, detail::VectorOrScalar T>
394template <UnitEnum E, detail::VectorOrScalar T, detail::VectorOrScalar TargetType>
401template <UnitEnum E, detail::VectorOrScalar T, detail::Val
idBoundForTargetType<T> U =
typename VectorTraits<T>::BaseType>
409template <UnitEnum E, detail::VectorOrScalar T, detail::Val
idDragSpeedForTargetType<T> SpeedType =
float, detail::Val
idBoundForTargetType<T> U =
typename VectorTraits<T>::BaseType>
410bool drag(
const char* label, T& v, SpeedType vSpeed =
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 =
getDefaultStep<E, U, T>(
false ),
const U& stepFast =
getDefaultStep<E, U, T>(
true ) );
413template <UnitEnum E, detail::VectorOrScalar T, detail::Val
idBoundForTargetType<T> U =
typename VectorTraits<T>::BaseType>
420template <UnitEnum E, detail::VectorOrScalar T>
428template <UnitEnum E, detail::Scalar T,
typename F>
435template <UnitEnum E, detail::Scalar T, detail::Val
idDragSpeedForTargetType<T> SpeedType =
float,
typename F = std::
nullptr_t>
441template <UnitEnum E, detail::Scalar T,
typename F = std::
nullptr_t>
494MRVIEWER_API
void separator(
const std::string& text =
"",
int issueCount = -1 );
496 const std::string& text,
498 const std::string& issueCount );
501MRVIEWER_API
void separator(
const ImGuiImage& icon,
const std::string& text,
const Vector2f& iconSize = { 24.f, 24.f } );
502MRVIEWER_API
void separator(
const std::string& iconName,
const std::string& text,
const Vector2f& iconSize = { 24.f, 24.f } );
508MRVIEWER_API
void progressBar(
float fraction,
const Vector2f&
size = Vector2f( -1, 0 ) );
511MRVIEWER_API
bool beginTabBar(
const char* str_id, ImGuiTabBarFlags flags = 0 );
513MRVIEWER_API
bool beginTabItem(
const char* label,
bool* p_open = NULL, ImGuiTabItemFlags flags = 0 );
540MRVIEWER_API
void highlightWindowArea(
const ImVec2& min = {-1.0f, -1.0f},
const ImVec2& max = { -1.0f, -1.0f } );
560 std::function<bool(
const std::string& name )>
onSave;
573 ImDrawFlags oldFlags{};
577 : list( list ), oldFlags( list.Flags )
587 list.Flags = oldFlags;
604#include "MRUIStyle.ipp"
Definition MRImGuiImage.h:15
Definition MRUIStyle.h:571
Disabler(const Disabler &)=delete
Disabler(ImDrawList &list, ImDrawFlags mask)
Definition MRUIStyle.h:576
Disabler & operator=(const Disabler &)=delete
~Disabler()
Definition MRUIStyle.h:585
Definition MRUIStyle.h:593
LineAntialiasingDisabler(ImDrawList &list)
Definition MRUIStyle.h:595
Definition MRUIStyle.h:350
Definition MRUIStyle.h:359
Definition MRUIStyle.h:366
Definition MRUIStyle.h:354
auto width(const Box< V > &box)
returns size along x axis
Definition MRMesh/MRBox.h:354
constexpr const V & get(const Box< V > &box) noexcept
get<0> returns min, get<1> returns max
Definition MRMesh/MRBox.h:400
MRVIEWER_API bool readBool(std::string_view key, bool defaultValue=false)
MRVIEWER_API void writeBool(std::string_view key, bool value)
MRVIEWER_API void setScale(float newScale)
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)
TextureType
Definition MRUIStyle.h:45
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 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={})
MRVIEWER_API void endTabBar()
MRVIEWER_API bool isItemActive(const char *name)
bool inputPlusMinus(const char *label, T &plus, T &minus, T plusMin=T{}, T plusMax=std::numeric_limits< T >::max(), UnitToStringParams< E > unitParams={}, ImGuiSliderFlags flags=defaultSliderFlags, F &&wrapFunc=nullptr)
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 buttonIcon(const std::string &name, const Vector2f &iconSize, const std::string &text, const ImVec2 &buttonSize)
Definition MRUIStyle.h:173
MRVIEWER_API void alignTextToButton()
Specialization of alignTextToFramePadding for UI::button with default height.
T getDefaultStep(bool fast)
MRVIEWER_API void alignTextToCheckBox()
Specialization of alignTextToFramePadding for UI::checkbox.
MRVIEWER_API void notificationFrame(NotificationType type, const std::string &str)
similar to ImGui::TextWrapped but also have styled background and notification type indicator
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:178
MRVIEWER_API bool checkbox(const char *label, bool *value)
draw gradient checkbox
bool dragPlusMinus(const char *label, T &plus, T &minus, SpeedType speed=getDefaultDragSpeed< E, SpeedType >(), T plusMin=T{}, T plusMax=std::numeric_limits< T >::max(), UnitToStringParams< E > unitParams={}, ImGuiSliderFlags flags=defaultSliderFlags, F &&wrapFunc=nullptr)
MRVIEWER_API void highlightWindowArea(const ImVec2 &min={-1.0f, -1.0f}, const ImVec2 &max={ -1.0f, -1.0f })
MRVIEWER_API float scale()
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 separator(const SeparatorParams ¶ms)
separator line with customizations
MRVIEWER_API void alignTextToControl(float controlHeight)
MRVIEWER_API bool checkKey(ImGuiKey passedKey)
returns true if button is pressed in this frame, preserve its further processing in viewer keyboard e...
bool drag(const char *label, T &v, SpeedType vSpeed=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=getDefaultStep< E, U, T >(false), const U &stepFast=getDefaultStep< E, U, T >(true))
MRVIEWER_API bool beginCombo(const char *label, const std::string &text="Not selected", bool showPreview=true)
draw custom content combo box
float getDefaultDragSpeed()
constexpr int defaultSliderFlags
Definition MRUIStyle.h:386
bool plusMinusGeneric(const char *label, T &plus, T &minus, UnitToStringParams< E > unitToStringParams, F &&func)
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 mouseControlHint(ImGuiMouseButton btn, const std::string &hint)
draws hint with corresponding mouse btn icon
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 alignTextToRadioButton()
Specialization of alignTextToFramePadding for UI::radioButton.
MRVIEWER_API void endCombo(bool showPreview=true)
MRVIEWER_API bool buttonEx(const char *label, bool active, const Vector2f &size=Vector2f(0, 0), ImGuiButtonFlags flags=ImGuiButtonFlags_None, const ButtonCustomizationParams &customParams={})
draw gradient button, which can be disabled (active = false)
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 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 ¶ms={})
MRVIEWER_API bool beginTabBar(const char *str_id, ImGuiTabBarFlags flags=0)
MRVIEWER_API void drawPoltHorizontalAxis(const PlotAxis &plotAxis)
bool checkboxFlags(const char *label, T &target, T flags)
Draw a checkbox toggling one or more bits in the mask.
Definition MRUIStyle.h:236
bool input(const char *label, T &v, const U &vMin=std::numeric_limits< U >::lowest(), const U &vMax=std::numeric_limits< U >::max(), UnitToStringParams< E > unitParams={}, ImGuiSliderFlags flags=defaultSliderFlags)
MRVIEWER_API void drawPoltVerticalAxis(const PlotAxis &plotAxis)
MRVIEWER_API void saveCustomConfigModal(const CustomConfigModalSettings &settings)
Draw modal window to save user configs (for example Palettes)
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 void setTooltipIfHovered(const std::string &text)
draw tooltip only if current item is hovered
MRVIEWER_API ImGuiKey getImGuiModPrimaryCtrl()
returns imgui modifier Id based on current environment
MRVIEWER_API bool button(const char *label, bool active, const Vector2f &size=Vector2f(0, 0), ImGuiKey key=ImGuiKey_None)
MRVIEWER_API const char * getImGuiPrimaryCtrlName()
returns "Ctrl" by default or "Command" if ImGui has changed it internally for macos
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 progressBar(float fraction, const Vector2f &size=Vector2f(-1, 0))
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:122
Definition MRMesh/MRColor.h:9
Definition MRUIStyle.h:329
std::optional< ImVec2 > cachedSize
Definition MRUIStyle.h:330
Definition MRUIStyle.h:252
bool modifierHeld
Definition MRUIStyle.h:256
CheckboxOrModifierState()
Definition MRUIStyle.h:258
CheckboxOrModifierState(bool baseValue)
Definition MRUIStyle.h:260
bool baseValue
Definition MRUIStyle.h:254
Settings required for UI::saveCustomConfigModal
Definition MRUIStyle.h:544
std::string imGuiIdKey
Optional string added at the end of popup name to have unique names.
Definition MRUIStyle.h:548
MRVIEWER_API std::string popupName() const
returns accumulated name of the popup
std::filesystem::path configDirectory
Directory where to save config.
Definition MRUIStyle.h:550
std::string configName
Name of desired config type.
Definition MRUIStyle.h:546
bool triggerSave
if true - opens modal in this frame, or saves if (!inputNameDialog && inputName)
Definition MRUIStyle.h:556
bool inputNameDialog
If false, inputName is used (if inputName is nullptr this option is not used)
Definition MRUIStyle.h:554
bool warnExisting
If true - warns user before overriding existing file, otherwise override without warning.
Definition MRUIStyle.h:558
std::function< bool(const std::string &name)> onSave
Callback that is called when save is requested->returns true if file saved successfully (to close mod...
Definition MRUIStyle.h:560
std::string * inputName
String used by input.
Definition MRUIStyle.h:552
Definition MRUIStyle.h:103
float size
Definition MRUIStyle.h:108
VarUnitToStringParams labelFormatParams
Definition MRUIStyle.h:125
float lenDash
Definition MRUIStyle.h:119
size_t textDashIndicesStep
Definition MRUIStyle.h:116
float minValue
Definition MRUIStyle.h:112
float lenDashWithText
Definition MRUIStyle.h:121
ImVec2 startAxisPoint
Definition MRUIStyle.h:105
float optimalLenth
Definition MRUIStyle.h:110
float maxValue
Definition MRUIStyle.h:114
float textPadding
Definition MRUIStyle.h:123
Parameters for drawing custom separator.
Definition MRUIStyle.h:463
std::string suffix
framed text after label (might be used for some indications)
Definition MRUIStyle.h:474
std::optional< Color > suffixFrameColor
color of background frame behind suffix (if not present default ImGuiCol_FrameBg is used)
Definition MRUIStyle.h:477
const ImGuiImage * icon
optional icon in the left part of separator
Definition MRUIStyle.h:465
Vector2f iconSize
size of icon
Definition MRUIStyle.h:468
bool forceImGuiSpacing
Definition MRUIStyle.h:481
float extraScale
The spacing is multiplied by this.
Definition MRUIStyle.h:484
std::string label
label at the left part of separator (drawn after icon if present)
Definition MRUIStyle.h:471
Definition MRMesh/MRVectorTraits.h:15
static constexpr int size
Definition MRMesh/MRVectorTraits.h:19
T BaseType
Definition MRMesh/MRVectorTraits.h:18