| 45 | } |
| 46 | |
| 47 | void AddPropertyWindow::Create() { |
| 48 | // Finding out parent position. |
| 49 | RECT parent_rect; |
| 50 | GetWindowRect(parent_->GetHandle(), &parent_rect); |
| 51 | |
| 52 | // Positioning window to the center of parent window. |
| 53 | const int pos_x = |
| 54 | parent_rect.left + (parent_rect.right - parent_rect.left - width_) / 2; |
| 55 | const int pos_y = |
| 56 | parent_rect.top + (parent_rect.bottom - parent_rect.top - height_) / 2; |
| 57 | |
| 58 | RECT desired_rect = {pos_x, pos_y, pos_x + width_, pos_y + height_}; |
| 59 | AdjustWindowRect(&desired_rect, WS_BORDER | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME, |
| 60 | FALSE); |
| 61 | |
| 62 | Window::Create(WS_OVERLAPPED | WS_SYSMENU, desired_rect.left, desired_rect.top, |
| 63 | desired_rect.right - desired_rect.left, |
| 64 | desired_rect.bottom - desired_rect.top, 0); |
| 65 | |
| 66 | if (!handle_) { |
| 67 | std::stringstream buf; |
| 68 | buf << "Can not create window, error code: " << GetLastError(); |
| 69 | throw DriverException(buf.str()); |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | bool AddPropertyWindow::GetProperty(std::wstring& key, std::wstring& value) { |
| 74 | if (accepted_) { |
nothing calls this directly
no test coverage detected