Skip to content

Commit

Permalink
widgets: add ID() method to the ComboWidget
Browse files Browse the repository at this point in the history
  • Loading branch information
gucio321 committed Nov 26, 2024
1 parent a968b4e commit 86f7b37
Showing 1 changed file with 24 additions and 18 deletions.
42 changes: 24 additions & 18 deletions Widgets.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,30 @@ func Combo(label, previewValue string, items []string, selected *int32) *ComboWi
}
}

// ID sets the interval id of combo. (overrides label).
func (c *ComboWidget) ID(id ID) *ComboWidget {
c.label = id
return c
}

// Flags allows to set combo flags (see Flags.go).
func (c *ComboWidget) Flags(flags ComboFlags) *ComboWidget {
c.flags = flags
return c
}

// Size sets combo's width.
func (c *ComboWidget) Size(width float32) *ComboWidget {
c.width = width
return c
}

// OnChange sets callback when combo value gets changed.
func (c *ComboWidget) OnChange(onChange func()) *ComboWidget {
c.onChange = onChange
return c
}

// Build implements Widget interface.
func (c *ComboWidget) Build() {
if c.width > 0 {
Expand All @@ -226,24 +250,6 @@ func (c *ComboWidget) Build() {
}
}

// Flags allows to set combo flags (see Flags.go).
func (c *ComboWidget) Flags(flags ComboFlags) *ComboWidget {
c.flags = flags
return c
}

// Size sets combo's width.
func (c *ComboWidget) Size(width float32) *ComboWidget {
c.width = width
return c
}

// OnChange sets callback when combo value gets changed.
func (c *ComboWidget) OnChange(onChange func()) *ComboWidget {
c.onChange = onChange
return c
}

var _ Widget = &ContextMenuWidget{}

// ContextMenuWidget is a context menu on another widget. (e.g. right-click menu on button).
Expand Down

0 comments on commit 86f7b37

Please sign in to comment.