Documentation
¶
Index ¶
- func GetTextView(tv *gtk.TextView, removeEmpty ...bool) (out []string)
- func SetTextView(tv *gtk.TextView, in []string, removeEmpty ...bool)
- func TextViewScrollToLine(textView *gtk.TextView, line int, highLight ...bool)
- type SourceViewStruct
- func (svs *SourceViewStruct) ColorBgRange(startLine, endLine int)
- func (svs *SourceViewStruct) GetCurrentLineNb() int
- func (svs *SourceViewStruct) GetText() (text string)
- func (svs *SourceViewStruct) ScrollToLine(line int) (iter *gtk.TextIter)
- func (svs *SourceViewStruct) SelectRange(startLine, endLine int)
- func (svs *SourceViewStruct) SetCursorAtLine(line int) (iter *gtk.TextIter)
- func (svs *SourceViewStruct) SetText(text string)
- func (svs *SourceViewStruct) UpdateCss()
- type TextViewNumbered
- func (tvn *TextViewNumbered) BufferAttach()
- func (tvn *TextViewNumbered) BufferDetach()
- func (tvn *TextViewNumbered) Clear()
- func (tvn *TextViewNumbered) ColorBgRange(startLine, endLine int)
- func (tvn *TextViewNumbered) FromFile(filename string, position ...int) (err error)
- func (tvn *TextViewNumbered) GetCurrentLineNb() int
- func (tvn *TextViewNumbered) GetText() (text string)
- func (tvn *TextViewNumbered) Init(container gtk.Container) (err error)
- func (tvn *TextViewNumbered) Reset()
- func (tvn *TextViewNumbered) ResetMd5()
- func (tvn *TextViewNumbered) RestoreScrollPos()
- func (tvn *TextViewNumbered) ScrollToLine(line int) (iter *gtk.TextIter)
- func (tvn *TextViewNumbered) SelectRange(startLine, endLine int)
- func (tvn *TextViewNumbered) SetCursorAtLine(line int) (iter *gtk.TextIter)
- func (tvn *TextViewNumbered) SetText(text string, line ...int)
- func (tvn *TextViewNumbered) SetTextMarkup(text string, line ...int)
- func (tvn *TextViewNumbered) StoreScrollPos()
- func (tvn *TextViewNumbered) Update()
- func (tvn *TextViewNumbered) WaitForEventPending()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetTextView ¶
GetTextView: Retrieve text from TextView as []string
func SetTextView ¶
SetTextView: Set []string to TextView
Types ¶
type SourceViewStruct ¶
type SourceViewStruct struct { SourceView *source.SourceView SourceBuffer *source.SourceBuffer FontSize int FontFamily, ColorBgRangeSet, NumFgCol, NumBgCol, TxtFgCol, TxtBgCol, SelFgCol, SelBgCol string // contains filtered or unexported fields }
func SourceViewStructNew ¶
func SourceViewStructNew(container gtk.Container) (svs *SourceViewStruct, err error)
func (*SourceViewStruct) ColorBgRange ¶
func (svs *SourceViewStruct) ColorBgRange(startLine, endLine int)
ColorBgRange: apply colored background to lines range.
func (*SourceViewStruct) GetCurrentLineNb ¶
func (svs *SourceViewStruct) GetCurrentLineNb() int
GetLineNumber: Get current line number at the cursor position
func (*SourceViewStruct) GetText ¶
func (svs *SourceViewStruct) GetText() (text string)
GetText: retrieve text from buffer.
func (*SourceViewStruct) ScrollToLine ¶
func (svs *SourceViewStruct) ScrollToLine(line int) (iter *gtk.TextIter)
ScrollToLine: Scroll to line
func (*SourceViewStruct) SelectRange ¶
func (svs *SourceViewStruct) SelectRange(startLine, endLine int)
SelectRange: select Lines
func (*SourceViewStruct) SetCursorAtLine ¶
func (svs *SourceViewStruct) SetCursorAtLine(line int) (iter *gtk.TextIter)
SetCursorAtLine: Set current line number & place cursor on it.
func (*SourceViewStruct) SetText ¶
func (svs *SourceViewStruct) SetText(text string)
GetText: update css and set text to buffer.
func (*SourceViewStruct) UpdateCss ¶
func (svs *SourceViewStruct) UpdateCss()
doColored: Add some colors to the numbers column
type TextViewNumbered ¶
type TextViewNumbered struct { TextView *gtk.TextView BuffTxt *gtk.TextBuffer ShowNumbers bool Editable bool NumFgCol string NumBgCol string TxtFgCol string TxtBgCol string SelFgCol string SelBgCol string ColorBgRangeSet string FontSze int FontFamily string BufferChangeCallbackFunc func() // contains filtered or unexported fields }
Allow the use of a TextView with line numbers (left sided) with scrolling capabilities and some formatting text controls
func TextViewNumberedNew ¶
func TextViewNumberedNew(container gtk.Container) (tvn *TextViewNumbered, err error)
TextViewNumberedNew: Create and initialize a new TextViewNumbered structure
func (*TextViewNumbered) BufferAttach ¶
func (tvn *TextViewNumbered) BufferAttach()
BufferAttach: to execute after the previous one.
func (*TextViewNumbered) BufferDetach ¶
func (tvn *TextViewNumbered) BufferDetach()
BufferDetach: Unlink buffer from TextView, if you hav to fill it with a large amount of data, it's useful to doing that.
func (*TextViewNumbered) Clear ¶
func (tvn *TextViewNumbered) Clear()
Clear: Delete buffers content (txt & num)
func (*TextViewNumbered) ColorBgRange ¶
func (tvn *TextViewNumbered) ColorBgRange(startLine, endLine int)
ColorBgRange: apply colored background to lines range.
func (*TextViewNumbered) FromFile ¶
func (tvn *TextViewNumbered) FromFile(filename string, position ...int) (err error)
FromFile: opens, loads the text file into the TextView and scrolls to the position if it has been specified.
func (*TextViewNumbered) GetCurrentLineNb ¶
func (tvn *TextViewNumbered) GetCurrentLineNb() int
GetLineNumber: Get current line number at the cursor position
func (*TextViewNumbered) GetText ¶
func (tvn *TextViewNumbered) GetText() (text string)
GetText: retrieve text from TextBuffer.
func (*TextViewNumbered) Init ¶
func (tvn *TextViewNumbered) Init(container gtk.Container) (err error)
Init: Initialize a TextViewNumbered structure
func (*TextViewNumbered) Reset ¶
func (tvn *TextViewNumbered) Reset()
Clear: Create new buffers (txt & num) and assign it. If you have made some signals callback, you must do it again.
func (*TextViewNumbered) ResetMd5 ¶
func (tvn *TextViewNumbered) ResetMd5()
ResetMd5: Used to determine if the text must be displayed again, ext has been changed.
func (*TextViewNumbered) RestoreScrollPos ¶
func (tvn *TextViewNumbered) RestoreScrollPos()
RestoreScrollPos: Restore position to scroll widget.
func (*TextViewNumbered) ScrollToLine ¶
func (tvn *TextViewNumbered) ScrollToLine(line int) (iter *gtk.TextIter)
ScrollToLine: Scroll to line
func (*TextViewNumbered) SelectRange ¶
func (tvn *TextViewNumbered) SelectRange(startLine, endLine int)
SelectRange: select Lines
func (*TextViewNumbered) SetCursorAtLine ¶
func (tvn *TextViewNumbered) SetCursorAtLine(line int) (iter *gtk.TextIter)
SetCursorAtLine: Set current line number & place cursor on it.
func (*TextViewNumbered) SetText ¶
func (tvn *TextViewNumbered) SetText(text string, line ...int)
SetText: and scroll to line nb if given.
func (*TextViewNumbered) SetTextMarkup ¶
func (tvn *TextViewNumbered) SetTextMarkup(text string, line ...int)
SetTextMarkup: and scroll to line nb if given.
func (*TextViewNumbered) StoreScrollPos ¶
func (tvn *TextViewNumbered) StoreScrollPos()
StoreScrollPos: store position in he scroll widget. Usage:
StoreScrollPos() line = GetCurrentLineNb() ... doing some adding to textview (assuming you understand adding at the end of textview ...) ... to preserve the "line" variable target position. SetCurrentLineNb(line) RestoreScrollPos()
in practice, you can add text with a minimum latency time.
func (*TextViewNumbered) WaitForEventPending ¶
func (tvn *TextViewNumbered) WaitForEventPending()
WaitForEventPending: Wait for pending events (until the widget is redrawn)