func uiReset() { if w.field != nil { w.field.Destroy() } var err error w.field, err = gtk.TextViewNew() e.Exit(err) w.field.SetAcceptsTab(false) w.field.SetWrapMode(gtk.WRAP_WORD) w.fieldBuf, err = w.field.GetBuffer() e.Exit(err) setStyle(w.field, "fontBig") w.fieldWindow.Add(w.field) r := state.v2result textual := w.showActionsText.GetActive() || r.SquareSide == 0 s := plural(r.NHeaps, "heap") if !textual || r.SquareSide <= 9 { s += fmt.Sprintf(" in a %d×%d layout", r.SquareSide, r.SquareSide) } s += fmt.Sprintf(". %s:\n", plural(len(r.Actions), "action")) if textual { s += fmt.Sprintf("%s.\n", r.String()) } if w.showPermutation.GetActive() { s += fmt.Sprintf("Permutation: %v.\n", r.Perm) } w.fieldBuf.SetText(s) if !textual { addGraphicalActions() } w.field.ShowAll() }
func setup_tview() *gtk.TextView { tv, err := gtk.TextViewNew() if err != nil { log.Fatal("Unable to create TextView:", err) } return tv }
// 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 newReadOnlyTextBox() textBox { view, _ := gtk.TextViewNew() view.SetEditable(false) view.SetCursorVisible(false) buf, _ := view.GetBuffer() iter := buf.GetStartIter() return textBox{view, buf, iter} }
func (f *FileViewer) Init(filename string) (err error) { // Read file content to buf buf, err := tool.ReadFile(filename) if err != nil { log.Println("Warning: could not read file", filename, err) return } // Create a new text view to show the file content f.view, err = gtk.TextViewNew() if err != nil { log.Println("Unable to create textview:", err) return } textbuf, err := f.view.GetBuffer() if err != nil { log.Println("view.GetBuffer failed:", err) return } f.scrolled.Add(f.view) textbuf.SetText(string(buf)) return }
// TextView creates a *gtk.TextView. func TextView() *gtk.TextView { w, _ := gtk.TextViewNew() return w }
func (*RealGtk) TextViewNew() (gtki.TextView, error) { return wrapTextView(gtk.TextViewNew()) }