| 67 | } |
| 68 | |
| 69 | void Window::Create(DWORD style, int pos_x, int pos_y, int width, int height, int id) { |
| 70 | if (handle_) { |
| 71 | std::stringstream buf; |
| 72 | buf << "Window already created, error code: " << GetLastError(); |
| 73 | throw DriverException(buf.str()); |
| 74 | } |
| 75 | |
| 76 | handle_ = CreateWindow(class_name_.c_str(), title_.c_str(), style, pos_x, pos_y, width, |
| 77 | height, parent_ ? parent_->GetHandle() : NULL, |
| 78 | reinterpret_cast<HMENU>(static_cast<ptrdiff_t>(id)), |
| 79 | GetHInstance(), this); |
| 80 | |
| 81 | if (!handle_) { |
| 82 | std::stringstream buf; |
| 83 | buf << "Can not create window, error code: " << GetLastError(); |
| 84 | throw DriverException(buf.str()); |
| 85 | } |
| 86 | |
| 87 | created_ = true; |
| 88 | |
| 89 | const HGDIOBJ hf_default = GetStockObject(DEFAULT_GUI_FONT); |
| 90 | SendMessage(GetHandle(), WM_SETFONT, (WPARAM)hf_default, MAKELPARAM(FALSE, 0)); |
| 91 | } |
| 92 | |
| 93 | std::unique_ptr<Window> Window::CreateTabControl(int id) { |
| 94 | std::unique_ptr<Window> child(new Window(this, WC_TABCONTROL, L"")); |
no test coverage detected