mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2025-02-02 06:36:28 -05:00
added static checks to d2ui (#990)
Co-authored-by: M. Sz <mszeptuch@protonmail.com>
This commit is contained in:
parent
540f285468
commit
fbfea917cb
@ -768,7 +768,8 @@ func getButtonLayouts() map[ButtonType]ButtonLayout {
|
||||
}
|
||||
}
|
||||
|
||||
var _ Widget = &Button{} // static check to ensure button implements widget
|
||||
// static check to ensure button implements clickable widget
|
||||
var _ ClickableWidget = &Button{}
|
||||
|
||||
// Button defines a standard wide UI button
|
||||
type Button struct {
|
||||
|
@ -6,8 +6,8 @@ import (
|
||||
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2resource"
|
||||
)
|
||||
|
||||
// static check that Checkbox implements Widget
|
||||
var _ Widget = &Checkbox{}
|
||||
// static check that Checkbox implements ClickableWidget
|
||||
var _ ClickableWidget = &Checkbox{}
|
||||
|
||||
// Checkbox represents a checkbox UI element
|
||||
type Checkbox struct {
|
||||
|
@ -11,6 +11,9 @@ import (
|
||||
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2util"
|
||||
)
|
||||
|
||||
// static check if Label implemented Widget
|
||||
var _ Widget = &Label{}
|
||||
|
||||
// Label represents a user interface label
|
||||
type Label struct {
|
||||
*BaseWidget
|
||||
|
@ -13,8 +13,8 @@ const (
|
||||
scrollbarWidth = 10
|
||||
)
|
||||
|
||||
// static check that Scrollbar implements widget
|
||||
var _ Widget = &Scrollbar{}
|
||||
// static check that Scrollbar implements clickable widget
|
||||
var _ ClickableWidget = &Scrollbar{}
|
||||
|
||||
// Scrollbar is a vertical slider ui element
|
||||
type Scrollbar struct {
|
||||
|
@ -11,6 +11,9 @@ import (
|
||||
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2util"
|
||||
)
|
||||
|
||||
// static check if Sprite implemented Widget
|
||||
var _ Widget = &Sprite{}
|
||||
|
||||
// Sprite is a positioned visual object.
|
||||
type Sprite struct {
|
||||
*BaseWidget
|
||||
|
@ -11,8 +11,8 @@ import (
|
||||
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2util"
|
||||
)
|
||||
|
||||
// static check that TextBox implements widget
|
||||
var _ Widget = &TextBox{}
|
||||
// static check that TextBox implements clickable widget
|
||||
var _ ClickableWidget = &TextBox{}
|
||||
|
||||
// TextBox represents a text input box
|
||||
type TextBox struct {
|
||||
|
Loading…
Reference in New Issue
Block a user