Skip to content

Commit

Permalink
MainWindow: Fix layout with StatusBar #215
Browse files Browse the repository at this point in the history
  • Loading branch information
lxn committed Aug 4, 2016
1 parent aa96e1c commit 7cddab9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 4 additions & 1 deletion mainwindow.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ func NewMainWindow() (*MainWindow, error) {
mw.Children().Remove(mw.statusBar)
mw.statusBar.parent = mw
win.SetParent(mw.statusBar.hWnd, mw.hWnd)
mw.statusBar.visibleChangedPublisher.event.Attach(func() {
mw.SetBounds(mw.Bounds())
})

// This forces display of focus rectangles, as soon as the user starts to type.
mw.SendMessage(win.WM_CHANGEUISTATE, win.UIS_INITIALIZE, 0)
Expand Down Expand Up @@ -215,7 +218,7 @@ func (mw *MainWindow) WndProc(hwnd win.HWND, msg uint32, wParam, lParam uintptr)
mw.toolBar.SetBounds(Rectangle{0, 0, cb.Width, mw.toolBar.Height()})
}

mw.statusBar.SetBounds(Rectangle{0, cb.Height, cb.Width, mw.statusBar.Height()})
mw.statusBar.SetBounds(Rectangle{0, cb.Y + cb.Height, cb.Width, mw.statusBar.Height()})
}

return mw.FormBase.WndProc(hwnd, msg, wParam, lParam)
Expand Down
5 changes: 3 additions & 2 deletions window.go
Original file line number Diff line number Diff line change
Expand Up @@ -1082,8 +1082,9 @@ func (wb *WindowBase) ClientBounds() Rectangle {
}

func (wb *WindowBase) sizeFromClientSize(clientSize Size) Size {
s := wb.Size()
cs := wb.ClientBounds().Size()
window := wb.window
s := window.Size()
cs := window.ClientBounds().Size()
ncs := Size{s.Width - cs.Width, s.Height - cs.Height}

return Size{clientSize.Width + ncs.Width, clientSize.Height + ncs.Height}
Expand Down

0 comments on commit 7cddab9

Please sign in to comment.