Documentation ¶
Index ¶
- type Align
- type Ctor
- func (ctor *Ctor) Align(align Align)
- func (ctor *Ctor) ClearStyle()
- func (ctor *Ctor) End()
- func (ctor *Ctor) LastChunkSel() Sel
- func (ctor *Ctor) Link(text string, hoverColor color.RGBA, callback func()) bool
- func (ctor *Ctor) ParagraphStyle(align Align, color color.RGBA)
- func (ctor *Ctor) RestoreStyle()
- func (ctor *Ctor) SaveStyle()
- func (ctor *Ctor) SetAlignForSel(sel Sel, align Align)
- func (ctor *Ctor) SetParagraphStyleForSel(sel Sel, align Align, color color.RGBA)
- func (ctor *Ctor) SetStyle(s TextStyle)
- func (ctor *Ctor) SetStyleForSel(sel Sel, s TextStyle)
- func (ctor *Ctor) Text(text string)
- type Events
- type FaceFlags
- type Flags
- type RichText
- func (rtxt *RichText) Append(scroll bool) *Ctor
- func (rtxt *RichText) FollowCursor()
- func (rtxt *RichText) Get(sel Sel) string
- func (rtxt *RichText) Len() int
- func (rtxt *RichText) Look(text string, wraparound bool) bool
- func (rtxt *RichText) Rows(w *nucular.Window, changed bool) *Ctor
- func (rtxt *RichText) Tail(n int)
- func (rtxt *RichText) Widget(w *nucular.Window, changed bool) *Ctor
- type Sel
- type SelectionGroup
- type TextStyle
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Ctor ¶
type Ctor struct {
// contains filtered or unexported fields
}
func (*Ctor) Align ¶
Align changes current text alignment. It is only legal to call Align before inserting text or after a newline character is inserted.
func (*Ctor) ClearStyle ¶
func (ctor *Ctor) ClearStyle()
ClearStyle resets the text style to the default.
func (*Ctor) LastChunkSel ¶
LastChunkSel returns the selection for the last chunk added
func (*Ctor) Link ¶
Link adds a link to the widget. It will return true if the link was clicked and callback is nil.
func (*Ctor) RestoreStyle ¶
func (ctor *Ctor) RestoreStyle()
RestoreStyle restores the last saved text style.
func (*Ctor) SetAlignForSel ¶
SetAlignForSel changes the alignment for the specified region.
func (*Ctor) SetParagraphStyleForSel ¶
func (*Ctor) SetStyle ¶
SetStyle changes current text style. If color or selColor are the zero value the default value (copied from the window) will be used. If face is nil the default font face from the window style will be used.
func (*Ctor) SetStyleForSel ¶
SetStyleForSel changes the text style for the specified region.
type RichText ¶
type RichText struct { Sel Sel // selected text if this widget is selectable, cursor position will have S == E Flags Flags SelFgColor color.RGBA // foreground color for selection, zero value specifies that it should be copied from the window style SelColor color.RGBA // background color for selection, zero value specifies that it should be copied from the window style Width int // maximum line width Events Events // events that happened during current frame Group *SelectionGroup // selection group for this object, only one object in the group can have a selection Replace func(Sel, *string) bool // if set and the Editable flag is set it will be called when the user wants to edit and should replace the specified selection with the given string // contains filtered or unexported fields }
func (*RichText) Append ¶
Append allows adding text at the end of the widget. Calling Link or LinkBytes on the returned constructor is illegal if callback is nil. Selections for SetStyleForSel and SetAlignForSel are interpreted to be relative to the newly added text.
func (*RichText) FollowCursor ¶
func (rtxt *RichText) FollowCursor()
func (*RichText) Look ¶
Look searches from the next occurence of text inside rtxt, starting at rtxt.Sel.S. Restarts the search from the start if nothing is found.
func (*RichText) Rows ¶
Rows is like Widget but adds the contents as a series of rows instead of a single widget.
func (*RichText) Widget ¶
Widget adds this rich text widget as a widget to w. The returned constructor allows populating the rich text widget with text and responding to events. The constructor will be returned under this circumstances: 1. the first time this function or Rows is called 2. changed is true 3. a link was clicked
type SelectionGroup ¶
type SelectionGroup struct {
// contains filtered or unexported fields
}
type TextStyle ¶
type TextStyle struct { Face font.Face Cursor font.Cursor Flags FaceFlags Color, SelFgColor, BgColor color.RGBA // foreground color, selected foreground color, background color LeftMarginHere bool // moves the left margin to this position, must be AlignLeft or AlignLeftDumb Tooltip func(*nucular.Window) TooltipWidth int ContextMenu func(*nucular.Window) }