SimpleWindow
载入中...
搜索中...
未找到
sw::RadioButton类 参考

单选框 更多...

#include <RadioButton.h>

类 sw::RadioButton 继承关系图:
sw::CheckableButton sw::ButtonBase sw::Control sw::UIElement sw::WndBase sw::ILayout sw::ITag

Public 成员函数

 RadioButton ()
 初始化单选框
 
- Public 成员函数 继承自 sw::CheckableButton
virtual ~CheckableButton ()=0
 析构函数,这里用纯虚函数使该类成为抽象类
 
- Public 成员函数 继承自 sw::ButtonBase
virtual ~ButtonBase ()=0
 析构函数,这里用纯虚函数使该类成为抽象类
 
- Public 成员函数 继承自 sw::Control
virtual ~Control ()=0
 析构函数,这里用纯虚函数使该类成为抽象类
 
- Public 成员函数 继承自 sw::UIElement
virtual ~UIElement ()=0
 析构函数,这里用纯虚函数使该类成为抽象类
 
void RegisterRoutedEvent (RoutedEventType eventType, const RoutedEvent &handler)
 注册路由事件处理函数,当事件已注册时会覆盖已注册的函数
 
template<typename T >
void RegisterRoutedEvent (RoutedEventType eventType, T &obj, void(T::*handler)(UIElement &, RoutedEventArgs &))
 注册成员函数作为路由事件处理函数,当事件已注册时会覆盖已注册的函数
 
template<typename TEventArgs >
std::enable_if< std::is_base_of< RoutedEventArgs, TEventArgs >::value &&sw::_IsTypedRoutedEventArgs< TEventArgs >::value >::type RegisterRoutedEvent (std::function< void(UIElement &, TEventArgs &)> handler)
 根据事件参数类型注册路由事件
 
template<typename TEventArgs , typename THandleObj >
std::enable_if< std::is_base_of< RoutedEventArgs, TEventArgs >::value &&sw::_IsTypedRoutedEventArgs< TEventArgs >::value >::type RegisterRoutedEvent (THandleObj &obj, void(THandleObj::*handler)(UIElement &, TEventArgs &))
 根据事件参数类型注册成员函数作为路由事件
 
void UnregisterRoutedEvent (RoutedEventType eventType)
 取消对应类型路由事件的注册
 
bool IsRoutedEventRegistered (RoutedEventType eventType)
 判断路由事件是否已被注册
 
bool AddChild (UIElement *element)
 添加子控件
 
bool AddChild (UIElement &element)
 添加子控件
 
bool AddChild (UIElement *element, uint64_t layoutTag)
 添加子控件并设置布局标记
 
bool AddChild (UIElement &element, uint64_t layoutTag)
 添加子控件并设置布局标记
 
bool RemoveChildAt (int index)
 移除指定索引处的子控件
 
bool RemoveChild (UIElement *element)
 移除子控件
 
bool RemoveChild (UIElement &element)
 移除子控件
 
void ClearChildren ()
 移除所有子控件
 
int IndexOf (UIElement *element)
 获取指定元素的索引
 
int IndexOf (UIElement &element)
 获取指定元素的索引
 
UIElementoperator[] (int index) const
 通过索引获取子控件
 
void ShowContextMenu (const Point &point)
 弹出当前元素的上下文菜单
 
void MoveToTop ()
 移动到界面顶部
 
void MoveToBottom ()
 移动到界面底部
 
bool IsRootElement ()
 判断当前元素是否为根节点
 
UIElementGetRootElement ()
 获取当前元素所在界面树的根节点
 
UIElementGetNextElement ()
 获取当前元素在界面树上的下一个节点,若已是最后一个节点则返回根节点
 
UIElementGetNextTabStopElement ()
 获取下一个TabStop属性为true的元素
 
Color GetRealBackColor ()
 获取当前要显示的背景颜色:当Transparent为true时获取到祖先节点中首个Transparent为false的背景颜色,否则返回当前元素的背景颜色
 
Color GetRealTextColor ()
 获取当前要显示的文本颜色:当InheritTextColor为true时获取到祖先节点中首个InheritTextColor为false的文本颜色,否则返回当前元素的文本颜色
 
void SetCursor (HCURSOR hCursor)
 设置鼠标样式
 
void SetCursor (StandardCursor cursor)
 设置鼠标样式
 
void ResetCursor ()
 将鼠标样式设置为默认样式
 
void SetAlignment (sw::HorizontalAlignment horz, sw::VerticalAlignment vert)
 设置对齐方式
 
void Resize (const Size &size)
 调整当前元素的尺寸,也可以用该函数更改默认Measure函数在当前横向或纵向对齐方式为拉伸时的DesireSize
 
virtual uint64_t GetTag () override
 获取Tag
 
virtual void SetTag (uint64_t tag) override
 设置Tag
 
virtual uint64_t GetLayoutTag () override
 获取布局标记
 
virtual int GetChildLayoutCount () override
 获取参与布局的子控件数量
 
virtual ILayoutGetChildLayoutAt (int index) override
 获取对应索引处的子控件,使用此函数前必须先调用GetChildLayoutCount
 
virtual Size GetDesireSize () override
 获取控件所需尺寸
 
virtual void SetDesireSize (const Size &size) override
 设置当前控件所需的尺寸
 
virtual void Measure (const Size &availableSize) override
 测量控件所需尺寸
 
virtual void Arrange (const sw::Rect &finalPosition) override
 安排控件位置
 
- Public 成员函数 继承自 sw::WndBase
virtual ~WndBase ()=0
 析构函数,这里用纯虚函数使该类成为抽象类
 
bool operator== (const WndBase &other) const
 判断两个WndBase是否为同一实例
 
bool operator!= (const WndBase &other) const
 判断两个WndBase是否为不同实例
 
void Show (int nCmdShow)
 该函数调用ShowWindow
 
void Close ()
 发送关闭消息
 
void Update ()
 该函数调用UpdateWindow
 
void UpdateFont ()
 更新字体
 
HFONT GetFontHandle ()
 获取字体句柄
 
void Redraw (bool erase=false, bool updateWindow=false)
 重画
 
bool IsControl ()
 判断当前对象是否是控件
 
bool IsVisible ()
 判断当前对象在界面中是否可视,与Visible属性不同的是该函数返回值会受父窗口的影响
 
DWORD GetStyle ()
 获取窗口样式
 
void SetStyle (DWORD style)
 设置窗口样式
 
bool GetStyle (DWORD mask)
 判断窗口是否设有指定样式
 
void SetStyle (DWORD mask, bool value)
 打开或关闭指定的样式
 
DWORD GetExtendedStyle ()
 获取扩展窗口样式
 
void SetExtendedStyle (DWORD style)
 设置扩展窗口样式
 
bool GetExtendedStyle (DWORD mask)
 判断窗口是否设有指定扩展样式
 
void SetExtendedStyle (DWORD mask, bool value)
 打开或关闭指定的扩展样式
 
Point PointToScreen (const Point &point)
 获取用户区点在屏幕上点的位置
 
Point PointFromScreen (const Point &screenPoint)
 获取屏幕上点在当前用户区点的位置
 
LRESULT SendMessageA (UINT uMsg, WPARAM wParam, LPARAM lParam)
 发送消息(ASCII)
 
LRESULT SendMessageW (UINT uMsg, WPARAM wParam, LPARAM lParam)
 发送消息(UNICODE)
 
HitTestResult NcHitTest (const Point &testPoint)
 测试指定点在窗口的哪一部分
 
- Public 成员函数 继承自 sw::ILayout
virtual ~ILayout ()=default
 默认虚析构函数
 
- Public 成员函数 继承自 sw::ITag
virtual ~ITag ()=default
 默认虚析构函数
 

额外继承的成员函数

- 静态 Public 成员函数 继承自 sw::WndBase
static WndBaseGetWndBase (HWND hwnd)
 通过窗口句柄获取WndBase
 
- Public 属性 继承自 sw::CheckableButton
const Property< sw::CheckState > CheckState
 选中状态
 
const Property< bool > IsChecked
 是否选中
 
- Public 属性 继承自 sw::UIElement
const Property< ThicknessMargin
 边距
 
const Property< HorizontalAlignment > HorizontalAlignment
 水平对齐方式
 
const Property< VerticalAlignment > VerticalAlignment
 垂直对齐方式
 
const ReadOnlyProperty< int > ChildCount
 子控件数量
 
const Property< bool > CollapseWhenHide
 是否在不可见时不参与布局
 
const ReadOnlyPtrProperty< UIElement * > Parent
 指向父元素的指针,当前元素为顶级窗口时该值为nullptr
 
const Property< uint64_t > Tag
 储存用户自定义信息的标记
 
const Property< uint64_t > LayoutTag
 布局标记,对于不同的布局有不同含义
 
const PtrProperty< sw::ContextMenu * > ContextMenu
 右键按下时弹出的菜单
 
const Property< bool > Float
 元素是否悬浮,若元素悬浮则该元素不会随滚动条滚动而改变位置
 
const Property< bool > TabStop
 表示用户是否可以通过按下Tab键将焦点移动到当前元素
 
const Property< ColorBackColor
 背景颜色,修改该属性会同时将Transparent属性设为false,对于部分控件该属性可能不生效
 
const Property< ColorTextColor
 文本颜色,修改该属性会同时将InheritTextColor属性设为false,对于部分控件该属性可能不生效
 
const Property< bool > Transparent
 是否使用透明背景(此属性并非真正意义上的透明,将该属性设为true可继承父元素的背景颜色)
 
const Property< bool > InheritTextColor
 是否继承父元素的文本颜色
 
- Public 属性 继承自 sw::WndBase
const ReadOnlyProperty< HWND > Handle
 窗口句柄
 
const Property< sw::FontFont
 字体
 
const Property< std::wstring > FontName
 字体名称
 
const Property< double > FontSize
 字体大小
 
const Property< sw::FontWeight > FontWeight
 字体粗细
 
const Property< sw::RectRect
 位置和尺寸
 
const Property< double > Left
 左边
 
const Property< double > Top
 顶边
 
const Property< double > Width
 宽度
 
const Property< double > Height
 高度
 
const ReadOnlyProperty< sw::RectClientRect
 用户区尺寸
 
const ReadOnlyProperty< double > ClientWidth
 用户区宽度
 
const ReadOnlyProperty< double > ClientHeight
 用户区高度
 
const Property< bool > Enabled
 窗口或控件是否可用
 
const Property< bool > Visible
 窗口或控件是否可见
 
const Property< std::wstring > Text
 窗口标题或控件文本
 
const Property< bool > Focused
 窗口是否拥有焦点
 
const ReadOnlyPtrProperty< WndBase * > Parent
 父窗口
 
const ReadOnlyProperty< bool > IsDestroyed
 是否已销毁,当该值为true时不应该继续使用当前对象
 
const Property< bool > AcceptFiles
 是否接受拖放文件
 
- Protected 成员函数 继承自 sw::CheckableButton
 CheckableButton ()
 初始化CheckableButton
 
- Protected 成员函数 继承自 sw::ButtonBase
 ButtonBase ()
 初始化ButtonBase
 
void InitButtonBase (LPCWSTR lpWindowName, DWORD dwStyle, DWORD dwExStyle)
 初始化控件
 
virtual void OnCommand (int code) override
 当父窗口接收到控件的WM_COMMAND时调用该函数
 
virtual void OnClicked ()
 被单击时调用该函数
 
virtual void OnDoubleClicked ()
 被双击时调用该函数
 
- Protected 成员函数 继承自 sw::Control
 Control ()
 初始化控件
 
void ResetHandle ()
 销毁控件句柄并重新初始化,该操作会创建新的句柄并设置样式、文本、字体等
 
void ResetHandle (DWORD style, DWORD exStyle)
 销毁控件句柄并重新初始化,并修改样式,该操作会创建新的句柄并设置样式、文本、字体等
 
virtual void HandleChenged ()
 控件句柄发生改变时调用该函数
 
- Protected 成员函数 继承自 sw::UIElement
 UIElement ()
 初始化UIElement
 
void RaiseRoutedEvent (RoutedEventType eventType)
 触发路由事件
 
void RaiseRoutedEvent (RoutedEventArgs &eventArgs)
 触发路由事件
 
void NotifyLayoutUpdated ()
 通知顶级窗口布局改变
 
double & GetArrangeOffsetX ()
 获取Arrange时子元素的水平偏移量
 
double & GetArrangeOffsetY ()
 获取Arrange时子元素的垂直偏移量
 
double GetChildRightmost (bool update)
 获取所有子元素在当前元素中最右边的位置(只考虑参与布局的子窗口且忽略悬浮的元素)
 
double GetChildBottommost (bool update)
 获取所有子元素在当前元素中最底边的位置(只考虑参与布局的子窗口且忽略悬浮的元素)
 
void UpdateChildrenZOrder ()
 更新子元素的Z轴位置
 
void UpdateSiblingsZOrder ()
 更新兄弟元素的Z轴位置
 
void SetNextTabStopFocus ()
 设置下一个TabStop属性为true的元素为焦点元素
 
virtual void SetBackColor (Color color, bool redraw)
 设置背景颜色
 
virtual void SetTextColor (Color color, bool redraw)
 设置文本颜色
 
virtual void OnAddedChild (UIElement &element)
 添加子元素后调用该函数
 
virtual void OnRemovedChild (UIElement &element)
 移除子元素后调用该函数
 
virtual void OnTabStop ()
 通过tab键将焦点移动到当前元素时调用该函数
 
virtual void OnDrawFocusRect ()
 绘制虚线框时调用该函数
 
virtual bool SetParent (WndBase *parent) override
 设置父窗口
 
virtual void ParentChanged (WndBase *newParent) override
 父窗口改变时调用此函数
 
virtual void OnEndPaint () override
 在OnPaint函数完成之后调用该函数
 
virtual bool OnClose () override
 接收到WM_CLOSE时调用该函数
 
virtual bool OnMove (Point newClientPosition) override
 接收到WM_MOVE时调用该函数
 
virtual bool OnSize (Size newClientSize) override
 接收到WM_SIZE时调用该函数
 
virtual void OnTextChanged () override
 Text属性更改时调用此函数
 
virtual void VisibleChanged (bool newVisible) override
 Visible属性改变时调用此函数
 
virtual bool OnSetFocus (HWND hPrevFocus) override
 接收到WM_SETFOCUS时调用该函数
 
virtual bool OnKillFocus (HWND hNextFocus) override
 接收到WM_KILLFOCUS时调用该函数
 
virtual bool OnChar (wchar_t ch, KeyFlags flags) override
 接收到WM_CHAR时调用该函数
 
virtual bool OnKeyDown (VirtualKey key, KeyFlags flags) override
 接收到WM_KEYDOWN时调用该函数
 
virtual bool OnKeyUp (VirtualKey key, KeyFlags flags) override
 接收到WM_KEYUP时调用该函数
 
virtual bool OnMouseMove (Point mousePosition, MouseKey keyState) override
 接收到WM_MOUSEMOVE时调用该函数
 
virtual bool OnMouseLeave () override
 接收到WM_MOUSELEAVE时调用该函数
 
virtual bool OnMouseWheel (int wheelDelta, Point mousePosition, MouseKey keyState) override
 接收到WM_MOUSEWHEEL时调用该函数
 
virtual bool OnMouseLeftButtonDown (Point mousePosition, MouseKey keyState) override
 接收到WM_LBUTTONDOWN时调用该函数
 
virtual bool OnMouseLeftButtonUp (Point mousePosition, MouseKey keyState) override
 接收到WM_LBUTTONUP时调用该函数
 
virtual bool OnMouseRightButtonDown (Point mousePosition, MouseKey keyState) override
 接收到WM_RBUTTONDOWN时调用该函数
 
virtual bool OnMouseRightButtonUp (Point mousePosition, MouseKey keyState) override
 接收到WM_RBUTTONUP时调用该函数
 
virtual bool OnMouseMiddleButtonDown (Point mousePosition, MouseKey keyState) override
 接收到WM_MBUTTONDOWN时调用该函数
 
virtual bool OnMouseMiddleButtonUp (Point mousePosition, MouseKey keyState) override
 接收到WM_MBUTTONUP时调用该函数
 
virtual bool OnContextMenu (bool isKeyboardMsg, Point mousePosition) override
 接收到WM_CONTEXTMENU后调用目标控件的该函数
 
virtual void OnMenuCommand (int id) override
 当WM_COMMAND接收到菜单命令时调用该函数
 
virtual bool OnColor (HDC hdc, HBRUSH &hRetBrush) override
 父窗口接收到WM_CTLCOLORxxx时调用对应控件的该函数
 
virtual bool OnSetCursor (HWND hwnd, HitTestResult hitTest, int message, bool &result) override
 接收到WM_SETCURSOR消息时调用该函数
 
virtual bool OnDropFiles (HDROP hDrop) override
 接收到WM_DROPFILES时调用该函数
 
- Protected 成员函数 继承自 sw::WndBase
 WndBase ()
 初始化WndBase
 
 WndBase (const WndBase &)=delete
 
 WndBase (WndBase &&)=delete
 
WndBaseoperator= (const WndBase &)=delete
 
WndBaseoperator= (WndBase &&)=delete
 
void InitWindow (LPCWSTR lpWindowName, DWORD dwStyle, DWORD dwExStyle)
 初始化为窗口,该函数会调用CreateWindowExW
 
void InitControl (LPCWSTR lpClassName, LPCWSTR lpWindowName, DWORD dwStyle, DWORD dwExStyle)
 初始化为控件,该函数会调用CreateWindowExW
 
LRESULT DefaultWndProc (const ProcMsg &refMsg)
 调用默认的WndProc,对于窗口则调用DefWindowProcW,控件则调用_controlOldWndProc
 
virtual LRESULT WndProc (const ProcMsg &refMsg)
 对WndProc的封装
 
void UpdateText ()
 更新_text字段
 
virtual std::wstring & GetText ()
 获取窗口文本
 
virtual void SetText (const std::wstring &value)
 调用SetWindowTextW设置窗口文本
 
virtual bool OnCreate ()
 接收到WM_CREATE时调用该函数
 
virtual bool OnDestroy ()
 接收到WM_DESTROY时调用该函数
 
virtual bool OnPaint ()
 接收到WM_PAINT时调用该函数
 
virtual bool OnMouseLeftButtonDoubleClick (Point mousePosition, MouseKey keyState)
 接收到WM_LBUTTONDBLCLK时调用该函数
 
virtual bool OnMouseRightButtonDoubleClick (Point mousePosition, MouseKey keyState)
 接收到WM_RBUTTONDBLCLK时调用该函数
 
virtual bool OnMouseMiddleButtonDoubleClick (Point mousePosition, MouseKey keyState)
 接收到WM_MBUTTONDBLCLK时调用该函数
 
virtual bool OnDeadChar (wchar_t ch, KeyFlags flags)
 接收到WM_DEADCHAR时调用该函数
 
virtual bool OnSysChar (wchar_t ch, KeyFlags flags)
 接收到WM_SYSCHAR时调用该函数
 
virtual bool OnSysDeadChar (wchar_t ch, KeyFlags flags)
 接收到WM_SYSDEADCHAR时调用该函数
 
virtual bool OnSysKeyDown (VirtualKey key, KeyFlags flags)
 接收到WM_SYSKEYDOWN时调用该函数
 
virtual bool OnSysKeyUp (VirtualKey key, KeyFlags flags)
 接收到WM_SYSKEYUP时调用该函数
 
virtual void OnControlCommand (WndBase *pControl, int code, int id)
 当WM_COMMAND接收到控件命令时调用该函数
 
virtual void OnAcceleratorCommand (int id)
 当WM_COMMAND接收到快捷键命令时调用该函数
 
virtual void HandleInitialized (HWND hwnd)
 窗口句柄初始化完成
 
virtual void FontChanged (HFONT hfont)
 字体改变时调用该函数
 
virtual bool OnNotify (NMHDR *pNMHDR, LRESULT &result)
 接收到WM_NOTIFY后调用该函数
 
virtual bool OnNotified (NMHDR *pNMHDR, LRESULT &result)
 父窗口接收到WM_NOTIFY后且父窗口OnNotify函数返回false时调用发出通知控件的该函数
 
virtual bool OnVerticalScroll (int event, int pos)
 接收到WM_VSCROLL时调用目标控件的该函数
 
virtual bool OnHorizontalScroll (int event, int pos)
 接收到WM_HSCROLL时调用目标控件的该函数
 
virtual bool OnEnabledChanged (bool newValue)
 接收到WM_ENABLE时调用该函数
 
virtual bool OnCtlColor (WndBase *pControl, HDC hdc, HBRUSH &hRetBrush)
 接收到WM_CTLCOLORxxx时调用该函数
 
virtual void OnNcHitTest (const Point &testPoint, HitTestResult &result)
 接收到WM_NCHITTEST后调用该函数
 
virtual bool OnEraseBackground (int &result)
 接收到WM_ERASEBKGND时调用该函数
 
virtual bool OnDrawItem (int id, DRAWITEMSTRUCT *pDrawItem)
 接收到WM_DRAWITEM时调用该函数
 

详细描述

单选框


该类的文档由以下文件生成: