Phase 1 fixtures: regenerate 03/04/05 from the C generator

03_all_props, 04_enum_values and 05_menus main.cpp now carry the
Phase 1 generator output (font picker + autosize helpers, anchor
lambda, new setter calls, enabled/visible, model-only notes).
02_all_types is byte-identical; 14/15/16 differ only in the
data-file path (generation directory), so their fixtures are
unchanged. cargo test -p lightgui-gen -p lightgui-designer
-p lightgui-core: all green.
This commit is contained in:
cnmcdee committed 2026-11-30 06:49:40 +00:00
1 parent 62695e0231
commit cb8bad1504
3 files changed
+592 -36

No files matched your search

+581 -36
View File
@@ -13,10 +13,77 @@
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <memory>
#include <string>
#include <vector>
// Pick a loadable XLFD for a per-widget font (Phase 1, Flag 2):
// family/size/bold/italic, then oblique for italic, then plain, then
// fixed at the requested size, then the fixed 13 default.
static std::string lightgui_pick_font(Display* display,
const std::string& family, int size,
bool bold, bool italic) {
if (size < 6) size = 6;
if (size > 72) size = 72;
std::string fam = family;
for (char& c : fam) c = (char)std::tolower((unsigned char)c);
if (fam.empty()) fam = "fixed";
std::string weight = bold ? "bold" : "medium";
std::string slant = italic ? "i" : "r";
std::string sz = std::to_string(size);
std::vector<std::string> cands;
if (!fam.empty() && fam[0] == '-') {
cands.push_back(fam);
} else {
cands.push_back("-*-" + fam + "-" + weight + "-" + slant + "-normal--" + sz + "-*");
if (italic) cands.push_back("-*-" + fam + "-" + weight + "-o-normal--" + sz + "-*");
cands.push_back("-*-" + fam + "-medium-r-normal--" + sz + "-*");
}
cands.push_back("-*-fixed-" + weight + "-" + slant + "-normal--" + sz + "-*");
if (italic) cands.push_back("-*-fixed-" + weight + "-o-normal--" + sz + "-*");
cands.push_back("-*-fixed-medium-r-normal--" + sz + "-*");
cands.push_back("-misc-fixed-medium-r-normal--13-*");
for (const std::string& pat : cands) {
int count = 0;
char** list = XListFonts(display, pat.c_str(), 1, &count);
if (list) {
XFreeFontNames(list);
if (count > 0) return pat;
}
}
return "-misc-fixed-medium-r-normal--13-*";
}
// AutoSize (Phase 1, Flag 11): resize a widget to fit its caption/text.
static void apply_autosize(lg::IWidget* w, SStyle_Manager& styles,
const std::string& style_name, int x, int y,
int minw, int minh, int maxw, int maxh) {
std::string text = w->get_text();
if (text.empty()) return;
SStyle st = styles.resolve(style_name);
XFontStruct* f = st.font_;
if (!f) return;
size_t best_start = 0, best_len = 0, cur_start = 0;
int lines = 1;
for (size_t i = 0; i <= text.size(); ++i) {
if (i == text.size() || text[i] == '\n') {
size_t len = i - cur_start;
if (len > best_len) { best_len = len; best_start = cur_start; }
if (i != text.size()) { lines++; cur_start = i + 1; }
}
}
int ww = XTextWidth(f, text.c_str() + best_start, (int)best_len) + 16;
int hh = (f->ascent + f->descent) * lines + 8;
if (minw > 0 && ww < minw) ww = minw;
if (minh > 0 && hh < minh) hh = minh;
if (maxw > 0 && ww > maxw) ww = maxw;
if (maxh > 0 && hh > maxh) hh = maxh;
if (ww < 24) ww = 24;
if (hh < 16) hh = 16;
w->set_bounds(x, y, ww, hh);
}
int main() {
Display* display = XOpenDisplay(nullptr);
if (!display) { std::fprintf(stderr, "cannot open display\n"); return 1; }
@@ -33,45 +100,49 @@ int main() {
styles.add_style_ex("default", Srgb{225, 225, 225}, Srgb{120, 120, 120}, Srgb{60, 60, 60}, Srgb{20, 20, 20}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.add_style_ex("dark", Srgb{45, 45, 48}, Srgb{20, 20, 22}, Srgb{200, 200, 200}, Srgb{240, 240, 240}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.set_active_style_byName("default");
styles.add_style_ex("Button_001_style", Srgb{51, 102, 153}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.add_style_ex("Label_001_style", Srgb{225, 225, 225}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.add_style_ex("Entry_001_style", Srgb{225, 225, 225}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.add_style_ex("Checkbutton_001_style", Srgb{51, 102, 153}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.add_style_ex("Radiobutton_001_style", Srgb{51, 102, 153}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.add_style_ex("Frame_001_style", Srgb{51, 102, 153}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.add_style_ex("Combobox_001_style", Srgb{51, 102, 153}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.add_style_ex("Listbox_001_style", Srgb{225, 225, 225}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.add_style_ex("Menubutton_001_style", Srgb{51, 102, 153}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.add_style_ex("Canvas_001_style", Srgb{51, 102, 153}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.add_style_ex("Scale_001_style", Srgb{51, 102, 153}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.add_style_ex("Scrollbar_001_style", Srgb{51, 102, 153}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.add_style_ex("Text_001_style", Srgb{225, 225, 225}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.add_style_ex("Toplevel_001_style", Srgb{51, 102, 153}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.add_style_ex("Spreadsheet_001_style", Srgb{225, 225, 225}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.add_style_ex("StockChart_001_style", Srgb{225, 225, 225}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.add_style_ex("Memo_001_style", Srgb{225, 225, 225}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.add_style_ex("GroupBox_001_style", Srgb{51, 102, 153}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.add_style_ex("Panel_001_style", Srgb{51, 102, 153}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.add_style_ex("Image_001_style", Srgb{51, 102, 153}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.add_style_ex("Shape_001_style", Srgb{51, 102, 153}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.add_style_ex("Notebook_001_style", Srgb{51, 102, 153}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.add_style_ex("ScrollBox_001_style", Srgb{225, 225, 225}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.add_style_ex("Splitter_001_style", Srgb{51, 102, 153}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.add_style_ex("StatusBar_001_style", Srgb{51, 102, 153}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.add_style_ex("ToolBar_001_style", Srgb{51, 102, 153}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.add_style_ex("MenuBar_001_style", Srgb{51, 102, 153}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.add_style_ex("SpinEdit_001_style", Srgb{225, 225, 225}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.add_style_ex("TrackBar_001_style", Srgb{51, 102, 153}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.add_style_ex("ProgressBar_001_style", Srgb{51, 102, 153}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.add_style_ex("DateTimePicker_001_style", Srgb{51, 102, 153}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.add_style_ex("ColorBox_001_style", Srgb{51, 102, 153}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.add_style_ex("ListView_001_style", Srgb{51, 102, 153}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.add_style_ex("TreeView_001_style", Srgb{51, 102, 153}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.add_style_ex("StringGrid_001_style", Srgb{225, 225, 225}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.add_style_ex("Plot_001_style", Srgb{225, 225, 225}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, "-misc-fixed-medium-r-normal--13-*");
styles.add_style_ex("Button_001_style", Srgb{51, 102, 153}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, lightgui_pick_font(display, "Test value", 13, true, true));
styles.add_style_ex("Label_001_style", Srgb{225, 225, 225}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, lightgui_pick_font(display, "Test value", 13, true, true));
styles.add_style_ex("Entry_001_style", Srgb{225, 225, 225}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, lightgui_pick_font(display, "Test value", 13, true, true));
styles.add_style_ex("Checkbutton_001_style", Srgb{51, 102, 153}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, lightgui_pick_font(display, "Test value", 13, true, true));
styles.add_style_ex("Radiobutton_001_style", Srgb{51, 102, 153}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, lightgui_pick_font(display, "Test value", 13, true, true));
styles.add_style_ex("Frame_001_style", Srgb{51, 102, 153}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, lightgui_pick_font(display, "Test value", 13, true, true));
styles.add_style_ex("Combobox_001_style", Srgb{51, 102, 153}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, lightgui_pick_font(display, "Test value", 13, true, true));
styles.add_style_ex("Listbox_001_style", Srgb{225, 225, 225}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, lightgui_pick_font(display, "Test value", 13, true, true));
styles.add_style_ex("Menubutton_001_style", Srgb{51, 102, 153}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, lightgui_pick_font(display, "Test value", 13, true, true));
styles.add_style_ex("Canvas_001_style", Srgb{51, 102, 153}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, lightgui_pick_font(display, "Test value", 13, true, true));
styles.add_style_ex("Scale_001_style", Srgb{51, 102, 153}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, lightgui_pick_font(display, "Test value", 13, true, true));
styles.add_style_ex("Scrollbar_001_style", Srgb{51, 102, 153}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, lightgui_pick_font(display, "Test value", 13, true, true));
styles.add_style_ex("Text_001_style", Srgb{225, 225, 225}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, lightgui_pick_font(display, "Test value", 13, true, true));
styles.add_style_ex("Toplevel_001_style", Srgb{51, 102, 153}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, lightgui_pick_font(display, "Test value", 13, true, true));
styles.add_style_ex("Spreadsheet_001_style", Srgb{225, 225, 225}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, lightgui_pick_font(display, "Test value", 13, true, true));
styles.add_style_ex("StockChart_001_style", Srgb{225, 225, 225}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, lightgui_pick_font(display, "Test value", 13, true, true));
styles.add_style_ex("Memo_001_style", Srgb{225, 225, 225}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, lightgui_pick_font(display, "Test value", 13, true, true));
styles.add_style_ex("GroupBox_001_style", Srgb{51, 102, 153}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, lightgui_pick_font(display, "Test value", 13, true, true));
styles.add_style_ex("Panel_001_style", Srgb{51, 102, 153}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, lightgui_pick_font(display, "Test value", 13, true, true));
styles.add_style_ex("Image_001_style", Srgb{51, 102, 153}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, lightgui_pick_font(display, "Test value", 13, true, true));
styles.add_style_ex("Shape_001_style", Srgb{51, 102, 153}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, lightgui_pick_font(display, "Test value", 13, true, true));
styles.add_style_ex("Notebook_001_style", Srgb{51, 102, 153}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, lightgui_pick_font(display, "Test value", 13, true, true));
styles.add_style_ex("ScrollBox_001_style", Srgb{225, 225, 225}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, lightgui_pick_font(display, "Test value", 13, true, true));
styles.add_style_ex("Splitter_001_style", Srgb{51, 102, 153}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, lightgui_pick_font(display, "Test value", 13, true, true));
styles.add_style_ex("StatusBar_001_style", Srgb{51, 102, 153}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, lightgui_pick_font(display, "Test value", 13, true, true));
styles.add_style_ex("ToolBar_001_style", Srgb{51, 102, 153}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, lightgui_pick_font(display, "Test value", 13, true, true));
styles.add_style_ex("MenuBar_001_style", Srgb{51, 102, 153}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, lightgui_pick_font(display, "Test value", 13, true, true));
styles.add_style_ex("SpinEdit_001_style", Srgb{225, 225, 225}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, lightgui_pick_font(display, "Test value", 13, true, true));
styles.add_style_ex("TrackBar_001_style", Srgb{51, 102, 153}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, lightgui_pick_font(display, "Test value", 13, true, true));
styles.add_style_ex("ProgressBar_001_style", Srgb{51, 102, 153}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, lightgui_pick_font(display, "Test value", 13, true, true));
styles.add_style_ex("DateTimePicker_001_style", Srgb{51, 102, 153}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, lightgui_pick_font(display, "Test value", 13, true, true));
styles.add_style_ex("ColorBox_001_style", Srgb{51, 102, 153}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, lightgui_pick_font(display, "Test value", 13, true, true));
styles.add_style_ex("ListView_001_style", Srgb{51, 102, 153}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, lightgui_pick_font(display, "Test value", 13, true, true));
styles.add_style_ex("TreeView_001_style", Srgb{51, 102, 153}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, lightgui_pick_font(display, "Test value", 13, true, true));
styles.add_style_ex("StringGrid_001_style", Srgb{225, 225, 225}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, lightgui_pick_font(display, "Test value", 13, true, true));
styles.add_style_ex("Plot_001_style", Srgb{225, 225, 225}, Srgb{120, 120, 120}, Srgb{51, 102, 153}, Srgb{255, 255, 255}, 6, 1, lightgui_pick_font(display, "Test value", 13, true, true));
lg::Holder<GtkButton> Button_001(display, screen, window, gc, &styles, 10, 10, 100, 30);
Button_001.w.set_text("Test value");
Button_001.w.set_style_name("Button_001_style");
Button_001.set_enabled(false);
Button_001.set_visible(false);
// NOTE (model-only, no XFrame setter): hint="Test value", tooltip-text="tip with \"quotes\" and \\ slash", cursor="Test value", tab-stop=false, show-hint=true, font-underline=true, font-strikeout=true
apply_autosize(&Button_001, styles, "Button_001_style", 10, 10, 0, 0, 0, 0);
lg::Holder<GtkLabel> Label_001(display, screen, window, gc, &styles, 200, 10, 100, 24);
Label_001.w.set_text("Test value");
Label_001.w.set_xalign(1.0);
@@ -79,63 +150,125 @@ int main() {
Label_001.w.set_selectable(true);
Label_001.w.set_fill_color_rgb(51, 102, 153);
Label_001.w.set_style_name("Label_001_style");
Label_001.set_enabled(false);
Label_001.set_visible(false);
// NOTE (model-only, no XFrame setter): hint="Test value", tooltip-text="tip with \"quotes\" and \\ slash", cursor="Test value", tab-stop=false, show-hint=true, font-underline=true, font-strikeout=true
apply_autosize(&Label_001, styles, "Label_001_style", 200, 10, 0, 0, 0, 0);
lg::Holder<GtkEntry> Entry_001(display, screen, window, gc, &styles, 390, 10, 160, 28);
Entry_001.w.set_text("Test value");
Entry_001.w.set_placeholder_text("Test value");
Entry_001.w.set_max_length(0);
Entry_001.w.set_editable(false);
Entry_001.w.set_password(true);
Entry_001.w.set_show_password(true);
Entry_001.w.set_fill_color_rgb(51, 102, 153);
Entry_001.w.set_style_name("Entry_001_style");
Entry_001.set_enabled(false);
Entry_001.set_visible(false);
// NOTE (model-only, no XFrame setter): hint="Test value", tooltip-text="tip with \"quotes\" and \\ slash", cursor="Test value", tab-stop=false, show-hint=true, font-underline=true, font-strikeout=true
apply_autosize(&Entry_001, styles, "Entry_001_style", 390, 10, 0, 0, 0, 0);
lg::Holder<GtkCheckButton> Checkbutton_001(display, screen, window, gc, &styles, 580, 10, 120, 26);
Checkbutton_001.w.set_text("Test value");
Checkbutton_001.w.set_active(true);
Checkbutton_001.w.set_inconsistent(true);
Checkbutton_001.w.set_style_name("Checkbutton_001_style");
Checkbutton_001.set_enabled(false);
Checkbutton_001.set_visible(false);
// NOTE (model-only, no XFrame setter): hint="Test value", tooltip-text="tip with \"quotes\" and \\ slash", cursor="Test value", tab-stop=false, show-hint=true, font-underline=true, font-strikeout=true
apply_autosize(&Checkbutton_001, styles, "Checkbutton_001_style", 580, 10, 0, 0, 0, 0);
lg::Holder<GtkRadioButton> Radiobutton_001(display, screen, window, gc, &styles, 10, 140, 120, 26);
Radiobutton_001.w.set_text("Test value");
Radiobutton_001.w.set_active(true);
Radiobutton_001.w.set_style_name("Radiobutton_001_style");
Radiobutton_001.set_enabled(false);
Radiobutton_001.set_visible(false);
// NOTE (model-only, no XFrame setter): hint="Test value", tooltip-text="tip with \"quotes\" and \\ slash", cursor="Test value", tab-stop=false, show-hint=true, font-underline=true, font-strikeout=true
apply_autosize(&Radiobutton_001, styles, "Radiobutton_001_style", 10, 140, 0, 0, 0, 0);
lg::Holder<GtkFrame> Frame_001(display, screen, window, gc, &styles, 200, 140, 200, 120);
Frame_001.w.set_label("Test value");
Frame_001.w.set_style_name("Frame_001_style");
Frame_001.set_enabled(false);
Frame_001.set_visible(false);
// NOTE (model-only, no XFrame setter): hint="Test value", tooltip-text="tip with \"quotes\" and \\ slash", cursor="Test value", tab-stop=false, show-hint=true, font-underline=true, font-strikeout=true
apply_autosize(&Frame_001, styles, "Frame_001_style", 200, 140, 0, 0, 0, 0);
lg::Holder<GtkComboBoxText> Combobox_001(display, screen, window, gc, &styles, 390, 140, 160, 28);
Combobox_001.w.append_text("Test value");
Combobox_001.w.set_active(0);
Combobox_001.w.set_style_name("Combobox_001_style");
Combobox_001.set_enabled(false);
Combobox_001.set_visible(false);
// NOTE (model-only, no XFrame setter): hint="Test value", tooltip-text="tip with \"quotes\" and \\ slash", cursor="Test value", tab-stop=false, show-hint=true, font-underline=true, font-strikeout=true
apply_autosize(&Combobox_001, styles, "Combobox_001_style", 390, 140, 0, 0, 0, 0);
lg::Holder<GtkListBox> Listbox_001(display, screen, window, gc, &styles, 580, 140, 180, 110);
Listbox_001.w.add_row("Test value");
Listbox_001.w.set_frame_background_color_rgb(51, 102, 153);
Listbox_001.w.set_style_name("Listbox_001_style");
Listbox_001.set_enabled(false);
Listbox_001.set_visible(false);
// NOTE (model-only, no XFrame setter): hint="Test value", tooltip-text="tip with \"quotes\" and \\ slash", cursor="Test value", tab-stop=false, show-hint=true, font-underline=true, font-strikeout=true
apply_autosize(&Listbox_001, styles, "Listbox_001_style", 580, 140, 0, 0, 0, 0);
lg::Holder<GtkMenuButton> Menubutton_001(display, screen, window, gc, &styles, 10, 270, 110, 30);
Menubutton_001.w.set_text("Test value");
Menubutton_001.w.set_direction(0);
Menubutton_001.w.set_style_name("Menubutton_001_style");
Menubutton_001.set_enabled(false);
Menubutton_001.set_visible(false);
// NOTE (model-only, no XFrame setter): hint="Test value", tooltip-text="tip with \"quotes\" and \\ slash", cursor="Test value", tab-stop=false, show-hint=true, font-underline=true, font-strikeout=true
apply_autosize(&Menubutton_001, styles, "Menubutton_001_style", 10, 270, 0, 0, 0, 0);
lg::Holder<GtkDrawingArea> Canvas_001(display, screen, window, gc, &styles, 200, 270, 200, 140);
// NOTE: Canvas has no XFrame counterpart; drawn as a plain area.
Canvas_001.w.set_style_name("Canvas_001_style");
Canvas_001.set_enabled(false);
Canvas_001.set_visible(false);
// NOTE (model-only, no XFrame setter): hint="Test value", tooltip-text="tip with \"quotes\" and \\ slash", cursor="Test value", tab-stop=false, show-hint=true, font-underline=true, font-strikeout=true
apply_autosize(&Canvas_001, styles, "Canvas_001_style", 200, 270, 0, 0, 0, 0);
lg::Holder<GtkScale> Scale_001(display, screen, window, gc, &styles, 390, 270, 160, 28);
Scale_001.w.set_value(42.5);
Scale_001.w.set_draw_value(false);
Scale_001.w.set_style_name("Scale_001_style");
Scale_001.set_enabled(false);
Scale_001.set_visible(false);
// NOTE (model-only, no XFrame setter): hint="Test value", tooltip-text="tip with \"quotes\" and \\ slash", cursor="Test value", tab-stop=false, show-hint=true, font-underline=true, font-strikeout=true
apply_autosize(&Scale_001, styles, "Scale_001_style", 390, 270, 0, 0, 0, 0);
lg::Holder<GtkScrollbar> Scrollbar_001(display, screen, window, gc, &styles, 580, 270, 160, 18);
Scrollbar_001.w.set_lower(42.5);
Scrollbar_001.w.set_upper(42.5);
Scrollbar_001.w.set_page_size(42.5);
Scrollbar_001.w.set_step(42.5);
Scrollbar_001.w.set_page_increment(42.5);
Scrollbar_001.w.set_value(42.5);
Scrollbar_001.w.set_style_name("Scrollbar_001_style");
Scrollbar_001.set_enabled(false);
Scrollbar_001.set_visible(false);
// NOTE (model-only, no XFrame setter): hint="Test value", tooltip-text="tip with \"quotes\" and \\ slash", cursor="Test value", tab-stop=false, show-hint=true, font-underline=true, font-strikeout=true
apply_autosize(&Scrollbar_001, styles, "Scrollbar_001_style", 580, 270, 0, 0, 0, 0);
lg::Holder<GtkTextView> Text_001(display, screen, window, gc, &styles, 10, 400, 220, 120);
Text_001.w.set_text("Test value");
Text_001.w.set_editable(false);
Text_001.w.set_wrap_mode(false);
Text_001.w.set_cursor_visible(false);
Text_001.w.set_fill_color_rgb(51, 102, 153);
Text_001.w.set_style_name("Text_001_style");
Text_001.set_enabled(false);
Text_001.set_visible(false);
// NOTE (model-only, no XFrame setter): hint="Test value", tooltip-text="tip with \"quotes\" and \\ slash", cursor="Test value", tab-stop=false, show-hint=true, font-underline=true, font-strikeout=true
apply_autosize(&Text_001, styles, "Text_001_style", 10, 400, 0, 0, 0, 0);
lg::Holder<GtkWindow> Toplevel_001(display, screen, window, gc, &styles, 200, 400, 300, 200);
Toplevel_001.w.set_title("Test value");
Toplevel_001.w.set_resizable(false);
Toplevel_001.w.set_style_name("Toplevel_001_style");
Toplevel_001.set_enabled(false);
Toplevel_001.set_visible(false);
// NOTE (model-only, no XFrame setter): hint="Test value", tooltip-text="tip with \"quotes\" and \\ slash", cursor="Test value", tab-stop=false, show-hint=true, font-underline=true, font-strikeout=true
apply_autosize(&Toplevel_001, styles, "Toplevel_001_style", 200, 400, 0, 0, 0, 0);
lg::Holder<XSpreadsheet> Spreadsheet_001(display, screen, window, gc, &styles, 390, 400, 320, 180);
Spreadsheet_001.w.set_size(4, 5);
Spreadsheet_001.w.set_white_color_rgb(51, 102, 153);
Spreadsheet_001.w.set_style_name("Spreadsheet_001_style");
Spreadsheet_001.set_enabled(false);
Spreadsheet_001.set_visible(false);
// NOTE (model-only, no XFrame setter): hint="Test value", tooltip-text="tip with \"quotes\" and \\ slash", cursor="Test value", tab-stop=false, show-hint=true, font-underline=true, font-strikeout=true
apply_autosize(&Spreadsheet_001, styles, "Spreadsheet_001_style", 390, 400, 0, 0, 0, 0);
lg::Holder<StockCandlestickChart> StockChart_001(display, screen, window, gc, &styles, 580, 400, 320, 200);
StockChart_001.w.set_up_color(Srgb{51, 102, 153});
StockChart_001.w.set_down_color(Srgb{51, 102, 153});
@@ -147,45 +280,93 @@ int main() {
// scale-mode: 0 (0 = price, 1 = percent)
StockChart_001.w.set_bg_color(Srgb{51, 102, 153});
StockChart_001.w.set_style_name("StockChart_001_style");
StockChart_001.set_enabled(false);
StockChart_001.set_visible(false);
// NOTE (model-only, no XFrame setter): hint="Test value", tooltip-text="tip with \"quotes\" and \\ slash", cursor="Test value", tab-stop=false, show-hint=true, font-underline=true, font-strikeout=true
apply_autosize(&StockChart_001, styles, "StockChart_001_style", 580, 400, 0, 0, 0, 0);
lg::Holder<TMemo> Memo_001(display, screen, window, gc, &styles, 10, 530, 220, 120);
Memo_001.w.set_text("Test value");
Memo_001.w.set_wordwrap(false);
Memo_001.w.set_fill_color_rgb(51, 102, 153);
Memo_001.w.set_style_name("Memo_001_style");
Memo_001.set_enabled(false);
Memo_001.set_visible(false);
// NOTE (model-only, no XFrame setter): hint="Test value", tooltip-text="tip with \"quotes\" and \\ slash", cursor="Test value", tab-stop=false, show-hint=true, font-underline=true, font-strikeout=true
apply_autosize(&Memo_001, styles, "Memo_001_style", 10, 530, 0, 0, 0, 0);
lg::Holder<GtkFrame> GroupBox_001(display, screen, window, gc, &styles, 200, 530, 200, 120);
GroupBox_001.w.set_label("Test value");
GroupBox_001.w.set_style_name("GroupBox_001_style");
GroupBox_001.set_enabled(false);
GroupBox_001.set_visible(false);
// NOTE (model-only, no XFrame setter): hint="Test value", tooltip-text="tip with \"quotes\" and \\ slash", cursor="Test value", tab-stop=false, show-hint=true, font-underline=true, font-strikeout=true
apply_autosize(&GroupBox_001, styles, "GroupBox_001_style", 200, 530, 0, 0, 0, 0);
lg::Holder<GtkFrame> Panel_001(display, screen, window, gc, &styles, 390, 530, 200, 120);
Panel_001.w.set_label("Test value");
Panel_001.w.set_style_name("Panel_001_style");
Panel_001.set_enabled(false);
Panel_001.set_visible(false);
// NOTE (model-only, no XFrame setter): hint="Test value", tooltip-text="tip with \"quotes\" and \\ slash", cursor="Test value", tab-stop=false, show-hint=true, font-underline=true, font-strikeout=true
apply_autosize(&Panel_001, styles, "Panel_001_style", 390, 530, 0, 0, 0, 0);
lg::Holder<GtkImage> Image_001(display, screen, window, gc, &styles, 580, 530, 160, 120);
Image_001.w.set_filename("Test value");
Image_001.w.set_pixel_size(-1);
Image_001.w.set_style_name("Image_001_style");
Image_001.set_enabled(false);
Image_001.set_visible(false);
// NOTE (model-only, no XFrame setter): hint="Test value", tooltip-text="tip with \"quotes\" and \\ slash", cursor="Test value", tab-stop=false, show-hint=true, font-underline=true, font-strikeout=true
apply_autosize(&Image_001, styles, "Image_001_style", 580, 530, 0, 0, 0, 0);
lg::Holder<GtkDrawingArea> Shape_001(display, screen, window, gc, &styles, 10, 660, 160, 120);
// NOTE: Shape ("0", fill "#336699") has no XFrame counterpart; drawn as a plain area.
Shape_001.w.set_style_name("Shape_001_style");
Shape_001.set_enabled(false);
Shape_001.set_visible(false);
// NOTE (model-only, no XFrame setter): hint="Test value", tooltip-text="tip with \"quotes\" and \\ slash", cursor="Test value", tab-stop=false, show-hint=true, font-underline=true, font-strikeout=true
apply_autosize(&Shape_001, styles, "Shape_001_style", 10, 660, 0, 0, 0, 0);
lg::Holder<GtkNotebook> Notebook_001(display, screen, window, gc, &styles, 200, 660, 320, 200);
Notebook_001.w.append_page("Test value");
Notebook_001.w.set_current_page(0);
Notebook_001.w.set_style_name("Notebook_001_style");
Notebook_001.set_enabled(false);
Notebook_001.set_visible(false);
// NOTE (model-only, no XFrame setter): hint="Test value", tooltip-text="tip with \"quotes\" and \\ slash", cursor="Test value", tab-stop=false, show-hint=true, font-underline=true, font-strikeout=true
apply_autosize(&Notebook_001, styles, "Notebook_001_style", 200, 660, 0, 0, 0, 0);
lg::Holder<GtkScrolledWindow> ScrollBox_001(display, screen, window, gc, &styles, 390, 660, 240, 160);
ScrollBox_001.w.set_text("Test value");
ScrollBox_001.w.set_viewport_background_color_rgb(51, 102, 153);
ScrollBox_001.w.set_style_name("ScrollBox_001_style");
ScrollBox_001.set_enabled(false);
ScrollBox_001.set_visible(false);
// NOTE (model-only, no XFrame setter): hint="Test value", tooltip-text="tip with \"quotes\" and \\ slash", cursor="Test value", tab-stop=false, show-hint=true, font-underline=true, font-strikeout=true
apply_autosize(&ScrollBox_001, styles, "ScrollBox_001_style", 390, 660, 0, 0, 0, 0);
lg::Holder<GtkPaned> Splitter_001(display, screen, window, gc, &styles, 580, 660, 280, 160);
Splitter_001.w.set_position(100);
Splitter_001.w.set_orientation(0);
Splitter_001.w.set_style_name("Splitter_001_style");
Splitter_001.set_enabled(false);
Splitter_001.set_visible(false);
// NOTE (model-only, no XFrame setter): hint="Test value", tooltip-text="tip with \"quotes\" and \\ slash", cursor="Test value", tab-stop=false, show-hint=true, font-underline=true, font-strikeout=true
apply_autosize(&Splitter_001, styles, "Splitter_001_style", 580, 660, 0, 0, 0, 0);
lg::Holder<GtkStatusbar> StatusBar_001(display, screen, window, gc, &styles, 10, 790, 320, 24);
StatusBar_001.w.set_text("Test value");
StatusBar_001.w.set_style_name("StatusBar_001_style");
StatusBar_001.set_enabled(false);
StatusBar_001.set_visible(false);
// NOTE (model-only, no XFrame setter): hint="Test value", tooltip-text="tip with \"quotes\" and \\ slash", cursor="Test value", tab-stop=false, show-hint=true, font-underline=true, font-strikeout=true
apply_autosize(&StatusBar_001, styles, "StatusBar_001_style", 10, 790, 0, 0, 0, 0);
lg::Holder<GtkToolbar> ToolBar_001(display, screen, window, gc, &styles, 200, 790, 320, 36);
ToolBar_001.w.set_items({"Test value"});
ToolBar_001.w.set_style_name("ToolBar_001_style");
ToolBar_001.set_enabled(false);
ToolBar_001.set_visible(false);
// NOTE (model-only, no XFrame setter): hint="Test value", tooltip-text="tip with \"quotes\" and \\ slash", cursor="Test value", tab-stop=false, show-hint=true, font-underline=true, font-strikeout=true
apply_autosize(&ToolBar_001, styles, "ToolBar_001_style", 200, 790, 0, 0, 0, 0);
lg::Holder<GtkMenuBar> MenuBar_001(display, screen, window, gc, &styles, 390, 790, 320, 28);
MenuBar_001.w.set_items({"Test value"});
MenuBar_001.w.set_style_name("MenuBar_001_style");
MenuBar_001.set_enabled(false);
MenuBar_001.set_visible(false);
// NOTE (model-only, no XFrame setter): hint="Test value", tooltip-text="tip with \"quotes\" and \\ slash", cursor="Test value", tab-stop=false, show-hint=true, font-underline=true, font-strikeout=true
apply_autosize(&MenuBar_001, styles, "MenuBar_001_style", 390, 790, 0, 0, 0, 0);
lg::Holder<GtkSpinButton> SpinEdit_001(display, screen, window, gc, &styles, 580, 790, 120, 28);
SpinEdit_001.w.set_range(0.0, 100.0);
SpinEdit_001.w.set_increments(1.0, 10.0);
@@ -194,6 +375,10 @@ int main() {
SpinEdit_001.w.set_wrap(true);
SpinEdit_001.w.set_fill_color_rgb(51, 102, 153);
SpinEdit_001.w.set_style_name("SpinEdit_001_style");
SpinEdit_001.set_enabled(false);
SpinEdit_001.set_visible(false);
// NOTE (model-only, no XFrame setter): hint="Test value", tooltip-text="tip with \"quotes\" and \\ slash", cursor="Test value", tab-stop=false, show-hint=true, font-underline=true, font-strikeout=true
apply_autosize(&SpinEdit_001, styles, "SpinEdit_001_style", 580, 790, 0, 0, 0, 0);
lg::Holder<GtkScale> TrackBar_001(display, screen, window, gc, &styles, 10, 920, 160, 28);
TrackBar_001.w.set_range(0.0, 100.0);
TrackBar_001.w.set_step(1.0);
@@ -201,33 +386,392 @@ int main() {
TrackBar_001.w.set_draw_value(false);
TrackBar_001.w.set_orientation_vertical(false);
TrackBar_001.w.set_style_name("TrackBar_001_style");
TrackBar_001.set_enabled(false);
TrackBar_001.set_visible(false);
// NOTE (model-only, no XFrame setter): hint="Test value", tooltip-text="tip with \"quotes\" and \\ slash", cursor="Test value", tab-stop=false, show-hint=true, font-underline=true, font-strikeout=true
apply_autosize(&TrackBar_001, styles, "TrackBar_001_style", 10, 920, 0, 0, 0, 0);
lg::Holder<GtkProgressBar> ProgressBar_001(display, screen, window, gc, &styles, 200, 920, 200, 24);
ProgressBar_001.w.set_text("Test value");
ProgressBar_001.w.set_fraction(1.0);
ProgressBar_001.w.set_show_text(true);
ProgressBar_001.w.set_style_name("ProgressBar_001_style");
ProgressBar_001.set_enabled(false);
ProgressBar_001.set_visible(false);
// NOTE (model-only, no XFrame setter): hint="Test value", tooltip-text="tip with \"quotes\" and \\ slash", cursor="Test value", tab-stop=false, show-hint=true, font-underline=true, font-strikeout=true
apply_autosize(&ProgressBar_001, styles, "ProgressBar_001_style", 200, 920, 0, 0, 0, 0);
lg::Holder<GtkCalendar> DateTimePicker_001(display, screen, window, gc, &styles, 390, 920, 240, 200);
DateTimePicker_001.w.set_show_heading(false);
DateTimePicker_001.w.set_show_day_names(false);
DateTimePicker_001.w.set_style_name("DateTimePicker_001_style");
DateTimePicker_001.set_enabled(false);
DateTimePicker_001.set_visible(false);
// NOTE (model-only, no XFrame setter): hint="Test value", tooltip-text="tip with \"quotes\" and \\ slash", cursor="Test value", tab-stop=false, show-hint=true, font-underline=true, font-strikeout=true
apply_autosize(&DateTimePicker_001, styles, "DateTimePicker_001_style", 390, 920, 0, 0, 0, 0);
lg::Holder<GtkColorButton> ColorBox_001(display, screen, window, gc, &styles, 580, 920, 120, 28);
ColorBox_001.w.set_color_rgb(51, 102, 153);
ColorBox_001.w.set_style_name("ColorBox_001_style");
ColorBox_001.set_enabled(false);
ColorBox_001.set_visible(false);
// NOTE (model-only, no XFrame setter): hint="Test value", tooltip-text="tip with \"quotes\" and \\ slash", cursor="Test value", tab-stop=false, show-hint=true, font-underline=true, font-strikeout=true
apply_autosize(&ColorBox_001, styles, "ColorBox_001_style", 580, 920, 0, 0, 0, 0);
lg::Holder<GtkListView> ListView_001(display, screen, window, gc, &styles, 10, 1050, 240, 140);
ListView_001.w.add_item("Test value");
ListView_001.w.set_style_name("ListView_001_style");
ListView_001.set_enabled(false);
ListView_001.set_visible(false);
// NOTE (model-only, no XFrame setter): hint="Test value", tooltip-text="tip with \"quotes\" and \\ slash", cursor="Test value", tab-stop=false, show-hint=true, font-underline=true, font-strikeout=true
apply_autosize(&ListView_001, styles, "ListView_001_style", 10, 1050, 0, 0, 0, 0);
lg::Holder<GtkTreeView> TreeView_001(display, screen, window, gc, &styles, 200, 1050, 240, 140);
TreeView_001.w.set_roots({GtkTreeView::Node{{"Test value"}, {}, true}});
TreeView_001.w.set_style_name("TreeView_001_style");
TreeView_001.set_enabled(false);
TreeView_001.set_visible(false);
// NOTE (model-only, no XFrame setter): hint="Test value", tooltip-text="tip with \"quotes\" and \\ slash", cursor="Test value", tab-stop=false, show-hint=true, font-underline=true, font-strikeout=true
apply_autosize(&TreeView_001, styles, "TreeView_001_style", 200, 1050, 0, 0, 0, 0);
lg::Holder<XSpreadsheet> StringGrid_001(display, screen, window, gc, &styles, 390, 1050, 280, 160);
StringGrid_001.w.set_size(4, 5);
StringGrid_001.w.set_white_color_rgb(51, 102, 153);
StringGrid_001.w.set_style_name("StringGrid_001_style");
StringGrid_001.set_enabled(false);
StringGrid_001.set_visible(false);
// NOTE (model-only, no XFrame setter): hint="Test value", tooltip-text="tip with \"quotes\" and \\ slash", cursor="Test value", tab-stop=false, show-hint=true, font-underline=true, font-strikeout=true
apply_autosize(&StringGrid_001, styles, "StringGrid_001_style", 390, 1050, 0, 0, 0, 0);
lg::Holder<XGraph> Plot_001(display, screen, window, gc, &styles, 580, 1050, 280, 180);
// NOTE: Plot line colour "#336699" is not representable through the XGraph API.
Plot_001.w.set_white_color_rgb(51, 102, 153);
Plot_001.w.set_style_name("Plot_001_style");
Plot_001.set_enabled(false);
Plot_001.set_visible(false);
// NOTE (model-only, no XFrame setter): hint="Test value", tooltip-text="tip with \"quotes\" and \\ slash", cursor="Test value", tab-stop=false, show-hint=true, font-underline=true, font-strikeout=true
apply_autosize(&Plot_001, styles, "Plot_001_style", 580, 1050, 0, 0, 0, 0);
std::vector<lg::IWidget*> widgets = { &Button_001, &Label_001, &Entry_001, &Checkbutton_001, &Radiobutton_001, &Frame_001, &Combobox_001, &Listbox_001, &Menubutton_001, &Canvas_001, &Scale_001, &Scrollbar_001, &Text_001, &Toplevel_001, &Spreadsheet_001, &StockChart_001, &Memo_001, &GroupBox_001, &Panel_001, &Image_001, &Shape_001, &Notebook_001, &ScrollBox_001, &Splitter_001, &StatusBar_001, &ToolBar_001, &MenuBar_001, &SpinEdit_001, &TrackBar_001, &ProgressBar_001, &DateTimePicker_001, &ColorBox_001, &ListView_001, &TreeView_001, &StringGrid_001, &Plot_001 };
// Anchors (Phase 1, Flag 1): minimal anchor layout. Each anchored widget is repositioned/resized from its design geometry when the window resizes; top+left alone is static and needs no code.
auto apply_anchors = [&](int new_w, int new_h) {
{ // Button_001: anchors right, bottom
int _x = 10 + (new_w - 800);
int _y = 10 + (new_h - 600);
int _w = 100;
int _h = 30;
if (_w < 24) _w = 24;
if (_h < 16) _h = 16;
Button_001.set_bounds(_x, _y, _w, _h);
}
{ // Label_001: anchors right, bottom
int _x = 200 + (new_w - 800);
int _y = 10 + (new_h - 600);
int _w = 100;
int _h = 24;
if (_w < 24) _w = 24;
if (_h < 16) _h = 16;
Label_001.set_bounds(_x, _y, _w, _h);
}
{ // Entry_001: anchors right, bottom
int _x = 390 + (new_w - 800);
int _y = 10 + (new_h - 600);
int _w = 160;
int _h = 28;
if (_w < 24) _w = 24;
if (_h < 16) _h = 16;
Entry_001.set_bounds(_x, _y, _w, _h);
}
{ // Checkbutton_001: anchors right, bottom
int _x = 580 + (new_w - 800);
int _y = 10 + (new_h - 600);
int _w = 120;
int _h = 26;
if (_w < 24) _w = 24;
if (_h < 16) _h = 16;
Checkbutton_001.set_bounds(_x, _y, _w, _h);
}
{ // Radiobutton_001: anchors right, bottom
int _x = 10 + (new_w - 800);
int _y = 140 + (new_h - 600);
int _w = 120;
int _h = 26;
if (_w < 24) _w = 24;
if (_h < 16) _h = 16;
Radiobutton_001.set_bounds(_x, _y, _w, _h);
}
{ // Frame_001: anchors right, bottom
int _x = 200 + (new_w - 800);
int _y = 140 + (new_h - 600);
int _w = 200;
int _h = 120;
if (_w < 24) _w = 24;
if (_h < 16) _h = 16;
Frame_001.set_bounds(_x, _y, _w, _h);
}
{ // Combobox_001: anchors right, bottom
int _x = 390 + (new_w - 800);
int _y = 140 + (new_h - 600);
int _w = 160;
int _h = 28;
if (_w < 24) _w = 24;
if (_h < 16) _h = 16;
Combobox_001.set_bounds(_x, _y, _w, _h);
}
{ // Listbox_001: anchors right, bottom
int _x = 580 + (new_w - 800);
int _y = 140 + (new_h - 600);
int _w = 180;
int _h = 110;
if (_w < 24) _w = 24;
if (_h < 16) _h = 16;
Listbox_001.set_bounds(_x, _y, _w, _h);
}
{ // Menubutton_001: anchors right, bottom
int _x = 10 + (new_w - 800);
int _y = 270 + (new_h - 600);
int _w = 110;
int _h = 30;
if (_w < 24) _w = 24;
if (_h < 16) _h = 16;
Menubutton_001.set_bounds(_x, _y, _w, _h);
}
{ // Canvas_001: anchors right, bottom
int _x = 200 + (new_w - 800);
int _y = 270 + (new_h - 600);
int _w = 200;
int _h = 140;
if (_w < 24) _w = 24;
if (_h < 16) _h = 16;
Canvas_001.set_bounds(_x, _y, _w, _h);
}
{ // Scale_001: anchors right, bottom
int _x = 390 + (new_w - 800);
int _y = 270 + (new_h - 600);
int _w = 160;
int _h = 28;
if (_w < 24) _w = 24;
if (_h < 16) _h = 16;
Scale_001.set_bounds(_x, _y, _w, _h);
}
{ // Scrollbar_001: anchors right, bottom
int _x = 580 + (new_w - 800);
int _y = 270 + (new_h - 600);
int _w = 160;
int _h = 18;
if (_w < 24) _w = 24;
if (_h < 16) _h = 16;
Scrollbar_001.set_bounds(_x, _y, _w, _h);
}
{ // Text_001: anchors right, bottom
int _x = 10 + (new_w - 800);
int _y = 400 + (new_h - 600);
int _w = 220;
int _h = 120;
if (_w < 24) _w = 24;
if (_h < 16) _h = 16;
Text_001.set_bounds(_x, _y, _w, _h);
}
{ // Toplevel_001: anchors right, bottom
int _x = 200 + (new_w - 800);
int _y = 400 + (new_h - 600);
int _w = 300;
int _h = 200;
if (_w < 24) _w = 24;
if (_h < 16) _h = 16;
Toplevel_001.set_bounds(_x, _y, _w, _h);
}
{ // Spreadsheet_001: anchors right, bottom
int _x = 390 + (new_w - 800);
int _y = 400 + (new_h - 600);
int _w = 320;
int _h = 180;
if (_w < 24) _w = 24;
if (_h < 16) _h = 16;
Spreadsheet_001.set_bounds(_x, _y, _w, _h);
}
{ // StockChart_001: anchors right, bottom
int _x = 580 + (new_w - 800);
int _y = 400 + (new_h - 600);
int _w = 320;
int _h = 200;
if (_w < 24) _w = 24;
if (_h < 16) _h = 16;
StockChart_001.set_bounds(_x, _y, _w, _h);
}
{ // Memo_001: anchors right, bottom
int _x = 10 + (new_w - 800);
int _y = 530 + (new_h - 600);
int _w = 220;
int _h = 120;
if (_w < 24) _w = 24;
if (_h < 16) _h = 16;
Memo_001.set_bounds(_x, _y, _w, _h);
}
{ // GroupBox_001: anchors right, bottom
int _x = 200 + (new_w - 800);
int _y = 530 + (new_h - 600);
int _w = 200;
int _h = 120;
if (_w < 24) _w = 24;
if (_h < 16) _h = 16;
GroupBox_001.set_bounds(_x, _y, _w, _h);
}
{ // Panel_001: anchors right, bottom
int _x = 390 + (new_w - 800);
int _y = 530 + (new_h - 600);
int _w = 200;
int _h = 120;
if (_w < 24) _w = 24;
if (_h < 16) _h = 16;
Panel_001.set_bounds(_x, _y, _w, _h);
}
{ // Image_001: anchors right, bottom
int _x = 580 + (new_w - 800);
int _y = 530 + (new_h - 600);
int _w = 160;
int _h = 120;
if (_w < 24) _w = 24;
if (_h < 16) _h = 16;
Image_001.set_bounds(_x, _y, _w, _h);
}
{ // Shape_001: anchors right, bottom
int _x = 10 + (new_w - 800);
int _y = 660 + (new_h - 600);
int _w = 160;
int _h = 120;
if (_w < 24) _w = 24;
if (_h < 16) _h = 16;
Shape_001.set_bounds(_x, _y, _w, _h);
}
{ // Notebook_001: anchors right, bottom
int _x = 200 + (new_w - 800);
int _y = 660 + (new_h - 600);
int _w = 320;
int _h = 200;
if (_w < 24) _w = 24;
if (_h < 16) _h = 16;
Notebook_001.set_bounds(_x, _y, _w, _h);
}
{ // ScrollBox_001: anchors right, bottom
int _x = 390 + (new_w - 800);
int _y = 660 + (new_h - 600);
int _w = 240;
int _h = 160;
if (_w < 24) _w = 24;
if (_h < 16) _h = 16;
ScrollBox_001.set_bounds(_x, _y, _w, _h);
}
{ // Splitter_001: anchors right, bottom
int _x = 580 + (new_w - 800);
int _y = 660 + (new_h - 600);
int _w = 280;
int _h = 160;
if (_w < 24) _w = 24;
if (_h < 16) _h = 16;
Splitter_001.set_bounds(_x, _y, _w, _h);
}
{ // StatusBar_001: anchors right, bottom
int _x = 10 + (new_w - 800);
int _y = 790 + (new_h - 600);
int _w = 320;
int _h = 24;
if (_w < 24) _w = 24;
if (_h < 16) _h = 16;
StatusBar_001.set_bounds(_x, _y, _w, _h);
}
{ // ToolBar_001: anchors right, bottom
int _x = 200 + (new_w - 800);
int _y = 790 + (new_h - 600);
int _w = 320;
int _h = 36;
if (_w < 24) _w = 24;
if (_h < 16) _h = 16;
ToolBar_001.set_bounds(_x, _y, _w, _h);
}
{ // MenuBar_001: anchors right, bottom
int _x = 390 + (new_w - 800);
int _y = 790 + (new_h - 600);
int _w = 320;
int _h = 28;
if (_w < 24) _w = 24;
if (_h < 16) _h = 16;
MenuBar_001.set_bounds(_x, _y, _w, _h);
}
{ // SpinEdit_001: anchors right, bottom
int _x = 580 + (new_w - 800);
int _y = 790 + (new_h - 600);
int _w = 120;
int _h = 28;
if (_w < 24) _w = 24;
if (_h < 16) _h = 16;
SpinEdit_001.set_bounds(_x, _y, _w, _h);
}
{ // TrackBar_001: anchors right, bottom
int _x = 10 + (new_w - 800);
int _y = 920 + (new_h - 600);
int _w = 160;
int _h = 28;
if (_w < 24) _w = 24;
if (_h < 16) _h = 16;
TrackBar_001.set_bounds(_x, _y, _w, _h);
}
{ // ProgressBar_001: anchors right, bottom
int _x = 200 + (new_w - 800);
int _y = 920 + (new_h - 600);
int _w = 200;
int _h = 24;
if (_w < 24) _w = 24;
if (_h < 16) _h = 16;
ProgressBar_001.set_bounds(_x, _y, _w, _h);
}
{ // DateTimePicker_001: anchors right, bottom
int _x = 390 + (new_w - 800);
int _y = 920 + (new_h - 600);
int _w = 240;
int _h = 200;
if (_w < 24) _w = 24;
if (_h < 16) _h = 16;
DateTimePicker_001.set_bounds(_x, _y, _w, _h);
}
{ // ColorBox_001: anchors right, bottom
int _x = 580 + (new_w - 800);
int _y = 920 + (new_h - 600);
int _w = 120;
int _h = 28;
if (_w < 24) _w = 24;
if (_h < 16) _h = 16;
ColorBox_001.set_bounds(_x, _y, _w, _h);
}
{ // ListView_001: anchors right, bottom
int _x = 10 + (new_w - 800);
int _y = 1050 + (new_h - 600);
int _w = 240;
int _h = 140;
if (_w < 24) _w = 24;
if (_h < 16) _h = 16;
ListView_001.set_bounds(_x, _y, _w, _h);
}
{ // TreeView_001: anchors right, bottom
int _x = 200 + (new_w - 800);
int _y = 1050 + (new_h - 600);
int _w = 240;
int _h = 140;
if (_w < 24) _w = 24;
if (_h < 16) _h = 16;
TreeView_001.set_bounds(_x, _y, _w, _h);
}
{ // StringGrid_001: anchors right, bottom
int _x = 390 + (new_w - 800);
int _y = 1050 + (new_h - 600);
int _w = 280;
int _h = 160;
if (_w < 24) _w = 24;
if (_h < 16) _h = 16;
StringGrid_001.set_bounds(_x, _y, _w, _h);
}
{ // Plot_001: anchors right, bottom
int _x = 580 + (new_w - 800);
int _y = 1050 + (new_h - 600);
int _w = 280;
int _h = 180;
if (_w < 24) _w = 24;
if (_h < 16) _h = 16;
Plot_001.set_bounds(_x, _y, _w, _h);
}
};
auto redraw_all = [&]() {
XClearWindow(display, window);
for (lg::IWidget* wd : widgets) wd->draw();
@@ -270,6 +814,7 @@ int main() {
break;
}
case ConfigureNotify:
apply_anchors(event.xconfigure.width, event.xconfigure.height);
handled = true;
break;
case ClientMessage:
@@ -65,16 +65,21 @@ int main() {
Lst_sel_3.w.add_row("Item 1");
Lst_sel_3.w.add_row("Item 2");
Lst_sel_3.w.add_row("Item 3");
Lst_sel_3.w.set_multi_select(true);
lg::Holder<GtkMenuButton> Mnu_dir_0(display, screen, window, gc, &styles, 1570, 10, 110, 30);
Mnu_dir_0.w.set_text("Mnu_dir_0");
Mnu_dir_0.w.set_direction(0);
lg::Holder<GtkMenuButton> Mnu_dir_1(display, screen, window, gc, &styles, 1700, 10, 110, 30);
Mnu_dir_1.w.set_text("Mnu_dir_1");
lg::Holder<GtkMenuButton> Mnu_dir_2(display, screen, window, gc, &styles, 1830, 10, 110, 30);
Mnu_dir_2.w.set_text("Mnu_dir_2");
Mnu_dir_2.w.set_direction(2);
lg::Holder<GtkMenuButton> Mnu_dir_3(display, screen, window, gc, &styles, 1960, 10, 110, 30);
Mnu_dir_3.w.set_text("Mnu_dir_3");
Mnu_dir_3.w.set_direction(3);
lg::Holder<GtkMenuButton> Mnu_dir_4(display, screen, window, gc, &styles, 2090, 10, 110, 30);
Mnu_dir_4.w.set_text("Mnu_dir_4");
Mnu_dir_4.w.set_direction(4);
lg::Holder<GtkTextView> Txt_wrap_0(display, screen, window, gc, &styles, 2220, 10, 220, 120);
Txt_wrap_0.w.set_editable(true);
Txt_wrap_0.w.set_wrap_mode(false);
+6
View File
@@ -61,6 +61,11 @@ int main() {
lg::Holder<GtkButton> Button_001(display, screen, window, gc, &styles, 10, 38, 100, 30);
Button_001.w.set_text("Button_001");
std::vector<lg::IWidget*> widgets = { &menubar, &Button_001 };
// Anchors (Phase 1, Flag 1): minimal anchor layout. Each anchored widget is repositioned/resized from its design geometry when the window resizes; top+left alone is static and needs no code.
auto apply_anchors = [&](int new_w, int new_h) {
(void)new_h;
menubar.set_bounds(0, 0, new_w, 28);
};
auto redraw_all = [&]() {
XClearWindow(display, window);
for (lg::IWidget* wd : widgets) wd->draw();
@@ -103,6 +108,7 @@ int main() {
break;
}
case ConfigureNotify:
apply_anchors(event.xconfigure.width, event.xconfigure.height);
handled = true;
break;
case ClientMessage: