miqt/cmd/miqt-uic/types.go

99 lines
2.5 KiB
Go
Raw Normal View History

2024-09-20 06:39:01 +00:00
package main
import (
"encoding/xml"
)
type UiLayoutItem struct {
2024-10-03 04:11:30 +00:00
Row *int `xml:"row,attr"`
Column *int `xml:"column,attr"`
// A layout item either has a widget, or a spacer
Widget *UiWidget `xml:"widget"`
Spacer *UiSpacer `xml:"spacer"`
2024-09-20 06:39:01 +00:00
}
type UiLayout struct {
2024-10-03 05:07:43 +00:00
Class string `xml:"class,attr"`
Name string `xml:"name,attr"`
Properties []UiProperty `xml:"property"`
Items []UiLayoutItem `xml:"item"`
2024-09-20 06:39:01 +00:00
}
type UiPropertyContainer struct {
Properties []UiProperty `xml:"property"`
}
2024-10-03 04:11:30 +00:00
type UiSpacer struct {
Name string `xml:"name,attr"`
Properties []UiProperty `xml:"property"`
}
2024-09-20 06:39:01 +00:00
type UiWidget struct {
Class string `xml:"class,attr"`
Name string `xml:"name,attr"`
Properties []UiProperty `xml:"property"`
Attributes []UiProperty `xml:"attribute"`
Layout *UiLayout `xml:"layout,omitempty"`
Widgets []UiWidget `xml:"widget"` // If no layout
Columns []UiPropertyContainer `xml:"column"` // e.g. for QTreeWidget
Items []UiPropertyContainer `xml:"item"` // e.g. for QComboBox
AddActions []UiActionReference `xml:"addaction"`
Actions []UiAction `xml:"action"`
}
type UiRect struct {
X int `xml:"x"`
Y int `xml:"y"`
Width int `xml:"width"`
Height int `xml:"height"`
}
type UiString struct {
Value string `xml:",chardata"`
Notr bool `xml:"notr,attr,omitempty"`
}
type UiProperty struct {
Name string `xml:"name,attr"`
StringVal *UiString `xml:"string,omitempty"`
NumberVal *string `xml:"number,omitempty"` // Preserve as string literal
BoolVal *bool `xml:"bool,omitempty"` // "true" or "false"
2024-09-20 06:39:01 +00:00
EnumVal *string `xml:"enum,omitempty"`
RectVal *UiRect `xml:"rect,omitempty"`
}
type UiActionReference struct {
Name string `xml:"name,attr"`
}
type UiAction struct {
Name string `xml:"name,attr"`
Properties []UiProperty `xml:"property"`
}
type UiResources struct {
}
type UiConnections struct {
}
2024-10-03 05:07:43 +00:00
type UiLayoutDefault struct {
Spacing *int `xml:"spacing,attr,omitempty"`
Margin *int `xml:"margin,attr,omitempty"`
}
2024-09-20 06:39:01 +00:00
type UiFile struct {
XMLName xml.Name // should always be xml.Name{Local: "ui"}
2024-10-03 05:07:43 +00:00
Class string `xml:"class"`
Version string `xml:"version,attr"` // e.g. 4.0
Widget UiWidget `xml:"widget"` // There's only one root widget
Resources UiResources `xml:"resources"`
Connections UiConnections `xml:"connections"`
LayoutDefault *UiLayoutDefault `xml:"layoutdefault,omitempty"`
2024-09-20 06:39:01 +00:00
}