SimpleWindow
载入中...
搜索中...
未找到
Rect.h
1#pragma once
2
3#include "IComparable.h"
4#include "IToString.h"
5#include "Point.h"
6#include "Size.h"
7#include <windows.h>
8#include <string>
9#include <type_traits>
10
11namespace sw
12{
16 struct Rect : public IToString<Rect>,
17 public IEqualityComparable<Rect> {
21 double left;
22
26 double top;
27
31 double width;
32
36 double height;
37
41 Rect() = default;
42
46 Rect(double left, double top, double width, double height) noexcept;
47
51 Rect(const RECT &rect) noexcept;
52
59 operator RECT() const noexcept;
60
65
70
75
79 std::wstring ToString() const;
80 };
81
82 // Rect应为POD类型
84 std::is_trivial<Rect>::value && std::is_standard_layout<Rect>::value,
85 "Rect should be a POD type.");
86}
相等性比较接口
Definition IComparable.h:14
为支持ToString方法的类提供统一接口
Definition IToString.h:13
值转换器接口
Definition IValueConverter.h:14
SimpleWindow框架的顶级命名空间,所有公共类型、控件、枚举和工具函数均定义于此。
Definition Alignment.h:4
表示相对于左上角的点坐标
Definition Point.h:15
表示一个矩形区域
Definition Rect.h:17
Rect()=default
默认构造函数
std::wstring ToString() const
获取描述当前对象的字符串
Rect(const RECT &rect) noexcept
从RECT构造Rect
bool Equals(const Rect &other) const noexcept
判断两个Rect是否相等
Rect(double left, double top, double width, double height) noexcept
构造Rect
Point GetPos() const noexcept
获取Rect左上角的位置
double width
宽度
Definition Rect.h:31
double top
顶边
Definition Rect.h:26
Size GetSize() const noexcept
获取Rect的尺寸
double left
左边
Definition Rect.h:21
double height
高度
Definition Rect.h:36
尺寸
Definition Size.h:15