Skip to content

Commit

Permalink
Merge pull request #915 from gucio321/combo-add-id-method
Browse files Browse the repository at this point in the history
widgets: add ID() method to the ComboWidget
  • Loading branch information
gucio321 authored Nov 26, 2024
2 parents e1daefe + 86f7b37 commit 4bc05bb
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 4bc05bb

Please sign in to comment.