| 84 | } |
| 85 | |
| 86 | RECT Toolbar::Resize(RECT availableBounds) |
| 87 | { |
| 88 | const int clientWidth = availableBounds.right - availableBounds.left; |
| 89 | const int clientHeight = availableBounds.bottom - availableBounds.top; |
| 90 | const float dpiScale = m_appWindow? float(m_appWindow->GetDpiScale()) : 1.0f; |
| 91 | const int clientLogicalWidth = int(float(clientWidth) / dpiScale); |
| 92 | const int itemHeight = int(32 * dpiScale); |
| 93 | |
| 94 | int nextOffsetX = 0; |
| 95 | |
| 96 | for (Item item = Item_BackButton; item < Item_LAST; item = Item(item + 1)) |
| 97 | { |
| 98 | int itemWidth = int(GetItemLogicalWidth(item, clientLogicalWidth) * dpiScale); |
| 99 | SetWindowPos(m_items[item], nullptr, nextOffsetX, 0, itemWidth, itemHeight, |
| 100 | SWP_NOZORDER | SWP_NOACTIVATE); |
| 101 | nextOffsetX += itemWidth; |
| 102 | } |
| 103 | |
| 104 | return { 0, itemHeight, clientWidth, clientHeight }; |
| 105 | } |
| 106 | |
| 107 | void Toolbar::UpdateDpiAndTextScale() |
| 108 | { |
no test coverage detected