MCPcopy Create free account
hub / github.com/SolarLune/masterplan / NewTableContents

Function NewTableContents

contents.go:4784–4823  ·  view source on GitHub ↗
(card *Card)

Source from the content-addressed store, hash-verified

4782}
4783
4784func NewTableContents(card *Card) *TableContents {
4785 tc := &TableContents{
4786 DefaultContents: newDefaultContents(card),
4787 }
4788
4789 tc.TableData = NewTableData(tc)
4790
4791 if tc.Card.Properties.Get("contents").AsString() != "" {
4792 tc.TableData.Deserialize(tc.Card.Properties.Get("contents").AsString())
4793 } else {
4794 tc.Card.Properties.Get("contents").SetRaw(tc.TableData.Serialize())
4795 tc.Card.Properties.Get("contents").OnChange = func() {
4796 // If the contents change independently of the table data (i.e. through
4797 // syncing), then deserialize the tabledata using the contents string.
4798 tc.TableData.Deserialize(tc.Card.Properties.Get("contents").AsString())
4799 }
4800 }
4801
4802 tc.SettingsButton = NewIconButtonTintless(0, 0, &sdl.FRect{400, 160, 32, 32}, globals.GUITexture, true, func() {
4803 menu := globals.MenuSystem.Get("table settings menu")
4804 menu.Open()
4805 mode := menu.Pages["root"].FindElement("table mode", false).(*ButtonGroup)
4806 mode.ChosenIndex = tc.TableData.ValueDisplayMode
4807 })
4808
4809 // row := tc.container.AddRow(AlignCenter)
4810
4811 // tc.Label = NewLabel("New Table", nil, true, AlignCenter)
4812 // tc.Label.Editable = true
4813 // tc.Label.Property = card.Properties.Get("description")
4814 // tc.Label.RegexString = RegexNoNewlines
4815
4816 // tc.Label.OnChange = func() {
4817 // commonTextEditingResizing(tc.Label, tc.Card)
4818 // }
4819
4820 // row.Add("label", tc.Label)
4821
4822 return tc
4823}
4824
4825func (tc *TableContents) Update() {
4826 tc.DefaultContents.Update()

Callers 1

SetContentsMethod · 0.85

Calls 10

newDefaultContentsFunction · 0.85
NewTableDataFunction · 0.85
NewIconButtonTintlessFunction · 0.85
AsStringMethod · 0.80
SetRawMethod · 0.80
GetMethod · 0.45
DeserializeMethod · 0.45
SerializeMethod · 0.45
OpenMethod · 0.45
FindElementMethod · 0.45

Tested by

no test coverage detected