MeshLib Documentation
Loading...
Searching...
No Matches
MRUIStyle.h File Reference
#include "MRMesh/MRFinally.h"
#include "MRPch/MRFmt.h"
#include "MRViewer/MRUnits.h"
#include "MRViewer/MRVectorTraits.h"
#include "exports.h"
#include "imgui.h"
#include "MRColorTheme.h"
#include <span>
#include <string>
#include <optional>
#include "MRUIStyle.ipp"

Go to the source code of this file.

Classes

struct  MR::UI::ButtonCustomizationParams
 parameters to customize buttonEx More...
 
struct  MR::UI::ButtonIconCustomizationParams
 
struct  MR::UI::PlotAxis
 
struct  MR::UI::CheckboxOrModifierState
 
struct  MR::UI::RadioButtonOrModifierState
 
struct  MR::UI::CachedTextSize
 

Namespaces

namespace  MR
 
namespace  MR::UI
 
namespace  MR::UI::detail
 

Concepts

concept  MR::UI::detail::Scalar
 
concept  MR::UI::detail::VectorOrScalar
 
concept  MR::UI::detail::ValidBoundForTargetType
 
concept  MR::UI::detail::ValidDragSpeedForTargetType
 

Enumerations

enum class  MR::UI::TextureType {
  MR::UI::Mono , MR::UI::Gradient , MR::UI::GradientBtn , MR::UI::GradientBtnSecond ,
  MR::UI::RainbowRect , MR::UI::Count
}
 

Functions

MRVIEWER_API std::unique_ptr< ImGuiImage > & MR::UI::getTexture (TextureType type)
 
MRVIEWER_API void MR::UI::init ()
 init internal parameters
 
MRVIEWER_API bool MR::UI::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)
 
MRVIEWER_API bool MR::UI::button (const char *label, bool active, const Vector2f &size=Vector2f(0, 0), ImGuiKey key=ImGuiKey_None)
 
bool MR::UI::button (const char *label, const Vector2f &size=Vector2f(0, 0), ImGuiKey key=ImGuiKey_None)
 
MRVIEWER_API bool MR::UI::buttonCommonSize (const char *label, const Vector2f &size=Vector2f(0, 0), ImGuiKey key=ImGuiKey_None)
 
MRVIEWER_API bool MR::UI::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 MR::UI::drawPoltHorizontalAxis (float menuScaling, const PlotAxis &plotAxis)
 
MRVIEWER_API void MR::UI::drawPoltVerticalAxis (float menuScaling, const PlotAxis &plotAxis)
 
MRVIEWER_API bool MR::UI::buttonIconEx (const std::string &name, const Vector2f &iconSize, const std::string &text, const ImVec2 &buttonSize, const ButtonIconCustomizationParams &params={})
 
bool MR::UI::buttonIcon (const std::string &name, const Vector2f &iconSize, const std::string &text, bool active, const ImVec2 &buttonSize)
 
bool MR::UI::buttonIcon (const std::string &name, const Vector2f &iconSize, const std::string &text, const ImVec2 &buttonSize)
 
bool MR::UI::buttonIconFlatBG (const std::string &name, const Vector2f &iconSize, const std::string &text, const ImVec2 &buttonSize)
 
MRVIEWER_API bool MR::UI::buttonUniqueIcon (const std::string &iconName, const Vector2f &iconSize, const std::string &text, const ImVec2 &buttonSize, int *value, int ownValue)
 
MRVIEWER_API bool MR::UI::checkbox (const char *label, bool *value)
 draw gradient checkbox
 
MRVIEWER_API bool MR::UI::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 value.
 
MRVIEWER_API bool MR::UI::checkboxValid (const char *label, bool *value, bool valid)
 If valid is false checkbox is disabled. Same as checkboxOrFixedValue( ..., valid ? nullopt : false ).
 
MRVIEWER_API bool MR::UI::checkboxMixed (const char *label, bool *value, bool mixed)
 draw gradient checkbox with mixed state
 
template<typename Getter , typename Setter >
bool MR::UI::checkbox (const char *label, Getter get, Setter set)
 draw gradient checkbox
 
template<typename T >
bool MR::UI::checkboxFlags (const char *label, T &target, T flags)
 Draw a checkbox toggling one or more bits in the mask.
 
MRVIEWER_API bool MR::UI::checkboxOrModifier (const char *label, CheckboxOrModifierState &value, int modifiers, int respectedModifiers=-1, std::optional< bool > valueOverride={})
 
MRVIEWER_API bool MR::UI::radioButton (const char *label, int *value, int valButton)
 draw gradient radio button
 
MRVIEWER_API bool MR::UI::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 of value.
 
MRVIEWER_API bool MR::UI::radioButtonOrModifier (const char *label, RadioButtonOrModifierState &value, int valButton, int modifiers, int respectedModifiers=-1, std::optional< int > valueOverride={})
 
MRVIEWER_API bool MR::UI::colorEdit4 (const char *label, Vector4f &color, ImGuiColorEditFlags flags=ImGuiColorEditFlags_None)
 draw gradient color edit 4
 
MRVIEWER_API bool MR::UI::colorEdit4 (const char *label, Color &color, ImGuiColorEditFlags flags=ImGuiColorEditFlags_None)
 
MRVIEWER_API bool MR::UI::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 MR::UI::beginCombo (const char *label, const std::string &text="Not selected", bool showPreview=true)
 draw custom content combo box
 
MRVIEWER_API void MR::UI::endCombo (bool showPreview=true)
 
MRVIEWER_API bool MR::UI::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 bool MR::UI::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 bool MR::UI::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 MR::UI::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 bool MR::UI::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 by default (so you can pass 0 as width).
 
MRVIEWER_API bool MR::UI::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 bool MR::UI::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 void MR::UI::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 MR::UI::detail::genericSlider (const char *label, ImGuiDataType data_type, void *p_data, const void *p_min, const void *p_max, const char *format, ImGuiSliderFlags flags)
 
template<UnitEnum E, VectorOrScalar T, typename F >
bool MR::UI::detail::unitWidget (const char *label, T &v, UnitToStringParams< E > &unitParams, F &&func)
 
template<UnitEnum E, VectorOrScalar T>
requires ( VectorTraits<T>::size == 1 )
float MR::UI::detail::getDefaultDragSpeed ()
 
template<UnitEnum E, VectorOrScalar T, VectorOrScalar TargetType>
MR::UI::detail::getDefaultStep (bool fast)
 
template<UnitEnum E, detail::VectorOrScalar T, detail::ValidBoundForTargetType< T > U = typename VectorTraits<T>::BaseType>
bool MR::UI::slider (const char *label, T &v, const U &vMin, const U &vMax, UnitToStringParams< E > unitParams={}, ImGuiSliderFlags flags=defaultSliderFlags)
 
template<UnitEnum E, detail::VectorOrScalar T, detail::ValidDragSpeedForTargetType< T > SpeedType = float, detail::ValidBoundForTargetType< T > U = typename VectorTraits<T>::BaseType>
bool MR::UI::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))
 
template<UnitEnum E, detail::VectorOrScalar T>
void MR::UI::readOnlyValue (const char *label, const T &v, std::optional< ImVec4 > textColor={}, UnitToStringParams< E > unitParams={}, std::optional< ImVec4 > labelColor={})
 
MRVIEWER_API void MR::UI::transparentText (const char *fmt,...)
 similar to ImGui::Text but use current text color with alpha channel = 0.5
 
MRVIEWER_API void MR::UI::transparentTextWrapped (const char *fmt,...)
 similar to ImGui::TextWrapped but use current text color with alpha channel = 0.5
 
MRVIEWER_API void MR::UI::setTooltipIfHovered (const std::string &text, float scaling)
 draw tooltip only if current item is hovered
 
MRVIEWER_API void MR::UI::separator (float scaling, const std::string &text="", int issueCount=-1)
 
MRVIEWER_API void MR::UI::separator (float scaling, const std::string &text, const ImVec4 &color, const std::string &issueCount)
 
MRVIEWER_API void MR::UI::separator (float scaling, const ImGuiImage &icon, const std::string &text, const Vector2f &iconSize={ 24.f, 24.f })
 
MRVIEWER_API void MR::UI::separator (float scaling, const std::string &iconName, const std::string &text, const Vector2f &iconSize={ 24.f, 24.f })
 
MRVIEWER_API void MR::UI::progressBar (float scaling, float fraction, const Vector2f &size=Vector2f(-1, 0))
 
MRVIEWER_API bool MR::UI::beginTabBar (const char *str_id, ImGuiTabBarFlags flags=0)
 
MRVIEWER_API void MR::UI::endTabBar ()
 
MRVIEWER_API bool MR::UI::beginTabItem (const char *label, bool *p_open=NULL, ImGuiTabItemFlags flags=0)
 
MRVIEWER_API void MR::UI::endTabItem ()
 
MRVIEWER_API void MR::UI::alignTextToFramePadding (float padding)
 
MRVIEWER_API void MR::UI::alignTextToControl (float controlHeight)
 
MRVIEWER_API void MR::UI::alignTextToRadioButton (float scaling)
 Specialization of alignTextToFramePadding for UI::radioButton.
 
MRVIEWER_API void MR::UI::alignTextToCheckBox (float scaling)
 Specialization of alignTextToFramePadding for UI::checkbox.
 
MRVIEWER_API void MR::UI::alignTextToButton (float scaling)
 Specialization of alignTextToFramePadding for UI::button with default height.
 
MRVIEWER_API void MR::UI::highlightWindowArea (float scaling, const ImVec2 &min={-1.0f, -1.0f}, const ImVec2 &max={ -1.0f, -1.0f })
 

Variables

constexpr int MR::UI::defaultSliderFlags = ImGuiSliderFlags_AlwaysClamp