MCPcopy
hub / github.com/lxn/walk / NewGradientCompositeWithStyle

Function NewGradientCompositeWithStyle

gradientcomposite.go:30–112  ·  view source on GitHub ↗
(parent Container, style uint32)

Source from the content-addressed store, hash-verified

28}
29
30func NewGradientCompositeWithStyle(parent Container, style uint32) (*GradientComposite, error) {
31 composite, err := NewCompositeWithStyle(parent, style)
32 if err != nil {
33 return nil, err
34 }
35
36 gc := &GradientComposite{Composite: composite}
37
38 succeeded := false
39 defer func() {
40 if !succeeded {
41 gc.Dispose()
42 }
43 }()
44
45 if err := InitWrapperWindow(gc); err != nil {
46 return nil, err
47 }
48
49 gc.MustRegisterProperty("Vertical", NewBoolProperty(
50 func() bool {
51 return gc.Vertical()
52 },
53 func(b bool) error {
54 gc.SetVertical(b)
55 return nil
56 },
57 gc.verticalChangedPublisher.Event()))
58
59 gc.MustRegisterProperty("Color1", NewProperty(
60 func() interface{} {
61 return float64(uint32(gc.Color1()))
62 },
63 func(v interface{}) error {
64 var c Color
65
66 switch v := v.(type) {
67 case Color:
68 c = v
69
70 case uint32:
71 c = Color(v)
72
73 case float64:
74 c = Color(uint32(v))
75
76 default:
77 return ErrInvalidType
78 }
79
80 return gc.SetColor1(c)
81 },
82 gc.color1ChangedPublisher.Event()))
83
84 gc.MustRegisterProperty("Color2", NewProperty(
85 func() interface{} {
86 return float64(uint32(gc.Color2()))
87 },

Callers 1

NewGradientCompositeFunction · 0.85

Calls 14

DisposeMethod · 0.95
VerticalMethod · 0.95
SetVerticalMethod · 0.95
Color1Method · 0.95
SetColor1Method · 0.95
Color2Method · 0.95
SetColor2Method · 0.95
NewCompositeWithStyleFunction · 0.85
InitWrapperWindowFunction · 0.85
NewBoolPropertyFunction · 0.85
NewPropertyFunction · 0.85
ColorTypeAlias · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…