Add docs for CircleProgress
Signed-off-by: jiajia_deng <2894220@gmail.com>
This commit is contained in:
parent
45c5104ce0
commit
6e359091b4
111
docs/Controls/CircleProgress.md
Normal file
111
docs/Controls/CircleProgress.md
Normal file
@ -0,0 +1,111 @@
|
||||
# CircleProgress(环形进度条)
|
||||
|
||||
`CircleProgress` 继承了 `Progress` 控件属性和方法,更多可用属性和方法请参考:[Progress](Progress.md) 控件
|
||||
|
||||
## 可用属性
|
||||
|
||||
| 属性名称 | 默认值 | 参数类型 | 用途 |
|
||||
| :--- | :--- | :--- | :--- |
|
||||
| circlewidth | 1 | INT | 环形进度条的宽度,如(10) |
|
||||
| indicator | | STRING | 设置进度指示移动图标 |
|
||||
| clockwise | true | BOOL |设置递增方向 |
|
||||
| bgcolor | | STRING | 设置进度条背景颜色 |
|
||||
| fgcolor | | STRING | 设置进度条背前景色 |
|
||||
| gradientcolor | | STRING | 设置进度条前景渐变颜色,与 fgcolor 同时使用,可以不设置则无渐变效果 |
|
||||
|
||||
## 可用接口
|
||||
|
||||
| 接口名称 | 用途 |
|
||||
| :--- | :--- |
|
||||
| [SetCircular](#SetCircular) | 设置圆形滚动条样式,默认为普通进度条 |
|
||||
| [SetClockwiseRotation](#SetClockwiseRotation) | 设置递增方向 |
|
||||
| [SetCircleWidth](#SetCircleWidth) | 设置圆环宽度 |
|
||||
| [SetBackgroudColor](#SetBackgroudColor) | 设置进度条背景颜色 |
|
||||
| [SetForegroudColor](#SetForegroudColor) | 设置进度条前景颜色 |
|
||||
| [SetCircleGradientColor](#SetCircleGradientColor) | 设置进度条前景渐变颜色,与 SetForegroudColor 同时使用,可以不设置则无渐变效果 |
|
||||
| [SetIndicator](#SetIndicator) | 设置进度指示移动图标 |
|
||||
|
||||
|
||||
### SetCircular
|
||||
|
||||
设置圆形滚动条,默认为普通进度条
|
||||
|
||||
```cpp
|
||||
void SetCircular(bool bCircular = true)
|
||||
```
|
||||
|
||||
- 参 数:
|
||||
- `bCircular` bCircular 为 true 时设置为圆形滚动条,false 时设置为父级滚动条,默认为 true
|
||||
- 返回值:无
|
||||
|
||||
### SetClockwiseRotation
|
||||
|
||||
设置递增方向
|
||||
|
||||
```cpp
|
||||
void SetClockwiseRotation(bool bClockwise = true)
|
||||
```
|
||||
|
||||
- 参 数:
|
||||
- `bClockwise` bClockwise 为 true 时设置为顺时针,false 时设置为逆时针,默认为 true
|
||||
- 返回值:无
|
||||
|
||||
### SetCircleWidth
|
||||
|
||||
设置圆环宽度
|
||||
|
||||
```cpp
|
||||
void SetCircleWidth(int nCircleWidth)
|
||||
```
|
||||
|
||||
- 参 数:
|
||||
- `nCircleWidth` nCircleWidth 宽度数值
|
||||
- 返回值:无
|
||||
|
||||
### SetBackgroudColor
|
||||
|
||||
设置进度条背景颜色
|
||||
|
||||
```cpp
|
||||
void SetBackgroudColor(const std::wstring& strColor)
|
||||
```
|
||||
|
||||
- 参 数:
|
||||
- `strColor` strColor要设置的背景颜色字符串,该字符串必须在 global.xml 中存在
|
||||
- 返回值:无
|
||||
|
||||
### SetForegroudColor
|
||||
|
||||
设置进度条前景颜色
|
||||
|
||||
```cpp
|
||||
void SetForegroudColor(const std::wstring& strColor)
|
||||
```
|
||||
|
||||
- 参 数:
|
||||
- `strColor` strColor要设置的前景颜色字符串,该字符串必须在 global.xml 中存在
|
||||
- 返回值:无
|
||||
|
||||
### SetCircleGradientColor
|
||||
|
||||
设置进度条前景渐变颜色,与 SetForegroudColor 同时使用,可以不设置,则无渐变效果
|
||||
|
||||
```cpp
|
||||
void SetCircleGradientColor(const std::wstring& strColor)
|
||||
```
|
||||
|
||||
- 参 数:
|
||||
- `strColor` strColor要设置的前景渐变颜色字符串,该字符串必须在 global.xml 中存在
|
||||
- 返回值:无
|
||||
|
||||
### SetIndicator
|
||||
|
||||
设置进度指示移动图标
|
||||
|
||||
```cpp
|
||||
void SetIndicator(const std::wstring& sIndicatorImage);
|
||||
```
|
||||
|
||||
- 参 数:
|
||||
- `sIndicatorImage` sIndicatorImage 要设置的图片
|
||||
- 返回值:无
|
@ -9,6 +9,7 @@
|
||||
- [Option](Option.md) 单选框
|
||||
- [Label](Label.md) 文本
|
||||
- [Progress](Progress.md) 进度条
|
||||
- [CircleProgress](CircleProgress.md) »·Ðνø¶ÈÌõ
|
||||
- [Slider](Slider.md) 滑动条
|
||||
- [RichEdit](RichEdit.md) 富文本
|
||||
- [ScrollBar](ScrollBar.md) 滚动条
|
||||
|
@ -4,7 +4,8 @@
|
||||
|
||||
namespace ui
|
||||
{
|
||||
CircleProgress::CircleProgress() :
|
||||
|
||||
CircleProgress::CircleProgress() :
|
||||
m_bCircular(true),
|
||||
m_bClockwise(true),
|
||||
m_nCircleWidth(1),
|
||||
@ -12,12 +13,12 @@ namespace ui
|
||||
m_dwForegroundColor(0),
|
||||
m_dwGradientColor(0),
|
||||
m_pIndicator(nullptr)
|
||||
{
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void CircleProgress::SetAttribute(const std::wstring& srName, const std::wstring& strValue)
|
||||
{
|
||||
void CircleProgress::SetAttribute(const std::wstring& srName, const std::wstring& strValue)
|
||||
{
|
||||
if (srName == _T("circular")) SetCircular(strValue == _T("true"));
|
||||
else if (srName == _T("circlewidth")) SetCircleWidth(_ttoi(strValue.c_str()));
|
||||
else if (srName == _T("indicator")) SetIndicator(strValue);
|
||||
@ -38,10 +39,10 @@ namespace ui
|
||||
SetCircleGradientColor(pValue);
|
||||
}
|
||||
else Progress::SetAttribute(srName, strValue);
|
||||
}
|
||||
}
|
||||
|
||||
void CircleProgress::PaintStatusImage(IRenderContext* pRender)
|
||||
{
|
||||
void CircleProgress::PaintStatusImage(IRenderContext* pRender)
|
||||
{
|
||||
Progress::PaintStatusImage(pRender);
|
||||
if (m_bCircular)
|
||||
{
|
||||
@ -105,36 +106,33 @@ namespace ui
|
||||
graphics.SetTransform(&matrix);
|
||||
Gdiplus::RectF rectf;
|
||||
rectf.X = center.x - m_pIndicator->GetWidth() / 2;
|
||||
rectf.Y = outer.Y + bordersize / 2 -m_pIndicator->GetHeight() / 2;
|
||||
rectf.Y = outer.Y + bordersize / 2 - m_pIndicator->GetHeight() / 2;
|
||||
rectf.Width = m_pIndicator->GetWidth();
|
||||
rectf.Height = m_pIndicator->GetHeight();
|
||||
graphics.DrawImage(m_pIndicator, rectf);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CircleProgress::ClearImageCache()
|
||||
{
|
||||
void CircleProgress::ClearImageCache()
|
||||
{
|
||||
__super::ClearImageCache();
|
||||
if (m_pIndicator)
|
||||
{
|
||||
delete m_pIndicator;
|
||||
m_pIndicator = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CircleProgress::SetCircular(bool bCircular /*= true*/)
|
||||
{
|
||||
void CircleProgress::SetCircular(bool bCircular /*= true*/)
|
||||
{
|
||||
m_bCircular = bCircular;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CircleProgress::SetClockwiseRotation(bool bClockwise /*= true*/)
|
||||
{
|
||||
void CircleProgress::SetClockwiseRotation(bool bClockwise /*= true*/)
|
||||
{
|
||||
if (bClockwise != m_bClockwise)
|
||||
{
|
||||
m_bClockwise = bClockwise;
|
||||
@ -145,31 +143,31 @@ namespace ui
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CircleProgress::SetCircleWidth(int nCircleWidth)
|
||||
{
|
||||
void CircleProgress::SetCircleWidth(int nCircleWidth)
|
||||
{
|
||||
m_nCircleWidth = nCircleWidth;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CircleProgress::SetBackgroudColor(const std::wstring& strColor)
|
||||
{
|
||||
void CircleProgress::SetBackgroudColor(const std::wstring& strColor)
|
||||
{
|
||||
m_dwBackgroundColor = GlobalManager::GetTextColor(strColor);
|
||||
ASSERT(m_dwBackgroundColor != 0);
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
void CircleProgress::SetForegroudColor(const std::wstring& strColor)
|
||||
{
|
||||
void CircleProgress::SetForegroudColor(const std::wstring& strColor)
|
||||
{
|
||||
m_dwForegroundColor = GlobalManager::GetTextColor(strColor);
|
||||
ASSERT(m_dwForegroundColor != 0);
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
void CircleProgress::SetIndicator(const std::wstring& sIndicatorImage)
|
||||
{
|
||||
void CircleProgress::SetIndicator(const std::wstring& sIndicatorImage)
|
||||
{
|
||||
if (m_sIndicatorImage != sIndicatorImage)
|
||||
{
|
||||
m_sIndicatorImage = sIndicatorImage;
|
||||
@ -195,12 +193,13 @@ namespace ui
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CircleProgress::SetCircleGradientColor(const std::wstring& strColor)
|
||||
{
|
||||
void CircleProgress::SetCircleGradientColor(const std::wstring& strColor)
|
||||
{
|
||||
m_dwGradientColor = GlobalManager::GetTextColor(strColor);
|
||||
ASSERT(m_dwGradientColor != 0);
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -13,9 +13,9 @@
|
||||
namespace ui
|
||||
{
|
||||
|
||||
class UILIB_API CircleProgress : public Progress
|
||||
{
|
||||
public:
|
||||
class UILIB_API CircleProgress : public Progress
|
||||
{
|
||||
public:
|
||||
CircleProgress();
|
||||
|
||||
/// 重写父类方法,提供个性化功能,请参考父类声明
|
||||
@ -24,7 +24,7 @@ namespace ui
|
||||
virtual void ClearImageCache() override;
|
||||
|
||||
/**
|
||||
* @brief 设置圆形滚动条
|
||||
* @brief 设置圆形滚动条,默认为普通进度条
|
||||
* @param[in] bCircular 为 true 时设置为圆形滚动条,false 时设置为父级滚动条,默认为 true
|
||||
* @return 无
|
||||
*/
|
||||
@ -54,19 +54,19 @@ namespace ui
|
||||
*/
|
||||
void SetForegroudColor(const std::wstring& strColor);
|
||||
/**
|
||||
* @brief 设置进度条前景渐变颜色,与ForegroudColor同时使用,可以不设置,则无渐变效果
|
||||
* @brief 设置进度条前景渐变颜色,与 SetForegroudColor 同时使用,可以不设置,则无渐变效果
|
||||
* @param[in] strColor要设置的前景渐变颜色字符串,该字符串必须在 global.xml 中存在
|
||||
* @return 无
|
||||
*/
|
||||
void SetCircleGradientColor(const std::wstring& strColor);
|
||||
/**
|
||||
* @brief 设置进度指示移动图标
|
||||
* @param[in] sIndicatorImage要设置的图片
|
||||
* @param[in] sIndicatorImage 要设置的图片
|
||||
* @return 无
|
||||
*/
|
||||
void SetIndicator(const std::wstring& sIndicatorImage);
|
||||
|
||||
protected:
|
||||
protected:
|
||||
bool m_bCircular;
|
||||
bool m_bClockwise;
|
||||
int m_nCircleWidth;
|
||||
@ -77,7 +77,7 @@ namespace ui
|
||||
Gdiplus::Image* m_pIndicator; //此类目前维护资源管理
|
||||
std::wstring m_sIndicatorImage;
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace ui
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user