diff options
author | Alexander Neumann <alexander.neumann@picos-software.com> | 2018-12-05 16:46:35 +0100 |
---|---|---|
committer | Alexander Neumann <alexander.neumann@picos-software.com> | 2018-12-05 16:46:35 +0100 |
commit | d855149da0e0c79a9bd2fe3add4ac406efbca952 (patch) | |
tree | 2fa42b16ab23380529003d7435ecfadb034164f7 /groupbox.go | |
parent | WindowBase: Add persistence implementations that recursively call descendant's (diff) | |
download | wireguard-windows-d855149da0e0c79a9bd2fe3add4ac406efbca952.tar.xz wireguard-windows-d855149da0e0c79a9bd2fe3add4ac406efbca952.zip |
Add support for widgets that trade height for width to layouts and do some refactoring
Diffstat (limited to 'groupbox.go')
-rw-r--r-- | groupbox.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/groupbox.go b/groupbox.go index 600dd11a..4135e0fe 100644 --- a/groupbox.go +++ b/groupbox.go @@ -140,6 +140,23 @@ func (gb *GroupBox) SizeHint() Size { return gb.MinSizeHint() } +func (gb *GroupBox) HeightForWidth(width int) int { + if gb.composite == nil || gb.composite.layout == nil { + return 100 + } + + cmsh := gb.composite.layout.MinSizeForSize(Size{Width: width}) + + if gb.Checkable() { + s := gb.checkBox.SizeHint() + + cmsh.Width = maxi(cmsh.Width, s.Width) + cmsh.Height += s.Height + } + + return cmsh.Height + 14 +} + func (gb *GroupBox) ClientBounds() Rectangle { cb := windowClientBounds(gb.hWndGroupBox) |