From 46febdb973206824d3382fa94fe6697c4c07ee2a Mon Sep 17 00:00:00 2001 From: Ysm-04 Date: Sun, 30 Nov 2025 19:05:58 +0800 Subject: [PATCH] feat: add a new awesome feature --- CHANGELOG.en.md | 20 +++++ CHANGELOG.md | 24 +++++ README.md | 31 +++---- examples/登录界面/LoginInterface.cpp | 127 +++++++++++++++++++++++++++ examples/登录界面/image/bk1.jpg | Bin 0 -> 11106365 bytes examples/登录界面/image/lo_bk2.jpg | Bin 0 -> 5130 bytes examples/登录界面/image/星垣logo.png | Bin 0 -> 1463584 bytes include/StellarX/Button.h | 3 + include/StellarX/Canvas.h | 4 + include/StellarX/Control.h | 10 +-- include/StellarX/Dialog.h | 3 - include/StellarX/StellarX.h | 3 +- include/StellarX/TabControl.h | 3 + include/StellarX/table.h | 2 + src/Button.cpp | 2 +- src/Canvas.cpp | 32 ++++++- src/Control.cpp | 3 +- src/Dialog.cpp | 35 +------- src/TabControl.cpp | 66 ++++++++++---- src/table.cpp | 15 ++++ src/window.cpp | 36 ++++---- 21 files changed, 318 insertions(+), 101 deletions(-) create mode 100644 examples/登录界面/LoginInterface.cpp create mode 100644 examples/登录界面/image/bk1.jpg create mode 100644 examples/登录界面/image/lo_bk2.jpg create mode 100644 examples/登录界面/image/星垣logo.png diff --git a/CHANGELOG.en.md b/CHANGELOG.en.md index 81eb593..2dbf125 100644 --- a/CHANGELOG.en.md +++ b/CHANGELOG.en.md @@ -7,6 +7,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [中文文档](CHANGELOG.md) +## [v2.3.1] - 2025-11-30 + +## 🙏 Acknowledgements + +- Special thanks to user [@To-KongBai](https://github.com/To-KongBai) for providing stable reproduction steps and key phenomenon comparisons (container nested child control coordinate transformation issue), which helped us quickly identify and fix the control coordinate transformation problem in deeply nested containers. ([Issues#6](https://github.com/Ysm-04/StellarX/issues/6)) +- In the upcoming website (currently undergoing ICP filing), we plan to add a contributors' wall to acknowledge users. We welcome everyone to report bugs or share interfaces created with StellarX, and we will carefully read and include acknowledgements. +- Sincere thanks to every user who reports bugs—your feedback makes StellarX more stable and robust. + +### ⚙️ Changes + +- **Dialog Background Snapshot Mechanism:** `Dialog` no longer captures and destroys its own snapshot. The methods for capturing and restoring snapshots have been **removed** from `Dialog`, and the base class `Canvas` now handles all snapshot management. The `draw` method in `Dialog` no longer deals with snapshots. +- **Timing Adjustment for Window and Control Redrawing on Size Change:** In the main event loop, when the window size changes, control sizes are processed first. Old snapshots are discarded, followed by the redrawing of the window with the new size, and finally, the controls are redrawn. + +### ✅ Fixes + +- **Child Control Coordinate Transformation in Nested Containers:** `Canvas` overrides the base class's `setX/Y` methods to synchronize the global coordinates of child controls when the parent container's global coordinates change. This prevents child controls in nested containers from incorrectly treating the container's relative coordinates as global coordinates. +- **Solid Background Window Title Not Applied:** In the `Window`'s `draw()` method, the window title is forcibly set to ensure that the title passed when creating the window is applied correctly, preventing the issue where the window title doesn't take effect. +- **Tab Control Background Residue when Changing Coordinates:** In the overridden `setX/Y` methods of `TabControl`, all tabs and their child controls are forced to discard snapshots when the tab's coordinates change. This prevents background residue caused by incorrect snapshot restoration order after modifying coordinates. +- **Table Page Number Label and Pagination Button Misalignment when Changing Coordinates:** In `Table`'s `setX/Y`, the `isNeedButtonAndPageNum` state is reset to `true`, ensuring that the pagination button and page number label are recalculated and remain centered directly beneath the table when redrawn. + ## [v2.3.0] - 2025-11-18 ### ✨ Added diff --git a/CHANGELOG.md b/CHANGELOG.md index e27f0a2..6170540 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,30 @@ StellarX 项目所有显著的变化都将被记录在这个文件中。 [English document](CHANGELOG.en.md) +## [v2.3.1] - 2025 - 11 - 30 + +## 🙏 鸣谢 + +- 感谢用户 [@To-KongBai](https://github.com/To-KongBai) 提供稳定复现步骤与关键现象对比(容器嵌套孙控件坐标转换问题),帮助我们快速确认多容器嵌套时的控件坐标转换问题并修复。([Issues#6](https://github.com/Ysm-04/StellarX/issues/6)) +- 在即将上线的官网中(ICP备案中)我们计划加入一个贡献者鸣谢墙,欢迎各位用户反馈BUG或者分享自己用星垣做的界面,我们将认真阅读并收录鸣谢 +- 真诚的感谢每一位反馈BUG的用户,你们的反馈将使星垣更加稳定和健壮 + +### ✨ 新增 + +新增一个登录界面Demo在主仓库**examples/**目录下 + +### ⚙️ 变更 + +- **Dialog背景快照机制:**`Dialog`不在自己抓取和销毁快照,**删除**重载的抓取和恢复快照的方法,完全交由基类`Canvas`处理,`Dialog`的`draw`方法中不在处理快照 +- **窗口变化重绘时控件和窗口重绘的时机调整:**主事件循环中窗口大小发生变化时先处理控件尺寸,并回贴和释放旧快照,然后再重绘新尺寸窗口,最后绘制控件 + +### ✅ 修复 + +- **容器嵌套时子控件坐标转化:**`Canvas`重写了基类的`setX/Y`方法,在容器全局坐标发生变化时同步修改子控件的全局坐标,防止在容器嵌套时,容器的相对坐标被子控件当成全局坐标处理 +- **纯色背景窗口标题不生效:**在`Window`的`draw()`方法中强制设置窗口标题,以防止,创建窗口时传递的窗口标题不生效 +- **选项卡控件页签打开时动态改变坐标背景残留:**在`TabControl`重写的`setX/Y`方法中,当选项卡的坐标发生变化时强制让所有页签以及页和子控件丢一次快照,防止,在修改坐标后因,快照恢复顺序引起的选项卡激活页残留 +- **Table动态改变坐标页码标签和翻页按钮错乱:**在`Table`控件的`setX/Y`中重置`isNeedButtonAndPageNum`状态为真,在绘制时重新计算翻页按钮和页码标签的位置以保持在表格正下方居中位置显示 + ## [v2.3.0] - 2025 - 11 - 18 ### ✨ 新增 diff --git a/README.md b/README.md index 1e8180c..2e795bd 100644 --- a/README.md +++ b/README.md @@ -12,8 +12,8 @@ ![GitHub all releases](https://img.shields.io/github/downloads/Ysm-04/StellarX/total) [![Star GitHub Repo](https://img.shields.io/github/stars/Ysm-04/StellarX.svg?style=social&label=Star%20This%20Repo)](https://github.com/Ysm-04/StellarX) -![Version](https://img.shields.io/badge/Version-2.3.0-brightgreen.svg) -![Download](https://img.shields.io/badge/Download-2.3.0_Release-blue.svg) +![Version](https://img.shields.io/badge/Version-2.3.1-brightgreen.svg) +![Download](https://img.shields.io/badge/Download-2.3.1_Release-blue.svg) ![C++](https://img.shields.io/badge/C++-17+-00599C?logo=cplusplus&logoColor=white) ![Windows](https://img.shields.io/badge/Platform-Windows-0078D6?logo=windows) @@ -32,31 +32,26 @@ ## ==公告== -### 关于获取对话框TextBox返回值的问题 +## 🙏 鸣谢 -在TextBox的实现里把保存文本的std::string.c_str()强转变成可写,这会导致调用getText()无法获取文本框的内容,需要使用getText().c_str()来获取,这个问题目前已经修复,感谢用户反馈特此公告 +- 感谢用户 [@To-KongBai](https://github.com/To-KongBai) 提供稳定复现步骤与关键现象对比(容器嵌套孙控件坐标转换问题),帮助我们快速确认多容器嵌套时的控件坐标转换问题并修复。([Issues#6](https://github.com/Ysm-04/StellarX/issues/6)) +- 在即将上线的官网中(ICP备案中)我们计划加入一个贡献者鸣谢墙,欢迎各位用户反馈BUG或者分享自己用星垣做的界面,我们将认真阅读并收录鸣谢 +- 真诚的感谢每一位反馈BUG的用户,你们的反馈将使星垣更加稳定和健壮 --- -## 🆕V2.3.0——重要更新 +## 🆕V2.3.1——重要更新 -**本版本是一次重大更新,增加了响应式布局系统,由静态布局转变为动态布局,并且彻底修复了之前存在的由重入重绘导致的概率出现的渲染错乱问题** +### ✨ 新增 -- **优化窗口尺寸调节机制**:重构 `WndProcThunk`、`runEventLoop` 和 `pumpResizeIfNeeded`,统一记录尺寸变化并在事件循环末尾集中重绘,避免重复重绘导致的抖动和顺序错乱。 +新增一个登录界面Demo在主仓库**examples/**目录下 -- **新增对话框尺寸调度接口**:引入 `Window::scheduleResizeFromModal()` 与 `pumpResizeIfNeeded()` 的组合,模态对话框在拉伸期间也可通知父窗口更新尺寸。底层控件将在统一收口时重新布局,而对话框自身保持尺寸不变。 +### ⚙️ 变更 -- **自适应布局改进**:内部新增 `adaptiveLayout()` 函数,按照锚点重新计算控件位置和尺寸,使双锚定(左右或上下)控件随窗口变化自适应伸缩。 +- **Dialog背景快照机制:**`Dialog`不在自己抓取和销毁快照,**删除**重载的抓取和恢复快照的方法,完全交由基类`Canvas`处理,`Dialog`的`draw`方法中不在处理快照 +- **窗口变化重绘时控件和窗口重绘的时机调整:**主事件循环中窗口大小发生变化时先处理控件尺寸,并回贴和释放旧快照,然后再重绘新尺寸窗口,最后绘制控件 -- **修复模态对话框拉伸问题**:解决模态对话框打开时,窗口拉伸导致底层控件无法根据锚点更新的位置和尺寸的问题;同时避免对话框反复重绘导致的残影。 - -- **进一步解决绘制顺序错乱**:拉伸过程中采用 `ValidateRect` 替代 `InvalidateRect`,确保窗口仅在一次统一收口绘制后标记为有效,杜绝系统再次触发 `WM_PAINT` 造成重入。 - -- 其他修复:修正表格和对话框背景快照某些边界情况下的更新不及时问题。 - - ![](image/1.png) - -![](image/2.png) +本次针对用户反馈和已知内容进行了一些修复…… 详细变更请参阅[更新日志](CHANGELOG.md) diff --git a/examples/登录界面/LoginInterface.cpp b/examples/登录界面/LoginInterface.cpp new file mode 100644 index 0000000..4cf51cc --- /dev/null +++ b/examples/登录界面/LoginInterface.cpp @@ -0,0 +1,127 @@ +// Demo StellarX Windows GUI ܡ +#include"StellarX.h" + +int main() +{ + Window win(1300, 800, NULL, RGB(255, 255, 0), "˹ϵͳ"); + + /*********¼***********/ + //ǩ + std::unique_ptr