diff --git a/animationEvents.go b/animationEvents.go index 391c09d..0b0a080 100644 --- a/animationEvents.go +++ b/animationEvents.go @@ -61,19 +61,19 @@ func valueToAnimationListeners(value interface{}) ([]func(View, string), bool) { return []func(View, string){value}, true case func(string): - fn := func(view View, event string) { + fn := func(_ View, event string) { value(event) } return []func(View, string){fn}, true case func(View): - fn := func(view View, event string) { + fn := func(view View, _ string) { value(view) } return []func(View, string){fn}, true case func(): - fn := func(view View, event string) { + fn := func(View, string) { value() } return []func(View, string){fn}, true @@ -99,7 +99,7 @@ func valueToAnimationListeners(value interface{}) ([]func(View, string), bool) { if v == nil { return nil, false } - listeners[i] = func(view View, event string) { + listeners[i] = func(_ View, event string) { v(event) } } @@ -115,7 +115,7 @@ func valueToAnimationListeners(value interface{}) ([]func(View, string), bool) { if v == nil { return nil, false } - listeners[i] = func(view View, event string) { + listeners[i] = func(view View, _ string) { v(view) } } @@ -131,7 +131,7 @@ func valueToAnimationListeners(value interface{}) ([]func(View, string), bool) { if v == nil { return nil, false } - listeners[i] = func(view View, event string) { + listeners[i] = func(View, string) { v() } } @@ -152,17 +152,17 @@ func valueToAnimationListeners(value interface{}) ([]func(View, string), bool) { listeners[i] = v case func(string): - listeners[i] = func(view View, event string) { + listeners[i] = func(_ View, event string) { v(event) } case func(View): - listeners[i] = func(view View, event string) { + listeners[i] = func(view View, _ string) { v(view) } case func(): - listeners[i] = func(view View, event string) { + listeners[i] = func(View, string) { v() } diff --git a/checkbox.go b/checkbox.go index 5d79da3..f39291d 100644 --- a/checkbox.go +++ b/checkbox.go @@ -218,7 +218,7 @@ func (button *checkboxData) setChangedListener(value interface{}) bool { button.checkedListeners = []func(Checkbox, bool){value} case func(bool): - fn := func(view Checkbox, checked bool) { + fn := func(_ Checkbox, checked bool) { value(checked) } button.checkedListeners = []func(Checkbox, bool){fn} @@ -233,7 +233,7 @@ func (button *checkboxData) setChangedListener(value interface{}) bool { return false } - listeners[i] = func(view Checkbox, checked bool) { + listeners[i] = func(_ Checkbox, checked bool) { val(checked) } } @@ -251,7 +251,7 @@ func (button *checkboxData) setChangedListener(value interface{}) bool { listeners[i] = val case func(bool): - listeners[i] = func(view Checkbox, date bool) { + listeners[i] = func(_ Checkbox, date bool) { val(date) } diff --git a/colorPicker.go b/colorPicker.go index 1e87f13..6dca74b 100644 --- a/colorPicker.go +++ b/colorPicker.go @@ -92,7 +92,7 @@ func (picker *colorPickerData) set(tag string, value interface{}) bool { picker.colorChangedListeners = []func(ColorPicker, Color){value} case func(Color): - fn := func(view ColorPicker, date Color) { + fn := func(_ ColorPicker, date Color) { value(date) } picker.colorChangedListeners = []func(ColorPicker, Color){fn} @@ -108,7 +108,7 @@ func (picker *colorPickerData) set(tag string, value interface{}) bool { return false } - listeners[i] = func(view ColorPicker, date Color) { + listeners[i] = func(_ ColorPicker, date Color) { val(date) } } @@ -127,7 +127,7 @@ func (picker *colorPickerData) set(tag string, value interface{}) bool { listeners[i] = val case func(Color): - listeners[i] = func(view ColorPicker, date Color) { + listeners[i] = func(_ ColorPicker, date Color) { val(date) } diff --git a/datePicker.go b/datePicker.go index fe3f8ed..5c1b808 100644 --- a/datePicker.go +++ b/datePicker.go @@ -240,7 +240,7 @@ func (picker *datePickerData) set(tag string, value interface{}) bool { picker.dateChangedListeners = []func(DatePicker, time.Time){value} case func(time.Time): - fn := func(view DatePicker, date time.Time) { + fn := func(_ DatePicker, date time.Time) { value(date) } picker.dateChangedListeners = []func(DatePicker, time.Time){fn} @@ -256,7 +256,7 @@ func (picker *datePickerData) set(tag string, value interface{}) bool { return false } - listeners[i] = func(view DatePicker, date time.Time) { + listeners[i] = func(_ DatePicker, date time.Time) { val(date) } } @@ -275,7 +275,7 @@ func (picker *datePickerData) set(tag string, value interface{}) bool { listeners[i] = val case func(time.Time): - listeners[i] = func(view DatePicker, date time.Time) { + listeners[i] = func(_ DatePicker, date time.Time) { val(date) } diff --git a/dropDownList.go b/dropDownList.go index 2a35879..1ded185 100644 --- a/dropDownList.go +++ b/dropDownList.go @@ -297,7 +297,7 @@ func (list *dropDownListData) setDropDownListener(value interface{}) bool { list.dropDownListener = []func(DropDownList, int){value} case func(int): - list.dropDownListener = []func(DropDownList, int){func(list DropDownList, index int) { + list.dropDownListener = []func(DropDownList, int){func(_ DropDownList, index int) { value(index) }} @@ -311,7 +311,7 @@ func (list *dropDownListData) setDropDownListener(value interface{}) bool { notCompatibleType(DropDownEvent, value) return false } - listeners[i] = func(list DropDownList, index int) { + listeners[i] = func(_ DropDownList, index int) { val(index) } } @@ -329,7 +329,7 @@ func (list *dropDownListData) setDropDownListener(value interface{}) bool { listeners[i] = val case func(int): - listeners[i] = func(list DropDownList, index int) { + listeners[i] = func(_ DropDownList, index int) { val(index) } diff --git a/editView.go b/editView.go index d1682b5..362d256 100644 --- a/editView.go +++ b/editView.go @@ -350,7 +350,7 @@ func (edit *editViewData) setChangeListeners(value interface{}) bool { edit.textChangeListeners = []func(EditView, string){value} case func(string): - fn := func(view EditView, text string) { + fn := func(_ EditView, text string) { value(text) } edit.textChangeListeners = []func(EditView, string){fn} @@ -364,7 +364,7 @@ func (edit *editViewData) setChangeListeners(value interface{}) bool { if v == nil { return false } - listeners[i] = func(view EditView, text string) { + listeners[i] = func(_ EditView, text string) { v(text) } } @@ -381,7 +381,7 @@ func (edit *editViewData) setChangeListeners(value interface{}) bool { listeners[i] = v case func(string): - listeners[i] = func(view EditView, text string) { + listeners[i] = func(_ EditView, text string) { v(text) } diff --git a/filePicker.go b/filePicker.go index 7437be7..980295f 100644 --- a/filePicker.go +++ b/filePicker.go @@ -156,7 +156,7 @@ func (picker *filePickerData) set(tag string, value interface{}) bool { picker.fileSelectedListeners = []func(FilePicker, []FileInfo){value} case func([]FileInfo): - fn := func(view FilePicker, files []FileInfo) { + fn := func(_ FilePicker, files []FileInfo) { value(files) } picker.fileSelectedListeners = []func(FilePicker, []FileInfo){fn} @@ -172,7 +172,7 @@ func (picker *filePickerData) set(tag string, value interface{}) bool { return false } - listeners[i] = func(view FilePicker, files []FileInfo) { + listeners[i] = func(_ FilePicker, files []FileInfo) { val(files) } } @@ -191,7 +191,7 @@ func (picker *filePickerData) set(tag string, value interface{}) bool { listeners[i] = val case func([]FileInfo): - listeners[i] = func(view FilePicker, files []FileInfo) { + listeners[i] = func(_ FilePicker, files []FileInfo) { val(files) } diff --git a/imageView.go b/imageView.go index 096bc3d..79bfbac 100644 --- a/imageView.go +++ b/imageView.go @@ -427,7 +427,11 @@ func GetImageViewAltText(view View, subviewID string) string { // NoneFit (0), ContainFit (1), CoverFit (2), FillFit (3), or ScaleDownFit (4). // If the second argument (subviewID) is "" then a left position of the first argument (view) is returned func GetImageViewFit(view View, subviewID string) int { - if value, ok := enumProperty(view, Fit, view.Session(), 0); ok { + if subviewID != "" { + view = ViewByID(view, subviewID) + } + + if value, ok := enumStyledProperty(view, Fit, NoneFit); ok { return value } return 0 @@ -436,7 +440,11 @@ func GetImageViewFit(view View, subviewID string) int { // GetImageViewVerticalAlign return the vertical align of an ImageView subview: TopAlign (0), BottomAlign (1), CenterAlign (2) // If the second argument (subviewID) is "" then a left position of the first argument (view) is returned func GetImageViewVerticalAlign(view View, subviewID string) int { - if align, ok := enumProperty(view, ImageVerticalAlign, view.Session(), LeftAlign); ok { + if subviewID != "" { + view = ViewByID(view, subviewID) + } + + if align, ok := enumStyledProperty(view, ImageVerticalAlign, LeftAlign); ok { return align } return CenterAlign @@ -445,7 +453,11 @@ func GetImageViewVerticalAlign(view View, subviewID string) int { // GetImageViewHorizontalAlign return the vertical align of an ImageView subview: LeftAlign (0), RightAlign (1), CenterAlign (2) // If the second argument (subviewID) is "" then a left position of the first argument (view) is returned func GetImageViewHorizontalAlign(view View, subviewID string) int { - if align, ok := enumProperty(view, ImageHorizontalAlign, view.Session(), LeftAlign); ok { + if subviewID != "" { + view = ViewByID(view, subviewID) + } + + if align, ok := enumStyledProperty(view, ImageHorizontalAlign, LeftAlign); ok { return align } return CenterAlign diff --git a/keyEvents.go b/keyEvents.go index 15762b2..1c11f47 100644 --- a/keyEvents.go +++ b/keyEvents.go @@ -60,19 +60,19 @@ func valueToKeyListeners(value interface{}) ([]func(View, KeyEvent), bool) { return []func(View, KeyEvent){value}, true case func(KeyEvent): - fn := func(view View, event KeyEvent) { + fn := func(_ View, event KeyEvent) { value(event) } return []func(View, KeyEvent){fn}, true case func(View): - fn := func(view View, event KeyEvent) { + fn := func(view View, _ KeyEvent) { value(view) } return []func(View, KeyEvent){fn}, true case func(): - fn := func(view View, event KeyEvent) { + fn := func(View, KeyEvent) { value() } return []func(View, KeyEvent){fn}, true @@ -98,7 +98,7 @@ func valueToKeyListeners(value interface{}) ([]func(View, KeyEvent), bool) { if v == nil { return nil, false } - listeners[i] = func(view View, event KeyEvent) { + listeners[i] = func(_ View, event KeyEvent) { v(event) } } @@ -114,7 +114,7 @@ func valueToKeyListeners(value interface{}) ([]func(View, KeyEvent), bool) { if v == nil { return nil, false } - listeners[i] = func(view View, event KeyEvent) { + listeners[i] = func(view View, _ KeyEvent) { v(view) } } @@ -130,7 +130,7 @@ func valueToKeyListeners(value interface{}) ([]func(View, KeyEvent), bool) { if v == nil { return nil, false } - listeners[i] = func(view View, event KeyEvent) { + listeners[i] = func(View, KeyEvent) { v() } } @@ -151,17 +151,17 @@ func valueToKeyListeners(value interface{}) ([]func(View, KeyEvent), bool) { listeners[i] = v case func(KeyEvent): - listeners[i] = func(view View, event KeyEvent) { + listeners[i] = func(_ View, event KeyEvent) { v(event) } case func(View): - listeners[i] = func(view View, event KeyEvent) { + listeners[i] = func(view View, _ KeyEvent) { v(view) } case func(): - listeners[i] = func(view View, event KeyEvent) { + listeners[i] = func(View, KeyEvent) { v() } diff --git a/listView.go b/listView.go index cbc2b7a..f8206bd 100644 --- a/listView.go +++ b/listView.go @@ -294,7 +294,7 @@ func (listView *listViewData) setItemCheckedEvent(value interface{}) bool { listView.checkedListeners = []func(ListView, []int){value} case func([]int): - fn := func(view ListView, date []int) { + fn := func(_ ListView, date []int) { value(date) } listView.checkedListeners = []func(ListView, []int){fn} @@ -310,7 +310,7 @@ func (listView *listViewData) setItemCheckedEvent(value interface{}) bool { return false } - listeners[i] = func(view ListView, date []int) { + listeners[i] = func(_ ListView, date []int) { val(date) } } @@ -329,7 +329,7 @@ func (listView *listViewData) setItemCheckedEvent(value interface{}) bool { listeners[i] = val case func([]int): - listeners[i] = func(view ListView, checked []int) { + listeners[i] = func(_ ListView, checked []int) { val(checked) } @@ -470,7 +470,7 @@ func (listView *listViewData) valueToItemListeners(value interface{}) []func(Lis return []func(ListView, int){value} case func(int): - fn := func(view ListView, index int) { + fn := func(_ ListView, index int) { value(index) } return []func(ListView, int){fn} @@ -484,7 +484,7 @@ func (listView *listViewData) valueToItemListeners(value interface{}) []func(Lis if val == nil { return nil } - listeners[i] = func(view ListView, index int) { + listeners[i] = func(_ ListView, index int) { val(index) } } @@ -501,7 +501,7 @@ func (listView *listViewData) valueToItemListeners(value interface{}) []func(Lis listeners[i] = val case func(int): - listeners[i] = func(view ListView, index int) { + listeners[i] = func(_ ListView, index int) { val(index) } diff --git a/mediaPlayer.go b/mediaPlayer.go index 357aa79..80b55a2 100644 --- a/mediaPlayer.go +++ b/mediaPlayer.go @@ -392,19 +392,19 @@ func valueToPlayerTimeListeners(value interface{}) ([]func(MediaPlayer, float64) return []func(MediaPlayer, float64){value}, true case func(float64): - fn := func(player MediaPlayer, time float64) { + fn := func(_ MediaPlayer, time float64) { value(time) } return []func(MediaPlayer, float64){fn}, true case func(MediaPlayer): - fn := func(player MediaPlayer, time float64) { + fn := func(player MediaPlayer, _ float64) { value(player) } return []func(MediaPlayer, float64){fn}, true case func(): - fn := func(player MediaPlayer, time float64) { + fn := func(MediaPlayer, float64) { value() } return []func(MediaPlayer, float64){fn}, true @@ -430,7 +430,7 @@ func valueToPlayerTimeListeners(value interface{}) ([]func(MediaPlayer, float64) if v == nil { return nil, false } - listeners[i] = func(player MediaPlayer, time float64) { + listeners[i] = func(_ MediaPlayer, time float64) { v(time) } } @@ -446,7 +446,7 @@ func valueToPlayerTimeListeners(value interface{}) ([]func(MediaPlayer, float64) if v == nil { return nil, false } - listeners[i] = func(player MediaPlayer, time float64) { + listeners[i] = func(player MediaPlayer, _ float64) { v(player) } } @@ -462,7 +462,7 @@ func valueToPlayerTimeListeners(value interface{}) ([]func(MediaPlayer, float64) if v == nil { return nil, false } - listeners[i] = func(player MediaPlayer, time float64) { + listeners[i] = func(MediaPlayer, float64) { v() } } @@ -483,17 +483,17 @@ func valueToPlayerTimeListeners(value interface{}) ([]func(MediaPlayer, float64) listeners[i] = v case func(float64): - listeners[i] = func(player MediaPlayer, time float64) { + listeners[i] = func(_ MediaPlayer, time float64) { v(time) } case func(MediaPlayer): - listeners[i] = func(player MediaPlayer, time float64) { + listeners[i] = func(player MediaPlayer, _ float64) { v(player) } case func(): - listeners[i] = func(player MediaPlayer, time float64) { + listeners[i] = func(MediaPlayer, float64) { v() } @@ -517,19 +517,19 @@ func valueToPlayerErrorListeners(value interface{}) ([]func(MediaPlayer, int, st return []func(MediaPlayer, int, string){value}, true case func(int, string): - fn := func(player MediaPlayer, code int, message string) { + fn := func(_ MediaPlayer, code int, message string) { value(code, message) } return []func(MediaPlayer, int, string){fn}, true case func(MediaPlayer): - fn := func(player MediaPlayer, code int, message string) { + fn := func(player MediaPlayer, _ int, _ string) { value(player) } return []func(MediaPlayer, int, string){fn}, true case func(): - fn := func(player MediaPlayer, code int, message string) { + fn := func(MediaPlayer, int, string) { value() } return []func(MediaPlayer, int, string){fn}, true @@ -555,7 +555,7 @@ func valueToPlayerErrorListeners(value interface{}) ([]func(MediaPlayer, int, st if v == nil { return nil, false } - listeners[i] = func(player MediaPlayer, code int, message string) { + listeners[i] = func(_ MediaPlayer, code int, message string) { v(code, message) } } @@ -571,7 +571,7 @@ func valueToPlayerErrorListeners(value interface{}) ([]func(MediaPlayer, int, st if v == nil { return nil, false } - listeners[i] = func(player MediaPlayer, code int, message string) { + listeners[i] = func(player MediaPlayer, _ int, _ string) { v(player) } } @@ -587,7 +587,7 @@ func valueToPlayerErrorListeners(value interface{}) ([]func(MediaPlayer, int, st if v == nil { return nil, false } - listeners[i] = func(player MediaPlayer, code int, message string) { + listeners[i] = func(MediaPlayer, int, string) { v() } } @@ -608,17 +608,17 @@ func valueToPlayerErrorListeners(value interface{}) ([]func(MediaPlayer, int, st listeners[i] = v case func(int, string): - listeners[i] = func(player MediaPlayer, code int, message string) { + listeners[i] = func(_ MediaPlayer, code int, message string) { v(code, message) } case func(MediaPlayer): - listeners[i] = func(player MediaPlayer, code int, message string) { + listeners[i] = func(player MediaPlayer, _ int, _ string) { v(player) } case func(): - listeners[i] = func(player MediaPlayer, code int, message string) { + listeners[i] = func(MediaPlayer, int, string) { v() } diff --git a/mouseEvents.go b/mouseEvents.go index bbfe76f..e9ae3a6 100644 --- a/mouseEvents.go +++ b/mouseEvents.go @@ -154,19 +154,19 @@ func valueToMouseListeners(value interface{}) ([]func(View, MouseEvent), bool) { return []func(View, MouseEvent){value}, true case func(MouseEvent): - fn := func(view View, event MouseEvent) { + fn := func(_ View, event MouseEvent) { value(event) } return []func(View, MouseEvent){fn}, true case func(View): - fn := func(view View, event MouseEvent) { + fn := func(view View, _ MouseEvent) { value(view) } return []func(View, MouseEvent){fn}, true case func(): - fn := func(view View, event MouseEvent) { + fn := func(View, MouseEvent) { value() } return []func(View, MouseEvent){fn}, true @@ -192,7 +192,7 @@ func valueToMouseListeners(value interface{}) ([]func(View, MouseEvent), bool) { if v == nil { return nil, false } - listeners[i] = func(view View, event MouseEvent) { + listeners[i] = func(_ View, event MouseEvent) { v(event) } } @@ -208,7 +208,7 @@ func valueToMouseListeners(value interface{}) ([]func(View, MouseEvent), bool) { if v == nil { return nil, false } - listeners[i] = func(view View, event MouseEvent) { + listeners[i] = func(view View, _ MouseEvent) { v(view) } } @@ -224,7 +224,7 @@ func valueToMouseListeners(value interface{}) ([]func(View, MouseEvent), bool) { if v == nil { return nil, false } - listeners[i] = func(view View, event MouseEvent) { + listeners[i] = func(View, MouseEvent) { v() } } @@ -245,17 +245,17 @@ func valueToMouseListeners(value interface{}) ([]func(View, MouseEvent), bool) { listeners[i] = v case func(MouseEvent): - listeners[i] = func(view View, event MouseEvent) { + listeners[i] = func(_ View, event MouseEvent) { v(event) } case func(View): - listeners[i] = func(view View, event MouseEvent) { + listeners[i] = func(view View, _ MouseEvent) { v(view) } case func(): - listeners[i] = func(view View, event MouseEvent) { + listeners[i] = func(View, MouseEvent) { v() } diff --git a/numberPicker.go b/numberPicker.go index db1aeaf..a44f60a 100644 --- a/numberPicker.go +++ b/numberPicker.go @@ -104,7 +104,7 @@ func (picker *numberPickerData) set(tag string, value interface{}) bool { picker.numberChangedListeners = []func(NumberPicker, float64){value} case func(float64): - fn := func(view NumberPicker, newValue float64) { + fn := func(_ NumberPicker, newValue float64) { value(newValue) } picker.numberChangedListeners = []func(NumberPicker, float64){fn} @@ -120,7 +120,7 @@ func (picker *numberPickerData) set(tag string, value interface{}) bool { return false } - listeners[i] = func(view NumberPicker, newValue float64) { + listeners[i] = func(_ NumberPicker, newValue float64) { val(newValue) } } diff --git a/pointerEvents.go b/pointerEvents.go index 12ec35b..e0f78db 100644 --- a/pointerEvents.go +++ b/pointerEvents.go @@ -97,19 +97,19 @@ func valueToPointerListeners(value interface{}) ([]func(View, PointerEvent), boo return []func(View, PointerEvent){value}, true case func(PointerEvent): - fn := func(view View, event PointerEvent) { + fn := func(_ View, event PointerEvent) { value(event) } return []func(View, PointerEvent){fn}, true case func(View): - fn := func(view View, event PointerEvent) { + fn := func(view View, _ PointerEvent) { value(view) } return []func(View, PointerEvent){fn}, true case func(): - fn := func(view View, event PointerEvent) { + fn := func(View, PointerEvent) { value() } return []func(View, PointerEvent){fn}, true @@ -135,7 +135,7 @@ func valueToPointerListeners(value interface{}) ([]func(View, PointerEvent), boo if v == nil { return nil, false } - listeners[i] = func(view View, event PointerEvent) { + listeners[i] = func(_ View, event PointerEvent) { v(event) } } @@ -151,7 +151,7 @@ func valueToPointerListeners(value interface{}) ([]func(View, PointerEvent), boo if v == nil { return nil, false } - listeners[i] = func(view View, event PointerEvent) { + listeners[i] = func(view View, _ PointerEvent) { v(view) } } @@ -167,7 +167,7 @@ func valueToPointerListeners(value interface{}) ([]func(View, PointerEvent), boo if v == nil { return nil, false } - listeners[i] = func(view View, event PointerEvent) { + listeners[i] = func(View, PointerEvent) { v() } } @@ -188,17 +188,17 @@ func valueToPointerListeners(value interface{}) ([]func(View, PointerEvent), boo listeners[i] = v case func(PointerEvent): - listeners[i] = func(view View, event PointerEvent) { + listeners[i] = func(_ View, event PointerEvent) { v(event) } case func(View): - listeners[i] = func(view View, event PointerEvent) { + listeners[i] = func(view View, _ PointerEvent) { v(view) } case func(): - listeners[i] = func(view View, event PointerEvent) { + listeners[i] = func(View, PointerEvent) { v() } diff --git a/popup.go b/popup.go index dab40b1..b4ac0e3 100644 --- a/popup.go +++ b/popup.go @@ -81,7 +81,7 @@ func (popup *popupData) init(view View, params Params) { case func(): popup.dismissListener = []func(Popup){ - func(popup Popup) { + func(_ Popup) { value() }, } @@ -96,7 +96,7 @@ func (popup *popupData) init(view View, params Params) { case []func(): for _, fn := range value { if fn != nil { - popup.dismissListener = append(popup.dismissListener, func(popup Popup) { + popup.dismissListener = append(popup.dismissListener, func(_ Popup) { fn() }) } @@ -110,7 +110,7 @@ func (popup *popupData) init(view View, params Params) { popup.dismissListener = append(popup.dismissListener, fn) case func(): - popup.dismissListener = append(popup.dismissListener, func(popup Popup) { + popup.dismissListener = append(popup.dismissListener, func(_ Popup) { fn() }) } diff --git a/resizeEvent.go b/resizeEvent.go index f00ab9c..bee0466 100644 --- a/resizeEvent.go +++ b/resizeEvent.go @@ -40,7 +40,7 @@ func (view *viewData) setFrameListener(tag string, value interface{}) bool { } case func(Frame): - fn := func(view View, frame Frame) { + fn := func(_ View, frame Frame) { value(frame) } view.properties[tag] = []func(View, Frame){fn} @@ -59,14 +59,14 @@ func (view *viewData) setFrameListener(tag string, value interface{}) bool { return false } - listeners[i] = func(view View, frame Frame) { + listeners[i] = func(_ View, frame Frame) { val(frame) } } view.properties[tag] = listeners case func(View): - fn := func(view View, frame Frame) { + fn := func(view View, _ Frame) { value(view) } view.properties[tag] = []func(View, Frame){fn} @@ -85,14 +85,14 @@ func (view *viewData) setFrameListener(tag string, value interface{}) bool { return false } - listeners[i] = func(view View, frame Frame) { + listeners[i] = func(view View, _ Frame) { val(view) } } view.properties[tag] = listeners case func(): - fn := func(view View, frame Frame) { + fn := func(View, Frame) { value() } view.properties[tag] = []func(View, Frame){fn} @@ -111,7 +111,7 @@ func (view *viewData) setFrameListener(tag string, value interface{}) bool { return false } - listeners[i] = func(view View, frame Frame) { + listeners[i] = func(View, Frame) { val() } } @@ -136,17 +136,17 @@ func (view *viewData) setFrameListener(tag string, value interface{}) bool { listeners[i] = val case func(Frame): - listeners[i] = func(view View, frame Frame) { + listeners[i] = func(_ View, frame Frame) { val(frame) } case func(View): - listeners[i] = func(view View, frame Frame) { + listeners[i] = func(view View, _ Frame) { val(view) } case func(): - listeners[i] = func(view View, frame Frame) { + listeners[i] = func(View, Frame) { val() } diff --git a/resources.go b/resources.go index 97b828a..6f1761a 100644 --- a/resources.go +++ b/resources.go @@ -336,26 +336,19 @@ func ReadRawResource(filename string) []byte { } } - readFile := func(path string) []byte { - if data, err := os.ReadFile(resources.path + rawDir + "/" + filename); err == nil { - return data - } - return nil - } - if resources.path != "" { - if data := readFile(resources.path + rawDir + "/" + filename); data != nil { + if data, err := os.ReadFile(resources.path + rawDir + "/" + filename); err == nil { return data } } if exe, err := os.Executable(); err == nil { - if data := readFile(filepath.Dir(exe) + "/resources/" + rawDir + "/" + filename); data != nil { + if data, err := os.ReadFile(filepath.Dir(exe) + "/resources/" + rawDir + "/" + filename); err == nil { return data } } - ErrorLogF(`The raw file "%s" don't found`, filename) + ErrorLogF(`The "%s" raw file don't found`, filename) return nil } diff --git a/tableView.go b/tableView.go index ed8ee9d..85b7316 100644 --- a/tableView.go +++ b/tableView.go @@ -686,7 +686,7 @@ func (table *tableViewData) valueToCellListeners(value interface{}) []func(Table return []func(TableView, int, int){value} case func(int, int): - fn := func(view TableView, row, column int) { + fn := func(_ TableView, row, column int) { value(row, column) } return []func(TableView, int, int){fn} @@ -700,7 +700,7 @@ func (table *tableViewData) valueToCellListeners(value interface{}) []func(Table if val == nil { return nil } - listeners[i] = func(view TableView, row, column int) { + listeners[i] = func(_ TableView, row, column int) { val(row, column) } } @@ -717,7 +717,7 @@ func (table *tableViewData) valueToCellListeners(value interface{}) []func(Table listeners[i] = val case func(int, int): - listeners[i] = func(view TableView, row, column int) { + listeners[i] = func(_ TableView, row, column int) { val(row, column) } @@ -741,7 +741,7 @@ func (table *tableViewData) valueToRowListeners(value interface{}) []func(TableV return []func(TableView, int){value} case func(int): - fn := func(view TableView, index int) { + fn := func(_ TableView, index int) { value(index) } return []func(TableView, int){fn} @@ -755,7 +755,7 @@ func (table *tableViewData) valueToRowListeners(value interface{}) []func(TableV if val == nil { return nil } - listeners[i] = func(view TableView, index int) { + listeners[i] = func(_ TableView, index int) { val(index) } } @@ -772,7 +772,7 @@ func (table *tableViewData) valueToRowListeners(value interface{}) []func(TableV listeners[i] = val case func(int): - listeners[i] = func(view TableView, index int) { + listeners[i] = func(_ TableView, index int) { val(index) } diff --git a/tabsLayout.go b/tabsLayout.go index e4e56dc..3291503 100644 --- a/tabsLayout.go +++ b/tabsLayout.go @@ -296,31 +296,31 @@ func (tabsLayout *tabsLayoutData) valueToTabListeners(value interface{}) []func( return []func(TabsLayout, int, int){value} case func(TabsLayout, int): - fn := func(view TabsLayout, current, old int) { + fn := func(view TabsLayout, current, _ int) { value(view, current) } return []func(TabsLayout, int, int){fn} case func(TabsLayout): - fn := func(view TabsLayout, current, old int) { + fn := func(view TabsLayout, _, _ int) { value(view) } return []func(TabsLayout, int, int){fn} case func(int, int): - fn := func(view TabsLayout, current, old int) { + fn := func(_ TabsLayout, current, old int) { value(current, old) } return []func(TabsLayout, int, int){fn} case func(int): - fn := func(view TabsLayout, current, old int) { + fn := func(_ TabsLayout, current, _ int) { value(current) } return []func(TabsLayout, int, int){fn} case func(): - fn := func(view TabsLayout, current, old int) { + fn := func(TabsLayout, int, int) { value() } return []func(TabsLayout, int, int){fn} @@ -334,7 +334,7 @@ func (tabsLayout *tabsLayoutData) valueToTabListeners(value interface{}) []func( if val == nil { return nil } - listeners[i] = func(view TabsLayout, current, old int) { + listeners[i] = func(view TabsLayout, current, _ int) { val(view, current) } } @@ -346,7 +346,7 @@ func (tabsLayout *tabsLayoutData) valueToTabListeners(value interface{}) []func( if val == nil { return nil } - listeners[i] = func(view TabsLayout, current, old int) { + listeners[i] = func(view TabsLayout, _, _ int) { val(view) } } @@ -358,7 +358,7 @@ func (tabsLayout *tabsLayoutData) valueToTabListeners(value interface{}) []func( if val == nil { return nil } - listeners[i] = func(view TabsLayout, current, old int) { + listeners[i] = func(_ TabsLayout, current, old int) { val(current, old) } } @@ -370,7 +370,7 @@ func (tabsLayout *tabsLayoutData) valueToTabListeners(value interface{}) []func( if val == nil { return nil } - listeners[i] = func(view TabsLayout, current, old int) { + listeners[i] = func(_ TabsLayout, current, _ int) { val(current) } } @@ -382,7 +382,7 @@ func (tabsLayout *tabsLayoutData) valueToTabListeners(value interface{}) []func( if val == nil { return nil } - listeners[i] = func(view TabsLayout, current, old int) { + listeners[i] = func(TabsLayout, int, int) { val() } } @@ -399,27 +399,27 @@ func (tabsLayout *tabsLayoutData) valueToTabListeners(value interface{}) []func( listeners[i] = val case func(TabsLayout, int): - listeners[i] = func(view TabsLayout, current, old int) { + listeners[i] = func(view TabsLayout, current, _ int) { val(view, current) } case func(TabsLayout): - listeners[i] = func(view TabsLayout, current, old int) { + listeners[i] = func(view TabsLayout, _, _ int) { val(view) } case func(int, int): - listeners[i] = func(view TabsLayout, current, old int) { + listeners[i] = func(_ TabsLayout, current, old int) { val(current, old) } case func(int): - listeners[i] = func(view TabsLayout, current, old int) { + listeners[i] = func(_ TabsLayout, current, _ int) { val(current) } case func(): - listeners[i] = func(view TabsLayout, current, old int) { + listeners[i] = func(TabsLayout, int, int) { val() } @@ -443,7 +443,7 @@ func (tabsLayout *tabsLayoutData) valueToCloseListeners(value interface{}) []fun return []func(TabsLayout, int){value} case func(int): - fn := func(view TabsLayout, index int) { + fn := func(_ TabsLayout, index int) { value(index) } return []func(TabsLayout, int){fn} @@ -457,7 +457,7 @@ func (tabsLayout *tabsLayoutData) valueToCloseListeners(value interface{}) []fun if val == nil { return nil } - listeners[i] = func(view TabsLayout, index int) { + listeners[i] = func(_ TabsLayout, index int) { val(index) } } @@ -474,7 +474,7 @@ func (tabsLayout *tabsLayoutData) valueToCloseListeners(value interface{}) []fun listeners[i] = val case func(int): - listeners[i] = func(view TabsLayout, index int) { + listeners[i] = func(_ TabsLayout, index int) { val(index) } diff --git a/timePicker.go b/timePicker.go index 548ac52..ace0a60 100644 --- a/timePicker.go +++ b/timePicker.go @@ -228,7 +228,7 @@ func (picker *timePickerData) set(tag string, value interface{}) bool { picker.timeChangedListeners = []func(TimePicker, time.Time){value} case func(time.Time): - fn := func(view TimePicker, time time.Time) { + fn := func(_ TimePicker, time time.Time) { value(time) } picker.timeChangedListeners = []func(TimePicker, time.Time){fn} @@ -244,7 +244,7 @@ func (picker *timePickerData) set(tag string, value interface{}) bool { return false } - listeners[i] = func(view TimePicker, time time.Time) { + listeners[i] = func(_ TimePicker, time time.Time) { val(time) } } @@ -263,7 +263,7 @@ func (picker *timePickerData) set(tag string, value interface{}) bool { listeners[i] = val case func(time.Time): - listeners[i] = func(view TimePicker, time time.Time) { + listeners[i] = func(_ TimePicker, time time.Time) { val(time) } diff --git a/touchEvents.go b/touchEvents.go index 2deeed1..bcb3ede 100644 --- a/touchEvents.go +++ b/touchEvents.go @@ -100,19 +100,19 @@ func valueToTouchListeners(value interface{}) ([]func(View, TouchEvent), bool) { return []func(View, TouchEvent){value}, true case func(TouchEvent): - fn := func(view View, event TouchEvent) { + fn := func(_ View, event TouchEvent) { value(event) } return []func(View, TouchEvent){fn}, true case func(View): - fn := func(view View, event TouchEvent) { + fn := func(view View, _ TouchEvent) { value(view) } return []func(View, TouchEvent){fn}, true case func(): - fn := func(view View, event TouchEvent) { + fn := func(View, TouchEvent) { value() } return []func(View, TouchEvent){fn}, true @@ -138,7 +138,7 @@ func valueToTouchListeners(value interface{}) ([]func(View, TouchEvent), bool) { if v == nil { return nil, false } - listeners[i] = func(view View, event TouchEvent) { + listeners[i] = func(_ View, event TouchEvent) { v(event) } } @@ -154,7 +154,7 @@ func valueToTouchListeners(value interface{}) ([]func(View, TouchEvent), bool) { if v == nil { return nil, false } - listeners[i] = func(view View, event TouchEvent) { + listeners[i] = func(view View, _ TouchEvent) { v(view) } } @@ -170,7 +170,7 @@ func valueToTouchListeners(value interface{}) ([]func(View, TouchEvent), bool) { if v == nil { return nil, false } - listeners[i] = func(view View, event TouchEvent) { + listeners[i] = func(View, TouchEvent) { v() } } @@ -191,17 +191,17 @@ func valueToTouchListeners(value interface{}) ([]func(View, TouchEvent), bool) { listeners[i] = v case func(TouchEvent): - listeners[i] = func(view View, event TouchEvent) { + listeners[i] = func(_ View, event TouchEvent) { v(event) } case func(View): - listeners[i] = func(view View, event TouchEvent) { + listeners[i] = func(view View, _ TouchEvent) { v(view) } case func(): - listeners[i] = func(view View, event TouchEvent) { + listeners[i] = func(View, TouchEvent) { v() }