2013-03-15 13:11:33 +00:00
|
|
|
namespace phoenix {
|
|
|
|
|
|
|
|
bool pRadioButton::checked() {
|
|
|
|
return SendMessage(hwnd, BM_GETCHECK, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
Size pRadioButton::minimumSize() {
|
|
|
|
Size size = pFont::size(hfont, radioButton.state.text);
|
|
|
|
return {size.width + 20, size.height + 4};
|
|
|
|
}
|
|
|
|
|
|
|
|
void pRadioButton::setChecked() {
|
2013-05-02 11:25:45 +00:00
|
|
|
for(auto& item : radioButton.state.group) {
|
2013-03-15 13:11:33 +00:00
|
|
|
SendMessage(item.p.hwnd, BM_SETCHECK, (WPARAM)(&item == &radioButton), 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-05-02 11:25:45 +00:00
|
|
|
void pRadioButton::setGroup(const group<RadioButton>& group) {
|
2013-03-15 13:11:33 +00:00
|
|
|
}
|
|
|
|
|
2013-05-02 11:25:45 +00:00
|
|
|
void pRadioButton::setText(const string& text) {
|
2013-03-15 13:11:33 +00:00
|
|
|
SetWindowText(hwnd, utf16_t(text));
|
|
|
|
}
|
|
|
|
|
|
|
|
void pRadioButton::constructor() {
|
|
|
|
hwnd = CreateWindow(
|
|
|
|
L"BUTTON", L"",
|
|
|
|
WS_CHILD | WS_TABSTOP | BS_RADIOBUTTON,
|
|
|
|
0, 0, 0, 0, parentWindow->p.hwnd, (HMENU)id, GetModuleHandle(0), 0
|
|
|
|
);
|
|
|
|
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)&radioButton);
|
|
|
|
setDefaultFont();
|
|
|
|
if(radioButton.state.checked) setChecked();
|
|
|
|
setText(radioButton.state.text);
|
|
|
|
synchronize();
|
|
|
|
}
|
|
|
|
|
|
|
|
void pRadioButton::destructor() {
|
|
|
|
DestroyWindow(hwnd);
|
|
|
|
}
|
|
|
|
|
|
|
|
void pRadioButton::orphan() {
|
|
|
|
destructor();
|
|
|
|
constructor();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|