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
|
// Button defines a standard wide UI button
|
||||||
type Button struct {
|
type Button struct {
|
||||||
|
@ -6,8 +6,8 @@ import (
|
|||||||
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2resource"
|
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2resource"
|
||||||
)
|
)
|
||||||
|
|
||||||
// static check that Checkbox implements Widget
|
// static check that Checkbox implements ClickableWidget
|
||||||
var _ Widget = &Checkbox{}
|
var _ ClickableWidget = &Checkbox{}
|
||||||
|
|
||||||
// Checkbox represents a checkbox UI element
|
// Checkbox represents a checkbox UI element
|
||||||
type Checkbox struct {
|
type Checkbox struct {
|
||||||
|
@ -11,6 +11,9 @@ import (
|
|||||||
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2util"
|
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2util"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// static check if Label implemented Widget
|
||||||
|
var _ Widget = &Label{}
|
||||||
|
|
||||||
// Label represents a user interface label
|
// Label represents a user interface label
|
||||||
type Label struct {
|
type Label struct {
|
||||||
*BaseWidget
|
*BaseWidget
|
||||||
|
@ -13,8 +13,8 @@ const (
|
|||||||
scrollbarWidth = 10
|
scrollbarWidth = 10
|
||||||
)
|
)
|
||||||
|
|
||||||
// static check that Scrollbar implements widget
|
// static check that Scrollbar implements clickable widget
|
||||||
var _ Widget = &Scrollbar{}
|
var _ ClickableWidget = &Scrollbar{}
|
||||||
|
|
||||||
// Scrollbar is a vertical slider ui element
|
// Scrollbar is a vertical slider ui element
|
||||||
type Scrollbar struct {
|
type Scrollbar struct {
|
||||||
|
@ -11,6 +11,9 @@ import (
|
|||||||
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2util"
|
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2util"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// static check if Sprite implemented Widget
|
||||||
|
var _ Widget = &Sprite{}
|
||||||
|
|
||||||
// Sprite is a positioned visual object.
|
// Sprite is a positioned visual object.
|
||||||
type Sprite struct {
|
type Sprite struct {
|
||||||
*BaseWidget
|
*BaseWidget
|
||||||
|
@ -11,8 +11,8 @@ import (
|
|||||||
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2util"
|
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2util"
|
||||||
)
|
)
|
||||||
|
|
||||||
// static check that TextBox implements widget
|
// static check that TextBox implements clickable widget
|
||||||
var _ Widget = &TextBox{}
|
var _ ClickableWidget = &TextBox{}
|
||||||
|
|
||||||
// TextBox represents a text input box
|
// TextBox represents a text input box
|
||||||
type TextBox struct {
|
type TextBox struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user