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

void nonOverlappingLabel ()
WindowRectAllocatorgetDefaultWindowRectAllocator ()
LabelRectAllocatorgetDefaultLabelRectAllocator ()
void saveChangesPopup (const char *str_id, const SaveChangesPopupSettings &settings={})
float scale ()
 Returns the global UI scale. Use this instead of passing around the scale in parameters.
bool isItemActive (const char *name)
 Checks if the item with this name in the current window is active.
std::unique_ptr< ImGuiImage > & getTexture (TextureType type)
 get texture by type
void init ()
 init internal parameters
ImGuiKey getImGuiModPrimaryCtrl ()
 returns imgui modifier Id based on current environment
const char * getImGuiPrimaryCtrlName ()
 returns "Ctrl" by default or "Command" if ImGui has changed it internally for macos
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
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)
bool buttonEx (const char *label, const Vector2f &size=Vector2f(0, 0), const ButtonCustomizationParams &customParams={})
 draw gradient button, which can be customized
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)
bool buttonCommonSize (const char *label, const Vector2f &size=Vector2f(0, 0), ImGuiKey key=ImGuiKey_None)
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
void drawPoltHorizontalAxis (const PlotAxis &plotAxis)
 draw dash with text along the horizontal axis
void drawPoltVerticalAxis (const PlotAxis &plotAxis)
 draw dash with text along the vertical axis
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
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)
bool toggle (const char *label, bool *value)
 draws checkbox-like toggle (enabled/disabled states)(O=)/(=O)
bool checkbox (const char *label, bool *value)
 draw gradient checkbox
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.
bool checkboxValid (const char *label, bool *value, bool valid)
 If valid is false checkbox is disabled. Same as checkboxOrFixedValue( ..., valid ? nullopt : false ).
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.
bool checkboxOrModifier (const char *label, CheckboxOrModifierState &value, int modifiers, int respectedModifiers=-1, std::optional< bool > valueOverride={})
bool radioButton (const char *label, int *value, int valButton)
 draw gradient radio button
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.
bool radioButtonOrModifier (const char *label, RadioButtonOrModifierState &value, int valButton, int modifiers, int respectedModifiers=-1, std::optional< int > valueOverride={})
bool colorEdit4 (const char *label, Vector4f &color, ImGuiColorEditFlags flags=ImGuiColorEditFlags_None)
 draw gradient color edit 4
bool colorEdit4 (const char *label, Color &color, ImGuiColorEditFlags flags=ImGuiColorEditFlags_None)
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
bool beginCombo (const char *label, const std::string &text, bool enableTestEngine=true)
void endCombo ()
 Only call this if beginCombo() returned true!
bool comboElem (const char *label, bool selected)
 A replacement for ImGui::Selectable() that should be used with beginCombo() and endCombo() to be able to interact with the combo-box from the UI Test Engine.
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().
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.
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().
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.
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).
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)
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
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)
const std::pair< const char *, ImU32 > & notificationChar (NotificationType type)
 returns icons font character for given notification type, and its color
void mouseControlHint (ImGuiMouseButton btn, const std::string &hint)
 draws hint with corresponding mouse btn icon
void transparentText (const char *fmt,...)
 similar to ImGui::Text but use current text color with alpha channel = 0.5
void transparentTextWrapped (const char *fmt,...)
 similar to ImGui::TextWrapped but use current text color with alpha channel = 0.5
void notificationFrame (NotificationType type, const std::string &str)
 similar to ImGui::TextWrapped but also have styled background and notification type indicator
void setTooltipIfHovered (const std::string &text)
 draw tooltip only if current item is hovered
void separator (const SeparatorParams &params)
 separator line with customizations
void separator (const std::string &text="", int issueCount=-1)
void separator (const std::string &text, const ImVec4 &color, const std::string &issueCount)
void separator (const ImGuiImage &icon, const std::string &text, const Vector2f &iconSize={ 24.f, 24.f })
void separator (const std::string &iconName, const std::string &text, const Vector2f &iconSize={ 24.f, 24.f })
void progressBar (float fraction, const Vector2f &size=Vector2f(-1, 0))
bool beginTabBar (const char *str_id, ImGuiTabBarFlags flags=0)
 create and append items into a TabBar: see corresponding ImGui:: functions
void endTabBar ()
bool beginTabItem (const char *label, bool *p_open=NULL, ImGuiTabItemFlags flags=0)
void endTabItem ()
void alignTextToFramePadding (float padding)
void alignTextToControl (float controlHeight)
void alignTextToRadioButton ()
 Specialization of alignTextToFramePadding for UI::radioButton.
void alignTextToCheckBox ()
 Specialization of alignTextToFramePadding for UI::checkbox.
void alignTextToButton ()
 Specialization of alignTextToFramePadding for UI::button with default height.
void highlightWindowArea (const ImVec2 &min={-1.0f, -1.0f}, const ImVec2 &max={ -1.0f, -1.0f })
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()

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

◆ getDefaultWindowRectAllocator()

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

◆ nonOverlappingLabel()

void MR::UI::nonOverlappingLabel ( )

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