feat: add a new awesome feature

This commit is contained in:
2025-11-30 19:05:58 +08:00
parent f05962954f
commit 46febdb973
21 changed files with 318 additions and 101 deletions

View File

@@ -25,6 +25,9 @@
#define DISABLEDCOLOUR RGB(96, 96, 96) //禁用状态颜色
#define TEXTMARGINS_X 6
#define TEXTMARGINS_Y 4
constexpr int bordWith = 1; //边框宽度,用于快照恢复时的偏移计算
constexpr int bordHeight = 1; //边框高度,用于快照恢复时的偏移计算
class Button : public Control
{

View File

@@ -41,6 +41,9 @@ public:
Canvas(int x, int y, int width, int height);
~Canvas() {}
void setX(int x)override;
void setY(int y)override;
//绘制容器及其子控件
void draw() override;
bool handleEvent(const ExMessage& msg) override;
@@ -68,5 +71,6 @@ public:
private:
//用来检查对话框是否模态,此控件不做实现
bool model() const override { return false; };
};

View File

@@ -43,8 +43,8 @@ protected:
bool show = true; // 是否显示
/* == 布局模式 == */
StellarX::LayoutMode layoutMode = StellarX::LayoutMode::AnchorToEdges; // 布局模式
StellarX::Anchor anchor_1 = StellarX::Anchor::Left; // 锚点
StellarX::LayoutMode layoutMode = StellarX::LayoutMode::Fixed; // 布局模式
StellarX::Anchor anchor_1 = StellarX::Anchor::Top; // 锚点
StellarX::Anchor anchor_2 = StellarX::Anchor::Right; // 锚点
/* == 背景快照 == */
@@ -118,8 +118,8 @@ public:
int getLocalRight() const { return localx + localWidth; }
int getLocalBottom() const { return localy + localHeight; }
void setX(int x) { this->x = x; dirty = true; }
void setY(int y) { this->y = y; dirty = true; }
virtual void setX(int x) { this->x = x; dirty = true; }
virtual void setY(int y) { this->y = y; dirty = true; }
virtual void setWidth(int width) { this->width = width; dirty = true; }
virtual void setHeight(int height) { this->height = height; dirty = true; }
public:
@@ -142,7 +142,7 @@ public:
virtual bool model()const = 0;
//布局
void setLayoutMode(StellarX::LayoutMode layoutMode_);
void steAnchor(StellarX::Anchor anchor_1, StellarX::Anchor anchor_2);
void setAnchor(StellarX::Anchor anchor_1, StellarX::Anchor anchor_2);
StellarX::Anchor getAnchor_1() const;
StellarX::Anchor getAnchor_2() const;
StellarX::LayoutMode getLayoutMode() const;

View File

@@ -123,9 +123,6 @@ private:
void getTextSize();
//初始化对话框尺寸
void initDialogSize();
void saveBackground(int x, int y, int w, int h)override;
void restBackground()override;
void addControl(std::unique_ptr<Control> control);
// 清除所有控件

View File

@@ -1,7 +1,7 @@
/*******************************************************************************
* @文件: StellarX.h
* @摘要: 星垣(StellarX) GUI框架 - 主包含头文件
* @版本: v2.3.0
* @版本: v2.3.1
* @描述:
* 一个为Windows平台打造的轻量级、模块化C++ GUI框架。
* 基于EasyX图形库提供简洁易用的API和丰富的控件。
@@ -12,6 +12,7 @@
* @作者: 我在人间做废物
* @邮箱: [3150131407@qq.com] | [ysm3150131407@gmail.com]
* @仓库: [https://github.com/Ysm-04/StellarX]
* @官网:即将上线,敬请期待
*
* @许可证: MIT License
* @版权: Copyright (c) 2025 我在人间做废物

View File

@@ -39,6 +39,9 @@ public:
TabControl();
TabControl(int x,int y,int width,int height);
~TabControl();
void setX(int x)override;
void setY(int y)override;
void draw() override;
bool handleEvent(const ExMessage& msg) override;

View File

@@ -99,6 +99,8 @@ private:
bool model() const override { return false; };
public:
StellarX::ControlText textStyle; // 文本样式
void setX(int x) override;
void setY(int y) override;
void setWidth(int width) override;
void setHeight(int height) override;
public: