11 #include <RADUi/RADUi.h>
17 #include <string_view>
37 const std::string&
text()
const;
62 bool checkable_ =
false;
63 bool checked_ =
false;
100 const std::vector<Menu>&
menus()
const;
119 std::vector<Menu> menus_;
120 std::optional<size_t> activeMenuIndex_;
135 const std::string&
at(
size_t index)
const;
142 void set(
size_t index, std::string value);
149 std::vector<std::string> values_;
164 const std::string&
text()
const;
176 bool enabled_ =
true;
194 bool checked_ =
false;
218 double minimum_ = 0.0;
219 double maximum_ = 1.0;
231 const std::string&
text()
const;
245 std::string placeholder_;
246 bool readOnly_ =
false;
257 const std::string&
text()
const;
275 std::string fileName_;
276 bool modified_ =
false;
287 const std::string&
text()
const;
339 void refreshDerived();
342 std::string displayText_;
343 std::string lineNumberText_ =
"1";
344 size_t lineCount_ = 1;
345 bool showLineNumbers_ =
true;
346 bool showWhitespace_ =
false;
347 double scrollY_ = 0.0;
348 double viewportHeight_ = 0.0;
366 std::optional<size_t> currentIndex_;
381 std::string
value(
size_t row,
size_t column)
const;
393 std::vector<std::vector<std::string>> rows_;
412 const std::vector<TreeNode>&
roots()
const;
419 std::vector<TreeNode> roots_;
534 const std::string&
text()
const;
577 const std::vector<std::string>&
filters()
const;
591 std::string directory_;
592 std::string selectedPath_;
593 std::vector<std::string> filters_;
607 const std::vector<ToolButton>&
buttons()
const;
616 std::vector<ToolButton> buttons_;
627 const std::vector<StatusItem>&
items()
const;
633 std::string
text(std::string
id)
const;
636 std::vector<StatusItem> items_;
649 const std::vector<PreferenceField>&
fields()
const;
655 std::string
value(
const std::string&
id)
const;
657 std::map<std::string, std::string>
values()
const;
660 std::vector<PreferenceField> fields_;
685 const std::vector<LayoutItem>&
items()
const;
692 std::vector<LayoutItem> items_;
#define RAD_EVENT(Name, Signature)
Declares a typed RADCore event; example: RAD_EVENT(done, (int)).
Definition: RADCore.h:97
#define RADEvents
Marks a public event declaration block in RADObject-derived classes.
Definition: RADCore.h:75
Base class for event receivers, senders, and thread-affinity aware objects.
Definition: RADCore.h:963
Backend-neutral command/action model for buttons, menus, and toolbars.
Definition: RADWidgets.h:23
Action(std::string text)
Creates an enabled action with display text.
void setEnabled(bool enabled)
Enables or disables the action.
void trigger()
Emits triggered when enabled.
void setText(std::string text)
Updates the action display text.
RADCore::Event< void() > changed
Raised when text, enabled state, checkable state, or checked state changes.
Definition: RADWidgets.h:27
bool isChecked() const
Returns true when a checkable action is checked.
bool isEnabled() const
Returns true when the action can be triggered.
void setCheckable(bool checkable)
Enables or disables checkable behavior.
RADCore::Event< void() > triggered
Raised when trigger() is called on an enabled action.
Definition: RADWidgets.h:29
void setChecked(bool checked)
Sets the checked state for checkable actions.
const std::string & text() const
Returns the action display text.
Action()=default
Creates an empty enabled action.
bool isCheckable() const
Returns true when the action has a checked state.
Generic dialog state model.
Definition: RADWidgets.h:491
void setTitle(std::string title)
Sets dialog title.
RADCore::Event< void(RADUi::DialogResult) > finished
Raised when the dialog accepts or rejects.
Definition: RADWidgets.h:497
void accept()
Accepts and closes the dialog.
void reject()
Rejects and closes the dialog.
RADCore::Event< void() > changed
Raised when title/open/result changes.
Definition: RADWidgets.h:495
bool isOpen() const
Returns true when dialog should be visible.
void open()
Opens the dialog and resets result to None.
DialogResult result() const
Returns current dialog result.
const std::string & title() const
Returns dialog title.
File picker state model with accept/reject events.
Definition: RADWidgets.h:554
void setSelectedPath(std::string path)
Sets selected path.
void open()
Opens the picker.
RADCore::Event< void() > rejected
Raised when rejected/cancelled.
Definition: RADWidgets.h:562
RADCore::Event< void() > changed
Raised when mode, directory, selection, filters, or open state changes.
Definition: RADWidgets.h:558
void setMode(FilePickerMode mode)
Sets picker mode.
void accept()
Accepts selectedPath and closes the picker.
bool isOpen() const
Returns true when picker should be visible.
void setDirectory(std::string directory)
Sets current directory.
void setFilters(std::vector< std::string > filters)
Sets active file filters.
FilePickerMode mode() const
Returns picker mode.
RADCore::Event< void(std::string) > accepted
Raised with selectedPath when accepted.
Definition: RADWidgets.h:560
const std::string & directory() const
Returns current directory.
const std::vector< std::string > & filters() const
Returns active file filters.
void reject()
Rejects and closes the picker.
const std::string & selectedPath() const
Returns selected path.
Simple grid layout descriptor model.
Definition: RADWidgets.h:678
const std::vector< LayoutItem > & items() const
Returns layout items.
RADCore::Event< void() > changed
Raised when layout items change.
Definition: RADWidgets.h:682
void setItems(std::vector< LayoutItem > items)
Replaces layout items.
void clear()
Removes all layout items.
Message box state model.
Definition: RADWidgets.h:521
MessageBoxIcon icon() const
Returns message icon category.
void reject()
Rejects and closes the message box.
void open()
Opens the message box.
RADCore::Event< void() > changed
Raised when message box configuration or open state changes.
Definition: RADWidgets.h:525
RADCore::Event< void(RADUi::DialogResult) > finished
Raised when the message box accepts or rejects.
Definition: RADWidgets.h:527
void configure(std::string title, std::string text, MessageBoxIcon icon=MessageBoxIcon::Information)
Sets title, text, and icon in one update.
const std::string & text() const
Returns message body text.
const std::string & title() const
Returns message box title.
void accept()
Accepts and closes the message box.
bool isOpen() const
Returns true when the message box should be visible.
Preferences/settings form model.
Definition: RADWidgets.h:640
void setFields(std::vector< PreferenceField > fields)
Replaces field descriptors.
std::map< std::string, std::string > values() const
Returns all values keyed by field id.
const std::vector< PreferenceField > & fields() const
Returns field descriptors.
std::string value(const std::string &id) const
Returns one field value by id or empty string.
RADCore::Event< void(std::string, std::string) > valueChanged
Raised with field id and value when a value changes.
Definition: RADWidgets.h:646
RADCore::Event< void() > changed
Raised when fields or values change.
Definition: RADWidgets.h:644
bool setValue(const std::string &id, std::string value)
Sets one field value by id.
Current-selection model for list/table/tree style views.
Definition: RADWidgets.h:352
void setCurrentIndex(std::optional< size_t > index)
Sets selected index or clears selection with nullopt.
RADCore::Event< void() > changed
Raised when current index changes.
Definition: RADWidgets.h:356
std::optional< size_t > currentIndex() const
Returns selected index, if any.
void clear()
Clears selection.
Numeric slider model with minimum, maximum, and current value.
Definition: RADWidgets.h:198
void setRange(double minimum, double maximum)
Updates range and clamps value as needed.
double maximum() const
Returns maximum accepted value.
double minimum() const
Returns minimum accepted value.
double value() const
Returns current value.
SliderModel(double minimum=0.0, double maximum=1.0, double value=0.0)
Creates a slider with range and initial value.
RADCore::Event< void(double) > changed
Raised with the current value when it changes.
Definition: RADWidgets.h:202
void setValue(double value)
Sets current value, clamped to range.
Status bar text item model.
Definition: RADWidgets.h:620
RADCore::Event< void() > changed
Raised when items or item text changes.
Definition: RADWidgets.h:624
const std::vector< StatusItem > & items() const
Returns status items.
void setItems(std::vector< StatusItem > items)
Replaces status items.
std::string text(std::string id) const
Returns text for item id or empty string.
void setText(std::string id, std::string text)
Sets text for item id, creating no new item when id is missing.
Simple string-list state model for list views and combo boxes.
Definition: RADWidgets.h:124
size_t rowCount() const
Returns the number of list rows.
void clear()
Removes all values and emits changed.
void set(size_t index, std::string value)
Replaces value at index and emits changed.
std::vector< std::string > values() const
Returns a copy of all values.
void append(std::string value)
Appends one value and emits changed.
RADCore::Event< void() > changed
Raised when list contents change.
Definition: RADWidgets.h:128
bool empty() const
Returns true when no values are stored.
void remove(size_t index)
Removes value at index and emits changed.
const std::string & at(size_t index) const
Returns value at index.
Simple string table model for grid/table UI components.
Definition: RADWidgets.h:370
size_t columnCount() const
Returns number of columns.
void setValue(size_t row, size_t column, std::string value)
Sets one cell value.
void appendRow(std::vector< std::string > row)
Appends a row, padding/truncating to column count as needed.
std::string value(size_t row, size_t column) const
Returns a cell value or empty string when out of range.
void clear()
Removes all rows and columns.
RADCore::Event< void() > changed
Raised when row, column, or cell data changes.
Definition: RADWidgets.h:374
void setColumnCount(size_t columns)
Sets the table column count.
size_t rowCount() const
Returns number of rows.
Text document model with file load/save and modified state.
Definition: RADWidgets.h:250
const std::string & fileName() const
Returns associated file path.
bool save()
Saves to the current fileName.
void clear()
Clears text and file state.
bool loadFromFile(const std::string &fileName)
Loads text from fileName.
bool saveAs(const std::string &fileName)
Saves to fileName and updates the current file.
void setText(std::string text)
Replaces document text and marks modified.
RADCore::Event< void() > changed
Raised when text, filename, or modified state changes.
Definition: RADWidgets.h:254
bool isModified() const
Returns true when text changed since load/save.
const std::string & text() const
Returns document text.
Multi-line text editor model with derived display text and scrolling helpers.
Definition: RADWidgets.h:280
static std::string decodeVisibleWhitespace(std::string_view text)
Converts visible whitespace display symbols back to raw text.
bool showWhitespace() const
Returns true when whitespace markers should be shown.
void setScrollY(double scrollY)
Sets model scroll offset in logical pixels.
const std::string & displayText() const
Returns text transformed for display settings.
size_t lineCount() const
Returns current line count.
const std::string & text() const
Returns raw editor text.
const std::string & lineNumberText() const
Returns newline-separated line-number text.
double scrollY() const
Returns model scroll offset in logical pixels.
void scrollToLastLine(double lineHeight=19.0, double padding=12.0)
Scrolls so the last line is visible.
void setShowWhitespace(bool show)
Enables or disables visible whitespace display.
static std::string makeWhitespaceVisible(std::string_view text)
Converts tabs/spaces/newlines into visible display symbols.
double viewportHeight() const
Returns the configured viewport height.
static size_t countLines(std::string_view text)
Counts text lines, treating empty text as one line.
static std::string makeLineNumberText(size_t lineCount)
Builds newline-separated line-number text for lineCount lines.
size_t insertText(size_t byteOffset, std::string_view text)
Inserts text at a byte offset and returns the new offset.
void setShowLineNumbers(bool show)
Enables or disables line-number display.
bool showLineNumbers() const
Returns true when line numbers should be displayed.
void setSlintViewportY(double viewportY)
Sets scroll offset from a Slint viewport position.
void setViewportHeight(double viewportHeight)
Sets the visible viewport height used by ensureLineVisible().
void setText(std::string text)
Replaces raw editor text.
RADCore::Event< void() > changed
Raised when editor text, display settings, or scroll state changes.
Definition: RADWidgets.h:284
void setEditorText(std::string text)
Replaces editor text after decoding visible whitespace when needed.
void ensureLineVisible(size_t line, double lineHeight=19.0, double padding=12.0)
Scrolls as needed so zero-based line is visible.
double slintViewportY() const
Returns Slint-compatible viewport offset.
Single-line text input state model.
Definition: RADWidgets.h:224
const std::string & placeholder() const
Returns placeholder text.
void setPlaceholder(std::string placeholder)
Updates placeholder text.
void setText(std::string text)
Updates input text.
bool isReadOnly() const
Returns true when user editing should be disabled.
void setReadOnly(bool readOnly)
Sets read-only state.
const std::string & text() const
Returns input text.
RADCore::Event< void() > changed
Raised when text, placeholder, or read-only state changes.
Definition: RADWidgets.h:228
Boolean toggle/check model.
Definition: RADWidgets.h:180
void setChecked(bool checked)
Sets checked state.
void toggle()
Inverts checked state.
RADCore::Event< void() > changed
Raised when checked state changes.
Definition: RADWidgets.h:184
bool isChecked() const
Returns current checked state.
Tree-view state model.
Definition: RADWidgets.h:405
void setRoots(std::vector< TreeNode > roots)
Replaces root nodes.
void clear()
Removes all root nodes.
const std::vector< TreeNode > & roots() const
Returns root nodes.
RADCore::Event< void() > changed
Raised when roots change.
Definition: RADWidgets.h:409
Definition: RADAppKit.h:20
DialogResult
Result state for dialogs and message boxes.
Definition: RADWidgets.h:423
@ Accepted
Dialog was accepted.
@ None
Dialog has not finished.
@ Rejected
Dialog was rejected/cancelled.
MessageBoxIcon
Message box icon category.
Definition: RADWidgets.h:433
@ Warning
Warning message.
@ Information
Informational message.
@ Question
Question/confirmation message.
FilePickerMode
File picker operation mode.
Definition: RADWidgets.h:445
@ OpenFile
Select an existing file to open.
@ SelectDirectory
Select a directory.
@ SaveFile
Select or enter a file to save.
Grid layout item descriptor.
Definition: RADWidgets.h:664
std::string id
Stable id for the item.
Definition: RADWidgets.h:666
int row
Starting grid row.
Definition: RADWidgets.h:668
int column
Starting grid column.
Definition: RADWidgets.h:670
int rowSpan
Number of rows occupied.
Definition: RADWidgets.h:672
int columnSpan
Number of columns occupied.
Definition: RADWidgets.h:674
Settings/preferences field descriptor.
Definition: RADWidgets.h:477
std::vector< std::string > options
Optional list of allowed choices.
Definition: RADWidgets.h:485
std::string value
Current serialized value.
Definition: RADWidgets.h:483
std::string id
Stable id for updates.
Definition: RADWidgets.h:479
bool isToggle
Whether the field should be presented as a toggle.
Definition: RADWidgets.h:487
std::string label
Display label.
Definition: RADWidgets.h:481
Status bar item descriptor.
Definition: RADWidgets.h:469
std::string text
Display text.
Definition: RADWidgets.h:473
std::string id
Stable id for updates.
Definition: RADWidgets.h:471
Tree node with display text and recursive children.
Definition: RADWidgets.h:397
std::string text
Node display text.
Definition: RADWidgets.h:399
std::vector< TreeNode > children
Child nodes.
Definition: RADWidgets.h:401