Listing 1
// controls.hpp
struct radio_button : wnd_extend<button, radio_button>,
auto_mapping<radio_button> {
radio_button();
// ...
static bool matches_hwnd(HWND h);
bool is_checked() const;
void set_check();
};
// controls.cpp
inline bool has_wnd_style(int style, int mask) {
return (style & mask) == mask;
}
radio_button::radio_button() {}
bool radio_button::matches_hwnd(HWND h) {
DWORD but_style = hwnd_func::style(h);
return has_wnd_style(but_style,BS_RADIOBUTTON) ||
has_wnd_style(but_style,BS_AUTORADIOBUTTON);
}