forked from mbk-lab/rui_orig
2
0
Fork 0

Bug fixing

This commit is contained in:
Alexei Anoshenko 2022-07-19 18:22:19 +03:00
parent d3c36e38bd
commit 392a0a0288
21 changed files with 146 additions and 141 deletions

View File

@ -61,19 +61,19 @@ func valueToAnimationListeners(value interface{}) ([]func(View, string), bool) {
return []func(View, string){value}, true return []func(View, string){value}, true
case func(string): case func(string):
fn := func(view View, event string) { fn := func(_ View, event string) {
value(event) value(event)
} }
return []func(View, string){fn}, true return []func(View, string){fn}, true
case func(View): case func(View):
fn := func(view View, event string) { fn := func(view View, _ string) {
value(view) value(view)
} }
return []func(View, string){fn}, true return []func(View, string){fn}, true
case func(): case func():
fn := func(view View, event string) { fn := func(View, string) {
value() value()
} }
return []func(View, string){fn}, true return []func(View, string){fn}, true
@ -99,7 +99,7 @@ func valueToAnimationListeners(value interface{}) ([]func(View, string), bool) {
if v == nil { if v == nil {
return nil, false return nil, false
} }
listeners[i] = func(view View, event string) { listeners[i] = func(_ View, event string) {
v(event) v(event)
} }
} }
@ -115,7 +115,7 @@ func valueToAnimationListeners(value interface{}) ([]func(View, string), bool) {
if v == nil { if v == nil {
return nil, false return nil, false
} }
listeners[i] = func(view View, event string) { listeners[i] = func(view View, _ string) {
v(view) v(view)
} }
} }
@ -131,7 +131,7 @@ func valueToAnimationListeners(value interface{}) ([]func(View, string), bool) {
if v == nil { if v == nil {
return nil, false return nil, false
} }
listeners[i] = func(view View, event string) { listeners[i] = func(View, string) {
v() v()
} }
} }
@ -152,17 +152,17 @@ func valueToAnimationListeners(value interface{}) ([]func(View, string), bool) {
listeners[i] = v listeners[i] = v
case func(string): case func(string):
listeners[i] = func(view View, event string) { listeners[i] = func(_ View, event string) {
v(event) v(event)
} }
case func(View): case func(View):
listeners[i] = func(view View, event string) { listeners[i] = func(view View, _ string) {
v(view) v(view)
} }
case func(): case func():
listeners[i] = func(view View, event string) { listeners[i] = func(View, string) {
v() v()
} }

View File

@ -218,7 +218,7 @@ func (button *checkboxData) setChangedListener(value interface{}) bool {
button.checkedListeners = []func(Checkbox, bool){value} button.checkedListeners = []func(Checkbox, bool){value}
case func(bool): case func(bool):
fn := func(view Checkbox, checked bool) { fn := func(_ Checkbox, checked bool) {
value(checked) value(checked)
} }
button.checkedListeners = []func(Checkbox, bool){fn} button.checkedListeners = []func(Checkbox, bool){fn}
@ -233,7 +233,7 @@ func (button *checkboxData) setChangedListener(value interface{}) bool {
return false return false
} }
listeners[i] = func(view Checkbox, checked bool) { listeners[i] = func(_ Checkbox, checked bool) {
val(checked) val(checked)
} }
} }
@ -251,7 +251,7 @@ func (button *checkboxData) setChangedListener(value interface{}) bool {
listeners[i] = val listeners[i] = val
case func(bool): case func(bool):
listeners[i] = func(view Checkbox, date bool) { listeners[i] = func(_ Checkbox, date bool) {
val(date) val(date)
} }

View File

@ -92,7 +92,7 @@ func (picker *colorPickerData) set(tag string, value interface{}) bool {
picker.colorChangedListeners = []func(ColorPicker, Color){value} picker.colorChangedListeners = []func(ColorPicker, Color){value}
case func(Color): case func(Color):
fn := func(view ColorPicker, date Color) { fn := func(_ ColorPicker, date Color) {
value(date) value(date)
} }
picker.colorChangedListeners = []func(ColorPicker, Color){fn} picker.colorChangedListeners = []func(ColorPicker, Color){fn}
@ -108,7 +108,7 @@ func (picker *colorPickerData) set(tag string, value interface{}) bool {
return false return false
} }
listeners[i] = func(view ColorPicker, date Color) { listeners[i] = func(_ ColorPicker, date Color) {
val(date) val(date)
} }
} }
@ -127,7 +127,7 @@ func (picker *colorPickerData) set(tag string, value interface{}) bool {
listeners[i] = val listeners[i] = val
case func(Color): case func(Color):
listeners[i] = func(view ColorPicker, date Color) { listeners[i] = func(_ ColorPicker, date Color) {
val(date) val(date)
} }

View File

@ -240,7 +240,7 @@ func (picker *datePickerData) set(tag string, value interface{}) bool {
picker.dateChangedListeners = []func(DatePicker, time.Time){value} picker.dateChangedListeners = []func(DatePicker, time.Time){value}
case func(time.Time): case func(time.Time):
fn := func(view DatePicker, date time.Time) { fn := func(_ DatePicker, date time.Time) {
value(date) value(date)
} }
picker.dateChangedListeners = []func(DatePicker, time.Time){fn} picker.dateChangedListeners = []func(DatePicker, time.Time){fn}
@ -256,7 +256,7 @@ func (picker *datePickerData) set(tag string, value interface{}) bool {
return false return false
} }
listeners[i] = func(view DatePicker, date time.Time) { listeners[i] = func(_ DatePicker, date time.Time) {
val(date) val(date)
} }
} }
@ -275,7 +275,7 @@ func (picker *datePickerData) set(tag string, value interface{}) bool {
listeners[i] = val listeners[i] = val
case func(time.Time): case func(time.Time):
listeners[i] = func(view DatePicker, date time.Time) { listeners[i] = func(_ DatePicker, date time.Time) {
val(date) val(date)
} }

View File

@ -297,7 +297,7 @@ func (list *dropDownListData) setDropDownListener(value interface{}) bool {
list.dropDownListener = []func(DropDownList, int){value} list.dropDownListener = []func(DropDownList, int){value}
case func(int): case func(int):
list.dropDownListener = []func(DropDownList, int){func(list DropDownList, index int) { list.dropDownListener = []func(DropDownList, int){func(_ DropDownList, index int) {
value(index) value(index)
}} }}
@ -311,7 +311,7 @@ func (list *dropDownListData) setDropDownListener(value interface{}) bool {
notCompatibleType(DropDownEvent, value) notCompatibleType(DropDownEvent, value)
return false return false
} }
listeners[i] = func(list DropDownList, index int) { listeners[i] = func(_ DropDownList, index int) {
val(index) val(index)
} }
} }
@ -329,7 +329,7 @@ func (list *dropDownListData) setDropDownListener(value interface{}) bool {
listeners[i] = val listeners[i] = val
case func(int): case func(int):
listeners[i] = func(list DropDownList, index int) { listeners[i] = func(_ DropDownList, index int) {
val(index) val(index)
} }

View File

@ -350,7 +350,7 @@ func (edit *editViewData) setChangeListeners(value interface{}) bool {
edit.textChangeListeners = []func(EditView, string){value} edit.textChangeListeners = []func(EditView, string){value}
case func(string): case func(string):
fn := func(view EditView, text string) { fn := func(_ EditView, text string) {
value(text) value(text)
} }
edit.textChangeListeners = []func(EditView, string){fn} edit.textChangeListeners = []func(EditView, string){fn}
@ -364,7 +364,7 @@ func (edit *editViewData) setChangeListeners(value interface{}) bool {
if v == nil { if v == nil {
return false return false
} }
listeners[i] = func(view EditView, text string) { listeners[i] = func(_ EditView, text string) {
v(text) v(text)
} }
} }
@ -381,7 +381,7 @@ func (edit *editViewData) setChangeListeners(value interface{}) bool {
listeners[i] = v listeners[i] = v
case func(string): case func(string):
listeners[i] = func(view EditView, text string) { listeners[i] = func(_ EditView, text string) {
v(text) v(text)
} }

View File

@ -156,7 +156,7 @@ func (picker *filePickerData) set(tag string, value interface{}) bool {
picker.fileSelectedListeners = []func(FilePicker, []FileInfo){value} picker.fileSelectedListeners = []func(FilePicker, []FileInfo){value}
case func([]FileInfo): case func([]FileInfo):
fn := func(view FilePicker, files []FileInfo) { fn := func(_ FilePicker, files []FileInfo) {
value(files) value(files)
} }
picker.fileSelectedListeners = []func(FilePicker, []FileInfo){fn} picker.fileSelectedListeners = []func(FilePicker, []FileInfo){fn}
@ -172,7 +172,7 @@ func (picker *filePickerData) set(tag string, value interface{}) bool {
return false return false
} }
listeners[i] = func(view FilePicker, files []FileInfo) { listeners[i] = func(_ FilePicker, files []FileInfo) {
val(files) val(files)
} }
} }
@ -191,7 +191,7 @@ func (picker *filePickerData) set(tag string, value interface{}) bool {
listeners[i] = val listeners[i] = val
case func([]FileInfo): case func([]FileInfo):
listeners[i] = func(view FilePicker, files []FileInfo) { listeners[i] = func(_ FilePicker, files []FileInfo) {
val(files) val(files)
} }

View File

@ -427,7 +427,11 @@ func GetImageViewAltText(view View, subviewID string) string {
// NoneFit (0), ContainFit (1), CoverFit (2), FillFit (3), or ScaleDownFit (4). // 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 // If the second argument (subviewID) is "" then a left position of the first argument (view) is returned
func GetImageViewFit(view View, subviewID string) int { 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 value
} }
return 0 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) // 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 // If the second argument (subviewID) is "" then a left position of the first argument (view) is returned
func GetImageViewVerticalAlign(view View, subviewID string) int { 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 align
} }
return CenterAlign 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) // 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 // If the second argument (subviewID) is "" then a left position of the first argument (view) is returned
func GetImageViewHorizontalAlign(view View, subviewID string) int { 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 align
} }
return CenterAlign return CenterAlign

View File

@ -60,19 +60,19 @@ func valueToKeyListeners(value interface{}) ([]func(View, KeyEvent), bool) {
return []func(View, KeyEvent){value}, true return []func(View, KeyEvent){value}, true
case func(KeyEvent): case func(KeyEvent):
fn := func(view View, event KeyEvent) { fn := func(_ View, event KeyEvent) {
value(event) value(event)
} }
return []func(View, KeyEvent){fn}, true return []func(View, KeyEvent){fn}, true
case func(View): case func(View):
fn := func(view View, event KeyEvent) { fn := func(view View, _ KeyEvent) {
value(view) value(view)
} }
return []func(View, KeyEvent){fn}, true return []func(View, KeyEvent){fn}, true
case func(): case func():
fn := func(view View, event KeyEvent) { fn := func(View, KeyEvent) {
value() value()
} }
return []func(View, KeyEvent){fn}, true return []func(View, KeyEvent){fn}, true
@ -98,7 +98,7 @@ func valueToKeyListeners(value interface{}) ([]func(View, KeyEvent), bool) {
if v == nil { if v == nil {
return nil, false return nil, false
} }
listeners[i] = func(view View, event KeyEvent) { listeners[i] = func(_ View, event KeyEvent) {
v(event) v(event)
} }
} }
@ -114,7 +114,7 @@ func valueToKeyListeners(value interface{}) ([]func(View, KeyEvent), bool) {
if v == nil { if v == nil {
return nil, false return nil, false
} }
listeners[i] = func(view View, event KeyEvent) { listeners[i] = func(view View, _ KeyEvent) {
v(view) v(view)
} }
} }
@ -130,7 +130,7 @@ func valueToKeyListeners(value interface{}) ([]func(View, KeyEvent), bool) {
if v == nil { if v == nil {
return nil, false return nil, false
} }
listeners[i] = func(view View, event KeyEvent) { listeners[i] = func(View, KeyEvent) {
v() v()
} }
} }
@ -151,17 +151,17 @@ func valueToKeyListeners(value interface{}) ([]func(View, KeyEvent), bool) {
listeners[i] = v listeners[i] = v
case func(KeyEvent): case func(KeyEvent):
listeners[i] = func(view View, event KeyEvent) { listeners[i] = func(_ View, event KeyEvent) {
v(event) v(event)
} }
case func(View): case func(View):
listeners[i] = func(view View, event KeyEvent) { listeners[i] = func(view View, _ KeyEvent) {
v(view) v(view)
} }
case func(): case func():
listeners[i] = func(view View, event KeyEvent) { listeners[i] = func(View, KeyEvent) {
v() v()
} }

View File

@ -294,7 +294,7 @@ func (listView *listViewData) setItemCheckedEvent(value interface{}) bool {
listView.checkedListeners = []func(ListView, []int){value} listView.checkedListeners = []func(ListView, []int){value}
case func([]int): case func([]int):
fn := func(view ListView, date []int) { fn := func(_ ListView, date []int) {
value(date) value(date)
} }
listView.checkedListeners = []func(ListView, []int){fn} listView.checkedListeners = []func(ListView, []int){fn}
@ -310,7 +310,7 @@ func (listView *listViewData) setItemCheckedEvent(value interface{}) bool {
return false return false
} }
listeners[i] = func(view ListView, date []int) { listeners[i] = func(_ ListView, date []int) {
val(date) val(date)
} }
} }
@ -329,7 +329,7 @@ func (listView *listViewData) setItemCheckedEvent(value interface{}) bool {
listeners[i] = val listeners[i] = val
case func([]int): case func([]int):
listeners[i] = func(view ListView, checked []int) { listeners[i] = func(_ ListView, checked []int) {
val(checked) val(checked)
} }
@ -470,7 +470,7 @@ func (listView *listViewData) valueToItemListeners(value interface{}) []func(Lis
return []func(ListView, int){value} return []func(ListView, int){value}
case func(int): case func(int):
fn := func(view ListView, index int) { fn := func(_ ListView, index int) {
value(index) value(index)
} }
return []func(ListView, int){fn} return []func(ListView, int){fn}
@ -484,7 +484,7 @@ func (listView *listViewData) valueToItemListeners(value interface{}) []func(Lis
if val == nil { if val == nil {
return nil return nil
} }
listeners[i] = func(view ListView, index int) { listeners[i] = func(_ ListView, index int) {
val(index) val(index)
} }
} }
@ -501,7 +501,7 @@ func (listView *listViewData) valueToItemListeners(value interface{}) []func(Lis
listeners[i] = val listeners[i] = val
case func(int): case func(int):
listeners[i] = func(view ListView, index int) { listeners[i] = func(_ ListView, index int) {
val(index) val(index)
} }

View File

@ -392,19 +392,19 @@ func valueToPlayerTimeListeners(value interface{}) ([]func(MediaPlayer, float64)
return []func(MediaPlayer, float64){value}, true return []func(MediaPlayer, float64){value}, true
case func(float64): case func(float64):
fn := func(player MediaPlayer, time float64) { fn := func(_ MediaPlayer, time float64) {
value(time) value(time)
} }
return []func(MediaPlayer, float64){fn}, true return []func(MediaPlayer, float64){fn}, true
case func(MediaPlayer): case func(MediaPlayer):
fn := func(player MediaPlayer, time float64) { fn := func(player MediaPlayer, _ float64) {
value(player) value(player)
} }
return []func(MediaPlayer, float64){fn}, true return []func(MediaPlayer, float64){fn}, true
case func(): case func():
fn := func(player MediaPlayer, time float64) { fn := func(MediaPlayer, float64) {
value() value()
} }
return []func(MediaPlayer, float64){fn}, true return []func(MediaPlayer, float64){fn}, true
@ -430,7 +430,7 @@ func valueToPlayerTimeListeners(value interface{}) ([]func(MediaPlayer, float64)
if v == nil { if v == nil {
return nil, false return nil, false
} }
listeners[i] = func(player MediaPlayer, time float64) { listeners[i] = func(_ MediaPlayer, time float64) {
v(time) v(time)
} }
} }
@ -446,7 +446,7 @@ func valueToPlayerTimeListeners(value interface{}) ([]func(MediaPlayer, float64)
if v == nil { if v == nil {
return nil, false return nil, false
} }
listeners[i] = func(player MediaPlayer, time float64) { listeners[i] = func(player MediaPlayer, _ float64) {
v(player) v(player)
} }
} }
@ -462,7 +462,7 @@ func valueToPlayerTimeListeners(value interface{}) ([]func(MediaPlayer, float64)
if v == nil { if v == nil {
return nil, false return nil, false
} }
listeners[i] = func(player MediaPlayer, time float64) { listeners[i] = func(MediaPlayer, float64) {
v() v()
} }
} }
@ -483,17 +483,17 @@ func valueToPlayerTimeListeners(value interface{}) ([]func(MediaPlayer, float64)
listeners[i] = v listeners[i] = v
case func(float64): case func(float64):
listeners[i] = func(player MediaPlayer, time float64) { listeners[i] = func(_ MediaPlayer, time float64) {
v(time) v(time)
} }
case func(MediaPlayer): case func(MediaPlayer):
listeners[i] = func(player MediaPlayer, time float64) { listeners[i] = func(player MediaPlayer, _ float64) {
v(player) v(player)
} }
case func(): case func():
listeners[i] = func(player MediaPlayer, time float64) { listeners[i] = func(MediaPlayer, float64) {
v() v()
} }
@ -517,19 +517,19 @@ func valueToPlayerErrorListeners(value interface{}) ([]func(MediaPlayer, int, st
return []func(MediaPlayer, int, string){value}, true return []func(MediaPlayer, int, string){value}, true
case func(int, string): case func(int, string):
fn := func(player MediaPlayer, code int, message string) { fn := func(_ MediaPlayer, code int, message string) {
value(code, message) value(code, message)
} }
return []func(MediaPlayer, int, string){fn}, true return []func(MediaPlayer, int, string){fn}, true
case func(MediaPlayer): case func(MediaPlayer):
fn := func(player MediaPlayer, code int, message string) { fn := func(player MediaPlayer, _ int, _ string) {
value(player) value(player)
} }
return []func(MediaPlayer, int, string){fn}, true return []func(MediaPlayer, int, string){fn}, true
case func(): case func():
fn := func(player MediaPlayer, code int, message string) { fn := func(MediaPlayer, int, string) {
value() value()
} }
return []func(MediaPlayer, int, string){fn}, true return []func(MediaPlayer, int, string){fn}, true
@ -555,7 +555,7 @@ func valueToPlayerErrorListeners(value interface{}) ([]func(MediaPlayer, int, st
if v == nil { if v == nil {
return nil, false return nil, false
} }
listeners[i] = func(player MediaPlayer, code int, message string) { listeners[i] = func(_ MediaPlayer, code int, message string) {
v(code, message) v(code, message)
} }
} }
@ -571,7 +571,7 @@ func valueToPlayerErrorListeners(value interface{}) ([]func(MediaPlayer, int, st
if v == nil { if v == nil {
return nil, false return nil, false
} }
listeners[i] = func(player MediaPlayer, code int, message string) { listeners[i] = func(player MediaPlayer, _ int, _ string) {
v(player) v(player)
} }
} }
@ -587,7 +587,7 @@ func valueToPlayerErrorListeners(value interface{}) ([]func(MediaPlayer, int, st
if v == nil { if v == nil {
return nil, false return nil, false
} }
listeners[i] = func(player MediaPlayer, code int, message string) { listeners[i] = func(MediaPlayer, int, string) {
v() v()
} }
} }
@ -608,17 +608,17 @@ func valueToPlayerErrorListeners(value interface{}) ([]func(MediaPlayer, int, st
listeners[i] = v listeners[i] = v
case func(int, string): case func(int, string):
listeners[i] = func(player MediaPlayer, code int, message string) { listeners[i] = func(_ MediaPlayer, code int, message string) {
v(code, message) v(code, message)
} }
case func(MediaPlayer): case func(MediaPlayer):
listeners[i] = func(player MediaPlayer, code int, message string) { listeners[i] = func(player MediaPlayer, _ int, _ string) {
v(player) v(player)
} }
case func(): case func():
listeners[i] = func(player MediaPlayer, code int, message string) { listeners[i] = func(MediaPlayer, int, string) {
v() v()
} }

View File

@ -154,19 +154,19 @@ func valueToMouseListeners(value interface{}) ([]func(View, MouseEvent), bool) {
return []func(View, MouseEvent){value}, true return []func(View, MouseEvent){value}, true
case func(MouseEvent): case func(MouseEvent):
fn := func(view View, event MouseEvent) { fn := func(_ View, event MouseEvent) {
value(event) value(event)
} }
return []func(View, MouseEvent){fn}, true return []func(View, MouseEvent){fn}, true
case func(View): case func(View):
fn := func(view View, event MouseEvent) { fn := func(view View, _ MouseEvent) {
value(view) value(view)
} }
return []func(View, MouseEvent){fn}, true return []func(View, MouseEvent){fn}, true
case func(): case func():
fn := func(view View, event MouseEvent) { fn := func(View, MouseEvent) {
value() value()
} }
return []func(View, MouseEvent){fn}, true return []func(View, MouseEvent){fn}, true
@ -192,7 +192,7 @@ func valueToMouseListeners(value interface{}) ([]func(View, MouseEvent), bool) {
if v == nil { if v == nil {
return nil, false return nil, false
} }
listeners[i] = func(view View, event MouseEvent) { listeners[i] = func(_ View, event MouseEvent) {
v(event) v(event)
} }
} }
@ -208,7 +208,7 @@ func valueToMouseListeners(value interface{}) ([]func(View, MouseEvent), bool) {
if v == nil { if v == nil {
return nil, false return nil, false
} }
listeners[i] = func(view View, event MouseEvent) { listeners[i] = func(view View, _ MouseEvent) {
v(view) v(view)
} }
} }
@ -224,7 +224,7 @@ func valueToMouseListeners(value interface{}) ([]func(View, MouseEvent), bool) {
if v == nil { if v == nil {
return nil, false return nil, false
} }
listeners[i] = func(view View, event MouseEvent) { listeners[i] = func(View, MouseEvent) {
v() v()
} }
} }
@ -245,17 +245,17 @@ func valueToMouseListeners(value interface{}) ([]func(View, MouseEvent), bool) {
listeners[i] = v listeners[i] = v
case func(MouseEvent): case func(MouseEvent):
listeners[i] = func(view View, event MouseEvent) { listeners[i] = func(_ View, event MouseEvent) {
v(event) v(event)
} }
case func(View): case func(View):
listeners[i] = func(view View, event MouseEvent) { listeners[i] = func(view View, _ MouseEvent) {
v(view) v(view)
} }
case func(): case func():
listeners[i] = func(view View, event MouseEvent) { listeners[i] = func(View, MouseEvent) {
v() v()
} }

View File

@ -104,7 +104,7 @@ func (picker *numberPickerData) set(tag string, value interface{}) bool {
picker.numberChangedListeners = []func(NumberPicker, float64){value} picker.numberChangedListeners = []func(NumberPicker, float64){value}
case func(float64): case func(float64):
fn := func(view NumberPicker, newValue float64) { fn := func(_ NumberPicker, newValue float64) {
value(newValue) value(newValue)
} }
picker.numberChangedListeners = []func(NumberPicker, float64){fn} picker.numberChangedListeners = []func(NumberPicker, float64){fn}
@ -120,7 +120,7 @@ func (picker *numberPickerData) set(tag string, value interface{}) bool {
return false return false
} }
listeners[i] = func(view NumberPicker, newValue float64) { listeners[i] = func(_ NumberPicker, newValue float64) {
val(newValue) val(newValue)
} }
} }

View File

@ -97,19 +97,19 @@ func valueToPointerListeners(value interface{}) ([]func(View, PointerEvent), boo
return []func(View, PointerEvent){value}, true return []func(View, PointerEvent){value}, true
case func(PointerEvent): case func(PointerEvent):
fn := func(view View, event PointerEvent) { fn := func(_ View, event PointerEvent) {
value(event) value(event)
} }
return []func(View, PointerEvent){fn}, true return []func(View, PointerEvent){fn}, true
case func(View): case func(View):
fn := func(view View, event PointerEvent) { fn := func(view View, _ PointerEvent) {
value(view) value(view)
} }
return []func(View, PointerEvent){fn}, true return []func(View, PointerEvent){fn}, true
case func(): case func():
fn := func(view View, event PointerEvent) { fn := func(View, PointerEvent) {
value() value()
} }
return []func(View, PointerEvent){fn}, true return []func(View, PointerEvent){fn}, true
@ -135,7 +135,7 @@ func valueToPointerListeners(value interface{}) ([]func(View, PointerEvent), boo
if v == nil { if v == nil {
return nil, false return nil, false
} }
listeners[i] = func(view View, event PointerEvent) { listeners[i] = func(_ View, event PointerEvent) {
v(event) v(event)
} }
} }
@ -151,7 +151,7 @@ func valueToPointerListeners(value interface{}) ([]func(View, PointerEvent), boo
if v == nil { if v == nil {
return nil, false return nil, false
} }
listeners[i] = func(view View, event PointerEvent) { listeners[i] = func(view View, _ PointerEvent) {
v(view) v(view)
} }
} }
@ -167,7 +167,7 @@ func valueToPointerListeners(value interface{}) ([]func(View, PointerEvent), boo
if v == nil { if v == nil {
return nil, false return nil, false
} }
listeners[i] = func(view View, event PointerEvent) { listeners[i] = func(View, PointerEvent) {
v() v()
} }
} }
@ -188,17 +188,17 @@ func valueToPointerListeners(value interface{}) ([]func(View, PointerEvent), boo
listeners[i] = v listeners[i] = v
case func(PointerEvent): case func(PointerEvent):
listeners[i] = func(view View, event PointerEvent) { listeners[i] = func(_ View, event PointerEvent) {
v(event) v(event)
} }
case func(View): case func(View):
listeners[i] = func(view View, event PointerEvent) { listeners[i] = func(view View, _ PointerEvent) {
v(view) v(view)
} }
case func(): case func():
listeners[i] = func(view View, event PointerEvent) { listeners[i] = func(View, PointerEvent) {
v() v()
} }

View File

@ -81,7 +81,7 @@ func (popup *popupData) init(view View, params Params) {
case func(): case func():
popup.dismissListener = []func(Popup){ popup.dismissListener = []func(Popup){
func(popup Popup) { func(_ Popup) {
value() value()
}, },
} }
@ -96,7 +96,7 @@ func (popup *popupData) init(view View, params Params) {
case []func(): case []func():
for _, fn := range value { for _, fn := range value {
if fn != nil { if fn != nil {
popup.dismissListener = append(popup.dismissListener, func(popup Popup) { popup.dismissListener = append(popup.dismissListener, func(_ Popup) {
fn() fn()
}) })
} }
@ -110,7 +110,7 @@ func (popup *popupData) init(view View, params Params) {
popup.dismissListener = append(popup.dismissListener, fn) popup.dismissListener = append(popup.dismissListener, fn)
case func(): case func():
popup.dismissListener = append(popup.dismissListener, func(popup Popup) { popup.dismissListener = append(popup.dismissListener, func(_ Popup) {
fn() fn()
}) })
} }

View File

@ -40,7 +40,7 @@ func (view *viewData) setFrameListener(tag string, value interface{}) bool {
} }
case func(Frame): case func(Frame):
fn := func(view View, frame Frame) { fn := func(_ View, frame Frame) {
value(frame) value(frame)
} }
view.properties[tag] = []func(View, Frame){fn} view.properties[tag] = []func(View, Frame){fn}
@ -59,14 +59,14 @@ func (view *viewData) setFrameListener(tag string, value interface{}) bool {
return false return false
} }
listeners[i] = func(view View, frame Frame) { listeners[i] = func(_ View, frame Frame) {
val(frame) val(frame)
} }
} }
view.properties[tag] = listeners view.properties[tag] = listeners
case func(View): case func(View):
fn := func(view View, frame Frame) { fn := func(view View, _ Frame) {
value(view) value(view)
} }
view.properties[tag] = []func(View, Frame){fn} view.properties[tag] = []func(View, Frame){fn}
@ -85,14 +85,14 @@ func (view *viewData) setFrameListener(tag string, value interface{}) bool {
return false return false
} }
listeners[i] = func(view View, frame Frame) { listeners[i] = func(view View, _ Frame) {
val(view) val(view)
} }
} }
view.properties[tag] = listeners view.properties[tag] = listeners
case func(): case func():
fn := func(view View, frame Frame) { fn := func(View, Frame) {
value() value()
} }
view.properties[tag] = []func(View, Frame){fn} view.properties[tag] = []func(View, Frame){fn}
@ -111,7 +111,7 @@ func (view *viewData) setFrameListener(tag string, value interface{}) bool {
return false return false
} }
listeners[i] = func(view View, frame Frame) { listeners[i] = func(View, Frame) {
val() val()
} }
} }
@ -136,17 +136,17 @@ func (view *viewData) setFrameListener(tag string, value interface{}) bool {
listeners[i] = val listeners[i] = val
case func(Frame): case func(Frame):
listeners[i] = func(view View, frame Frame) { listeners[i] = func(_ View, frame Frame) {
val(frame) val(frame)
} }
case func(View): case func(View):
listeners[i] = func(view View, frame Frame) { listeners[i] = func(view View, _ Frame) {
val(view) val(view)
} }
case func(): case func():
listeners[i] = func(view View, frame Frame) { listeners[i] = func(View, Frame) {
val() val()
} }

View File

@ -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 resources.path != "" {
if data := readFile(resources.path + rawDir + "/" + filename); data != nil { if data, err := os.ReadFile(resources.path + rawDir + "/" + filename); err == nil {
return data return data
} }
} }
if exe, err := os.Executable(); err == nil { 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 return data
} }
} }
ErrorLogF(`The raw file "%s" don't found`, filename) ErrorLogF(`The "%s" raw file don't found`, filename)
return nil return nil
} }

View File

@ -686,7 +686,7 @@ func (table *tableViewData) valueToCellListeners(value interface{}) []func(Table
return []func(TableView, int, int){value} return []func(TableView, int, int){value}
case func(int, int): case func(int, int):
fn := func(view TableView, row, column int) { fn := func(_ TableView, row, column int) {
value(row, column) value(row, column)
} }
return []func(TableView, int, int){fn} return []func(TableView, int, int){fn}
@ -700,7 +700,7 @@ func (table *tableViewData) valueToCellListeners(value interface{}) []func(Table
if val == nil { if val == nil {
return nil return nil
} }
listeners[i] = func(view TableView, row, column int) { listeners[i] = func(_ TableView, row, column int) {
val(row, column) val(row, column)
} }
} }
@ -717,7 +717,7 @@ func (table *tableViewData) valueToCellListeners(value interface{}) []func(Table
listeners[i] = val listeners[i] = val
case func(int, int): case func(int, int):
listeners[i] = func(view TableView, row, column int) { listeners[i] = func(_ TableView, row, column int) {
val(row, column) val(row, column)
} }
@ -741,7 +741,7 @@ func (table *tableViewData) valueToRowListeners(value interface{}) []func(TableV
return []func(TableView, int){value} return []func(TableView, int){value}
case func(int): case func(int):
fn := func(view TableView, index int) { fn := func(_ TableView, index int) {
value(index) value(index)
} }
return []func(TableView, int){fn} return []func(TableView, int){fn}
@ -755,7 +755,7 @@ func (table *tableViewData) valueToRowListeners(value interface{}) []func(TableV
if val == nil { if val == nil {
return nil return nil
} }
listeners[i] = func(view TableView, index int) { listeners[i] = func(_ TableView, index int) {
val(index) val(index)
} }
} }
@ -772,7 +772,7 @@ func (table *tableViewData) valueToRowListeners(value interface{}) []func(TableV
listeners[i] = val listeners[i] = val
case func(int): case func(int):
listeners[i] = func(view TableView, index int) { listeners[i] = func(_ TableView, index int) {
val(index) val(index)
} }

View File

@ -296,31 +296,31 @@ func (tabsLayout *tabsLayoutData) valueToTabListeners(value interface{}) []func(
return []func(TabsLayout, int, int){value} return []func(TabsLayout, int, int){value}
case func(TabsLayout, int): case func(TabsLayout, int):
fn := func(view TabsLayout, current, old int) { fn := func(view TabsLayout, current, _ int) {
value(view, current) value(view, current)
} }
return []func(TabsLayout, int, int){fn} return []func(TabsLayout, int, int){fn}
case func(TabsLayout): case func(TabsLayout):
fn := func(view TabsLayout, current, old int) { fn := func(view TabsLayout, _, _ int) {
value(view) value(view)
} }
return []func(TabsLayout, int, int){fn} return []func(TabsLayout, int, int){fn}
case func(int, int): case func(int, int):
fn := func(view TabsLayout, current, old int) { fn := func(_ TabsLayout, current, old int) {
value(current, old) value(current, old)
} }
return []func(TabsLayout, int, int){fn} return []func(TabsLayout, int, int){fn}
case func(int): case func(int):
fn := func(view TabsLayout, current, old int) { fn := func(_ TabsLayout, current, _ int) {
value(current) value(current)
} }
return []func(TabsLayout, int, int){fn} return []func(TabsLayout, int, int){fn}
case func(): case func():
fn := func(view TabsLayout, current, old int) { fn := func(TabsLayout, int, int) {
value() value()
} }
return []func(TabsLayout, int, int){fn} return []func(TabsLayout, int, int){fn}
@ -334,7 +334,7 @@ func (tabsLayout *tabsLayoutData) valueToTabListeners(value interface{}) []func(
if val == nil { if val == nil {
return nil return nil
} }
listeners[i] = func(view TabsLayout, current, old int) { listeners[i] = func(view TabsLayout, current, _ int) {
val(view, current) val(view, current)
} }
} }
@ -346,7 +346,7 @@ func (tabsLayout *tabsLayoutData) valueToTabListeners(value interface{}) []func(
if val == nil { if val == nil {
return nil return nil
} }
listeners[i] = func(view TabsLayout, current, old int) { listeners[i] = func(view TabsLayout, _, _ int) {
val(view) val(view)
} }
} }
@ -358,7 +358,7 @@ func (tabsLayout *tabsLayoutData) valueToTabListeners(value interface{}) []func(
if val == nil { if val == nil {
return nil return nil
} }
listeners[i] = func(view TabsLayout, current, old int) { listeners[i] = func(_ TabsLayout, current, old int) {
val(current, old) val(current, old)
} }
} }
@ -370,7 +370,7 @@ func (tabsLayout *tabsLayoutData) valueToTabListeners(value interface{}) []func(
if val == nil { if val == nil {
return nil return nil
} }
listeners[i] = func(view TabsLayout, current, old int) { listeners[i] = func(_ TabsLayout, current, _ int) {
val(current) val(current)
} }
} }
@ -382,7 +382,7 @@ func (tabsLayout *tabsLayoutData) valueToTabListeners(value interface{}) []func(
if val == nil { if val == nil {
return nil return nil
} }
listeners[i] = func(view TabsLayout, current, old int) { listeners[i] = func(TabsLayout, int, int) {
val() val()
} }
} }
@ -399,27 +399,27 @@ func (tabsLayout *tabsLayoutData) valueToTabListeners(value interface{}) []func(
listeners[i] = val listeners[i] = val
case func(TabsLayout, int): case func(TabsLayout, int):
listeners[i] = func(view TabsLayout, current, old int) { listeners[i] = func(view TabsLayout, current, _ int) {
val(view, current) val(view, current)
} }
case func(TabsLayout): case func(TabsLayout):
listeners[i] = func(view TabsLayout, current, old int) { listeners[i] = func(view TabsLayout, _, _ int) {
val(view) val(view)
} }
case func(int, int): case func(int, int):
listeners[i] = func(view TabsLayout, current, old int) { listeners[i] = func(_ TabsLayout, current, old int) {
val(current, old) val(current, old)
} }
case func(int): case func(int):
listeners[i] = func(view TabsLayout, current, old int) { listeners[i] = func(_ TabsLayout, current, _ int) {
val(current) val(current)
} }
case func(): case func():
listeners[i] = func(view TabsLayout, current, old int) { listeners[i] = func(TabsLayout, int, int) {
val() val()
} }
@ -443,7 +443,7 @@ func (tabsLayout *tabsLayoutData) valueToCloseListeners(value interface{}) []fun
return []func(TabsLayout, int){value} return []func(TabsLayout, int){value}
case func(int): case func(int):
fn := func(view TabsLayout, index int) { fn := func(_ TabsLayout, index int) {
value(index) value(index)
} }
return []func(TabsLayout, int){fn} return []func(TabsLayout, int){fn}
@ -457,7 +457,7 @@ func (tabsLayout *tabsLayoutData) valueToCloseListeners(value interface{}) []fun
if val == nil { if val == nil {
return nil return nil
} }
listeners[i] = func(view TabsLayout, index int) { listeners[i] = func(_ TabsLayout, index int) {
val(index) val(index)
} }
} }
@ -474,7 +474,7 @@ func (tabsLayout *tabsLayoutData) valueToCloseListeners(value interface{}) []fun
listeners[i] = val listeners[i] = val
case func(int): case func(int):
listeners[i] = func(view TabsLayout, index int) { listeners[i] = func(_ TabsLayout, index int) {
val(index) val(index)
} }

View File

@ -228,7 +228,7 @@ func (picker *timePickerData) set(tag string, value interface{}) bool {
picker.timeChangedListeners = []func(TimePicker, time.Time){value} picker.timeChangedListeners = []func(TimePicker, time.Time){value}
case func(time.Time): case func(time.Time):
fn := func(view TimePicker, time time.Time) { fn := func(_ TimePicker, time time.Time) {
value(time) value(time)
} }
picker.timeChangedListeners = []func(TimePicker, time.Time){fn} picker.timeChangedListeners = []func(TimePicker, time.Time){fn}
@ -244,7 +244,7 @@ func (picker *timePickerData) set(tag string, value interface{}) bool {
return false return false
} }
listeners[i] = func(view TimePicker, time time.Time) { listeners[i] = func(_ TimePicker, time time.Time) {
val(time) val(time)
} }
} }
@ -263,7 +263,7 @@ func (picker *timePickerData) set(tag string, value interface{}) bool {
listeners[i] = val listeners[i] = val
case func(time.Time): case func(time.Time):
listeners[i] = func(view TimePicker, time time.Time) { listeners[i] = func(_ TimePicker, time time.Time) {
val(time) val(time)
} }

View File

@ -100,19 +100,19 @@ func valueToTouchListeners(value interface{}) ([]func(View, TouchEvent), bool) {
return []func(View, TouchEvent){value}, true return []func(View, TouchEvent){value}, true
case func(TouchEvent): case func(TouchEvent):
fn := func(view View, event TouchEvent) { fn := func(_ View, event TouchEvent) {
value(event) value(event)
} }
return []func(View, TouchEvent){fn}, true return []func(View, TouchEvent){fn}, true
case func(View): case func(View):
fn := func(view View, event TouchEvent) { fn := func(view View, _ TouchEvent) {
value(view) value(view)
} }
return []func(View, TouchEvent){fn}, true return []func(View, TouchEvent){fn}, true
case func(): case func():
fn := func(view View, event TouchEvent) { fn := func(View, TouchEvent) {
value() value()
} }
return []func(View, TouchEvent){fn}, true return []func(View, TouchEvent){fn}, true
@ -138,7 +138,7 @@ func valueToTouchListeners(value interface{}) ([]func(View, TouchEvent), bool) {
if v == nil { if v == nil {
return nil, false return nil, false
} }
listeners[i] = func(view View, event TouchEvent) { listeners[i] = func(_ View, event TouchEvent) {
v(event) v(event)
} }
} }
@ -154,7 +154,7 @@ func valueToTouchListeners(value interface{}) ([]func(View, TouchEvent), bool) {
if v == nil { if v == nil {
return nil, false return nil, false
} }
listeners[i] = func(view View, event TouchEvent) { listeners[i] = func(view View, _ TouchEvent) {
v(view) v(view)
} }
} }
@ -170,7 +170,7 @@ func valueToTouchListeners(value interface{}) ([]func(View, TouchEvent), bool) {
if v == nil { if v == nil {
return nil, false return nil, false
} }
listeners[i] = func(view View, event TouchEvent) { listeners[i] = func(View, TouchEvent) {
v() v()
} }
} }
@ -191,17 +191,17 @@ func valueToTouchListeners(value interface{}) ([]func(View, TouchEvent), bool) {
listeners[i] = v listeners[i] = v
case func(TouchEvent): case func(TouchEvent):
listeners[i] = func(view View, event TouchEvent) { listeners[i] = func(_ View, event TouchEvent) {
v(event) v(event)
} }
case func(View): case func(View):
listeners[i] = func(view View, event TouchEvent) { listeners[i] = func(view View, _ TouchEvent) {
v(view) v(view)
} }
case func(): case func():
listeners[i] = func(view View, event TouchEvent) { listeners[i] = func(View, TouchEvent) {
v() v()
} }