Documentation
¶
Index ¶
- Constants
- type ExpandSelectionFn
- type Frame
- func (fr *Frame) BytesSize() uintptr
- func (fr *Frame) Clear()
- func (fr *Frame) CoordToPoint(coord image.Point) int
- func (fr *Frame) Init(margin int) error
- func (fr *Frame) Insert(r1, r2 []rune) (limit image.Point)
- func (fr *Frame) Inside(p int) bool
- func (fr *Frame) Invalidate()
- func (fr *Frame) LastPhisicalLineStart(a, b []rune) int
- func (fr *Frame) LimitY() int
- func (fr *Frame) LineNo() int
- func (f *Frame) OnClick(e util.MouseDownEvent, events <-chan util.EventOrRunnable) *mouse.Event
- func (fr *Frame) PointToCoord(p int) image.Point
- func (fr *Frame) PushDown(ln int, a, b []rune)
- func (fr *Frame) PushUp(ln int, drawOpt bool) (newsize int)
- func (fr *Frame) Redraw(flush bool, predrawRects *[]image.Rectangle)
- func (fr *Frame) RefreshColors(colors []uint8)
- func (fr *Frame) Select(idx, kind int, button mouse.Button, startPos image.Point, ...) *mouse.Event
- func (fr *Frame) SetSelect(idx, kind, start, end int)
- func (fr *Frame) Size() int
- type FrameScrollFn
- type Redrawable
- type ScrollFrame
- func (sfr *ScrollFrame) Init(margin int) error
- func (sfr *ScrollFrame) OnClick(e util.MouseDownEvent, events <-chan util.EventOrRunnable) (bool, *mouse.Event)
- func (sfr *ScrollFrame) Redraw(flush bool, predrawRects *[]image.Rectangle)
- func (sfr *ScrollFrame) ScrollClick(e util.MouseDownEvent, events <-chan util.EventOrRunnable) bool
- func (sfr *ScrollFrame) Set(top, bodyLen int)
- func (sfr *ScrollFrame) SetRects(b draw.Image, r image.Rectangle)
- func (sfr *ScrollFrame) Under(p image.Point) bool
Constants ¶
const ( HF_MARKSOFTWRAP uint32 = 1 << iota HF_TRUNCATE // truncates instead of softwrapping HF_NOVERTSTOP // Insert and InsertColor don't stop after they are past the bottom of the visible area HF_AUTOINDENT_SOFTWRAP HF_AUTOINDENT_WORDWRAP )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExpandSelectionFn ¶
type Frame ¶
type Frame struct { Font font.Face Hackflags uint32 B draw.Image // the image the text will be drawn upon R image.Rectangle // the rectangle occupied by the frame VisibleTick bool Colors [][]image.Uniform TabWidth int Flush func(...image.Rectangle) Scroll FrameScrollFn ExpandSelection ExpandSelectionFn Top int Tabs []int Offset int Sel util.Sel MarkSel *util.Sel SelColor int PMatch util.Sel // contains filtered or unexported fields }
func (*Frame) CoordToPoint ¶
Converts a graphical coordinate to a rune index
func (*Frame) Invalidate ¶
func (fr *Frame) Invalidate()
func (*Frame) LastPhisicalLineStart ¶
func (*Frame) OnClick ¶
func (f *Frame) OnClick(e util.MouseDownEvent, events <-chan util.EventOrRunnable) *mouse.Event
func (*Frame) PointToCoord ¶
Converts rune index into a graphical coordinate
func (*Frame) PushUp ¶
Pushes text graphically up by "ln" phisical lines Returns the number of glyphs left in the frame
func (*Frame) RefreshColors ¶
func (*Frame) Select ¶
func (fr *Frame) Select(idx, kind int, button mouse.Button, startPos image.Point, events <-chan util.EventOrRunnable) *mouse.Event
Tracks the mouse position, selecting text, the events channel is from go.wde kind is 1 for character by character selection, 2 for word by word selection, 3 for line by line selection
type FrameScrollFn ¶
Callback when the frame needs to scroll its text If scrollDir is 0 then n is the absolute position to move to If scrollDir is -1 the text should be scrolled back by n lines If scrollDir is +1 the text should be scrolled forward by n lines
type Redrawable ¶
type Redrawable interface {
Redraw(flush bool)
}
type ScrollFrame ¶
type ScrollFrame struct { Flush func(...image.Rectangle) Color image.Uniform // color for the scrollbar Width int // horizontal width of the scrollbar Fr Frame // text frame // contains filtered or unexported fields }
func (*ScrollFrame) Init ¶
func (sfr *ScrollFrame) Init(margin int) error
Initializes the ScrollFrame, will set B, R and Wnd of the underlying Frame itself
func (*ScrollFrame) OnClick ¶
func (sfr *ScrollFrame) OnClick(e util.MouseDownEvent, events <-chan util.EventOrRunnable) (bool, *mouse.Event)
func (*ScrollFrame) Redraw ¶
func (sfr *ScrollFrame) Redraw(flush bool, predrawRects *[]image.Rectangle)
Redraws frame. rdir and rpar are optimization parameters for partial redrawing of the frame during scrolling When rdir > 0, rpar is the number of glyphs that don't need to be redrawn When rdir < 0, rpar is the first glyph that doesn't need to be redrawn
func (*ScrollFrame) ScrollClick ¶
func (sfr *ScrollFrame) ScrollClick(e util.MouseDownEvent, events <-chan util.EventOrRunnable) bool
If the click wasn't in the scrollbar area returns false Otherwise handles the click, until mouse-up is received, then returns true
func (*ScrollFrame) Set ¶
func (sfr *ScrollFrame) Set(top, bodyLen int)