setting&autostart&widgets (OptionField and Waveform) imp (#2286)

* test

* test

* format

* format

* tune order
This commit is contained in:
sommermorgentraum 2024-10-07 03:58:03 +08:00 committed by GitHub
parent 536d25db64
commit d4edb5f5f9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 69 additions and 22 deletions

View file

@ -680,7 +680,7 @@ class OptionsField : public Widget {
std::function<void(size_t, value_t)> on_change{};
std::function<void(void)> on_show_options{};
OptionsField(Point parent_pos, size_t length, options_t options);
OptionsField(Point parent_pos, size_t length, options_t options, bool centered = false);
options_t& options() { return options_; }
const options_t& options() const { return options_; }
@ -708,6 +708,7 @@ class OptionsField : public Widget {
const size_t length_;
options_t options_;
size_t selected_index_{0};
bool centered_{false}; // e.g.: length as screen_width/8, x position as 0, it will be centered in x axis
};
// A TextEdit is bound to a string reference and allows the string
@ -1036,4 +1037,4 @@ class OptionTabView : public View {
} /* namespace ui */
#endif /*__UI_WIDGET_H__*/
#endif /*__UI_WIDGET_H__*/