(parent Container)
| 31 | } |
| 32 | |
| 33 | func NewGroupBox(parent Container) (*GroupBox, error) { |
| 34 | gb := new(GroupBox) |
| 35 | |
| 36 | if err := InitWidget( |
| 37 | gb, |
| 38 | parent, |
| 39 | groupBoxWindowClass, |
| 40 | win.WS_VISIBLE, |
| 41 | win.WS_EX_CONTROLPARENT); err != nil { |
| 42 | return nil, err |
| 43 | } |
| 44 | |
| 45 | succeeded := false |
| 46 | defer func() { |
| 47 | if !succeeded { |
| 48 | gb.Dispose() |
| 49 | } |
| 50 | }() |
| 51 | |
| 52 | gb.hWndGroupBox = win.CreateWindowEx( |
| 53 | 0, syscall.StringToUTF16Ptr("BUTTON"), nil, |
| 54 | win.WS_CHILD|win.WS_VISIBLE|win.BS_GROUPBOX, |
| 55 | 0, 0, 80, 24, gb.hWnd, 0, 0, nil) |
| 56 | if gb.hWndGroupBox == 0 { |
| 57 | return nil, lastError("CreateWindowEx(BUTTON)") |
| 58 | } |
| 59 | win.SetWindowLong(gb.hWndGroupBox, win.GWL_ID, 1) |
| 60 | |
| 61 | gb.applyFont(gb.Font()) |
| 62 | gb.updateHeaderHeight() |
| 63 | |
| 64 | var err error |
| 65 | |
| 66 | gb.checkBox, err = NewCheckBox(gb) |
| 67 | if err != nil { |
| 68 | return nil, err |
| 69 | } |
| 70 | win.SetWindowLong(gb.checkBox.hWnd, win.GWL_ID, 2) |
| 71 | |
| 72 | gb.SetCheckable(false) |
| 73 | gb.checkBox.SetChecked(true) |
| 74 | |
| 75 | gb.checkBox.CheckedChanged().Attach(func() { |
| 76 | gb.applyEnabledFromCheckBox(gb.checkBox.Checked()) |
| 77 | }) |
| 78 | |
| 79 | setWindowVisible(gb.checkBox.hWnd, false) |
| 80 | |
| 81 | gb.composite, err = NewComposite(gb) |
| 82 | if err != nil { |
| 83 | return nil, err |
| 84 | } |
| 85 | win.SetWindowLong(gb.composite.hWnd, win.GWL_ID, 3) |
| 86 | gb.composite.name = "composite" |
| 87 | |
| 88 | win.SetWindowPos(gb.checkBox.hWnd, win.HWND_TOP, 0, 0, 0, 0, win.SWP_NOMOVE|win.SWP_NOSIZE) |
| 89 | |
| 90 | gb.SetBackground(NullBrush()) |
nothing calls this directly
no test coverage detected
searching dependent graphs…