void set(int left, int top, unsigned width, unsigned height) { SingleWindow::set(_T("KeyCodeDumper"), _T("KeyCodeDumper"), left, top, width, height); RECT rc = get_client_rect(); key_code_dumper.set(*this, rc.left, rc.top, rc.right - rc.left, (rc.bottom - rc.top + 1) / 2); close_button.set(*this, _T("Close"), ID_CLOSE, rc.left, (rc.top + rc.bottom + 1) / 2, rc.right - rc.left, (rc.top + rc.bottom) / 2); key_code_dumper.set_focus(); }
void set(PixelRect _rc) { SingleWindow::set(_T("KeyCodeDumper"), _T("KeyCodeDumper"), _rc); PixelRect rc = get_client_rect(); PixelRect d_rc = rc; d_rc.bottom = (rc.top + rc.bottom + 1) / 2; key_code_dumper.set(*this, d_rc); PixelRect button_rc = rc; button_rc.top = (rc.top + rc.bottom + 1) / 2; close_button.set(*this, _T("Close"), ID_CLOSE, button_rc); key_code_dumper.set_focus(); }
virtual void OnResize(UPixelScalar width, UPixelScalar height) { SingleWindow::OnResize(width, height); key_code_dumper.move(0, 0, width, (height + 1) / 2); close_button.move(0, (height + 1) / 2, width, height / 2); }
virtual bool on_resize(unsigned width, unsigned height) { SingleWindow::on_resize(width, height); key_code_dumper.move(0, 0, width, (height + 1) / 2); close_button.move(0, (height + 1) / 2, width, height / 2); return true; }