// Setup the TextView, put it in a ScrolledWindow, and add both to box. func setupTextView(box *gtk.Box) *gtk.TextView { sw, _ := gtk.ScrolledWindowNew(nil, nil) tv, _ := gtk.TextViewNew() sw.Add(tv) box.PackStart(sw, true, true, 0) return tv }
func (account *account) setCurrentNotification(ib *gtk.InfoBar, notificationArea *gtk.Box) { account.Lock() defer account.Unlock() account.removeCurrentNotification() account.currentNotification = ib notificationArea.Add(ib) ib.ShowAll() }
// Collect all input elements to be constructed. func (dialog *EditMenuDialog) fillBox(box *gtk.Box, e elementType) error { for _, i := range inputElementMap[e] { widget, err := dialog.createInputElement(i) if err != nil { return err } box.Add(widget) } return nil }
func newUnifiedLayout(ui *gtkUI, left, parent *gtk.Box) *unifiedLayout { ul := &unifiedLayout{ ui: ui, cl: &conversationList{}, leftPane: left, itemMap: make(map[int]*conversationStackItem), } ul.cl.layout = ul builder := newBuilder("UnifiedLayout") builder.getItems( "treeview", &ul.cl.view, "liststore", &ul.cl.model, "revealer", &ul.revealer, "notebook", &ul.notebook, "header_label", &ul.header, "header_box", &ul.headerBox, "close_button", &ul.close, ) builder.ConnectSignals(map[string]interface{}{ "on_activate": ul.cl.onActivate, "on_clicked": ul.onCloseClicked, "on_switch_page": ul.onSwitchPage, }) parent.PackStart(ul.revealer, false, true, 0) parent.SetChildPacking(left, false, true, 0, gtk.PACK_START) ul.notebook.SetSizeRequest(500, -1) ul.revealer.Hide() left.SetHAlign(gtk.ALIGN_FILL) left.SetHExpand(true) return ul }
func setupPropertyCheckboxes(tv *gtk.TextView, outer *gtk.Box, props []*BoolProperty) { box, _ := gtk.BoxNew(gtk.ORIENTATION_HORIZONTAL, 0) for _, prop := range props { chk, _ := gtk.CheckButtonNewWithLabel(prop.Name) // initialize the checkbox with the property's current value chk.SetActive(prop.Get()) p := prop // w/o this all the checkboxes will toggle the last property in props chk.Connect("toggled", func() { p.Set(chk.GetActive()) }) box.PackStart(chk, true, true, 0) } outer.PackStart(box, false, false, 0) }
func (dialog *EditMenuDialog) CreateDialog(extra *gtk.Widget) (err error) { d := dialog.dialog d.SetTitle("New Element") var active string active, err = dialog.fts.GetValueById(dialog.fts.GetCurrentId()) if err != nil { return } var box *gtk.Box box, err = d.GetContentArea() if err != nil { return } activeText, err := gtk.LabelNew(fmt.Sprintf("%s", active)) if err != nil { return } activeLayoutBox, err := createLabeledRow("Active element:", &activeText.Widget) if err != nil { return } box.PackStart(activeLayoutBox, false, false, 6) if extra != nil { box.PackStart(extra, false, false, 6) } dialog.stack, err = gtk.StackNew() if err != nil { return } err = dialog.fillStack() if err != nil { return } box.PackStart(dialog.stack, true, true, 6) d.AddButton("Cancel", gtk.RESPONSE_CANCEL) d.AddButton("OK", gtk.RESPONSE_OK) d.SetDefaultResponse(gtk.RESPONSE_OK) d.ShowAll() return }