1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-06-29 10:35:23 +00:00

added static checks to d2ui (#990)

Co-authored-by: M. Sz <mszeptuch@protonmail.com>
This commit is contained in:
gucio321 2020-12-19 21:28:07 +01:00 committed by GitHub
parent 540f285468
commit fbfea917cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 14 additions and 7 deletions

View File

@ -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 {

View File

@ -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 {

View File

@ -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

View File

@ -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 {

View File

@ -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

View File

@ -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 {