ngscopeclient v0.3
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Dialog Class Referenceabstract

Generic dialog box or other popup window. More...

#include <Dialog.h>

Inheritance diagram for Dialog:
Inheritance graph
[legend]
Collaboration diagram for Dialog:
Collaboration graph
[legend]

Public Member Functions

 Dialog (const std::string &title, const std::string &id, ImVec2 defaultSize=ImVec2(300, 100), Session *session=nullptr, MainWindow *parent=nullptr)
 
virtual bool Render ()
 Renders the dialog and handles UI events.
 
void RenderAsChild ()
 Runs the dialog's contents directly into a parent window.
 
virtual bool DoRender ()=0
 
const std::string & GetID ()
 
std::string GetTitleAndID ()
 
template<typename T >
bool renderEditableProperty (float width, const string &label, string &currentValue, T &committedValue, Unit unit, const char *tooltip, optional< ImVec4 > optcolor, bool allow7SegmentDisplay, bool explicitApply)
 Render an editable numeric value.
 

Static Public Member Functions

static bool Combo (const std::string &label, const std::vector< std::string > &items, int &selection, bool *open=nullptr)
 Displays a combo box from a vector<string>
 
static bool UnitInputWithImplicitApply (const std::string &label, std::string &currentValue, float &committedValue, Unit unit)
 Input box for a floating point value with an associated unit.
 
static bool UnitInputWithImplicitApply (const std::string &label, std::string &currentValue, double &committedValue, Unit unit)
 Input box for a double precision floating point value with an associated unit.
 
static bool UnitInputWithImplicitApply (const std::string &label, std::string &currentValue, int64_t &committedValue, Unit unit)
 Input box for an integer value with an associated unit.
 
static bool TextInputWithImplicitApply (const std::string &label, std::string &currentValue, std::string &committedValue)
 
static void Tooltip (const std::string &str, bool allowDisabled=false)
 Helper based on imgui demo for displaying tooltip text over the previously rendered widget.
 
static void HelpMarker (const std::string &str)
 
static void HelpMarker (const std::string &header, const std::vector< std::string > &bullets)
 

Protected Member Functions

bool TextInputWithExplicitApply (const std::string &label, std::string &currentValue, std::string &committedValue)
 
bool IntInputWithImplicitApply (const std::string &label, int &currentValue, int &committedValue)
 
bool UnitInputWithExplicitApply (const std::string &label, std::string &currentValue, float &committedValue, Unit unit)
 Input box for a floating point value with an associated unit and an "apply" button.
 
void renderNumericValue (const std::string &value, bool &clicked, bool &hovered, std::optional< ImVec4 > optcolor=std::nullopt, bool allow7SegmentDisplay=false, float digitHeight=0, bool clickable=true)
 Render a numeric value.
 
void renderReadOnlyProperty (float width, const std::string &label, const std::string &value, const char *tooltip=nullptr)
 Render a read-only instrument property value.
 
template<typename T >
bool renderEditableProperty (float width, const std::string &label, std::string &currentValue, T &committedValue, Unit unit, const char *tooltip=nullptr, std::optional< ImVec4 > optcolor=std::nullopt, bool allow7SegmentDisplay=false, bool explicitApply=false)
 
template<typename T >
bool renderEditablePropertyWithExplicitApply (float width, const std::string &label, std::string &currentValue, T &committedValue, Unit unit, const char *tooltip=nullptr, std::optional< ImVec4 > optcolor=std::nullopt, bool allow7SegmentDisplay=false)
 Render an editable numeric value with explicit apply (if the input value needs to explicitly be applied by clicking the apply button)
 
void renderBadge (float width, ImVec4 color, const std::string &label)
 Render a badge with text inside.
 
void RenderErrorPopup ()
 Popup message when we fail to connect.
 
void ShowErrorPopup (const std::string &title, const std::string &msg)
 Opens the error popup.
 
void Render7SegmentDigit (ImDrawList *drawList, uint8_t digit, ImVec2 size, ImVec2 position, float thikness, ImU32 colorOn, ImU32 colorOff)
 Render a single digit in 7 segment display style.
 
void Render7SegmentValue (const std::string &value, ImVec4 color, float digitHeight)
 Render a numeric value with a 7 segment display style.
 
void Render7SegmentValue (const std::string &value, ImVec4 color, float digitHeight, bool &clicked, bool &hovered, bool clickable=true)
 Render a numeric value with a 7 segment display style.
 

Protected Attributes

bool m_open
 
std::string m_id
 
std::string m_title
 
ImVec2 m_defaultSize
 
std::string m_errorPopupTitle
 
std::string m_errorPopupMessage
 
Session * m_session
 optional reference to session
 
MainWindow * m_parent
 optional reference to parent MainWindow
 
ImGuiID m_editedItemId = 0
 Id of the item currently beeing edited.
 
ImGuiID m_lastEditedItemId = 0
 Id of the last edited item.
 

Detailed Description

Generic dialog box or other popup window.

Member Function Documentation

◆ Combo()

bool Dialog::Combo ( const std::string &  label,
const std::vector< std::string > &  items,
int &  selection,
bool *  open = nullptr 
)
static

Displays a combo box from a vector<string>

Parameters
openoptional boolean indicating the dropdown is open

◆ DoRender()

virtual bool Dialog::DoRender ( )
pure virtual

◆ Render()

bool Dialog::Render ( )
virtual

Renders the dialog and handles UI events.

Returns
True if we should continue showing the dialog False if it's been closed

Reimplemented in FilterGraphEditor, FilterGraphErrorWindow, FilterPropertiesDialog, BERTInputChannelDialog, ProtocolAnalyzerDialog, and TutorialWizard.

◆ Render7SegmentDigit()

void Dialog::Render7SegmentDigit ( ImDrawList *  drawList,
uint8_t  digit,
ImVec2  size,
ImVec2  position,
float  thickness,
ImU32  colorOn,
ImU32  colorOff 
)
protected

Render a single digit in 7 segment display style.

Parameters
drawListthe drawList used for rendering
digitthe digit to render
sizethe size of the digit
positionthe position of the digit
thicknessthe thickness of a segment
colorOnthe color for an "on" segment
colorOffthe color for an "off" segment

◆ Render7SegmentValue() [1/2]

void Dialog::Render7SegmentValue ( const std::string &  value,
ImVec4  color,
float  digitHeight 
)
protected

Render a numeric value with a 7 segment display style.

Parameters
valuethe string representation of the value to display (may include the unit)
colorthe color to use
digitHeightthe height of a digit

◆ Render7SegmentValue() [2/2]

void Dialog::Render7SegmentValue ( const std::string &  value,
ImVec4  color,
float  digitHeight,
bool &  clicked,
bool &  hovered,
bool  clickable = true 
)
protected

Render a numeric value with a 7 segment display style.

Parameters
valuethe string representation of the value to display (may include the unit)
colorthe color to use
digitHeightthe height of a digit
clickedoutput value for clicked state
hoveredoutput value for hovered state
clickabletrue (default) if the displayed value should be clickable

◆ renderBadge()

void Dialog::renderBadge ( float  width,
ImVec4  color,
const std::string &  label 
)
protected

Render a badge with text inside.

Parameters
widththe width of the badge
colorthe badge color
labelthe text of the badge

◆ renderEditableProperty()

template<typename T >
bool Dialog::renderEditableProperty ( float  width,
const string &  label,
string &  currentValue,
T &  committedValue,
Unit  unit,
const char *  tooltip,
optional< ImVec4 >  optcolor,
bool  allow7SegmentDisplay,
bool  explicitApply 
)

Render an editable numeric value.

Parameters
widththe width of the input value (if <0 will be ignored, if =0 will default to 6*ImGui::GetStyle())
labelthe value label (used as a label for the TextInput)
currentValuethe string representation of the current value
comittedValuethe last comitted typed (float, double or int64_t) value
unitthe Unit of the value
tooltipif not null, will add the provided text as an help marker (defaults to nullptr)
optcolorthe optional color to use (defaults to text color)
clickedoutput value for clicked state
hoveredoutput value for hovered state
allow7SegmentDisplay(defaults to false) true if the value can be displayed in 7 segment format
explicitApply(defaults to false) true if the input value needs to explicitly be applied (by clicking the apply button)
Returns
true if the value has changed

◆ renderEditablePropertyWithExplicitApply()

template<typename T >
template bool Dialog::renderEditablePropertyWithExplicitApply< int64_t > ( float  width,
const std::string &  label,
std::string &  currentValue,
T &  committedValue,
Unit  unit,
const char *  tooltip = nullptr,
std::optional< ImVec4 >  optcolor = std::nullopt,
bool  allow7SegmentDisplay = false 
)
protected

Render an editable numeric value with explicit apply (if the input value needs to explicitly be applied by clicking the apply button)

Parameters
widththe width of the input value (if <0 will be ignored, if =0 will default to 6*ImGui::GetStyle())
labelthe value label (used as a label for the TextInput)
currentValuethe string representation of the current value
comittedValuethe last comitted typed (float, double or int64_t) value
unitthe Unit of the value
tooltipif not null, will add the provided text as an help marker (defaults to nullptr)
optcolorthe optional color to use (defaults to text color)
clickedoutput value for clicked state
hoveredoutput value for hovered state
allow7SegmentDisplay(defaults to false) true if the value can be displayed in 7 segment format
Returns
true if the value has changed

◆ renderNumericValue()

void Dialog::renderNumericValue ( const std::string &  value,
bool &  clicked,
bool &  hovered,
std::optional< ImVec4 >  optcolor = std::nullopt,
bool  allow7SegmentDisplay = false,
float  digitHeight = 0,
bool  clickable = true 
)
protected

Render a numeric value.

Parameters
valuethe string representation of the value to display (may include the unit)
clickedoutput value for clicked state
hoveredoutput value for hovered state
optcolorthe optional color to use (defaults to text color)
allow7SegmentDisplay(defaults to false) true if the value can be displayed in 7 segment format
digitHeightthe height of a digit (if 0 (defualt), will use ImGui::GetFontSize())
clickabletrue (default) if the displayed value should be clickable

◆ renderReadOnlyProperty()

void Dialog::renderReadOnlyProperty ( float  width,
const std::string &  label,
const std::string &  value,
const char *  tooltip = nullptr 
)
protected

Render a read-only instrument property value.

Parameters
labelthe value label (used as a label for the property)
currentValuethe string representation of the current value
tooltipif not null, will add the provided text as an help marker (defaults to nullptr)

◆ UnitInputWithExplicitApply()

bool Dialog::UnitInputWithExplicitApply ( const std::string &  label,
std::string &  currentValue,
float &  committedValue,
Unit  unit 
)
protected

Input box for a floating point value with an associated unit and an "apply" button.

Parameters
labelText label
currentValueCurrent text box content
committedValueMost recently applied value
unitThe unit for the input
Returns
True the "apply" button is pressed

◆ UnitInputWithImplicitApply() [1/3]

bool Dialog::UnitInputWithImplicitApply ( const std::string &  label,
std::string &  currentValue,
double &  committedValue,
Unit  unit 
)
static

Input box for a double precision floating point value with an associated unit.

Parameters
labelText label
currentValueCurrent text box content
committedValueMost recently applied value
unitThe unit for the input
Returns
True when focus is lost or user presses enter

◆ UnitInputWithImplicitApply() [2/3]

bool Dialog::UnitInputWithImplicitApply ( const std::string &  label,
std::string &  currentValue,
float &  committedValue,
Unit  unit 
)
static

Input box for a floating point value with an associated unit.

Parameters
labelText label
currentValueCurrent text box content
committedValueMost recently applied value
unitThe unit for the input
Returns
True when focus is lost or user presses enter

◆ UnitInputWithImplicitApply() [3/3]

bool Dialog::UnitInputWithImplicitApply ( const std::string &  label,
std::string &  currentValue,
int64_t &  committedValue,
Unit  unit 
)
static

Input box for an integer value with an associated unit.

Parameters
labelText label
currentValueCurrent text box content
committedValueMost recently applied value
unitThe unit for the input
Returns
True when focus is lost or user presses enter

The documentation for this class was generated from the following files: