MCPcopy Create free account
hub / github.com/lxn/walk / applyDefaultButtonWidth

Method applyDefaultButtonWidth

toolbar.go:148–170  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

146}
147
148func (tb *ToolBar) applyDefaultButtonWidth() error {
149 if tb.defaultButtonWidth == 0 {
150 return nil
151 }
152
153 dpi := tb.DPI()
154 width := IntFrom96DPI(tb.defaultButtonWidth, dpi)
155
156 lParam := uintptr(win.MAKELONG(uint16(width), uint16(width)))
157 if 0 == tb.SendMessage(win.TB_SETBUTTONWIDTH, 0, lParam) {
158 return newError("SendMessage(TB_SETBUTTONWIDTH)")
159 }
160
161 size := uint32(tb.SendMessage(win.TB_GETBUTTONSIZE, 0, 0))
162 height := win.HIWORD(size)
163
164 lParam = uintptr(win.MAKELONG(uint16(width), height))
165 if win.FALSE == tb.SendMessage(win.TB_SETBUTTONSIZE, 0, lParam) {
166 return newError("SendMessage(TB_SETBUTTONSIZE)")
167 }
168
169 return nil
170}
171
172// DefaultButtonWidth returns the default button width of the ToolBar.
173//

Callers 3

applyFontMethod · 0.95
SetDefaultButtonWidthMethod · 0.95
insertActionMethod · 0.95

Calls 4

IntFrom96DPIFunction · 0.85
newErrorFunction · 0.85
DPIMethod · 0.65
SendMessageMethod · 0.65

Tested by

no test coverage detected