2011-02-27 09:11:01 +00:00
|
|
|
bool pRadioBox::checked() {
|
|
|
|
return SendMessage(hwnd, BM_GETCHECK, 0, 0);
|
|
|
|
}
|
|
|
|
|
2011-04-30 13:12:15 +00:00
|
|
|
Geometry pRadioBox::minimumGeometry() {
|
2012-04-24 13:13:42 +00:00
|
|
|
Geometry geometry = pFont::geometry(hfont, radioBox.state.text);
|
|
|
|
return { 0, 0, geometry.width + 20, geometry.height + 4 };
|
2011-04-30 13:12:15 +00:00
|
|
|
}
|
|
|
|
|
2011-02-27 09:11:01 +00:00
|
|
|
void pRadioBox::setChecked() {
|
2012-04-24 13:13:42 +00:00
|
|
|
for(auto &item : radioBox.state.group) {
|
2011-02-27 09:11:01 +00:00
|
|
|
SendMessage(item.p.hwnd, BM_SETCHECK, (WPARAM)(&item == &radioBox), 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-04-24 13:13:42 +00:00
|
|
|
void pRadioBox::setGroup(const array<RadioBox&> &group) {
|
2011-02-27 09:11:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void pRadioBox::setText(const string &text) {
|
|
|
|
SetWindowText(hwnd, utf16_t(text));
|
|
|
|
}
|
|
|
|
|
|
|
|
void pRadioBox::constructor() {
|
|
|
|
hwnd = CreateWindow(
|
|
|
|
L"BUTTON", L"",
|
2012-04-24 13:13:42 +00:00
|
|
|
WS_CHILD | WS_TABSTOP | BS_RADIOBUTTON,
|
|
|
|
0, 0, 0, 0, parentWindow->p.hwnd, (HMENU)id, GetModuleHandle(0), 0
|
2011-02-27 09:11:01 +00:00
|
|
|
);
|
|
|
|
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)&radioBox);
|
|
|
|
setDefaultFont();
|
|
|
|
if(radioBox.state.checked) setChecked();
|
|
|
|
setText(radioBox.state.text);
|
2012-04-24 13:13:42 +00:00
|
|
|
synchronize();
|
|
|
|
}
|
|
|
|
|
|
|
|
void pRadioBox::destructor() {
|
|
|
|
DestroyWindow(hwnd);
|
|
|
|
}
|
|
|
|
|
|
|
|
void pRadioBox::orphan() {
|
|
|
|
destructor();
|
|
|
|
constructor();
|
2011-02-27 09:11:01 +00:00
|
|
|
}
|