2021-09-07 17:36:50 +03:00
|
|
|
package rui
|
|
|
|
|
|
|
|
import "strings"
|
|
|
|
|
2024-09-12 14:05:11 +03:00
|
|
|
// AbsoluteLayout represent an AbsoluteLayout view where child views can be arbitrary positioned
|
2021-09-07 17:36:50 +03:00
|
|
|
type AbsoluteLayout interface {
|
|
|
|
ViewsContainer
|
|
|
|
}
|
|
|
|
|
|
|
|
type absoluteLayoutData struct {
|
|
|
|
viewsContainerData
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewAbsoluteLayout create new AbsoluteLayout object and return it
|
|
|
|
func NewAbsoluteLayout(session Session, params Params) AbsoluteLayout {
|
|
|
|
view := new(absoluteLayoutData)
|
2022-09-01 11:04:50 +03:00
|
|
|
view.init(session)
|
2021-09-07 17:36:50 +03:00
|
|
|
setInitParams(view, params)
|
|
|
|
return view
|
|
|
|
}
|
|
|
|
|
|
|
|
func newAbsoluteLayout(session Session) View {
|
2024-11-13 12:56:39 +03:00
|
|
|
//return NewAbsoluteLayout(session, nil)
|
|
|
|
return new(absoluteLayoutData)
|
2021-09-07 17:36:50 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// Init initialize fields of ViewsContainer by default values
|
2022-09-01 11:04:50 +03:00
|
|
|
func (layout *absoluteLayoutData) init(session Session) {
|
|
|
|
layout.viewsContainerData.init(session)
|
2021-09-07 17:36:50 +03:00
|
|
|
layout.tag = "AbsoluteLayout"
|
|
|
|
layout.systemClass = "ruiAbsoluteLayout"
|
|
|
|
}
|
|
|
|
|
|
|
|
func (layout *absoluteLayoutData) htmlSubviews(self View, buffer *strings.Builder) {
|
|
|
|
if layout.views != nil {
|
|
|
|
for _, view := range layout.views {
|
|
|
|
view.addToCSSStyle(map[string]string{`position`: `absolute`})
|
|
|
|
viewHTML(view, buffer)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|