mirror of https://github.com/anoshenko/rui.git
Added ViewByID functions
This commit is contained in:
parent
d254664655
commit
79fb34f29f
|
@ -9,7 +9,7 @@ type audioPlayerData struct {
|
|||
}
|
||||
|
||||
// NewAudioPlayer create new MediaPlayer object and return it
|
||||
func NewAudioPlayer(session Session, params Params) MediaPlayer {
|
||||
func NewAudioPlayer(session Session, params Params) AudioPlayer {
|
||||
view := new(audioPlayerData)
|
||||
view.Init(session)
|
||||
view.tag = "AudioPlayer"
|
||||
|
|
|
@ -28,7 +28,7 @@ type videoPlayerData struct {
|
|||
}
|
||||
|
||||
// NewVideoPlayer create new MediaPlayer object and return it
|
||||
func NewVideoPlayer(session Session, params Params) MediaPlayer {
|
||||
func NewVideoPlayer(session Session, params Params) VideoPlayer {
|
||||
view := new(videoPlayerData)
|
||||
view.Init(session)
|
||||
view.tag = "VideoPlayer"
|
||||
|
|
24
viewByID.go
24
viewByID.go
|
@ -312,3 +312,27 @@ func VideoPlayerByID(rootView View, id string) VideoPlayer {
|
|||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ImageViewByID return a ImageView with id equal to the argument of the function or
|
||||
// nil if there is no such View or View is not ImageView
|
||||
func ImageViewByID(rootView View, id string) ImageView {
|
||||
if view := ViewByID(rootView, id); view != nil {
|
||||
if canvas, ok := view.(ImageView); ok {
|
||||
return canvas
|
||||
}
|
||||
ErrorLog(`ImageViewByID(_, "` + id + `"): The found View is not ImageView`)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// TableViewByID return a TableView with id equal to the argument of the function or
|
||||
// nil if there is no such View or View is not TableView
|
||||
func TableViewByID(rootView View, id string) TableView {
|
||||
if view := ViewByID(rootView, id); view != nil {
|
||||
if canvas, ok := view.(TableView); ok {
|
||||
return canvas
|
||||
}
|
||||
ErrorLog(`TableViewByID(_, "` + id + `"): The found View is not TableView`)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue