Phase 2 widget setters (C++): Button default/cancel/kind/modal-result/layout with default ring and kind text; Entry alignment/char-case/numbers-only/hide-selection/auto-select with live filtering and max-length truncation; Label transparent/show-accel-char/focus-control with & stripping; CheckBox allow-grayed/alignment/value-checked/unchecked with right-box draw; RadioButton group-id; ComboBox style/drop-down-count/width/sorted/read-only/max-length/auto-complete/char-case; ListBox sorted; Scale show-sel-range/sel-start/sel-end with range draw; TextView/Memo max-length/alignment/scroll-bars/want-tabs/want-returns/hide-selection with Memo editable/cursor-visible; CheckListBox set_items/set_checked_items/selected-row/sorted; 35 new IWidget virtuals via SFINAE

This commit is contained in:
cnmcdee committed 2026-11-30 09:43:25 +00:00
1 parent c4057ced85
commit 5c10871d15
13 files changed
+2403 -26

No files matched your search

+421
View File
@@ -1247,6 +1247,42 @@ struct IWidget {
virtual bool set_direction(int) { return false; }
virtual bool set_cursor_visible(bool) { return false; }
virtual bool set_multi_select(bool) { return false; }
// Phase 2: per-widget custom properties (proposal §2.1–§2.10) + CheckListBox.
virtual bool set_default(bool) { return false; }
virtual bool set_cancel(bool) { return false; }
virtual bool set_modal_result(int) { return false; }
virtual bool set_kind(int) { return false; }
virtual bool set_layout(int) { return false; }
virtual bool set_alignment(int) { return false; }
virtual bool set_char_case(int) { return false; }
virtual bool set_numbers_only(bool) { return false; }
virtual bool set_hide_selection(bool) { return false; }
virtual bool set_auto_select(bool) { return false; }
virtual bool set_transparent(bool) { return false; }
virtual bool set_show_accel_char(bool) { return false; }
virtual bool set_focus_control(const std::string&) { return false; }
virtual bool set_allow_grayed(bool) { return false; }
virtual bool set_value_checked(const std::string&) { return false; }
virtual bool set_value_unchecked(const std::string&) { return false; }
virtual bool set_group_id(int) { return false; }
virtual bool set_style(int) { return false; }
virtual bool set_drop_down_count(int) { return false; }
virtual bool set_drop_down_width(int) { return false; }
virtual bool set_sorted(bool) { return false; }
virtual bool set_read_only(bool) { return false; }
virtual bool set_auto_complete(bool) { return false; }
virtual bool set_selected_row(int) { return false; }
virtual bool set_row_height(int) { return false; }
virtual bool set_page_step(double) { return false; }
virtual bool set_marks(const std::vector<double>&) { return false; }
virtual bool set_show_sel_range(bool) { return false; }
virtual bool set_sel_start(double) { return false; }
virtual bool set_sel_end(double) { return false; }
virtual bool set_scroll_bars(int) { return false; }
virtual bool set_want_tabs(bool) { return false; }
virtual bool set_want_returns(bool) { return false; }
virtual bool set_yalign(double) { return false; }
virtual bool set_checked_items(const std::string&) { return false; }
virtual std::string get_text() { return ""; }
// Phase 2, Flag 10: raw pointer/keyboard callbacks, set by the
// generator on the Holder when the corresponding Lazarus event
@@ -1408,6 +1444,146 @@ template <typename, typename = void>
struct has_get_text : std::false_type {};
template <typename T>
struct has_get_text<T, std::void_t<decltype(std::declval<T&>().get_text())>> : std::bool_constant<std::is_convertible_v<decltype(std::declval<T&>().get_text()), std::string>> {};
template <typename, typename = void>
struct has_set_default : std::false_type {};
template <typename T>
struct has_set_default<T, std::void_t<decltype(static_cast<void (T::*)(bool)>(&T::set_default))>> : std::true_type {};
template <typename, typename = void>
struct has_set_cancel : std::false_type {};
template <typename T>
struct has_set_cancel<T, std::void_t<decltype(static_cast<void (T::*)(bool)>(&T::set_cancel))>> : std::true_type {};
template <typename, typename = void>
struct has_set_modal_result : std::false_type {};
template <typename T>
struct has_set_modal_result<T, std::void_t<decltype(static_cast<void (T::*)(int)>(&T::set_modal_result))>> : std::true_type {};
template <typename, typename = void>
struct has_set_kind : std::false_type {};
template <typename T>
struct has_set_kind<T, std::void_t<decltype(static_cast<void (T::*)(int)>(&T::set_kind))>> : std::true_type {};
template <typename, typename = void>
struct has_set_layout : std::false_type {};
template <typename T>
struct has_set_layout<T, std::void_t<decltype(static_cast<void (T::*)(int)>(&T::set_layout))>> : std::true_type {};
template <typename, typename = void>
struct has_set_alignment : std::false_type {};
template <typename T>
struct has_set_alignment<T, std::void_t<decltype(static_cast<void (T::*)(int)>(&T::set_alignment))>> : std::true_type {};
template <typename, typename = void>
struct has_set_char_case : std::false_type {};
template <typename T>
struct has_set_char_case<T, std::void_t<decltype(static_cast<void (T::*)(int)>(&T::set_char_case))>> : std::true_type {};
template <typename, typename = void>
struct has_set_numbers_only : std::false_type {};
template <typename T>
struct has_set_numbers_only<T, std::void_t<decltype(static_cast<void (T::*)(bool)>(&T::set_numbers_only))>> : std::true_type {};
template <typename, typename = void>
struct has_set_hide_selection : std::false_type {};
template <typename T>
struct has_set_hide_selection<T, std::void_t<decltype(static_cast<void (T::*)(bool)>(&T::set_hide_selection))>> : std::true_type {};
template <typename, typename = void>
struct has_set_auto_select : std::false_type {};
template <typename T>
struct has_set_auto_select<T, std::void_t<decltype(static_cast<void (T::*)(bool)>(&T::set_auto_select))>> : std::true_type {};
template <typename, typename = void>
struct has_set_transparent : std::false_type {};
template <typename T>
struct has_set_transparent<T, std::void_t<decltype(static_cast<void (T::*)(bool)>(&T::set_transparent))>> : std::true_type {};
template <typename, typename = void>
struct has_set_show_accel_char : std::false_type {};
template <typename T>
struct has_set_show_accel_char<T, std::void_t<decltype(static_cast<void (T::*)(bool)>(&T::set_show_accel_char))>> : std::true_type {};
template <typename, typename = void>
struct has_set_focus_control : std::false_type {};
template <typename T>
struct has_set_focus_control<T, std::void_t<decltype(static_cast<void (T::*)(std::string)>(&T::set_focus_control))>> : std::true_type {};
template <typename, typename = void>
struct has_set_allow_grayed : std::false_type {};
template <typename T>
struct has_set_allow_grayed<T, std::void_t<decltype(static_cast<void (T::*)(bool)>(&T::set_allow_grayed))>> : std::true_type {};
template <typename, typename = void>
struct has_set_value_checked : std::false_type {};
template <typename T>
struct has_set_value_checked<T, std::void_t<decltype(static_cast<void (T::*)(std::string)>(&T::set_value_checked))>> : std::true_type {};
template <typename, typename = void>
struct has_set_value_unchecked : std::false_type {};
template <typename T>
struct has_set_value_unchecked<T, std::void_t<decltype(static_cast<void (T::*)(std::string)>(&T::set_value_unchecked))>> : std::true_type {};
template <typename, typename = void>
struct has_set_group_id : std::false_type {};
template <typename T>
struct has_set_group_id<T, std::void_t<decltype(static_cast<void (T::*)(int)>(&T::set_group_id))>> : std::true_type {};
template <typename, typename = void>
struct has_set_style : std::false_type {};
template <typename T>
struct has_set_style<T, std::void_t<decltype(static_cast<void (T::*)(int)>(&T::set_style))>> : std::true_type {};
template <typename, typename = void>
struct has_set_drop_down_count : std::false_type {};
template <typename T>
struct has_set_drop_down_count<T, std::void_t<decltype(static_cast<void (T::*)(int)>(&T::set_drop_down_count))>> : std::true_type {};
template <typename, typename = void>
struct has_set_drop_down_width : std::false_type {};
template <typename T>
struct has_set_drop_down_width<T, std::void_t<decltype(static_cast<void (T::*)(int)>(&T::set_drop_down_width))>> : std::true_type {};
template <typename, typename = void>
struct has_set_sorted : std::false_type {};
template <typename T>
struct has_set_sorted<T, std::void_t<decltype(static_cast<void (T::*)(bool)>(&T::set_sorted))>> : std::true_type {};
template <typename, typename = void>
struct has_set_read_only : std::false_type {};
template <typename T>
struct has_set_read_only<T, std::void_t<decltype(static_cast<void (T::*)(bool)>(&T::set_read_only))>> : std::true_type {};
template <typename, typename = void>
struct has_set_auto_complete : std::false_type {};
template <typename T>
struct has_set_auto_complete<T, std::void_t<decltype(static_cast<void (T::*)(bool)>(&T::set_auto_complete))>> : std::true_type {};
template <typename, typename = void>
struct has_set_selected_row : std::false_type {};
template <typename T>
struct has_set_selected_row<T, std::void_t<decltype(static_cast<void (T::*)(int)>(&T::set_selected_row))>> : std::true_type {};
template <typename, typename = void>
struct has_set_row_height : std::false_type {};
template <typename T>
struct has_set_row_height<T, std::void_t<decltype(static_cast<void (T::*)(int)>(&T::set_row_height))>> : std::true_type {};
template <typename, typename = void>
struct has_set_page_step : std::false_type {};
template <typename T>
struct has_set_page_step<T, std::void_t<decltype(static_cast<void (T::*)(double)>(&T::set_page_step))>> : std::true_type {};
template <typename, typename = void>
struct has_set_marks : std::false_type {};
template <typename T>
struct has_set_marks<T, std::void_t<decltype(static_cast<void (T::*)(const std::vector<double>&)>(&T::set_marks))>> : std::true_type {};
template <typename, typename = void>
struct has_set_show_sel_range : std::false_type {};
template <typename T>
struct has_set_show_sel_range<T, std::void_t<decltype(static_cast<void (T::*)(bool)>(&T::set_show_sel_range))>> : std::true_type {};
template <typename, typename = void>
struct has_set_sel_start : std::false_type {};
template <typename T>
struct has_set_sel_start<T, std::void_t<decltype(static_cast<void (T::*)(double)>(&T::set_sel_start))>> : std::true_type {};
template <typename, typename = void>
struct has_set_sel_end : std::false_type {};
template <typename T>
struct has_set_sel_end<T, std::void_t<decltype(static_cast<void (T::*)(double)>(&T::set_sel_end))>> : std::true_type {};
template <typename, typename = void>
struct has_set_scroll_bars : std::false_type {};
template <typename T>
struct has_set_scroll_bars<T, std::void_t<decltype(static_cast<void (T::*)(int)>(&T::set_scroll_bars))>> : std::true_type {};
template <typename, typename = void>
struct has_set_want_tabs : std::false_type {};
template <typename T>
struct has_set_want_tabs<T, std::void_t<decltype(static_cast<void (T::*)(bool)>(&T::set_want_tabs))>> : std::true_type {};
template <typename, typename = void>
struct has_set_want_returns : std::false_type {};
template <typename T>
struct has_set_want_returns<T, std::void_t<decltype(static_cast<void (T::*)(bool)>(&T::set_want_returns))>> : std::true_type {};
template <typename, typename = void>
struct has_set_yalign : std::false_type {};
template <typename T>
struct has_set_yalign<T, std::void_t<decltype(static_cast<void (T::*)(double)>(&T::set_yalign))>> : std::true_type {};
template <typename, typename = void>
struct has_set_checked_items : std::false_type {};
template <typename T>
struct has_set_checked_items<T, std::void_t<decltype(static_cast<void (T::*)(const std::string&)>(&T::set_checked_items))>> : std::true_type {};
} // namespace detail
template <typename T>
@@ -1692,6 +1868,251 @@ struct Holder : IWidget {
}
return false;
}
bool set_default(bool v) override {
if constexpr (detail::has_set_default<T>::value) {
w.set_default(v);
return true;
}
return false;
}
bool set_cancel(bool v) override {
if constexpr (detail::has_set_cancel<T>::value) {
w.set_cancel(v);
return true;
}
return false;
}
bool set_modal_result(int v) override {
if constexpr (detail::has_set_modal_result<T>::value) {
w.set_modal_result(v);
return true;
}
return false;
}
bool set_kind(int v) override {
if constexpr (detail::has_set_kind<T>::value) {
w.set_kind(v);
return true;
}
return false;
}
bool set_layout(int v) override {
if constexpr (detail::has_set_layout<T>::value) {
w.set_layout(v);
return true;
}
return false;
}
bool set_alignment(int v) override {
if constexpr (detail::has_set_alignment<T>::value) {
w.set_alignment(v);
return true;
}
return false;
}
bool set_char_case(int v) override {
if constexpr (detail::has_set_char_case<T>::value) {
w.set_char_case(v);
return true;
}
return false;
}
bool set_numbers_only(bool v) override {
if constexpr (detail::has_set_numbers_only<T>::value) {
w.set_numbers_only(v);
return true;
}
return false;
}
bool set_hide_selection(bool v) override {
if constexpr (detail::has_set_hide_selection<T>::value) {
w.set_hide_selection(v);
return true;
}
return false;
}
bool set_auto_select(bool v) override {
if constexpr (detail::has_set_auto_select<T>::value) {
w.set_auto_select(v);
return true;
}
return false;
}
bool set_transparent(bool v) override {
if constexpr (detail::has_set_transparent<T>::value) {
w.set_transparent(v);
return true;
}
return false;
}
bool set_show_accel_char(bool v) override {
if constexpr (detail::has_set_show_accel_char<T>::value) {
w.set_show_accel_char(v);
return true;
}
return false;
}
bool set_focus_control(const std::string& v) override {
if constexpr (detail::has_set_focus_control<T>::value) {
w.set_focus_control(v);
return true;
}
return false;
}
bool set_allow_grayed(bool v) override {
if constexpr (detail::has_set_allow_grayed<T>::value) {
w.set_allow_grayed(v);
return true;
}
return false;
}
bool set_value_checked(const std::string& v) override {
if constexpr (detail::has_set_value_checked<T>::value) {
w.set_value_checked(v);
return true;
}
return false;
}
bool set_value_unchecked(const std::string& v) override {
if constexpr (detail::has_set_value_unchecked<T>::value) {
w.set_value_unchecked(v);
return true;
}
return false;
}
bool set_group_id(int v) override {
if constexpr (detail::has_set_group_id<T>::value) {
w.set_group_id(v);
return true;
}
return false;
}
bool set_style(int v) override {
if constexpr (detail::has_set_style<T>::value) {
w.set_style(v);
return true;
}
return false;
}
bool set_drop_down_count(int v) override {
if constexpr (detail::has_set_drop_down_count<T>::value) {
w.set_drop_down_count(v);
return true;
}
return false;
}
bool set_drop_down_width(int v) override {
if constexpr (detail::has_set_drop_down_width<T>::value) {
w.set_drop_down_width(v);
return true;
}
return false;
}
bool set_sorted(bool v) override {
if constexpr (detail::has_set_sorted<T>::value) {
w.set_sorted(v);
return true;
}
return false;
}
bool set_read_only(bool v) override {
if constexpr (detail::has_set_read_only<T>::value) {
w.set_read_only(v);
return true;
}
return false;
}
bool set_auto_complete(bool v) override {
if constexpr (detail::has_set_auto_complete<T>::value) {
w.set_auto_complete(v);
return true;
}
return false;
}
bool set_selected_row(int v) override {
if constexpr (detail::has_set_selected_row<T>::value) {
w.set_selected_row(v);
return true;
}
return false;
}
bool set_row_height(int v) override {
if constexpr (detail::has_set_row_height<T>::value) {
w.set_row_height(v);
return true;
}
return false;
}
bool set_page_step(double v) override {
if constexpr (detail::has_set_page_step<T>::value) {
w.set_page_step(v);
return true;
}
return false;
}
bool set_marks(const std::vector<double>& v) override {
if constexpr (detail::has_set_marks<T>::value) {
w.set_marks(v);
return true;
}
return false;
}
bool set_show_sel_range(bool v) override {
if constexpr (detail::has_set_show_sel_range<T>::value) {
w.set_show_sel_range(v);
return true;
}
return false;
}
bool set_sel_start(double v) override {
if constexpr (detail::has_set_sel_start<T>::value) {
w.set_sel_start(v);
return true;
}
return false;
}
bool set_sel_end(double v) override {
if constexpr (detail::has_set_sel_end<T>::value) {
w.set_sel_end(v);
return true;
}
return false;
}
bool set_scroll_bars(int v) override {
if constexpr (detail::has_set_scroll_bars<T>::value) {
w.set_scroll_bars(v);
return true;
}
return false;
}
bool set_want_tabs(bool v) override {
if constexpr (detail::has_set_want_tabs<T>::value) {
w.set_want_tabs(v);
return true;
}
return false;
}
bool set_want_returns(bool v) override {
if constexpr (detail::has_set_want_returns<T>::value) {
w.set_want_returns(v);
return true;
}
return false;
}
bool set_yalign(double v) override {
if constexpr (detail::has_set_yalign<T>::value) {
w.set_yalign(v);
return true;
}
return false;
}
bool set_checked_items(const std::string& v) override {
if constexpr (detail::has_set_checked_items<T>::value) {
w.set_checked_items(v);
return true;
}
return false;
}
std::string get_text() override {
if constexpr (detail::has_get_text<T>::value) {
return w.get_text();
+114
View File
@@ -36,6 +36,16 @@ private:
bool pressed_ = false;
bool default_ = false;
bool cancel_ = false;
int modal_result_ = 0;
int kind_ = 0;
int layout_ = 0;
// Colours exposed by the getter/setter pass; defaults are the old hardcoded values.
Srgb disabled_text_color_ = {140, 140, 140};
@@ -168,6 +178,100 @@ public:
}
bool get_default()
{
return default_;
}
void set_default(bool v)
{
default_ = v;
}
bool get_cancel()
{
return cancel_;
}
void set_cancel(bool v)
{
cancel_ = v;
}
int get_modal_result()
{
return modal_result_;
}
void set_modal_result(int v)
{
modal_result_ = v;
}
int get_kind()
{
return kind_;
}
void set_kind(int k)
{
kind_ = k;
static const char* texts[] = {"", "OK", "Cancel", "Yes", "No", "Close", "Help", "Retry", "Ignore", "Abort"};
static const int results[] = {0, 1, 2, 6, 7, 8, 9, 4, 5, 3};
if (k >= 1 && k <= 9)
{
text_ = texts[k];
modal_result_ = results[k];
}
}
int get_layout()
{
return layout_;
}
void set_layout(int v)
{
layout_ = v;
}
Srgb get_disabled_text_color()
{
@@ -238,6 +342,16 @@ public:
xf::draw_polished(display_, window_, gc_, st, x1_, y1_, x2_, y2_);
if (default_)
{
XSetForeground(display_, gc_, st.lineColor_);
XDrawRectangle(display_, window_, gc_, x1_ + 1, y1_ + 1, width() > 2 ? width() - 2 : 0, height() > 2 ? height() - 2 : 0);
}
xf::draw_text_centered(display_, window_, gc_, st, x1_, y1_, x2_, y2_, text_);
if (focused_)
@@ -40,6 +40,14 @@ private:
bool inconsistent_ = false;
bool allow_grayed_ = false;
int alignment_ = 0; // 0 = box left, 1 = box right
std::string value_checked_;
std::string value_unchecked_;
// Colours exposed by the getter/setter pass; defaults are the old hardcoded values.
Srgb disabled_text_color_ = {140, 140, 140};
@@ -272,6 +280,14 @@ public:
{
if (i && !allow_grayed_)
{
return;
}
inconsistent_ = i;
}
@@ -284,6 +300,70 @@ public:
}
bool get_allow_grayed()
{
return allow_grayed_;
}
void set_allow_grayed(bool v)
{
allow_grayed_ = v;
}
int get_alignment()
{
return alignment_;
}
void set_alignment(int v)
{
alignment_ = v;
}
std::string get_value_checked()
{
return value_checked_;
}
void set_value_checked(std::string v)
{
value_checked_ = v;
}
std::string get_value_unchecked()
{
return value_unchecked_;
}
void set_value_unchecked(std::string v)
{
value_unchecked_ = v;
}
//endregion
void draw()
@@ -320,6 +400,20 @@ public:
int by2 = by1 + box;
int tx = bx2 + 6;
if (alignment_ == 1)
{
bx1 = x2_ - 2 - box;
bx2 = bx1 + box;
tx = x1_ + 2;
}
XSetForeground(display_, gc_, styles_->get_color_Srgb(box_color_));
XFillRectangle(display_, window_, gc_, bx1, by1, box, box);
@@ -358,7 +452,7 @@ public:
}
xf::draw_text_left(display_, window_, gc_, st, bx2 + 6, y1_, y2_, text_);
xf::draw_text_left(display_, window_, gc_, st, tx, y1_, y2_, text_);
if (focused_)
@@ -46,6 +46,22 @@ private:
bool pressed_ = false;
int style_ = 0; // 0 = DropDown, 1 = Simple, 2 = DropDownList
int drop_down_count_ = 8;
int drop_down_width_ = 0; // 0 = same width as the widget
bool sorted_ = false;
bool read_only_ = false; // stored; the widget has no text editing
int max_length_ = 0; // stored; the widget has no text editing
bool auto_complete_ = false; // stored; the widget has no text editing
int char_case_ = 0; // stored; the widget has no text editing
int row_height()
{
@@ -58,7 +74,15 @@ private:
{
return 8;
return drop_down_count_;
}
int popup_width()
{
return drop_down_width_ > 0 ? drop_down_width_ : width();
}
@@ -82,7 +106,7 @@ private:
{
return open_ && x >= x1_ && x <= x2_ && y >= list_y1() && y <= list_y1() + shown_rows() * row_height();
return open_ && x >= x1_ && x <= x1_ + popup_width() && y >= list_y1() && y <= list_y1() + shown_rows() * row_height();
}
@@ -431,10 +455,154 @@ public:
}
if (sorted_)
{
std::sort(texts_.begin(), texts_.end());
}
}
int get_style()
{
return style_;
}
void set_style(int v)
{
style_ = v;
}
int get_drop_down_count()
{
return drop_down_count_;
}
void set_drop_down_count(int v)
{
drop_down_count_ = v < 1 ? 1 : v;
}
int get_drop_down_width()
{
return drop_down_width_;
}
void set_drop_down_width(int v)
{
drop_down_width_ = v < 0 ? 0 : v;
}
bool get_sorted()
{
return sorted_;
}
void set_sorted(bool v)
{
sorted_ = v;
if (sorted_)
{
std::sort(texts_.begin(), texts_.end());
}
}
bool get_read_only()
{
return read_only_;
}
void set_read_only(bool v)
{
read_only_ = v;
}
int get_max_length()
{
return max_length_;
}
void set_max_length(int v)
{
max_length_ = v < 0 ? 0 : v;
}
bool get_auto_complete()
{
return auto_complete_;
}
void set_auto_complete(bool v)
{
auto_complete_ = v;
}
int get_char_case()
{
return char_case_;
}
void set_char_case(int v)
{
char_case_ = v;
}
std::string get_items()
{
@@ -611,11 +779,11 @@ public:
XSetForeground(display_, gc_, styles_->get_color_rgb(fill_color_.r, fill_color_.g, fill_color_.b));
XFillRectangle(display_, window_, gc_, x1_, ly, width(), lh);
XFillRectangle(display_, window_, gc_, x1_, ly, popup_width(), lh);
XSetForeground(display_, gc_, st.lineColor_);
XDrawRectangle(display_, window_, gc_, x1_, ly, width(), lh);
XDrawRectangle(display_, window_, gc_, x1_, ly, popup_width(), lh);
for (int row = 0; row < shown_rows(); ++row)
@@ -639,7 +807,7 @@ public:
XSetForeground(display_, gc_, styles_->get_color_rgb(selection_fill_color_.r, selection_fill_color_.g, selection_fill_color_.b));
XFillRectangle(display_, window_, gc_, x1_ + 1, ry + 1, width() - 2, row_height() - 1);
XFillRectangle(display_, window_, gc_, x1_ + 1, ry + 1, popup_width() - 2, row_height() - 1);
}
+212 -6
View File
@@ -50,6 +50,16 @@ private:
bool show_password_ = false; // reveal the real text when set
int alignment_ = 0; // 0 = left, 1 = center, 2 = right
int char_case_ = 0; // 0 = normal, 1 = upper, 2 = lower
bool numbers_only_ = false;
bool hide_selection_ = false;
bool auto_select_ = false;
bool dragging_ = false; // mouse held down, extending the selection
bool blink_on_ = true; // cursor blink phase
@@ -150,6 +160,78 @@ private:
}
std::string filter_text(const std::string& t)
{
std::string out;
for (size_t i = 0; i < t.size(); ++i)
{
char c = t[i];
if (numbers_only_ && (c < '0' || c > '9'))
{
continue;
}
if (char_case_ == 1 && c >= 'a' && c <= 'z')
{
c = (char)(c - 'a' + 'A');
}
else if (char_case_ == 2 && c >= 'A' && c <= 'Z')
{
c = (char)(c - 'A' + 'a');
}
out += c;
}
return out;
}
int text_x()
{
int tx = x1_ + 8;
if (alignment_ > 0 && !text_.empty())
{
int tw = char_x((int)text_.size());
int extra = inner_width() - tw;
if (extra > 0)
{
tx += (alignment_ == 1) ? extra / 2 : extra;
}
}
return tx;
}
bool has_selection()
{
@@ -307,7 +389,15 @@ public:
{
text_ = t;
text_ = filter_text(t);
if (max_length_ > 0 && (int)text_.size() > max_length_)
{
text_ = text_.substr(0, (size_t)max_length_);
}
cursor_ = (int)text_.size();
@@ -327,6 +417,86 @@ public:
}
int get_alignment()
{
return alignment_;
}
void set_alignment(int v)
{
alignment_ = v;
}
int get_char_case()
{
return char_case_;
}
void set_char_case(int v)
{
char_case_ = v;
}
bool get_numbers_only()
{
return numbers_only_;
}
void set_numbers_only(bool v)
{
numbers_only_ = v;
}
bool get_hide_selection()
{
return hide_selection_;
}
void set_hide_selection(bool v)
{
hide_selection_ = v;
}
bool get_auto_select()
{
return auto_select_;
}
void set_auto_select(bool v)
{
auto_select_ = v;
}
SStyle style()
{
@@ -603,11 +773,11 @@ public:
}
int tx = x1_ + 8;
int tx = text_x();
// Selection highlight behind the text.
if (has_selection() && focused_)
if (has_selection() && (focused_ || !hide_selection_))
{
@@ -715,10 +885,20 @@ public:
blink_on_ = true;
cursor_ = index_at_pixel(x - (x1_ + 8) + scroll_px_);
cursor_ = index_at_pixel(x - text_x() + scroll_px_);
sel_anchor_ = cursor_;
if (auto_select_)
{
sel_anchor_ = 0;
cursor_ = (int)text_.size();
}
dragging_ = true;
ensure_cursor_visible();
@@ -763,7 +943,7 @@ public:
}
cursor_ = index_at_pixel(x - (x1_ + 8) + scroll_px_);
cursor_ = index_at_pixel(x - text_x() + scroll_px_);
ensure_cursor_visible();
@@ -1009,6 +1189,32 @@ public:
}
char c = str[i];
if (numbers_only_ && (c < '0' || c > '9'))
{
continue;
}
if (char_case_ == 1 && c >= 'a' && c <= 'z')
{
c = (char)(c - 'a' + 'A');
}
else if (char_case_ == 2 && c >= 'A' && c <= 'Z')
{
c = (char)(c - 'A' + 'a');
}
if (max_length_ > 0 && (int)text_.size() >= max_length_)
{
@@ -1017,7 +1223,7 @@ public:
}
text_.insert((size_t)cursor_, 1, str[i]);
text_.insert((size_t)cursor_, 1, c);
++cursor_;
+110 -4
View File
@@ -42,6 +42,12 @@ private:
bool selectable_ = false;
bool transparent_ = false; // labels never fill a background; stored for the model
bool show_accel_char_ = true;
std::string focus_control_;
int selection_start_ = -1; // character offsets when selectable_
int selection_end_ = -1;
@@ -280,6 +286,56 @@ public:
}
std::string display_text()
{
if (!show_accel_char_)
{
return text_;
}
std::string out;
for (size_t i = 0; i < text_.size(); ++i)
{
if (text_[i] == '&' && i + 1 < text_.size() && text_[i + 1] == '&')
{
out += '&';
++i;
}
else if (text_[i] == '&')
{
continue;
}
else
{
out += text_[i];
}
}
return out;
}
// Split text_ into lines that fit the widget width (word wrap).
std::vector<std::string> wrap_lines(const SStyle& st)
@@ -288,11 +344,13 @@ public:
std::vector<std::string> lines;
std::string dt = display_text();
if (!wrap_)
{
lines.push_back(text_);
lines.push_back(dt);
return lines;
@@ -302,13 +360,13 @@ public:
size_t pos = 0;
while (pos <= text_.size())
while (pos <= dt.size())
{
size_t sp = text_.find(' ', pos);
size_t sp = dt.find(' ', pos);
std::string word = text_.substr(pos, sp == std::string::npos ? std::string::npos : sp - pos);
std::string word = dt.substr(pos, sp == std::string::npos ? std::string::npos : sp - pos);
std::string trial = line.empty() ? word : line + " " + word;
@@ -350,6 +408,54 @@ public:
//endregion
bool get_transparent()
{
return transparent_;
}
void set_transparent(bool v)
{
transparent_ = v;
}
bool get_show_accel_char()
{
return show_accel_char_;
}
void set_show_accel_char(bool v)
{
show_accel_char_ = v;
}
std::string get_focus_control()
{
return focus_control_;
}
void set_focus_control(std::string v)
{
focus_control_ = v;
}
//region GtkLabel colours (getter/setter pass: formerly hardcoded in draw()/helpers)
void set_text_color(Srgb c) { text_color_ = c; }
Srgb get_text_color() { return text_color_; }
@@ -42,6 +42,8 @@ private:
bool multi_select_ = false;
bool sorted_ = false;
std::vector<int> selected_rows_; // toggled rows when multi_select_
int scroll_offset_ = 0; // first visible row index
@@ -353,6 +355,14 @@ public:
}
if (sorted_)
{
std::sort(rows_.begin(), rows_.end());
}
selected_row_ = rows_.empty() ? -1 : 0;
scroll_offset_ = 0;
@@ -535,6 +545,36 @@ public:
void set_inset(int v) { inset_ = v; }
int get_inset() { return inset_; }
void set_row_height(int v) { row_height_ = v; }
bool get_sorted()
{
return sorted_;
}
void set_sorted(bool v)
{
sorted_ = v;
if (sorted_)
{
std::sort(rows_.begin(), rows_.end());
selected_row_ = rows_.empty() ? -1 : 0;
selected_rows_.clear();
scroll_offset_ = 0;
}
}
int get_row_height() { return row_height_; }
//endregion
@@ -44,6 +44,9 @@ private:
std::vector<GtkRadioButton*> *group_ = nullptr;
int group_id_ = 0; // Inspector group id; the generator wires buttons
// sharing an id into one shared group vector.
// Colours exposed by the getter/setter pass; defaults are the old hardcoded values.
Srgb disabled_text_color_ = {140, 140, 140};
@@ -284,6 +287,22 @@ public:
}
int get_group_id()
{
return group_id_;
}
void set_group_id(int v)
{
group_id_ = v;
}
void set_active(bool a)
{
+90
View File
@@ -52,6 +52,12 @@ private:
std::vector<double> marks_;
bool show_sel_range_ = false;
double sel_start_ = 0.0;
double sel_end_ = 0.0;
int pad_ = 12; // room for the handle at each end
double clamp_value(double v)
@@ -62,6 +68,14 @@ private:
}
double sel_frac(double v)
{
return (max_ > min_) ? (v - min_) / (max_ - min_) : 0.0;
}
// Centre position of the handle along the trough.
int handle_pos()
@@ -420,6 +434,54 @@ public:
void set_marks(const std::vector<double>& v) { marks_ = v; }
const std::vector<double>& get_marks() { return marks_; }
void set_page_step(double v) { page_step_ = v; }
bool get_show_sel_range()
{
return show_sel_range_;
}
void set_show_sel_range(bool v)
{
show_sel_range_ = v;
}
double get_sel_start()
{
return sel_start_;
}
void set_sel_start(double v)
{
sel_start_ = clamp_value(v);
}
double get_sel_end()
{
return sel_end_;
}
void set_sel_end(double v)
{
sel_end_ = clamp_value(v);
}
double get_page_step() { return page_step_; }
//endregion
@@ -467,6 +529,20 @@ public:
XFillRectangle(display_, window_, gc_, x1_ + pad_, cy - 2, hp - x1_ - pad_, 5);
if (show_sel_range_)
{
int sx1 = x1_ + pad_ + (int)(sel_frac(sel_start_) * (width() - 2 * pad_));
int sx2 = x1_ + pad_ + (int)(sel_frac(sel_end_) * (width() - 2 * pad_));
XSetForeground(display_, gc_, st.lineColor_);
XFillRectangle(display_, window_, gc_, sx1, cy - 2, sx2 - sx1, 5);
}
// Marks under the trough.
XSetForeground(display_, gc_, st.lineColor_);
@@ -515,6 +591,20 @@ public:
XFillRectangle(display_, window_, gc_, cx - 2, hp, 5, y2_ - pad_ - hp);
if (show_sel_range_)
{
int sy1 = y2_ - pad_ - (int)(sel_frac(sel_end_) * (height() - 2 * pad_));
int sy2 = y2_ - pad_ - (int)(sel_frac(sel_start_) * (height() - 2 * pad_));
XSetForeground(display_, gc_, st.lineColor_);
XFillRectangle(display_, window_, gc_, cx - 2, sy1, 5, sy2 - sy1);
}
XSetForeground(display_, gc_, st.lineColor_);
for (size_t i = 0; i < marks_.size(); ++i)
+211 -5
View File
@@ -44,6 +44,18 @@ private:
bool wrap_ = true;
int max_length_ = 0; // 0 = unlimited
int alignment_ = 0; // 0 = left, 1 = center, 2 = right
int scroll_bars_ = 0; // 0 = none, 1 = horizontal, 2 = vertical, 3 = both (stored; no scrollbars are drawn)
bool want_tabs_ = true;
bool want_returns_ = true;
bool hide_selection_ = false; // stored; no selection is drawn
bool blink_on_ = true;
int pad_ = 6;
@@ -245,6 +257,34 @@ private:
}
int line_tx(const SStyle& st, const std::string& line_text)
{
if (alignment_ == 0)
{
return x1_ + pad_;
}
int tw = xf::text_width(st, line_text);
int extra = width() - 2 * pad_ - tw;
if (extra <= 0)
{
return x1_ + pad_;
}
return x1_ + pad_ + (alignment_ == 1 ? extra / 2 : extra);
}
void ensure_cursor_visible()
{
@@ -424,6 +464,14 @@ public:
text_ = t;
if (max_length_ > 0 && (int)text_.size() > max_length_)
{
text_ = text_.substr(0, (size_t)max_length_);
}
cursor_ = 0;
top_line_ = 0;
@@ -516,6 +564,102 @@ public:
}
int get_max_length()
{
return max_length_;
}
void set_max_length(int v)
{
max_length_ = v < 0 ? 0 : v;
}
int get_alignment()
{
return alignment_;
}
void set_alignment(int v)
{
alignment_ = v;
}
int get_scroll_bars()
{
return scroll_bars_;
}
void set_scroll_bars(int v)
{
scroll_bars_ = v;
}
bool get_want_tabs()
{
return want_tabs_;
}
void set_want_tabs(bool v)
{
want_tabs_ = v;
}
bool get_want_returns()
{
return want_returns_;
}
void set_want_returns(bool v)
{
want_returns_ = v;
}
bool get_hide_selection()
{
return hide_selection_;
}
void set_hide_selection(bool v)
{
hide_selection_ = v;
}
void get_cursor_line_col(int& line, int& col)
{
@@ -554,9 +698,19 @@ public:
}
text_.insert((size_t)cursor_, s);
std::string ins = s;
cursor_ += (int)s.size();
if (max_length_ > 0 && (int)text_.size() + (int)ins.size() > max_length_)
{
ins = ins.substr(0, (size_t)std::max(0, max_length_ - (int)text_.size()));
}
text_.insert((size_t)cursor_, ins);
cursor_ += (int)ins.size();
ensure_cursor_visible();
@@ -708,7 +862,9 @@ public:
int baseline = y1_ + pad_ + row * lh + ascent;
xf::draw_text_at(display_, window_, gc_, ink, x1_ + pad_, baseline, text_.substr((size_t)s, (size_t)len));
std::string lt = text_.substr((size_t)s, (size_t)len);
xf::draw_text_at(display_, window_, gc_, ink, line_tx(st, lt), baseline, lt);
}
@@ -728,7 +884,7 @@ public:
int s = lines[(size_t)cl].first;
int cx = x1_ + pad_ + xf::text_width(st, text_.substr((size_t)s, (size_t)(cursor_ - s)));
int cx = line_tx(st, text_.substr((size_t)s, (size_t)lines[(size_t)cl].second)) + xf::text_width(st, text_.substr((size_t)s, (size_t)(cursor_ - s)));
int ty = y1_ + pad_ + row * lh;
@@ -780,6 +936,8 @@ public:
SStyle st = style();
px = x - line_tx(st, text_.substr((size_t)s, (size_t)len));
for (int i = 0; i <= len; ++i)
{
@@ -1018,6 +1176,22 @@ public:
{
if (!want_returns_)
{
return false;
}
if (max_length_ > 0 && (int)text_.size() >= max_length_)
{
return true;
}
text_.insert((size_t)cursor_, 1, '\n');
++cursor_;
@@ -1074,7 +1248,31 @@ public:
{
return false; // let Tab move focus, like the real widget
if (!want_tabs_)
{
return false; // let Tab move focus, like the real widget
}
if (max_length_ > 0 && (int)text_.size() >= max_length_)
{
return true;
}
text_.insert((size_t)cursor_, 1, '\t');
++cursor_;
ensure_cursor_visible();
changed();
return true;
}
@@ -1094,6 +1292,14 @@ public:
}
if (max_length_ > 0 && (int)text_.size() >= max_length_)
{
break;
}
text_.insert((size_t)cursor_, 1, str[i]);
++cursor_;
@@ -44,6 +44,8 @@ private:
int row_height_ = 18;
bool sorted_ = false;
int visible_rows()
{
@@ -369,6 +371,234 @@ public:
}
void sort_items()
{
std::vector<std::pair<std::string, bool>> pairs;
for (size_t i = 0; i < items_.size(); ++i)
{
pairs.push_back({items_[i], checked_[i]});
}
std::sort(pairs.begin(), pairs.end(), [](const std::pair<std::string, bool>& a, const std::pair<std::string, bool>& b) { return a.first < b.first; });
for (size_t i = 0; i < pairs.size(); ++i)
{
items_[i] = pairs[i].first;
checked_[i] = pairs[i].second;
}
}
void set_items(const std::string& items)
{
items_.clear();
checked_.clear();
size_t start = 0;
while (start <= items.size()) {
size_t bar = items.find('|', start);
std::string one = items.substr(start, bar == std::string::npos ? bar : bar - start);
if (!one.empty()) add_item(one, false);
if (bar == std::string::npos) break;
start = bar + 1;
}
if (sorted_)
{
sort_items();
}
item_index_ = items_.empty() ? -1 : 0;
top_index_ = 0;
}
std::string get_items()
{
std::string out;
for (size_t i = 0; i < items_.size(); ++i)
{
if (i > 0)
{
out += '|';
}
out += items_[i];
}
return out;
}
void set_checked_items(const std::string& csv)
{
for (size_t i = 0; i < checked_.size(); ++i)
{
checked_[i] = false;
}
size_t start = 0;
while (start <= csv.size()) {
size_t comma = csv.find(',', start);
std::string one = csv.substr(start, comma == std::string::npos ? comma : comma - start);
if (!one.empty())
{
int idx = 0;
bool ok = true;
for (size_t k = 0; k < one.size(); ++k)
{
if (one[k] < '0' || one[k] > '9')
{
ok = false;
break;
}
idx = idx * 10 + (one[k] - '0');
}
if (ok && idx >= 0 && idx < (int)checked_.size())
{
checked_[(size_t)idx] = true;
}
}
if (comma == std::string::npos) break;
start = comma + 1;
}
}
std::string get_checked_items()
{
std::string out;
for (size_t i = 0; i < checked_.size(); ++i)
{
if (checked_[i])
{
if (!out.empty())
{
out += ',';
}
out += std::to_string(i);
}
}
return out;
}
void set_selected_row(int i)
{
set_item_index(i);
}
int get_selected_row()
{
return get_item_index();
}
bool get_sorted()
{
return sorted_;
}
void set_sorted(bool v)
{
sorted_ = v;
if (sorted_)
{
sort_items();
}
}
int get_top_index()
{
+267 -5
View File
@@ -44,6 +44,22 @@ private:
bool wordwrap_ = true;
bool editable_ = true;
bool cursor_visible_ = true;
int max_length_ = 0; // 0 = unlimited
int alignment_ = 0; // 0 = left, 1 = center, 2 = right
int scroll_bars_ = 3; // 0 = none, 1 = horizontal, 2 = vertical, 3 = both
bool want_tabs_ = true;
bool want_returns_ = true;
bool hide_selection_ = false; // stored; no selection is drawn
int padding_ = 4;
int line_height()
@@ -351,6 +367,14 @@ public:
{
if (max_length_ > 0 && (int)t.size() > max_length_)
{
t = t.substr(0, (size_t)max_length_);
}
lines_.clear();
std::string line;
@@ -515,6 +539,134 @@ public:
}
bool get_editable()
{
return editable_;
}
void set_editable(bool v)
{
editable_ = v;
}
bool get_cursor_visible()
{
return cursor_visible_;
}
void set_cursor_visible(bool v)
{
cursor_visible_ = v;
}
int get_max_length()
{
return max_length_;
}
void set_max_length(int v)
{
max_length_ = v < 0 ? 0 : v;
}
int get_alignment()
{
return alignment_;
}
void set_alignment(int v)
{
alignment_ = v;
}
int get_scroll_bars()
{
return scroll_bars_;
}
void set_scroll_bars(int v)
{
scroll_bars_ = v;
}
bool get_want_tabs()
{
return want_tabs_;
}
void set_want_tabs(bool v)
{
want_tabs_ = v;
}
bool get_want_returns()
{
return want_returns_;
}
void set_want_returns(bool v)
{
want_returns_ = v;
}
bool get_hide_selection()
{
return hide_selection_;
}
void set_hide_selection(bool v)
{
hide_selection_ = v;
}
//region TMemo colours (getter/setter pass: formerly hardcoded in draw()/helpers)
void set_white_inset_color(Srgb c) { white_inset_color_ = c; }
Srgb get_white_inset_color() { return white_inset_color_; }
@@ -537,6 +689,44 @@ public:
int get_padding() { return padding_; }
//endregion
int text_len()
{
sync_text();
return (int)text_.size();
}
int line_tx(const SStyle& st, const std::string& line_text)
{
if (alignment_ == 0)
{
return x1_ + padding_;
}
int tw = xf::text_width(st, line_text);
int extra = width() - 2 * padding_ - tw;
if (extra <= 0)
{
return x1_ + padding_;
}
return x1_ + padding_ + (alignment_ == 1 ? extra / 2 : extra);
}
void draw()
{
@@ -607,11 +797,11 @@ public:
int baseline = y1_ + padding_ + row * lh + (st.font_ ? st.font_->ascent : 12);
xf::draw_text_at(display_, window_, gc_, st, x1_ + padding_, baseline, lines_[index]);
xf::draw_text_at(display_, window_, gc_, st, line_tx(st, lines_[index]), baseline, lines_[index]);
}
if (focused_ && enabled_)
if (focused_ && enabled_ && cursor_visible_)
{
@@ -623,7 +813,7 @@ public:
std::string before = lines_[cursor_line_].substr(0, cursor_col_);
int cursor_x = x1_ + padding_ + xf::text_width(st, before);
int cursor_x = line_tx(st, lines_[cursor_line_]) + xf::text_width(st, before);
int cursor_top = y1_ + padding_ + row * lh;
@@ -641,7 +831,7 @@ public:
// Scrollbar hint on the right edge when the text overflows.
if ((int)lines_.size() > count)
if ((int)lines_.size() > count && (scroll_bars_ == 2 || scroll_bars_ == 3))
{
@@ -705,7 +895,7 @@ public:
SStyle st = style();
int target_x = x - x1_ - padding_;
int target_x = x - line_tx(st, lines_[cursor_line_]);
int col = 0;
@@ -787,6 +977,22 @@ public:
{
if (!editable_ || !want_returns_)
{
return false;
}
if (max_length_ > 0 && text_len() >= max_length_)
{
return true;
}
std::string tail = lines_[cursor_line_].substr(cursor_col_);
lines_[cursor_line_] = lines_[cursor_line_].substr(0, cursor_col_);
@@ -807,6 +1013,14 @@ public:
{
if (!editable_)
{
return false;
}
if (cursor_col_ > 0)
{
@@ -845,6 +1059,14 @@ public:
{
if (!editable_)
{
return false;
}
if (cursor_col_ < (int)lines_[cursor_line_].size())
{
@@ -1019,6 +1241,14 @@ public:
{
if (!editable_ || !want_tabs_)
{
return false;
}
lines_[cursor_line_].insert(cursor_col_, " ");
cursor_col_ += 2;
@@ -1049,6 +1279,38 @@ public:
}
if (!editable_)
{
return false;
}
if (max_length_ > 0)
{
int rem = max_length_ - text_len();
if (rem <= 0)
{
return true;
}
if ((int)insert.size() > rem)
{
insert = insert.substr(0, (size_t)rem);
}
}
if (!insert.empty())
{
+421
View File
@@ -142,6 +142,42 @@ struct IWidget {{
virtual bool set_direction(int) {{ return false; }}
virtual bool set_cursor_visible(bool) {{ return false; }}
virtual bool set_multi_select(bool) {{ return false; }}
// Phase 2: per-widget custom properties (proposal §2.1–§2.10) + CheckListBox.
virtual bool set_default(bool) {{ return false; }}
virtual bool set_cancel(bool) {{ return false; }}
virtual bool set_modal_result(int) {{ return false; }}
virtual bool set_kind(int) {{ return false; }}
virtual bool set_layout(int) {{ return false; }}
virtual bool set_alignment(int) {{ return false; }}
virtual bool set_char_case(int) {{ return false; }}
virtual bool set_numbers_only(bool) {{ return false; }}
virtual bool set_hide_selection(bool) {{ return false; }}
virtual bool set_auto_select(bool) {{ return false; }}
virtual bool set_transparent(bool) {{ return false; }}
virtual bool set_show_accel_char(bool) {{ return false; }}
virtual bool set_focus_control(const std::string&) {{ return false; }}
virtual bool set_allow_grayed(bool) {{ return false; }}
virtual bool set_value_checked(const std::string&) {{ return false; }}
virtual bool set_value_unchecked(const std::string&) {{ return false; }}
virtual bool set_group_id(int) {{ return false; }}
virtual bool set_style(int) {{ return false; }}
virtual bool set_drop_down_count(int) {{ return false; }}
virtual bool set_drop_down_width(int) {{ return false; }}
virtual bool set_sorted(bool) {{ return false; }}
virtual bool set_read_only(bool) {{ return false; }}
virtual bool set_auto_complete(bool) {{ return false; }}
virtual bool set_selected_row(int) {{ return false; }}
virtual bool set_row_height(int) {{ return false; }}
virtual bool set_page_step(double) {{ return false; }}
virtual bool set_marks(const std::vector<double>&) {{ return false; }}
virtual bool set_show_sel_range(bool) {{ return false; }}
virtual bool set_sel_start(double) {{ return false; }}
virtual bool set_sel_end(double) {{ return false; }}
virtual bool set_scroll_bars(int) {{ return false; }}
virtual bool set_want_tabs(bool) {{ return false; }}
virtual bool set_want_returns(bool) {{ return false; }}
virtual bool set_yalign(double) {{ return false; }}
virtual bool set_checked_items(const std::string&) {{ return false; }}
virtual std::string get_text() {{ return ""; }}
// Phase 2, Flag 10: raw pointer/keyboard callbacks, set by the
// generator on the Holder when the corresponding Lazarus event
@@ -303,6 +339,146 @@ template <typename, typename = void>
struct has_get_text : std::false_type {{}};
template <typename T>
struct has_get_text<T, std::void_t<decltype(std::declval<T&>().get_text())>> : std::bool_constant<std::is_convertible_v<decltype(std::declval<T&>().get_text()), std::string>> {{}};
template <typename, typename = void>
struct has_set_default : std::false_type {{}};
template <typename T>
struct has_set_default<T, std::void_t<decltype(static_cast<void (T::*)(bool)>(&T::set_default))>> : std::true_type {{}};
template <typename, typename = void>
struct has_set_cancel : std::false_type {{}};
template <typename T>
struct has_set_cancel<T, std::void_t<decltype(static_cast<void (T::*)(bool)>(&T::set_cancel))>> : std::true_type {{}};
template <typename, typename = void>
struct has_set_modal_result : std::false_type {{}};
template <typename T>
struct has_set_modal_result<T, std::void_t<decltype(static_cast<void (T::*)(int)>(&T::set_modal_result))>> : std::true_type {{}};
template <typename, typename = void>
struct has_set_kind : std::false_type {{}};
template <typename T>
struct has_set_kind<T, std::void_t<decltype(static_cast<void (T::*)(int)>(&T::set_kind))>> : std::true_type {{}};
template <typename, typename = void>
struct has_set_layout : std::false_type {{}};
template <typename T>
struct has_set_layout<T, std::void_t<decltype(static_cast<void (T::*)(int)>(&T::set_layout))>> : std::true_type {{}};
template <typename, typename = void>
struct has_set_alignment : std::false_type {{}};
template <typename T>
struct has_set_alignment<T, std::void_t<decltype(static_cast<void (T::*)(int)>(&T::set_alignment))>> : std::true_type {{}};
template <typename, typename = void>
struct has_set_char_case : std::false_type {{}};
template <typename T>
struct has_set_char_case<T, std::void_t<decltype(static_cast<void (T::*)(int)>(&T::set_char_case))>> : std::true_type {{}};
template <typename, typename = void>
struct has_set_numbers_only : std::false_type {{}};
template <typename T>
struct has_set_numbers_only<T, std::void_t<decltype(static_cast<void (T::*)(bool)>(&T::set_numbers_only))>> : std::true_type {{}};
template <typename, typename = void>
struct has_set_hide_selection : std::false_type {{}};
template <typename T>
struct has_set_hide_selection<T, std::void_t<decltype(static_cast<void (T::*)(bool)>(&T::set_hide_selection))>> : std::true_type {{}};
template <typename, typename = void>
struct has_set_auto_select : std::false_type {{}};
template <typename T>
struct has_set_auto_select<T, std::void_t<decltype(static_cast<void (T::*)(bool)>(&T::set_auto_select))>> : std::true_type {{}};
template <typename, typename = void>
struct has_set_transparent : std::false_type {{}};
template <typename T>
struct has_set_transparent<T, std::void_t<decltype(static_cast<void (T::*)(bool)>(&T::set_transparent))>> : std::true_type {{}};
template <typename, typename = void>
struct has_set_show_accel_char : std::false_type {{}};
template <typename T>
struct has_set_show_accel_char<T, std::void_t<decltype(static_cast<void (T::*)(bool)>(&T::set_show_accel_char))>> : std::true_type {{}};
template <typename, typename = void>
struct has_set_focus_control : std::false_type {{}};
template <typename T>
struct has_set_focus_control<T, std::void_t<decltype(static_cast<void (T::*)(std::string)>(&T::set_focus_control))>> : std::true_type {{}};
template <typename, typename = void>
struct has_set_allow_grayed : std::false_type {{}};
template <typename T>
struct has_set_allow_grayed<T, std::void_t<decltype(static_cast<void (T::*)(bool)>(&T::set_allow_grayed))>> : std::true_type {{}};
template <typename, typename = void>
struct has_set_value_checked : std::false_type {{}};
template <typename T>
struct has_set_value_checked<T, std::void_t<decltype(static_cast<void (T::*)(std::string)>(&T::set_value_checked))>> : std::true_type {{}};
template <typename, typename = void>
struct has_set_value_unchecked : std::false_type {{}};
template <typename T>
struct has_set_value_unchecked<T, std::void_t<decltype(static_cast<void (T::*)(std::string)>(&T::set_value_unchecked))>> : std::true_type {{}};
template <typename, typename = void>
struct has_set_group_id : std::false_type {{}};
template <typename T>
struct has_set_group_id<T, std::void_t<decltype(static_cast<void (T::*)(int)>(&T::set_group_id))>> : std::true_type {{}};
template <typename, typename = void>
struct has_set_style : std::false_type {{}};
template <typename T>
struct has_set_style<T, std::void_t<decltype(static_cast<void (T::*)(int)>(&T::set_style))>> : std::true_type {{}};
template <typename, typename = void>
struct has_set_drop_down_count : std::false_type {{}};
template <typename T>
struct has_set_drop_down_count<T, std::void_t<decltype(static_cast<void (T::*)(int)>(&T::set_drop_down_count))>> : std::true_type {{}};
template <typename, typename = void>
struct has_set_drop_down_width : std::false_type {{}};
template <typename T>
struct has_set_drop_down_width<T, std::void_t<decltype(static_cast<void (T::*)(int)>(&T::set_drop_down_width))>> : std::true_type {{}};
template <typename, typename = void>
struct has_set_sorted : std::false_type {{}};
template <typename T>
struct has_set_sorted<T, std::void_t<decltype(static_cast<void (T::*)(bool)>(&T::set_sorted))>> : std::true_type {{}};
template <typename, typename = void>
struct has_set_read_only : std::false_type {{}};
template <typename T>
struct has_set_read_only<T, std::void_t<decltype(static_cast<void (T::*)(bool)>(&T::set_read_only))>> : std::true_type {{}};
template <typename, typename = void>
struct has_set_auto_complete : std::false_type {{}};
template <typename T>
struct has_set_auto_complete<T, std::void_t<decltype(static_cast<void (T::*)(bool)>(&T::set_auto_complete))>> : std::true_type {{}};
template <typename, typename = void>
struct has_set_selected_row : std::false_type {{}};
template <typename T>
struct has_set_selected_row<T, std::void_t<decltype(static_cast<void (T::*)(int)>(&T::set_selected_row))>> : std::true_type {{}};
template <typename, typename = void>
struct has_set_row_height : std::false_type {{}};
template <typename T>
struct has_set_row_height<T, std::void_t<decltype(static_cast<void (T::*)(int)>(&T::set_row_height))>> : std::true_type {{}};
template <typename, typename = void>
struct has_set_page_step : std::false_type {{}};
template <typename T>
struct has_set_page_step<T, std::void_t<decltype(static_cast<void (T::*)(double)>(&T::set_page_step))>> : std::true_type {{}};
template <typename, typename = void>
struct has_set_marks : std::false_type {{}};
template <typename T>
struct has_set_marks<T, std::void_t<decltype(static_cast<void (T::*)(const std::vector<double>&)>(&T::set_marks))>> : std::true_type {{}};
template <typename, typename = void>
struct has_set_show_sel_range : std::false_type {{}};
template <typename T>
struct has_set_show_sel_range<T, std::void_t<decltype(static_cast<void (T::*)(bool)>(&T::set_show_sel_range))>> : std::true_type {{}};
template <typename, typename = void>
struct has_set_sel_start : std::false_type {{}};
template <typename T>
struct has_set_sel_start<T, std::void_t<decltype(static_cast<void (T::*)(double)>(&T::set_sel_start))>> : std::true_type {{}};
template <typename, typename = void>
struct has_set_sel_end : std::false_type {{}};
template <typename T>
struct has_set_sel_end<T, std::void_t<decltype(static_cast<void (T::*)(double)>(&T::set_sel_end))>> : std::true_type {{}};
template <typename, typename = void>
struct has_set_scroll_bars : std::false_type {{}};
template <typename T>
struct has_set_scroll_bars<T, std::void_t<decltype(static_cast<void (T::*)(int)>(&T::set_scroll_bars))>> : std::true_type {{}};
template <typename, typename = void>
struct has_set_want_tabs : std::false_type {{}};
template <typename T>
struct has_set_want_tabs<T, std::void_t<decltype(static_cast<void (T::*)(bool)>(&T::set_want_tabs))>> : std::true_type {{}};
template <typename, typename = void>
struct has_set_want_returns : std::false_type {{}};
template <typename T>
struct has_set_want_returns<T, std::void_t<decltype(static_cast<void (T::*)(bool)>(&T::set_want_returns))>> : std::true_type {{}};
template <typename, typename = void>
struct has_set_yalign : std::false_type {{}};
template <typename T>
struct has_set_yalign<T, std::void_t<decltype(static_cast<void (T::*)(double)>(&T::set_yalign))>> : std::true_type {{}};
template <typename, typename = void>
struct has_set_checked_items : std::false_type {{}};
template <typename T>
struct has_set_checked_items<T, std::void_t<decltype(static_cast<void (T::*)(const std::string&)>(&T::set_checked_items))>> : std::true_type {{}};
}} // namespace detail
template <typename T>
@@ -587,6 +763,251 @@ struct Holder : IWidget {{
}}
return false;
}}
bool set_default(bool v) override {{
if constexpr (detail::has_set_default<T>::value) {{
w.set_default(v);
return true;
}}
return false;
}}
bool set_cancel(bool v) override {{
if constexpr (detail::has_set_cancel<T>::value) {{
w.set_cancel(v);
return true;
}}
return false;
}}
bool set_modal_result(int v) override {{
if constexpr (detail::has_set_modal_result<T>::value) {{
w.set_modal_result(v);
return true;
}}
return false;
}}
bool set_kind(int v) override {{
if constexpr (detail::has_set_kind<T>::value) {{
w.set_kind(v);
return true;
}}
return false;
}}
bool set_layout(int v) override {{
if constexpr (detail::has_set_layout<T>::value) {{
w.set_layout(v);
return true;
}}
return false;
}}
bool set_alignment(int v) override {{
if constexpr (detail::has_set_alignment<T>::value) {{
w.set_alignment(v);
return true;
}}
return false;
}}
bool set_char_case(int v) override {{
if constexpr (detail::has_set_char_case<T>::value) {{
w.set_char_case(v);
return true;
}}
return false;
}}
bool set_numbers_only(bool v) override {{
if constexpr (detail::has_set_numbers_only<T>::value) {{
w.set_numbers_only(v);
return true;
}}
return false;
}}
bool set_hide_selection(bool v) override {{
if constexpr (detail::has_set_hide_selection<T>::value) {{
w.set_hide_selection(v);
return true;
}}
return false;
}}
bool set_auto_select(bool v) override {{
if constexpr (detail::has_set_auto_select<T>::value) {{
w.set_auto_select(v);
return true;
}}
return false;
}}
bool set_transparent(bool v) override {{
if constexpr (detail::has_set_transparent<T>::value) {{
w.set_transparent(v);
return true;
}}
return false;
}}
bool set_show_accel_char(bool v) override {{
if constexpr (detail::has_set_show_accel_char<T>::value) {{
w.set_show_accel_char(v);
return true;
}}
return false;
}}
bool set_focus_control(const std::string& v) override {{
if constexpr (detail::has_set_focus_control<T>::value) {{
w.set_focus_control(v);
return true;
}}
return false;
}}
bool set_allow_grayed(bool v) override {{
if constexpr (detail::has_set_allow_grayed<T>::value) {{
w.set_allow_grayed(v);
return true;
}}
return false;
}}
bool set_value_checked(const std::string& v) override {{
if constexpr (detail::has_set_value_checked<T>::value) {{
w.set_value_checked(v);
return true;
}}
return false;
}}
bool set_value_unchecked(const std::string& v) override {{
if constexpr (detail::has_set_value_unchecked<T>::value) {{
w.set_value_unchecked(v);
return true;
}}
return false;
}}
bool set_group_id(int v) override {{
if constexpr (detail::has_set_group_id<T>::value) {{
w.set_group_id(v);
return true;
}}
return false;
}}
bool set_style(int v) override {{
if constexpr (detail::has_set_style<T>::value) {{
w.set_style(v);
return true;
}}
return false;
}}
bool set_drop_down_count(int v) override {{
if constexpr (detail::has_set_drop_down_count<T>::value) {{
w.set_drop_down_count(v);
return true;
}}
return false;
}}
bool set_drop_down_width(int v) override {{
if constexpr (detail::has_set_drop_down_width<T>::value) {{
w.set_drop_down_width(v);
return true;
}}
return false;
}}
bool set_sorted(bool v) override {{
if constexpr (detail::has_set_sorted<T>::value) {{
w.set_sorted(v);
return true;
}}
return false;
}}
bool set_read_only(bool v) override {{
if constexpr (detail::has_set_read_only<T>::value) {{
w.set_read_only(v);
return true;
}}
return false;
}}
bool set_auto_complete(bool v) override {{
if constexpr (detail::has_set_auto_complete<T>::value) {{
w.set_auto_complete(v);
return true;
}}
return false;
}}
bool set_selected_row(int v) override {{
if constexpr (detail::has_set_selected_row<T>::value) {{
w.set_selected_row(v);
return true;
}}
return false;
}}
bool set_row_height(int v) override {{
if constexpr (detail::has_set_row_height<T>::value) {{
w.set_row_height(v);
return true;
}}
return false;
}}
bool set_page_step(double v) override {{
if constexpr (detail::has_set_page_step<T>::value) {{
w.set_page_step(v);
return true;
}}
return false;
}}
bool set_marks(const std::vector<double>& v) override {{
if constexpr (detail::has_set_marks<T>::value) {{
w.set_marks(v);
return true;
}}
return false;
}}
bool set_show_sel_range(bool v) override {{
if constexpr (detail::has_set_show_sel_range<T>::value) {{
w.set_show_sel_range(v);
return true;
}}
return false;
}}
bool set_sel_start(double v) override {{
if constexpr (detail::has_set_sel_start<T>::value) {{
w.set_sel_start(v);
return true;
}}
return false;
}}
bool set_sel_end(double v) override {{
if constexpr (detail::has_set_sel_end<T>::value) {{
w.set_sel_end(v);
return true;
}}
return false;
}}
bool set_scroll_bars(int v) override {{
if constexpr (detail::has_set_scroll_bars<T>::value) {{
w.set_scroll_bars(v);
return true;
}}
return false;
}}
bool set_want_tabs(bool v) override {{
if constexpr (detail::has_set_want_tabs<T>::value) {{
w.set_want_tabs(v);
return true;
}}
return false;
}}
bool set_want_returns(bool v) override {{
if constexpr (detail::has_set_want_returns<T>::value) {{
w.set_want_returns(v);
return true;
}}
return false;
}}
bool set_yalign(double v) override {{
if constexpr (detail::has_set_yalign<T>::value) {{
w.set_yalign(v);
return true;
}}
return false;
}}
bool set_checked_items(const std::string& v) override {{
if constexpr (detail::has_set_checked_items<T>::value) {{
w.set_checked_items(v);
return true;
}}
return false;
}}
std::string get_text() override {{
if constexpr (detail::has_get_text<T>::value) {{
return w.get_text();