Template Class TypedInput#

Inheritance Relationships#

Base Type#

Derived Types#

Class Documentation#

template<typename InputType>
class TypedInput : public Karana::WebUI::Widget#

Widget displaying a Generic Input field (e.g., text, double, str) with input validation.

Uses a single State object to store the value, and sets type via a constructor parameter.

Subclassed by Karana::WebUI::NumericTypedInput< int64_t >, Karana::WebUI::NumericTypedInput< double >, Karana::WebUI::NumericTypedInput< InputType >

Public Functions

TypedInput(Router &router, std::string_view text, std::string_view tooltip, std::function<void(InputType)> on_change = {}, int64_t debounce_ms = 500, const Karana::Core::ks_ptr<State> &value_state = nullptr)#

Constructor for the typed input widget.

Parameters:
  • router – The connection router to use

  • text – Legend text displayed on the widget

  • tooltip – The tooltip to show on hover

  • on_change – Callback for when the widget state is modified

  • debounce_ms – Delay in milliseconds before submitting numeric edits

  • value_state – State for synchronizing the slider’s value

virtual ~TypedInput()#

TypedInput destructor.

void setValue(InputType value, bool trigger_own_callback = false)#

Set the current value of the input field; performs type checking internally and prints a warning on mismatch.

Parameters:
  • value – The value of the input field

  • trigger_own_callback – Whether to invoke the on_change callback

Protected Attributes

Karana::Core::id_t _state_callback_id#

Id of registered onChange callback.