| 275 | } |
| 276 | |
| 277 | void Window::GetText(std::wstring& text) const { |
| 278 | if (!IsEnabled()) { |
| 279 | text.clear(); |
| 280 | |
| 281 | return; |
| 282 | } |
| 283 | |
| 284 | int len = GetWindowTextLength(handle_); |
| 285 | |
| 286 | if (len <= 0) { |
| 287 | text.clear(); |
| 288 | |
| 289 | return; |
| 290 | } |
| 291 | |
| 292 | text.resize(len + 1); |
| 293 | |
| 294 | if (!GetWindowText(handle_, &text[0], len + 1)) text.clear(); |
| 295 | |
| 296 | text.resize(len); |
| 297 | boost::algorithm::trim(text); |
| 298 | } |
| 299 | |
| 300 | void Window::SetText(const std::wstring& text) const { |
| 301 | SNDMSG(handle_, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(text.c_str())); |
no test coverage detected