composite.go 831 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // Copyright 2010 The Walk Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // +build windows
  5. package walk
  6. import (
  7. "github.com/lxn/win"
  8. )
  9. const compositeWindowClass = `\o/ Walk_Composite_Class \o/`
  10. func init() {
  11. MustRegisterWindowClass(compositeWindowClass)
  12. }
  13. type Composite struct {
  14. ContainerBase
  15. }
  16. func newCompositeWithStyle(parent Window, style uint32) (*Composite, error) {
  17. c := new(Composite)
  18. c.children = newWidgetList(c)
  19. c.SetPersistent(true)
  20. if err := InitWidget(
  21. c,
  22. parent,
  23. compositeWindowClass,
  24. win.WS_CHILD|win.WS_VISIBLE|style,
  25. win.WS_EX_CONTROLPARENT); err != nil {
  26. return nil, err
  27. }
  28. return c, nil
  29. }
  30. func NewComposite(parent Container) (*Composite, error) {
  31. return newCompositeWithStyle(parent, 0)
  32. }