From 6cb1b3d2f2f58ddfecc022b7a3b9e41322978388 Mon Sep 17 00:00:00 2001 From: cnmcdee Date: Mon, 30 Nov 2026 11:57:42 +0000 Subject: [PATCH] Phase 3: widget setters for Inspector props (ProgressBar, SpinEdit, Calendar, Image, Notebook, ToggleButton, ListView, TreeView, Splitter, StatusBar, ToolBar, ColorButton, Shape, Spreadsheet, Window) --- widgets/components/GtkCalendar/GtkCalendar.h | 106 ++++++- .../GtkColorButton/GtkColorButton.h | 71 +++++ widgets/components/GtkImage/GtkImage.h | 109 ++++++- widgets/components/GtkListView/GtkListView.h | 209 +++++++++++++- widgets/components/GtkMenuBar/GtkMenuBar.h | 14 + widgets/components/GtkNotebook/GtkNotebook.h | 138 ++++++++- widgets/components/GtkPaned/GtkPaned.h | 182 +++++++++++- .../GtkProgressBar/GtkProgressBar.h | 114 ++++++++ .../components/GtkSpinButton/GtkSpinButton.h | 48 ++++ .../components/GtkStatusbar/GtkStatusbar.h | 36 ++- .../GtkToggleButton/GtkToggleButton.h | 65 ++++- widgets/components/GtkToolbar/GtkToolbar.h | 60 +++- widgets/components/GtkTreeView/GtkTreeView.h | 272 +++++++++++++++--- widgets/components/GtkWindow/GtkWindow.h | 89 ++++++ widgets/components/TShape/TShape.h | 21 ++ .../components/XSpreadsheet/XSpreadsheet.h | 58 +++- 16 files changed, 1510 insertions(+), 82 deletions(-) diff --git a/widgets/components/GtkCalendar/GtkCalendar.h b/widgets/components/GtkCalendar/GtkCalendar.h index a26d39e..4121c2b 100644 --- a/widgets/components/GtkCalendar/GtkCalendar.h +++ b/widgets/components/GtkCalendar/GtkCalendar.h @@ -59,6 +59,8 @@ private: bool show_day_names_ = true; + bool show_week_numbers_ = false; // Phase 3 (§2.15) + // Getter/setter pass: colours formerly hardcoded in draw()/helpers. Srgb dim_text_color_{110, 110, 110}; Srgb grid_color_{205, 205, 205}; @@ -466,6 +468,25 @@ public: } + // Phase 3 (§2.15): ShowWeekNumbers — a week-number gutter at the + // left of the day grid. + + void set_show_week_numbers(bool s) + + { + + show_week_numbers_ = s; + + } + + bool get_show_week_numbers() + + { + + return show_week_numbers_; + + } + std::string date_string() { @@ -510,7 +531,52 @@ public: { - return std::max(1, width() / 7); + return std::max(1, (width() - week_gutter()) / 7); + + } + + // Phase 3 (§2.15): week-number gutter. + + int week_gutter() + + { + + return show_week_numbers_ ? 26 : 0; + + } + + int grid_x0() + + { + + return x1_ + week_gutter(); + + } + + // Sunday-start week number of the week holding the first valid + // day of a grid row (week 1 holds Jan 1). + + int week_number_for(int row) + + { + + for (int c = 0; c < 7; ++c) + + { + + int d = day_at_cell(row, c); + + if (d == 0) continue; + + int doy = d; + + for (int m = 1; m < month_; ++m) doy += days_in_month(year_, m); + + return (doy + weekday_of(year_, 1, 1) - 1) / 7 + 1; + + } + + return 0; } @@ -584,7 +650,7 @@ public: } - col = (x - x1_) / cell_w(); + col = (x - grid_x0()) / cell_w(); row = (y - grid_top()) / cell_h(); @@ -678,7 +744,7 @@ public: { - xf::draw_text_centered(display_, window_, gc_, dim, x1_ + c * cw, y1_ + header_h(), x1_ + (c + 1) * cw, y1_ + header_h() + names_h(), dow[c]); + xf::draw_text_centered(display_, window_, gc_, dim, grid_x0() + c * cw, y1_ + header_h(), grid_x0() + (c + 1) * cw, y1_ + header_h() + names_h(), dow[c]); } @@ -694,7 +760,7 @@ public: { - XDrawLine(display_, window_, gc_, x1_ + c * cw, top, x1_ + c * cw, top + 6 * ch); + XDrawLine(display_, window_, gc_, grid_x0() + c * cw, top, grid_x0() + c * cw, top + 6 * ch); } @@ -702,7 +768,35 @@ public: { - XDrawLine(display_, window_, gc_, x1_, top + r * ch, x2_ - 1, top + r * ch); + XDrawLine(display_, window_, gc_, grid_x0(), top + r * ch, x2_ - 1, top + r * ch); + + } + + // Week numbers in the gutter (Phase 3, §2.15). + + if (show_week_numbers_) + + { + + SStyle wdim = st; + + wdim.text_color_ = styles_->get_color_rgb(dim_text_color_.r, dim_text_color_.g, dim_text_color_.b); + + for (int r = 0; r < 6; ++r) + + { + + int wn = week_number_for(r); + + if (wn == 0) continue; + + char buf[16]; + + std::snprintf(buf, sizeof(buf), "%d", wn); + + xf::draw_text_centered(display_, window_, gc_, wdim, x1_, top + r * ch, grid_x0(), top + (r + 1) * ch, buf); + + } } @@ -724,7 +818,7 @@ public: } - int cx1 = x1_ + c * cw; + int cx1 = grid_x0() + c * cw; int cy1 = top + r * ch; diff --git a/widgets/components/GtkColorButton/GtkColorButton.h b/widgets/components/GtkColorButton/GtkColorButton.h index 95e67c2..54d3709 100644 --- a/widgets/components/GtkColorButton/GtkColorButton.h +++ b/widgets/components/GtkColorButton/GtkColorButton.h @@ -38,6 +38,13 @@ private: Srgb color_ = {52, 101, 164}; // a GTK-ish blue, so the swatch shows at once + // Phase 3 (§2.16): Style / DefaultColor / NoneColor. + int style_ = 0; // 0 standard, 1 extended, 2 system, 3 custom + + Srgb default_color_ = {255, 255, 255}; + + Srgb none_color_ = {0, 0, 0}; + // Colours exposed by the getter/setter pass; defaults are the old hardcoded values. Srgb disabled_text_color_ = {140, 140, 140}; @@ -230,6 +237,70 @@ public: } + void set_style(int s) + + { + + style_ = s; + + } + + int get_style() + + { + + return style_; + + } + + void set_default_color(Srgb c) + + { + + default_color_ = c; + + } + + void set_default_color_rgb(int r, int g, int b) + + { + + default_color_ = Srgb{r, g, b}; + + } + + Srgb get_default_color() + + { + + return default_color_; + + } + + void set_none_color(Srgb c) + + { + + none_color_ = c; + + } + + void set_none_color_rgb(int r, int g, int b) + + { + + none_color_ = Srgb{r, g, b}; + + } + + Srgb get_none_color() + + { + + return none_color_; + + } + //endregion void draw() diff --git a/widgets/components/GtkImage/GtkImage.h b/widgets/components/GtkImage/GtkImage.h index fed94d5..ff2171f 100644 --- a/widgets/components/GtkImage/GtkImage.h +++ b/widgets/components/GtkImage/GtkImage.h @@ -47,6 +47,15 @@ private: int pixel_size_ = -1; // -1 = use the widget bounds + // Phase 3 (§2.12): Stretch / Proportional / Center / Transparent. + bool stretch_ = false; + + bool proportional_ = true; + + bool center_ = true; + + bool transparent_ = false; + // Getter/setter pass: colours formerly hardcoded in draw()/helpers. Srgb sky_color_{135, 190, 235}; Srgb sun_color_{250, 215, 60}; @@ -265,21 +274,105 @@ public: } + void set_stretch(bool s) + + { + + stretch_ = s; + + } + + bool get_stretch() + + { + + return stretch_; + + } + + void set_proportional(bool s) + + { + + proportional_ = s; + + } + + bool get_proportional() + + { + + return proportional_; + + } + + void set_center(bool s) + + { + + center_ = s; + + } + + bool get_center() + + { + + return center_; + + } + + void set_transparent(bool s) + + { + + transparent_ = s; + + } + + bool get_transparent() + + { + + return transparent_; + + } + // The square the picture itself is drawn into, centred. void image_rect(int& rx, int& ry, int& rw, int& rh) { + // Phase 3 (§2.12): Stretch fills the bounds; otherwise the + // picture stays square (its natural aspect here) and is + // centred unless Center is off. + + if (stretch_) + + { + + rw = width(); + + rh = height(); + + rx = x1_; + + ry = y1_; + + return; + + } + int side = pixel_size_ > 0 ? pixel_size_ : std::min(width(), height()); rw = side; rh = side; - rx = x1_ + (width() - rw) / 2; + rx = center_ ? x1_ + (width() - rw) / 2 : x1_; - ry = y1_ + (height() - rh) / 2; + ry = center_ ? y1_ + (height() - rh) / 2 : y1_; } @@ -442,9 +535,17 @@ public: } - XSetForeground(display_, gc_, st.lineColor_); + // Phase 3 (§2.12): Transparent draws no frame around the picture. - XDrawRectangle(display_, window_, gc_, rx, ry, rw - 1, rh - 1); + if (!transparent_) + + { + + XSetForeground(display_, gc_, st.lineColor_); + + XDrawRectangle(display_, window_, gc_, rx, ry, rw - 1, rh - 1); + + } if (!filename_.empty()) diff --git a/widgets/components/GtkListView/GtkListView.h b/widgets/components/GtkListView/GtkListView.h index d4983a0..18a7ae1 100644 --- a/widgets/components/GtkListView/GtkListView.h +++ b/widgets/components/GtkListView/GtkListView.h @@ -44,6 +44,18 @@ private: int row_height_ = 22; + // Phase 3 (§2.17): ViewStyle / GridLines / RowSelect / + // MultiSelect / SortType. + int view_style_ = 0; // 0 report, 1 icon, 2 small icon, 3 list + + bool grid_lines_ = false; + + bool row_select_ = true; + + bool multi_select_ = false; + + int sort_type_ = 0; // 0 none, 1 ascending, 2 descending + bool dragging_ = false; int band_x0_ = 0; @@ -363,6 +375,50 @@ public: } + void set_selected_row(int r) + + { + + select_row(r); + + } + + // Phase 3 (§2.17): rebuild items from "Row 1;Row 2" text. + + void set_items(const std::string& items) + + { + + clear_items(); + + size_t pos = 0; + + while (true) + + { + + size_t semi = items.find(';', pos); + + add_item(items.substr(pos, semi == std::string::npos ? semi : semi - pos)); + + if (semi == std::string::npos) break; + + pos = semi + 1; + + } + + if (!selected_.empty()) + + { + + selected_[0] = true; + + anchor_row_ = 0; + + } + + } + void set_scroll_row(int row) { @@ -389,6 +445,83 @@ public: int get_row_height() { return row_height_; } void set_selected(const std::vector& v) { selected_ = v; } const std::vector& get_selected() { return selected_; } + + //region GtkListView view properties (Phase 3, §2.17) + void set_view_style(int v) { view_style_ = v; } + int get_view_style() { return view_style_; } + void set_grid_lines(bool v) { grid_lines_ = v; } + bool get_grid_lines() { return grid_lines_; } + void set_row_select(bool v) { row_select_ = v; } + bool get_row_select() { return row_select_; } + void set_multi_select(bool v) { multi_select_ = v; } + bool get_multi_select() { return multi_select_; } + void set_sort_type(int s) + { + sort_type_ = s; + if (sort_type_ == 0) return; + std::vector> pairs; + for (size_t i = 0; i < items_.size(); ++i) + { + pairs.push_back({items_[i], selected_[i]}); + } + std::sort(pairs.begin(), pairs.end(), + [this](const std::pair& a, + const std::pair& b) { + return sort_type_ == 1 ? a.first < b.first + : a.first > b.first; + }); + for (size_t i = 0; i < pairs.size(); ++i) + { + items_[i] = pairs[i].first; + selected_[i] = pairs[i].second; + } + } + int get_sort_type() { return sort_type_; } + //endregion + // Icon grid (1) and multi-column list (3) views. + void draw_alt_view(unsigned long sel_fill) + { + SStyle st = style(); + if (view_style_ == 1) + { + int cw = 76, ch = 60; + int cols = std::max(1, (width() - 4) / cw); + for (int i = scroll_row_; i < (int)items_.size(); ++i) + { + int pos = i - scroll_row_; + int cx = x1_ + 2 + (pos % cols) * cw; + int cy = y1_ + 2 + (pos / cols) * ch; + if (cy + ch > y2_ - 2) break; + if (selected_[i]) + { + XSetForeground(display_, gc_, sel_fill); + XFillRectangle(display_, window_, gc_, cx, cy, cw - 2, ch - 2); + } + XSetForeground(display_, gc_, st.lineColor_); + XDrawRectangle(display_, window_, gc_, cx + cw / 2 - 12, cy + 4, 24, 24); + xf::draw_text_centered(display_, window_, gc_, st, cx, cy + 30, cx + cw - 2, cy + ch, items_[i]); + } + return; + } + int col_w = 150; + int cols = std::max(1, (width() - 4) / col_w); + int rows_per_col = std::max(1, (height() - 4) / row_height_); + for (int i = scroll_row_; i < (int)items_.size(); ++i) + { + int pos = i - scroll_row_; + int col = pos / rows_per_col; + int row = pos % rows_per_col; + if (col >= cols) break; + int cx = x1_ + 2 + col * col_w; + int ry = y1_ + 2 + row * row_height_; + if (selected_[i]) + { + XSetForeground(display_, gc_, sel_fill); + XFillRectangle(display_, window_, gc_, cx, ry, col_w - 2, row_height_); + } + xf::draw_text_left(display_, window_, gc_, st, cx + 6, ry, ry + row_height_, items_[i]); + } + } //endregion void draw() @@ -411,6 +544,18 @@ public: unsigned long band_fill = styles_->get_color_rgb(band_fill_color_.r, band_fill_color_.g, band_fill_color_.b); + // Phase 3 (§2.17): icon / list views branch out of the report loop. + + if (view_style_ == 1 || view_style_ == 3) + + { + + draw_alt_view(sel_fill); + + } + + else + for (int i = scroll_row_; i < (int)items_.size(); ++i) { @@ -439,7 +584,35 @@ public: } - xf::draw_text_left(display_, window_, gc_, row_style, x1_ + 8, ry, ry + row_height_, items_[i]); + if (view_style_ == 2) + + { + + XSetForeground(display_, gc_, st.lineColor_); + + XDrawRectangle(display_, window_, gc_, x1_ + 8, ry + (row_height_ - 14) / 2, 14, 14); + + xf::draw_text_left(display_, window_, gc_, row_style, x1_ + 26, ry, ry + row_height_, items_[i]); + + } + + else + + { + + xf::draw_text_left(display_, window_, gc_, row_style, x1_ + 8, ry, ry + row_height_, items_[i]); + + } + + if (grid_lines_) + + { + + XSetForeground(display_, gc_, st.lineColor_); + + XDrawLine(display_, window_, gc_, x1_ + 2, ry + row_height_, x2_ - 2, ry + row_height_); + + } } @@ -521,21 +694,45 @@ public: int row = row_at(y); - for (size_t i = 0; i < selected_.size(); ++i) + // Phase 3 (§2.17): multi-select toggles; single-select replaces. + + if (multi_select_ && row >= 0 && selected_[row]) { - selected_[i] = false; + selected_[row] = false; + + anchor_row_ = row; } - if (row >= 0) + else { - selected_[row] = true; + if (!multi_select_) - anchor_row_ = row; + { + + for (size_t i = 0; i < selected_.size(); ++i) + + { + + selected_[i] = false; + + } + + } + + if (row >= 0) + + { + + selected_[row] = true; + + anchor_row_ = row; + + } } diff --git a/widgets/components/GtkMenuBar/GtkMenuBar.h b/widgets/components/GtkMenuBar/GtkMenuBar.h index 9b31417..41d1497 100644 --- a/widgets/components/GtkMenuBar/GtkMenuBar.h +++ b/widgets/components/GtkMenuBar/GtkMenuBar.h @@ -392,6 +392,20 @@ public: void set_dropdowns(const std::vector>& v) { dropdowns_ = v; } const std::vector>& get_dropdowns() { return dropdowns_; } void set_items(const std::vector& v) { items_ = v; } + + // Phase 3 (§2.19): rebuild the top-level menus from "File|Edit" text. + void set_items(const std::string& menus) + { + items_.clear(); + size_t pos = 0; + while (true) + { + size_t bar = menus.find('|', pos); + items_.push_back(menus.substr(pos, bar == std::string::npos ? bar : bar - pos)); + if (bar == std::string::npos) break; + pos = bar + 1; + } + } const std::vector& get_items() { return items_; } //endregion diff --git a/widgets/components/GtkNotebook/GtkNotebook.h b/widgets/components/GtkNotebook/GtkNotebook.h index 9caacd5..f7c72bb 100644 --- a/widgets/components/GtkNotebook/GtkNotebook.h +++ b/widgets/components/GtkNotebook/GtkNotebook.h @@ -56,6 +56,10 @@ private: int tab_height_ = 26; + int tab_width_ = 0; // Phase 3 (§2.18): 0 = auto (label + padding) + + int tab_position_ = 0; // Phase 3 (§2.18): 0 top, 1 bottom, 2 left, 3 right + // Colours exposed by the getter/setter pass; defaults are the old hardcoded values. Srgb disabled_text_color_ = {140, 140, 140}; @@ -314,6 +318,38 @@ public: } + void set_tab_width(int v) + + { + + tab_width_ = v; + + } + + int get_tab_width() + + { + + return tab_width_; + + } + + void set_tab_position(int v) + + { + + tab_position_ = v; + + } + + int get_tab_position() + + { + + return tab_position_; + + } + SStyle style() { @@ -410,29 +446,93 @@ public: } - Rect tab_rect(int index) + // Phase 3 (§2.18): rebuild the pages from "Tab 1|Tab 2" text. + + void set_items(const std::string& pages) + + { + + pages_.clear(); + + size_t pos = 0; + + while (true) + + { + + size_t bar = pages.find('|', pos); + + pages_.push_back(pages.substr(pos, bar == std::string::npos ? bar : bar - pos)); + + if (bar == std::string::npos) break; + + pos = bar + 1; + + } + + if (current_page_ >= (int)pages_.size()) current_page_ = 0; + + } + + // Phase 3 (§2.18): tab width/position. Left/right tabs stack + // vertically in a strip (tab_width_ or 96 wide); the press test + // already uses tab_rect, so clicks follow the strip. + + int tab_w_for(int index) { SStyle st = style(); + if (tab_width_ > 0) return tab_width_; + + if (index >= 0 && index < (int)pages_.size()) + + { + + return xf::text_width(st, pages_[index]) + 24; + + } + + return 0; + + } + + Rect tab_rect(int index) + + { + + if (tab_position_ == 2 || tab_position_ == 3) + + { + + int strip = tab_width_ > 0 ? tab_width_ : 96; + + int tx = tab_position_ == 2 ? x1_ : x2_ - strip; + + int ty = y1_ + 4 + index * tab_height_; + + return Rect{tx, ty, tx + strip, ty + tab_height_}; + + } + int tx = x1_ + 4; for (int i = 0; i < index && i < (int)pages_.size(); ++i) { - tx += xf::text_width(st, pages_[i]) + 24; + tx += tab_w_for(i); } - int tw = 0; + int tw = tab_w_for(index); - if (index >= 0 && index < (int)pages_.size()) + if (tab_position_ == 1) { - tw = xf::text_width(st, pages_[index]) + 24; + return Rect{tx, y2_ - tab_height_, tx + tw, y2_}; } @@ -444,6 +544,34 @@ public: { + if (tab_position_ == 1) + + { + + return Rect{x1_, y1_, x2_, y2_ - tab_height_}; + + } + + if (tab_position_ == 2) + + { + + int strip = tab_width_ > 0 ? tab_width_ : 96; + + return Rect{x1_ + strip, y1_, x2_, y2_}; + + } + + if (tab_position_ == 3) + + { + + int strip = tab_width_ > 0 ? tab_width_ : 96; + + return Rect{x1_, y1_, x2_ - strip, y2_}; + + } + return Rect{x1_, y1_ + tab_height_, x2_, y2_}; } diff --git a/widgets/components/GtkPaned/GtkPaned.h b/widgets/components/GtkPaned/GtkPaned.h index 89bc2a6..2c45a94 100644 --- a/widgets/components/GtkPaned/GtkPaned.h +++ b/widgets/components/GtkPaned/GtkPaned.h @@ -54,6 +54,15 @@ private: int position_ = 160; + // Phase 3 (§2.19): MinSize / ResizeStyle / AutoSnap. + int min_size_ = 0; + + int resize_style_ = 0; // 0 live update, 1 rubber-band line + + bool auto_snap_ = false; + + int drag_pos_ = -1; // rubber-band position while dragging + bool dragging_ = false; int handle_size_ = 10; @@ -308,19 +317,56 @@ public: int span = (orientation_ == 0) ? width() : height(); - if (position_ < 40) + int lo = std::max(40, min_size_); + + int hi = span - std::max(40, min_size_); + + if (position_ < lo) { - position_ = 40; + position_ = lo; } - if (position_ > span - 40 && span - 40 >= 40) + if (position_ > hi && hi >= lo) { - position_ = span - 40; + position_ = hi; + + } + + } + + // Phase 3 (§2.19): AutoSnap pulls the divider to the nearest edge + // when it is released (or set) within 16px of it. + + void maybe_snap() + + { + + if (!auto_snap_) return; + + int span = (orientation_ == 0) ? width() : height(); + + int lo = std::max(handle_size_, min_size_); + + int hi = std::max(lo, span - std::max(handle_size_, min_size_)); + + if (position_ - lo <= 16) + + { + + position_ = lo; + + } + + else if (hi - position_ <= 16) + + { + + position_ = hi; } @@ -334,6 +380,8 @@ public: clamp_position(); + maybe_snap(); + } int get_position() @@ -362,6 +410,56 @@ public: } + void set_min_size(int v) + + { + + min_size_ = v; + + clamp_position(); + + } + + int get_min_size() + + { + + return min_size_; + + } + + void set_resize_style(int v) + + { + + resize_style_ = v; + + } + + int get_resize_style() + + { + + return resize_style_; + + } + + void set_auto_snap(bool v) + + { + + auto_snap_ = v; + + } + + bool get_auto_snap() + + { + + return auto_snap_; + + } + bool is_horizontal() { @@ -500,6 +598,32 @@ public: } + // Rubber-band divider while dragging with resize-style 1. + + if (dragging_ && resize_style_ == 1 && drag_pos_ >= 0) + + { + + XSetForeground(display_, gc_, st.lineColor_); + + if (orientation_ == 0) + + { + + XDrawLine(display_, window_, gc_, x1_ + drag_pos_, y1_, x1_ + drag_pos_, y2_); + + } + + else + + { + + XDrawLine(display_, window_, gc_, x1_, y1_ + drag_pos_, x2_, y1_ + drag_pos_); + + } + + } + if (focused_) { @@ -558,6 +682,26 @@ public: } + // Rubber-band (resize-style 1): the divider moves on release. + + if (resize_style_ == 1 && drag_pos_ >= 0) + + { + + set_position(drag_pos_); + + drag_pos_ = -1; + + if (on_position_changed) + + { + + on_position_changed(position_); + + } + + } + dragging_ = false; return true; @@ -576,24 +720,36 @@ public: } - if (orientation_ == 0) + int np = (orientation_ == 0) ? x - x1_ : y - y1_; + + if (resize_style_ == 1) { - position_ = x - x1_; + // Rubber-band: show the line, move the divider on release. + + int span = (orientation_ == 0) ? width() : height(); + + int lo = std::max(handle_size_, min_size_); + + int hi = std::max(lo, span - std::max(handle_size_, min_size_)); + + drag_pos_ = np; + + if (drag_pos_ < lo) drag_pos_ = lo; + + if (drag_pos_ > hi) drag_pos_ = hi; + + return true; } - else - - { - - position_ = y - y1_; - - } + position_ = np; clamp_position(); + maybe_snap(); + if (on_position_changed) { diff --git a/widgets/components/GtkProgressBar/GtkProgressBar.h b/widgets/components/GtkProgressBar/GtkProgressBar.h index 7f40427..c2ebe94 100644 --- a/widgets/components/GtkProgressBar/GtkProgressBar.h +++ b/widgets/components/GtkProgressBar/GtkProgressBar.h @@ -54,6 +54,15 @@ private: bool inverted_ = false; + // Phase 3 (§2.13): Position/Min/Max/Step over fraction_. + double min_ = 0.0; + + double max_ = 100.0; + + double position_ = 45.0; + + double step_ = 1.0; + // Getter/setter pass: colours formerly hardcoded in draw()/helpers. Srgb trough_color_{225, 225, 225}; Srgb bar_color_{52, 101, 164}; @@ -203,6 +212,8 @@ public: fraction_ = std::max(0.0, std::min(1.0, f)); + position_ = min_ + fraction_ * (max_ - min_); + } double get_fraction() @@ -261,6 +272,109 @@ public: } + // Phase 3 (§2.13): Position/Min/Max/Step as a convenience over + // fraction_ — fraction_ is always (position_ - min_) / (max_ - min_). + + void recompute_fraction() + + { + + if (max_ > min_) + + { + + fraction_ = std::max(0.0, std::min(1.0, (position_ - min_) / (max_ - min_))); + + } + + else + + { + + fraction_ = 0.0; + + } + + } + + void set_position(double p) + + { + + position_ = p; + + recompute_fraction(); + + } + + double get_position() + + { + + return position_; + + } + + void set_min(double v) + + { + + min_ = v; + + recompute_fraction(); + + } + + double get_min() + + { + + return min_; + + } + + void set_max(double v) + + { + + max_ = v; + + recompute_fraction(); + + } + + double get_max() + + { + + return max_; + + } + + void set_step(double s) + + { + + step_ = s; + + } + + double get_step() + + { + + return step_; + + } + + void step_it() + + { + + set_position(position_ + step_); + + } + // One step of activity-mode animation: the block bounces. void pulse() diff --git a/widgets/components/GtkSpinButton/GtkSpinButton.h b/widgets/components/GtkSpinButton/GtkSpinButton.h index 1925362..7df7b75 100644 --- a/widgets/components/GtkSpinButton/GtkSpinButton.h +++ b/widgets/components/GtkSpinButton/GtkSpinButton.h @@ -50,6 +50,8 @@ private: bool wrap_ = false; + bool editable_ = true; // Phase 3 (§2.14): EditorEnabled + int cursor_ = 0; bool blink_on_ = true; @@ -394,6 +396,41 @@ public: } + // Phase 3 (§2.14): EditorEnabled — when false the text part cannot + // be typed into; the arrow keys / arrow zones still step the value. + + void set_editable(bool e) + + { + + editable_ = e; + + } + + bool get_editable() + + { + + return editable_; + + } + + void set_step(double s) + + { + + step_increment_ = s; + + } + + double get_step() + + { + + return step_increment_; + + } + void set_value(double v) { @@ -795,6 +832,17 @@ public: } + // Phase 3 (§2.14): EditorEnabled=false blocks typing (arrows, + // Return and the arrow zones above still step the value). + + if (!editable_) + + { + + return false; + + } + if (key == XK_Left) { diff --git a/widgets/components/GtkStatusbar/GtkStatusbar.h b/widgets/components/GtkStatusbar/GtkStatusbar.h index 5cf9951..f74c0dd 100644 --- a/widgets/components/GtkStatusbar/GtkStatusbar.h +++ b/widgets/components/GtkStatusbar/GtkStatusbar.h @@ -40,6 +40,8 @@ private: std::vector messages_; // back() is showing + bool size_grip_ = true; // Phase 3 (§2.19): SizeGrip + int next_id_ = 1; // Getter/setter pass: colours formerly hardcoded in draw()/helpers. @@ -269,6 +271,22 @@ public: //region GtkStatusbar properties (getter/setter pass) void set_messages(const std::vector& v) { messages_ = v; } const std::vector& get_messages() { return messages_; } + + // Phase 3 (§2.19): Panels — pipe-separated messages; back() shows. + void set_items(const std::string& panels) + { + messages_.clear(); + size_t pos = 0; + while (true) + { + size_t bar = panels.find('|', pos); + messages_.push_back(panels.substr(pos, bar == std::string::npos ? bar : bar - pos)); + if (bar == std::string::npos) break; + pos = bar + 1; + } + } + void set_size_grip(bool g) { size_grip_ = g; } + bool get_size_grip() { return size_grip_; } //endregion void draw() @@ -309,7 +327,7 @@ public: std::string msg = current_message(); - while (!msg.empty() && xf::text_width(st, msg) > width() - 28) + while (!msg.empty() && xf::text_width(st, msg) > width() - (size_grip_ ? 28 : 6)) { @@ -331,15 +349,21 @@ public: // Resize grip: three diagonal lines in the bottom-right. - XSetForeground(display_, gc_, styles_->get_color_rgb(resize_grip_color_.r, resize_grip_color_.g, resize_grip_color_.b)); - - for (int i = 0; i < 3; ++i) + if (size_grip_) { - int off = 4 + i * 4; + XSetForeground(display_, gc_, styles_->get_color_rgb(resize_grip_color_.r, resize_grip_color_.g, resize_grip_color_.b)); - XDrawLine(display_, window_, gc_, x2_ - off, y2_ - 2, x2_ - 2, y2_ - off); + for (int i = 0; i < 3; ++i) + + { + + int off = 4 + i * 4; + + XDrawLine(display_, window_, gc_, x2_ - off, y2_ - 2, x2_ - 2, y2_ - off); + + } } diff --git a/widgets/components/GtkToggleButton/GtkToggleButton.h b/widgets/components/GtkToggleButton/GtkToggleButton.h index bf0ee1b..4530019 100644 --- a/widgets/components/GtkToggleButton/GtkToggleButton.h +++ b/widgets/components/GtkToggleButton/GtkToggleButton.h @@ -38,6 +38,13 @@ private: bool active_ = false; + // Phase 3 (§2.21): SpeedButton group / flat state. + int group_index_ = 0; + + bool allow_all_up_ = false; + + bool flat_ = false; + // Colours exposed by the getter/setter pass; defaults are the old hardcoded values. Srgb disabled_text_color_ = {140, 140, 140}; @@ -238,6 +245,54 @@ public: } + void set_group_index(int g) + + { + + group_index_ = g; + + } + + int get_group_index() + + { + + return group_index_; + + } + + void set_allow_all_up(bool a) + + { + + allow_all_up_ = a; + + } + + bool get_allow_all_up() + + { + + return allow_all_up_; + + } + + void set_flat(bool f) + + { + + flat_ = f; + + } + + bool get_flat() + + { + + return flat_; + + } + void toggle() { @@ -284,7 +339,15 @@ public: } - xf::draw_polished(display_, window_, gc_, st, x1_, y1_, x2_, y2_); + // Phase 3 (§2.21): Flat draws no button face until pressed/active. + + if (!flat_ || active_ || pressed_) + + { + + xf::draw_polished(display_, window_, gc_, st, x1_, y1_, x2_, y2_); + + } xf::draw_text_centered(display_, window_, gc_, st, x1_, y1_, x2_, y2_, text_); diff --git a/widgets/components/GtkToolbar/GtkToolbar.h b/widgets/components/GtkToolbar/GtkToolbar.h index 80ccd56..a0c761f 100644 --- a/widgets/components/GtkToolbar/GtkToolbar.h +++ b/widgets/components/GtkToolbar/GtkToolbar.h @@ -40,10 +40,23 @@ private: int hover_ = -1; + // Phase 3 (§2.19): ShowCaptions / Flat / ButtonWidth / ButtonHeight. + bool show_captions_ = true; + + bool flat_ = false; + + int button_width_ = 0; // 0 = auto (label width + padding) + + int button_height_ = 0; // 0 = full height + int zone_w(int index) { + if (button_width_ > 0) return button_width_; + + if (!show_captions_) return 34; + SStyle st = style(); return xf::text_width(st, items_[index]) + 34; @@ -344,7 +357,32 @@ public: //endregion //region GtkToolbar properties (getter/setter pass) void set_items(const std::vector& v) { items_ = v; } + + // Phase 3 (§2.19): rebuild the buttons from "New|Open|Save" text. + void set_items(const std::string& items) + { + items_.clear(); + size_t pos = 0; + while (true) + { + size_t bar = items.find('|', pos); + items_.push_back(items.substr(pos, bar == std::string::npos ? bar : bar - pos)); + if (bar == std::string::npos) break; + pos = bar + 1; + } + } const std::vector& get_items() { return items_; } + + //region GtkToolbar view properties (Phase 3, §2.19) + void set_show_captions(bool v) { show_captions_ = v; } + bool get_show_captions() { return show_captions_; } + void set_flat(bool v) { flat_ = v; } + bool get_flat() { return flat_; } + void set_button_width(int v) { button_width_ = v; } + int get_button_width() { return button_width_; } + void set_button_height(int v) { button_height_ = v; } + int get_button_height() { return button_height_; } + //endregion //endregion void draw() @@ -377,23 +415,31 @@ public: int zw = zone_w(i); + // Phase 3 (§2.19): ButtonHeight centres the zone; Flat + // is already the default look (zones draw flat until + // hovered/pressed), so it is stored only. + + int zy0 = button_height_ > 0 ? y1_ + (height() - button_height_) / 2 : y1_ + 3; + + int zh = button_height_ > 0 ? button_height_ : height() - 6; + if (i == pressed_ || i == hover_) { XSetForeground(display_, gc_, hot_fill); - XFillRectangle(display_, window_, gc_, zx + 1, y1_ + 3, zw - 2, height() - 6); + XFillRectangle(display_, window_, gc_, zx + 1, zy0, zw - 2, zh); XSetForeground(display_, gc_, st.lineColor_); - XDrawRectangle(display_, window_, gc_, zx + 1, y1_ + 3, zw - 2, height() - 6); + XDrawRectangle(display_, window_, gc_, zx + 1, zy0, zw - 2, zh); } // Little icon square, then the label. - int iy = (y1_ + y2_) / 2 - 6; + int iy = zy0 + zh / 2 - 6; SStyle icon_style = st; @@ -403,7 +449,13 @@ public: xf::fill_rounded_rect(display_, window_, gc_, icon_style, zx + 5, iy, zx + 17, iy + 12); - xf::draw_text_left(display_, window_, gc_, st, zx + 22, y1_, y2_, items_[i]); + if (show_captions_) + + { + + xf::draw_text_left(display_, window_, gc_, st, zx + 22, y1_, y2_, items_[i]); + + } } diff --git a/widgets/components/GtkTreeView/GtkTreeView.h b/widgets/components/GtkTreeView/GtkTreeView.h index eb750cf..576ea7e 100644 --- a/widgets/components/GtkTreeView/GtkTreeView.h +++ b/widgets/components/GtkTreeView/GtkTreeView.h @@ -85,21 +85,52 @@ private: int header_height_ = 22; + bool headers_visible_ = true; // Phase 3 (§2.17) + int row_height_ = 20; + // Phase 3 (§2.17): GridLines / RowSelect / MultiSelect / + // SortType / Indent / ShowButtons / ShowLines / ShowRoot. + bool grid_lines_ = false; + + bool row_select_ = true; + + bool multi_select_ = false; + + int sort_type_ = 0; // 0 none, 1 ascending, 2 descending + + int indent_ = 16; + + bool show_buttons_ = true; + + bool show_lines_ = true; + + bool show_root_ = true; + + std::vector multi_selected_; + //endregion void flatten_rec(Node& node, int depth, std::vector& out) { - FlatRow row; + // Phase 3 (§2.17): ShowRoot=false hides the root rows; their + // children are promoted to depth 0. - row.node = &node; + if (show_root_ || depth > 0) - row.depth = depth; + { - out.push_back(row); + FlatRow row; + + row.node = &node; + + row.depth = show_root_ ? depth : depth - 1; + + out.push_back(row); + + } if (node.expanded) @@ -135,11 +166,19 @@ private: } + int header_h() + + { + + return headers_visible_ ? header_height_ : 0; + + } + int visible_rows() { - return std::max(1, (height() - header_height_ - 4) / row_height_); + return std::max(1, (height() - header_h() - 4) / row_height_); } @@ -459,6 +498,26 @@ public: } + void set_selected_row(int r) + + { + + std::vector rows = flatten(); + + if (r >= 0 && r < (int)rows.size()) + + { + + selected_row_ = r; + + multi_selected_.clear(); + + keep_selection_visible(); + + } + + } + std::string get_selected_text() { @@ -514,10 +573,92 @@ public: const std::vector& get_columns() { return columns_; } void set_header_height(int v) { header_height_ = v; } int get_header_height() { return header_height_; } + + void set_headers_visible(bool v) { headers_visible_ = v; } + bool get_headers_visible() { return headers_visible_; } void set_roots(const std::vector& v) { roots_ = v; } const std::vector& get_roots() { return roots_; } + + // Phase 3 (§2.17): rebuild the tree from "Root/Child;Other" paths. + void insert_path(std::vector& nodes, const std::vector& segs, size_t i) + { + if (i >= segs.size()) return; + for (size_t k = 0; k < nodes.size(); ++k) + { + if (!nodes[k].cells.empty() && nodes[k].cells[0] == segs[i]) + { + insert_path(nodes[k].children, segs, i + 1); + return; + } + } + Node node = make_node({segs[i]}); + nodes.push_back(node); + insert_path(nodes.back().children, segs, i + 1); + } + void set_items(const std::string& items) + { + roots_.clear(); + size_t pos = 0; + while (true) + { + size_t semi = items.find(';', pos); + std::string path = items.substr(pos, semi == std::string::npos ? semi : semi - pos); + std::vector segs; + size_t sp = 0; + while (true) + { + size_t slash = path.find('/', sp); + segs.push_back(path.substr(sp, slash == std::string::npos ? slash : slash - sp)); + if (slash == std::string::npos) break; + sp = slash + 1; + } + if (!(segs.size() == 1 && segs[0].empty())) + { + insert_path(roots_, segs, 0); + } + if (semi == std::string::npos) break; + pos = semi + 1; + } + selected_row_ = 0; + multi_selected_.clear(); + scroll_row_ = 0; + } void set_row_height(int v) { row_height_ = v; } int get_row_height() { return row_height_; } + + //region GtkTreeView view properties (Phase 3, §2.17) + void set_grid_lines(bool v) { grid_lines_ = v; } + bool get_grid_lines() { return grid_lines_; } + void set_row_select(bool v) { row_select_ = v; } + bool get_row_select() { return row_select_; } + void set_multi_select(bool v) { multi_select_ = v; } + bool get_multi_select() { return multi_select_; } + void sort_nodes(std::vector& nodes) + { + if (sort_type_ == 0) return; + std::sort(nodes.begin(), nodes.end(), + [this](const Node& a, const Node& b) { + std::string av = a.cells.empty() ? "" : a.cells[0]; + std::string bv = b.cells.empty() ? "" : b.cells[0]; + return sort_type_ == 1 ? av < bv : av > bv; + }); + for (size_t i = 0; i < nodes.size(); ++i) sort_nodes(nodes[i].children); + } + void set_sort_type(int s) + { + sort_type_ = s; + sort_nodes(roots_); + } + int get_sort_type() { return sort_type_; } + void set_indent(int v) { indent_ = v; } + int get_indent() { return indent_; } + void set_show_buttons(bool v) { show_buttons_ = v; } + bool get_show_buttons() { return show_buttons_; } + void set_show_lines(bool v) { show_lines_ = v; } + bool get_show_lines() { return show_lines_; } + void set_show_root(bool v) { show_root_ = v; } + bool get_show_root() { return show_root_; } + //endregion //endregion void draw() @@ -536,40 +677,46 @@ public: xf::draw_polished(display_, window_, gc_, st, x1_, y1_, x2_, y2_); - // Header band. + // Header band (Phase 3, §2.17: hidden when headers-visible is off). - unsigned long header_fill = styles_->get_color_rgb(header_fill_color_.r, header_fill_color_.g, header_fill_color_.b); - - XSetForeground(display_, gc_, header_fill); - - XFillRectangle(display_, window_, gc_, x1_ + 1, y1_ + 1, width() - 2, header_height_); - - int col_x = x1_ + 4; - - for (size_t c = 0; c < columns_.size(); ++c) + if (headers_visible_) { - xf::draw_text_left(display_, window_, gc_, st, col_x, y1_ + 1, y1_ + 1 + header_height_, columns_[c].title); + unsigned long header_fill = styles_->get_color_rgb(header_fill_color_.r, header_fill_color_.g, header_fill_color_.b); - col_x += columns_[c].width; + XSetForeground(display_, gc_, header_fill); - if (c + 1 < columns_.size()) + XFillRectangle(display_, window_, gc_, x1_ + 1, y1_ + 1, width() - 2, header_height_); + + int col_x = x1_ + 4; + + for (size_t c = 0; c < columns_.size(); ++c) { - XSetForeground(display_, gc_, st.lineColor_); + xf::draw_text_left(display_, window_, gc_, st, col_x, y1_ + 1, y1_ + 1 + header_height_, columns_[c].title); - XDrawLine(display_, window_, gc_, col_x - 4, y1_ + 3, col_x - 4, y1_ + header_height_ - 3); + col_x += columns_[c].width; + + if (c + 1 < columns_.size()) + + { + + XSetForeground(display_, gc_, st.lineColor_); + + XDrawLine(display_, window_, gc_, col_x - 4, y1_ + 3, col_x - 4, y1_ + header_height_ - 3); + + } } + XSetForeground(display_, gc_, st.lineColor_); + + XDrawLine(display_, window_, gc_, x1_ + 1, y1_ + header_height_ + 1, x2_ - 1, y1_ + header_height_ + 1); + } - XSetForeground(display_, gc_, st.lineColor_); - - XDrawLine(display_, window_, gc_, x1_ + 1, y1_ + header_height_ + 1, x2_ - 1, y1_ + header_height_ + 1); - // Rows. std::vector rows = flatten(); @@ -578,7 +725,7 @@ public: unsigned long guide = styles_->get_color_rgb(guide_color_.r, guide_color_.g, guide_color_.b); - int rows_top = y1_ + header_height_ + 3; + int rows_top = y1_ + header_h() + 3; for (int i = scroll_row_; i < (int)rows.size(); ++i) @@ -596,19 +743,28 @@ public: Node *node = rows[i].node; - if (i == selected_row_) + bool is_sel = (i == selected_row_) || + + (multi_select_ && std::find(multi_selected_.begin(), multi_selected_.end(), i) != multi_selected_.end()); + + if (is_sel) { XSetForeground(display_, gc_, sel_fill); - XFillRectangle(display_, window_, gc_, x1_ + 2, ry, width() - 4, row_height_); + // Phase 3 (§2.17): RowSelect=false highlights the first + // column only. + + int fw = row_select_ ? width() - 4 : (columns_.empty() ? width() - 4 : columns_[0].width); + + XFillRectangle(display_, window_, gc_, x1_ + 2, ry, fw, row_height_); } SStyle row_style = st; - if (i == selected_row_) + if (is_sel) { @@ -616,11 +772,11 @@ public: } - int indent = rows[i].depth * 16; + int indent = rows[i].depth * indent_; // Indent guide line. - if (rows[i].depth > 0) + if (show_lines_ && rows[i].depth > 0) { @@ -632,7 +788,7 @@ public: // Expander triangle. - if (!node->children.empty()) + if (show_buttons_ && !node->children.empty()) { @@ -676,6 +832,16 @@ public: } + if (grid_lines_) + + { + + XSetForeground(display_, gc_, guide); + + XDrawLine(display_, window_, gc_, x1_ + 2, ry + row_height_, x2_ - 2, ry + row_height_); + + } + } if (focused_) @@ -734,7 +900,7 @@ public: } - int rows_top = y1_ + header_height_ + 3; + int rows_top = y1_ + header_h() + 3; if (y < rows_top) @@ -758,11 +924,11 @@ public: Node *node = rows[index].node; - int indent = rows[index].depth * 16; + int indent = rows[index].depth * indent_; // Click on the expander toggles the node instead of selecting. - if (!node->children.empty() && x >= x1_ + 2 + indent && x <= x1_ + 18 + indent) + if (show_buttons_ && !node->children.empty() && x >= x1_ + 2 + indent && x <= x1_ + 18 + indent) { @@ -780,7 +946,43 @@ public: } - if (index != selected_row_) + // Phase 3 (§2.17): multi-select toggles the row in the set. + + if (multi_select_) + + { + + auto it = std::find(multi_selected_.begin(), multi_selected_.end(), index); + + if (it != multi_selected_.end()) + + { + + multi_selected_.erase(it); + + } + + else + + { + + multi_selected_.push_back(index); + + } + + selected_row_ = index; + + if (on_selection_changed) + + { + + on_selection_changed(); + + } + + } + + else if (index != selected_row_) { diff --git a/widgets/components/GtkWindow/GtkWindow.h b/widgets/components/GtkWindow/GtkWindow.h index c01d448..0878a64 100644 --- a/widgets/components/GtkWindow/GtkWindow.h +++ b/widgets/components/GtkWindow/GtkWindow.h @@ -47,6 +47,17 @@ private: bool decorated_ = true; + // Phase 3 (§2.20): window-level Inspector props. + int border_style_ = 0; // 0 default, 1 none, 2 single, 3 dialog + + std::string icon_; + + int position_ = 0; // 0 default, 1 center, 2 screen center, 3 main-form center, 4 designed + + int window_state_ = 0; // 0 normal, 1 minimized, 2 maximized, 3 fullscreen + + bool fullscreen_ = false; + // Title-bar button the mouse is currently over: 0 none, // 1 minimise, 2 maximise, 3 close. @@ -313,6 +324,84 @@ public: } + // Phase 3 (§2.20): BorderStyle / Icon / Position / WindowState. + // BorderStyle none clears the decoration; WindowState drives the + // iconified / maximized / fullscreen flags the widget already has. + + void set_border_style(int v) + + { + + border_style_ = v; + + if (v == 1) decorated_ = false; + + else if (v == 2 || v == 3) decorated_ = true; + + } + + int get_border_style() + + { + + return border_style_; + + } + + void set_icon(std::string p) + + { + + icon_ = p; + + } + + std::string get_icon() + + { + + return icon_; + + } + + void set_position(int v) + + { + + position_ = v; + + } + + int get_position() + + { + + return position_; + + } + + void set_window_state(int v) + + { + + window_state_ = v; + + iconified_ = (v == 1); + + maximized_ = (v == 2); + + fullscreen_ = (v == 3); + + } + + int get_window_state() + + { + + return window_state_; + + } + bool is_closed() { diff --git a/widgets/components/TShape/TShape.h b/widgets/components/TShape/TShape.h index 20bec9b..966ad38 100644 --- a/widgets/components/TShape/TShape.h +++ b/widgets/components/TShape/TShape.h @@ -275,6 +275,17 @@ public: } + // Phase 3 (§2.19): int overload so the Inspector/generator can set + // the shape by its TShapeType ordinal (0 Rectangle .. 9 Hexagon). + + void set_shape(int s) + + { + + if (s >= 0 && s <= 9) shape_ = (TShapeType)s; + + } + void set_brush_color(Srgb c) { @@ -291,6 +302,16 @@ public: } + // Phase 3 (§2.19): fill-color is the brush colour. + + void set_fill_color(Srgb c) + + { + + set_brush_color(c); + + } + void set_pen_color(Srgb c) { diff --git a/widgets/components/XSpreadsheet/XSpreadsheet.h b/widgets/components/XSpreadsheet/XSpreadsheet.h index 4c4d7a3..0791fd1 100644 --- a/widgets/components/XSpreadsheet/XSpreadsheet.h +++ b/widgets/components/XSpreadsheet/XSpreadsheet.h @@ -80,6 +80,11 @@ private: int row_height_ = 20; + // Phase 3 (§2.19): DefaultColWidth / GridLineWidth. + int default_col_width_ = 84; + + int grid_line_width_ = 1; + int header_w_ = 46; // row-number gutter int header_h_ = 22; // column-letter band @@ -157,7 +162,7 @@ public: cells_.assign(cols_, std::vector(rows_)); - col_widths_.assign(cols_, 84); + col_widths_.assign(cols_, default_col_width_); // Preload a small working example: a parts list with a // formula column and totals, so the demo shows the engine. @@ -324,7 +329,7 @@ public: cells_.assign(cols_, std::vector(rows_)); - col_widths_.assign(cols_, 84); + col_widths_.assign(cols_, default_col_width_); active_col_ = active_row_ = sel_col_ = sel_row_ = 0; @@ -386,6 +391,43 @@ public: } + // Phase 3 (§2.19): DefaultColWidth re-widths every column; + // GridLineWidth is the cell/header grid outline width. + + void set_default_col_width(int w) + + { + + default_col_width_ = std::max(24, w); + + for (size_t i = 0; i < col_widths_.size(); ++i) col_widths_[i] = default_col_width_; + + } + + int get_default_col_width() + + { + + return default_col_width_; + + } + + void set_grid_line_width(int w) + + { + + grid_line_width_ = std::max(1, w); + + } + + int get_grid_line_width() + + { + + return grid_line_width_; + + } + static std::string col_name(int col) { @@ -1722,8 +1764,12 @@ public: XSetForeground(display_, gc_, grid); + xf::set_line_width(display_, gc_, grid_line_width_); + XDrawRectangle(display_, window_, gc_, cx, cy, cw, row_height_); + xf::set_line_width(display_, gc_, 1); + std::string disp = get_cell_display(c, r); if (!disp.empty() && !(editing_ && c == active_col_ && r == active_row_)) @@ -1822,8 +1868,12 @@ public: XSetForeground(display_, gc_, grid); + xf::set_line_width(display_, gc_, grid_line_width_); + XDrawRectangle(display_, window_, gc_, cx, y1_, cw, header_h_); + xf::set_line_width(display_, gc_, 1); + std::string nm = col_name(c); int tw = xf::text_width(st, nm); @@ -1872,8 +1922,12 @@ public: XSetForeground(display_, gc_, grid); + xf::set_line_width(display_, gc_, grid_line_width_); + XDrawRectangle(display_, window_, gc_, x1_, cy, header_w_, row_height_); + xf::set_line_width(display_, gc_, 1); + std::string nm = std::to_string(r + 1); int tw = xf::text_width(st, nm);