MeshLib C++ Docs
Loading...
Searching...
No Matches
MR::UI Namespace Reference

Namespaces

namespace  detail
 
namespace  StateStorage
 Use this to store state across frames. Like what CollapsingHeader() uses to store it's open/close state.
 
namespace  TestEngine
 

Classes

struct  ButtonCustomizationParams
 parameters to customize buttonEx More...
 
struct  ButtonIconCustomizationParams
 
struct  CachedTextSize
 
struct  CheckboxOrModifierState
 
struct  CustomConfigModalSettings
 Settings required for UI::saveCustomConfigModal More...
 
class  Disabler
 While this exists, it temporarily disables in the given list the flags with 0 bits in the given mask. More...
 
class  LabelRectAllocator
 A rect allocator for labels. More...
 
class  LineAntialiasingDisabler
 While this exists, it temporarily disables antialiasing for the lines drawn to this list. More...
 
class  NonOverlappingLabelTask
 
struct  PlotAxis
 
struct  RadioButtonOrModifierState
 
class  RectAllocator
 
struct  SaveChangesPopupSettings
 
struct  SeparatorParams
 Parameters for drawing custom separator. More...
 
class  WindowRectAllocator
 A rect allocator specifically for ImGui windows. More...
 

Enumerations

enum class  TextureType {
  TextureType::Mono , TextureType::Gradient , TextureType::GradientBtn , TextureType::GradientBtnSecond ,
  TextureType::GradientBtnGray , TextureType::RainbowRect , TextureType::Count
}
 enumeration texture types More...
 

Functions

MRVIEWER_API void nonOverlappingLabel ()
 
MRVIEWER_API WindowRectAllocatorgetDefaultWindowRectAllocator ()
 
MRVIEWER_API LabelRectAllocatorgetDefaultLabelRectAllocator ()
 
MRVIEWER_API void saveChangesPopup (const char *str_id, const SaveChangesPopupSettings &settings={})
 
MRVIEWER_API float scale ()
 Returns the global UI scale. Use this instead of passing around the scale in parameters.
 
MRVIEWER_API bool isItemActive (const char *name)
 Checks if the item with this name in the current window is active.
 
MRVIEWER_API std::unique_ptr< ImGuiImage > & getTexture (TextureType type)
 get texture by type
 
MRVIEWER_API void init ()
 init internal parameters
 
MRVIEWER_API ImGuiKey getImGuiModPrimaryCtrl ()
 returns imgui modifier Id based on current environment
 
MRVIEWER_API const char * getImGuiPrimaryCtrlName ()
 returns "Ctrl" by default or "Command" if ImGui has changed it internally for macos
 
MRVIEWER_API bool checkKey (ImGuiKey passedKey)
 returns true if button is pressed in this frame, preserve its further processing in viewer keyboard events system if taken here
 
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 buttonEx (const char *label, const Vector2f &size=Vector2f(0, 0), const ButtonCustomizationParams &customParams={})
 draw gradient button, which can be customized
 
MRVIEWER_API bool button (const char *label, bool active, const Vector2f &size=Vector2f(0, 0), ImGuiKey key=ImGuiKey_None)
 
bool button (const char *label, const Vector2f &size=Vector2f(0, 0), ImGuiKey key=ImGuiKey_None)
 
MRVIEWER_API bool buttonCommonSize (const char *label, const Vector2f &size=Vector2f(0, 0), ImGuiKey key=ImGuiKey_None)
 
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 drawPoltHorizontalAxis (const PlotAxis &plotAxis)
 draw dash with text along the horizontal axis
 
MRVIEWER_API void drawPoltVerticalAxis (const PlotAxis &plotAxis)
 draw dash with text along the vertical axis
 
MRVIEWER_API bool buttonIconEx (const std::string &name, const Vector2f &iconSize, const std::string &text, const ImVec2 &buttonSize, const ButtonIconCustomizationParams &params={})
 draw a button with an icon and text under it
 
bool buttonIcon (const std::string &name, const Vector2f &iconSize, const std::string &text, const ImVec2 &buttonSize)
 button with a gradient, always active
 
bool buttonIconFlatBG (const std::string &name, const Vector2f &iconSize, const std::string &text, const ImVec2 &buttonSize, bool textUnderIcon=true, ImGuiKey key=ImGuiKey_None)
 button without a gradient, always active, configurable by an external style
 
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 toggle (const char *label, bool *value)
 draws checkbox-like toggle (enabled/disabled states)(O=)/(=O)
 
MRVIEWER_API bool checkbox (const char *label, bool *value)
 draw gradient checkbox
 
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 value.
 
MRVIEWER_API bool checkboxValid (const char *label, bool *value, bool valid)
 If valid is false checkbox is disabled. Same as checkboxOrFixedValue( ..., valid ? nullopt : false ).
 
MRVIEWER_API bool checkboxMixed (const char *label, bool *value, bool mixed)
 draw gradient checkbox with mixed state
 
template<typename Getter , typename Setter >
bool checkbox (const char *label, Getter get, Setter set)
 draw gradient checkbox
 
template<typename Getter , typename Setter >
bool checkboxValid (const char *label, Getter get, Setter set, bool valid)
 
template<typename T >
bool checkboxFlags (const char *label, T &target, T flags)
 Draw a checkbox toggling one or more bits in the mask.
 
MRVIEWER_API bool checkboxOrModifier (const char *label, CheckboxOrModifierState &value, int modifiers, int respectedModifiers=-1, std::optional< bool > valueOverride={})
 
MRVIEWER_API bool radioButton (const char *label, int *value, int valButton)
 draw gradient radio button
 
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 of value.
 
MRVIEWER_API bool radioButtonOrModifier (const char *label, RadioButtonOrModifierState &value, int valButton, int modifiers, int respectedModifiers=-1, std::optional< int > valueOverride={})
 
MRVIEWER_API bool colorEdit4 (const char *label, Vector4f &color, ImGuiColorEditFlags flags=ImGuiColorEditFlags_None)
 draw gradient color edit 4
 
MRVIEWER_API bool colorEdit4 (const char *label, Color &color, ImGuiColorEditFlags flags=ImGuiColorEditFlags_None)
 
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 beginCombo (const char *label, const std::string &text="Not selected", bool showPreview=true)
 draw custom content combo box
 
MRVIEWER_API void endCombo (bool showPreview=true)
 
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 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 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 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 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 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 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 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
 
template<UnitEnum E, detail::VectorOrScalar T>
requires ( VectorTraits<T>::size == 1 )
float getDefaultDragSpeed ()
 Default drag speed for UI::drag().
 
template<UnitEnum E, detail::VectorOrScalar T, detail::VectorOrScalar TargetType>
getDefaultStep (bool fast)
 Default step speed for UI::input().
 
template<UnitEnum E, detail::VectorOrScalar T, detail::ValidBoundForTargetType< T > U = typename VectorTraits<T>::BaseType>
bool 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 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))
 
template<UnitEnum E, detail::VectorOrScalar T, detail::ValidBoundForTargetType< T > U = typename VectorTraits<T>::BaseType>
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)
 Like drag(), but clicking it immediately activates text input, so it's not actually draggable.
 
template<UnitEnum E, detail::VectorOrScalar T>
void readOnlyValue (const char *label, const T &v, std::optional< ImVec4 > textColor={}, UnitToStringParams< E > unitParams={}, std::optional< ImVec4 > labelColor={})
 
template<UnitEnum E, detail::Scalar T, typename F >
bool plusMinusGeneric (const char *label, T &plus, T &minus, UnitToStringParams< E > unitToStringParams, F &&func)
 
template<UnitEnum E, detail::Scalar T, detail::ValidDragSpeedForTargetType< T > SpeedType = float, typename F = std::nullptr_t>
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)
 
template<UnitEnum E, detail::Scalar T, typename F = std::nullptr_t>
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 const std::pair< const char *, ImU32 > & notificationChar (NotificationType type)
 returns icons font character for given notification type, and its color
 
MRVIEWER_API void mouseControlHint (ImGuiMouseButton btn, const std::string &hint)
 draws hint with corresponding mouse btn icon
 
MRVIEWER_API void transparentText (const char *fmt,...)
 similar to ImGui::Text but use current text color with alpha channel = 0.5
 
MRVIEWER_API void transparentTextWrapped (const char *fmt,...)
 similar to ImGui::TextWrapped but use current text color with alpha channel = 0.5
 
MRVIEWER_API void notificationFrame (NotificationType type, const std::string &str)
 similar to ImGui::TextWrapped but also have styled background and notification type indicator
 
MRVIEWER_API void setTooltipIfHovered (const std::string &text)
 draw tooltip only if current item is hovered
 
MRVIEWER_API void separator (const SeparatorParams &params)
 separator line with customizations
 
MRVIEWER_API void separator (const std::string &text="", int issueCount=-1)
 
MRVIEWER_API void separator (const std::string &text, const ImVec4 &color, const std::string &issueCount)
 
MRVIEWER_API void separator (const ImGuiImage &icon, const std::string &text, const Vector2f &iconSize={ 24.f, 24.f })
 
MRVIEWER_API void separator (const std::string &iconName, const std::string &text, const Vector2f &iconSize={ 24.f, 24.f })
 
MRVIEWER_API void progressBar (float fraction, const Vector2f &size=Vector2f(-1, 0))
 
MRVIEWER_API bool beginTabBar (const char *str_id, ImGuiTabBarFlags flags=0)
 create and append items into a TabBar: see corresponding ImGui:: functions
 
MRVIEWER_API void endTabBar ()
 
MRVIEWER_API bool beginTabItem (const char *label, bool *p_open=NULL, ImGuiTabItemFlags flags=0)
 
MRVIEWER_API void endTabItem ()
 
MRVIEWER_API void alignTextToFramePadding (float padding)
 
MRVIEWER_API void alignTextToControl (float controlHeight)
 
MRVIEWER_API void alignTextToRadioButton ()
 Specialization of alignTextToFramePadding for UI::radioButton.
 
MRVIEWER_API void alignTextToCheckBox ()
 Specialization of alignTextToFramePadding for UI::checkbox.
 
MRVIEWER_API void alignTextToButton ()
 Specialization of alignTextToFramePadding for UI::button with default height.
 
MRVIEWER_API void highlightWindowArea (const ImVec2 &min={-1.0f, -1.0f}, const ImVec2 &max={ -1.0f, -1.0f })
 
MRVIEWER_API void saveCustomConfigModal (const CustomConfigModalSettings &settings)
 Draw modal window to save user configs (for example Palettes)
 

Variables

constexpr int defaultSliderFlags = ImGuiSliderFlags_AlwaysClamp
 Default flags for slider() and drag() below.
 

Function Documentation

◆ getDefaultLabelRectAllocator()

MRVIEWER_API LabelRectAllocator & MR::UI::getDefaultLabelRectAllocator ( )
nodiscard

◆ getDefaultWindowRectAllocator()

MRVIEWER_API WindowRectAllocator & MR::UI::getDefaultWindowRectAllocator ( )
nodiscard

◆ nonOverlappingLabel()

MRVIEWER_API void MR::UI::nonOverlappingLabel ( )

Draws a label on top of the viewport area. id should be a unique ID persistent across frames.