1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-09-30 07:06:18 -04: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 // Button defines a standard wide UI button
type Button struct { type Button struct {

View File

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

View File

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

View File

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

View File

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

View File

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