Documentation ¶
Index ¶
- Constants
- Variables
- func CheckVersion(major, minor, micro uint) bool
- func CompletionFuZZYHighlight(haystack, casefoldQuery string) *pango.AttrList
- func CompletionFuZZYMatch(haystack, casefoldNeedle string) (uint, bool)
- func FileLoaderErrorQuark() glib.Quark
- func FileSaverErrorQuark() glib.Quark
- func Finalize()
- func GetMajorVersion() uint
- func GetMicroVersion() uint
- func GetMinorVersion() uint
- func Init()
- func SchedulerAdd(callback SchedulerCallback) uint
- func SchedulerAddFull(callback SchedulerCallback) uint
- func SchedulerRemove(handlerId uint)
- func UtilsEscapeSearchText(text string) string
- func UtilsUnescapeSearchText(text string) string
- type BackgroundPatternType
- type BracketMatchType
- type Buffer
- func (buffer *Buffer) ChangeCase(caseType ChangeCaseType, start, end *gtk.TextIter)
- func (buffer *Buffer) ConnectBracketMatched(f func(iter *gtk.TextIter, state BracketMatchType)) coreglib.SignalHandle
- func (buffer *Buffer) ConnectCursorMoved(f func()) coreglib.SignalHandle
- func (buffer *Buffer) ConnectHighlightUpdated(f func(start, end *gtk.TextIter)) coreglib.SignalHandle
- func (buffer *Buffer) ConnectSourceMarkUpdated(f func(mark *gtk.TextMark)) coreglib.SignalHandle
- func (buffer *Buffer) ContextClassesAtIter(iter *gtk.TextIter) []string
- func (buffer *Buffer) CreateSourceMark(name, category string, where *gtk.TextIter) *Mark
- func (buffer *Buffer) EnsureHighlight(start, end *gtk.TextIter)
- func (buffer *Buffer) HighlightMatchingBrackets() bool
- func (buffer *Buffer) HighlightSyntax() bool
- func (buffer *Buffer) ImplicitTrailingNewline() bool
- func (buffer *Buffer) IterHasContextClass(iter *gtk.TextIter, contextClass string) bool
- func (buffer *Buffer) JoinLines(start, end *gtk.TextIter)
- func (buffer *Buffer) Language() *Language
- func (buffer *Buffer) RemoveSourceMarks(start, end *gtk.TextIter, category string)
- func (buffer *Buffer) SetHighlightMatchingBrackets(highlight bool)
- func (buffer *Buffer) SetHighlightSyntax(highlight bool)
- func (buffer *Buffer) SetImplicitTrailingNewline(implicitTrailingNewline bool)
- func (buffer *Buffer) SetLanguage(language *Language)
- func (buffer *Buffer) SetStyleScheme(scheme *StyleScheme)
- func (buffer *Buffer) SortLines(start, end *gtk.TextIter, flags SortFlags, column int)
- func (buffer *Buffer) SourceMarksAtIter(iter *gtk.TextIter, category string) []*Mark
- func (buffer *Buffer) SourceMarksAtLine(line int, category string) []*Mark
- func (buffer *Buffer) StyleScheme() *StyleScheme
- type BufferClass
- type BufferOverrides
- type ChangeCaseType
- type Completion
- func (self *Completion) AddProvider(provider CompletionProviderer)
- func (self *Completion) BlockInteractive()
- func (self *Completion) Buffer() *Buffer
- func (self *Completion) ConnectHide(f func()) coreglib.SignalHandle
- func (self *Completion) ConnectProviderAdded(f func(provider CompletionProviderer)) coreglib.SignalHandle
- func (self *Completion) ConnectProviderRemoved(f func(provider CompletionProviderer)) coreglib.SignalHandle
- func (self *Completion) ConnectShow(f func()) coreglib.SignalHandle
- func (self *Completion) Hide()
- func (self *Completion) PageSize() uint
- func (self *Completion) RemoveProvider(provider CompletionProviderer)
- func (self *Completion) SetPageSize(pageSize uint)
- func (self *Completion) Show()
- func (self *Completion) UnblockInteractive()
- func (self *Completion) View() *View
- type CompletionActivation
- type CompletionCell
- func (self *CompletionCell) Column() CompletionColumn
- func (self *CompletionCell) GetWidget() gtk.Widgetter
- func (self *CompletionCell) SetGIcon(gicon gio.Iconner)
- func (self *CompletionCell) SetIconName(iconName string)
- func (self *CompletionCell) SetMarkup(markup string)
- func (self *CompletionCell) SetPaintable(paintable gdk.Paintabler)
- func (self *CompletionCell) SetText(text string)
- func (self *CompletionCell) SetTextWithAttributes(text string, attrs *pango.AttrList)
- func (self *CompletionCell) SetWidget(child gtk.Widgetter)
- type CompletionCellClass
- type CompletionCellOverrides
- type CompletionClass
- type CompletionColumn
- type CompletionContext
- func (self *CompletionContext) Activation() CompletionActivation
- func (self *CompletionContext) Bounds() (begin, end *gtk.TextIter, ok bool)
- func (self *CompletionContext) Buffer() *Buffer
- func (self *CompletionContext) Busy() bool
- func (self *CompletionContext) Completion() *Completion
- func (self *CompletionContext) ConnectProviderModelChanged(f func(provider CompletionProviderer, model gio.ListModeller)) coreglib.SignalHandle
- func (self *CompletionContext) Empty() bool
- func (self *CompletionContext) Language() *Language
- func (self *CompletionContext) ListProviders() *gio.ListModel
- func (self *CompletionContext) ProposalsForProvider(provider CompletionProviderer) *gio.ListModel
- func (self *CompletionContext) SetProposalsForProvider(provider CompletionProviderer, results gio.ListModeller)
- func (self *CompletionContext) View() *View
- func (self *CompletionContext) Word() string
- type CompletionContextClass
- type CompletionContextOverrides
- type CompletionOverrides
- type CompletionProposal
- type CompletionProposalInterface
- type CompletionProposaller
- type CompletionProvider
- func (self *CompletionProvider) Activate(context *CompletionContext, proposal CompletionProposaller)
- func (self *CompletionProvider) Display(context *CompletionContext, proposal CompletionProposaller, ...)
- func (self *CompletionProvider) IsTrigger(iter *gtk.TextIter, ch uint32) bool
- func (self *CompletionProvider) KeyActivates(context *CompletionContext, proposal CompletionProposaller, keyval uint, ...) bool
- func (self *CompletionProvider) PopulateFinish(result gio.AsyncResulter) (*gio.ListModel, error)
- func (self *CompletionProvider) Priority(context *CompletionContext) int
- func (self *CompletionProvider) Refilter(context *CompletionContext, model gio.ListModeller)
- func (self *CompletionProvider) Title() string
- type CompletionProviderInterface
- type CompletionProviderer
- type CompletionSnippets
- type CompletionSnippetsClass
- type CompletionSnippetsOverrides
- type CompletionWords
- type CompletionWordsClass
- type CompletionWordsOverrides
- type CompressionType
- type Encoding
- type File
- func (file *File) CheckFileOnDisk()
- func (file *File) CompressionType() CompressionType
- func (file *File) Encoding() *Encoding
- func (file *File) IsDeleted() bool
- func (file *File) IsExternallyModified() bool
- func (file *File) IsLocal() bool
- func (file *File) IsReadonly() bool
- func (file *File) Location() *gio.File
- func (file *File) NewlineType() NewlineType
- func (file *File) SetLocation(location gio.Filer)
- type FileClass
- type FileLoader
- func (loader *FileLoader) Buffer() *Buffer
- func (loader *FileLoader) CompressionType() CompressionType
- func (loader *FileLoader) Encoding() *Encoding
- func (loader *FileLoader) File() *File
- func (loader *FileLoader) InputStream() gio.InputStreamer
- func (loader *FileLoader) LoadFinish(result gio.AsyncResulter) error
- func (loader *FileLoader) Location() *gio.File
- func (loader *FileLoader) NewlineType() NewlineType
- func (loader *FileLoader) SetCandidateEncodings(candidateEncodings []*Encoding)
- type FileLoaderClass
- type FileLoaderError
- type FileLoaderOverrides
- type FileOverrides
- type FileSaver
- func (saver *FileSaver) Buffer() *Buffer
- func (saver *FileSaver) CompressionType() CompressionType
- func (saver *FileSaver) Encoding() *Encoding
- func (saver *FileSaver) File() *File
- func (saver *FileSaver) Flags() FileSaverFlags
- func (saver *FileSaver) Location() *gio.File
- func (saver *FileSaver) NewlineType() NewlineType
- func (saver *FileSaver) SaveFinish(result gio.AsyncResulter) error
- func (saver *FileSaver) SetCompressionType(compressionType CompressionType)
- func (saver *FileSaver) SetEncoding(encoding *Encoding)
- func (saver *FileSaver) SetFlags(flags FileSaverFlags)
- func (saver *FileSaver) SetNewlineType(newlineType NewlineType)
- type FileSaverClass
- type FileSaverError
- type FileSaverFlags
- type FileSaverOverrides
- type Gutter
- type GutterClass
- type GutterLines
- func (lines *GutterLines) AddClass(line uint, name string)
- func (lines *GutterLines) AddQclass(line uint, qname glib.Quark)
- func (lines *GutterLines) Buffer() *gtk.TextBuffer
- func (lines *GutterLines) First() uint
- func (lines *GutterLines) HasAnyClass(line uint) bool
- func (lines *GutterLines) HasClass(line uint, name string) bool
- func (lines *GutterLines) HasQclass(line uint, qname glib.Quark) bool
- func (lines *GutterLines) IsCursor(line uint) bool
- func (lines *GutterLines) IsPrelit(line uint) bool
- func (lines *GutterLines) IsSelected(line uint) bool
- func (lines *GutterLines) IterAtLine(line uint) *gtk.TextIter
- func (lines *GutterLines) Last() uint
- func (lines *GutterLines) LineYrange(line uint, mode GutterRendererAlignmentMode) (y, height int)
- func (lines *GutterLines) RemoveClass(line uint, name string)
- func (lines *GutterLines) RemoveQclass(line uint, qname glib.Quark)
- func (lines *GutterLines) View() *gtk.TextView
- type GutterLinesClass
- type GutterLinesOverrides
- type GutterOverrides
- type GutterRenderer
- func (renderer *GutterRenderer) Activate(iter *gtk.TextIter, area *gdk.Rectangle, button uint, state gdk.ModifierType, ...)
- func (renderer *GutterRenderer) AlignCell(line uint, width, height float32) (x, y float32)
- func (renderer *GutterRenderer) AlignmentMode() GutterRendererAlignmentMode
- func (renderer *GutterRenderer) Buffer() *Buffer
- func (renderer *GutterRenderer) ConnectActivate(...) coreglib.SignalHandle
- func (renderer *GutterRenderer) ConnectQueryActivatable(f func(iter *gtk.TextIter, area *gdk.Rectangle) (ok bool)) coreglib.SignalHandle
- func (renderer *GutterRenderer) ConnectQueryData(f func(object *coreglib.Object, p0 uint)) coreglib.SignalHandle
- func (renderer *GutterRenderer) QueryActivatable(iter *gtk.TextIter, area *gdk.Rectangle) bool
- func (renderer *GutterRenderer) SetAlignmentMode(mode GutterRendererAlignmentMode)
- func (renderer *GutterRenderer) SetXAlign(xalign float32)
- func (renderer *GutterRenderer) SetXpad(xpad int)
- func (renderer *GutterRenderer) SetYAlign(yalign float32)
- func (renderer *GutterRenderer) SetYpad(ypad int)
- func (renderer *GutterRenderer) View() *View
- func (renderer *GutterRenderer) XAlign() float32
- func (renderer *GutterRenderer) Xpad() int
- func (renderer *GutterRenderer) YAlign() float32
- func (renderer *GutterRenderer) Ypad() int
- type GutterRendererAlignmentMode
- type GutterRendererClass
- type GutterRendererOverrides
- type GutterRendererPixbuf
- func (renderer *GutterRendererPixbuf) GIcon() *gio.Icon
- func (renderer *GutterRendererPixbuf) IconName() string
- func (renderer *GutterRendererPixbuf) OverlayPaintable(paintable gdk.Paintabler)
- func (renderer *GutterRendererPixbuf) Paintable() *gdk.Paintable
- func (renderer *GutterRendererPixbuf) Pixbuf() *gdkpixbuf.Pixbuf
- func (renderer *GutterRendererPixbuf) SetGIcon(icon gio.Iconner)
- func (renderer *GutterRendererPixbuf) SetIconName(iconName string)
- func (renderer *GutterRendererPixbuf) SetPaintable(paintable gdk.Paintabler)
- func (renderer *GutterRendererPixbuf) SetPixbuf(pixbuf *gdkpixbuf.Pixbuf)
- type GutterRendererPixbufClass
- type GutterRendererPixbufOverrides
- type GutterRendererText
- func (renderer *GutterRendererText) Measure(text string) (width, height int)
- func (renderer *GutterRendererText) MeasureMarkup(markup string) (width, height int)
- func (renderer *GutterRendererText) SetMarkup(markup string, length int)
- func (renderer *GutterRendererText) SetText(text string, length int)
- type GutterRendererTextClass
- type GutterRendererTextOverrides
- type GutterRendererer
- type Hover
- type HoverClass
- type HoverContext
- type HoverContextClass
- type HoverContextOverrides
- type HoverDisplay
- type HoverDisplayClass
- type HoverDisplayOverrides
- type HoverOverrides
- type HoverProvider
- type HoverProviderInterface
- type HoverProviderer
- type Indenter
- type IndenterInterface
- type Indenterer
- type Language
- func (language *Language) Globs() []string
- func (language *Language) Hidden() bool
- func (language *Language) ID() string
- func (language *Language) MIMETypes() []string
- func (language *Language) Metadata(name string) string
- func (language *Language) Name() string
- func (language *Language) Section() string
- func (language *Language) StyleFallback(styleId string) string
- func (language *Language) StyleIDs() []string
- func (language *Language) StyleName(styleId string) string
- type LanguageClass
- type LanguageManager
- func (lm *LanguageManager) AppendSearchPath(path string)
- func (lm *LanguageManager) GuessLanguage(filename, contentType string) *Language
- func (lm *LanguageManager) Language(id string) *Language
- func (lm *LanguageManager) LanguageIDs() []string
- func (lm *LanguageManager) PrependSearchPath(path string)
- func (lm *LanguageManager) SearchPath() []string
- func (lm *LanguageManager) SetSearchPath(dirs []string)
- type LanguageManagerClass
- type LanguageManagerOverrides
- type LanguageOverrides
- type Map
- type MapClass
- type MapOverrides
- type Mark
- type MarkAttributes
- func (attributes *MarkAttributes) Background() (*gdk.RGBA, bool)
- func (attributes *MarkAttributes) ConnectQueryTooltipMarkup(f func(mark *Mark) (utf8 string)) coreglib.SignalHandle
- func (attributes *MarkAttributes) ConnectQueryTooltipText(f func(mark *Mark) (utf8 string)) coreglib.SignalHandle
- func (attributes *MarkAttributes) GIcon() *gio.Icon
- func (attributes *MarkAttributes) IconName() string
- func (attributes *MarkAttributes) Pixbuf() *gdkpixbuf.Pixbuf
- func (attributes *MarkAttributes) RenderIcon(widget gtk.Widgetter, size int) *gdk.Paintable
- func (attributes *MarkAttributes) SetBackground(background *gdk.RGBA)
- func (attributes *MarkAttributes) SetGIcon(gicon gio.Iconner)
- func (attributes *MarkAttributes) SetIconName(iconName string)
- func (attributes *MarkAttributes) SetPixbuf(pixbuf *gdkpixbuf.Pixbuf)
- func (attributes *MarkAttributes) TooltipMarkup(mark *Mark) string
- func (attributes *MarkAttributes) TooltipText(mark *Mark) string
- type MarkAttributesClass
- type MarkAttributesOverrides
- type MarkClass
- type MarkOverrides
- type NewlineType
- type PrintCompositor
- func (compositor *PrintCompositor) BodyFontName() string
- func (compositor *PrintCompositor) BottomMargin(unit gtk.Unit) float64
- func (compositor *PrintCompositor) Buffer() *Buffer
- func (compositor *PrintCompositor) DrawPage(context *gtk.PrintContext, pageNr int)
- func (compositor *PrintCompositor) FooterFontName() string
- func (compositor *PrintCompositor) HeaderFontName() string
- func (compositor *PrintCompositor) HighlightSyntax() bool
- func (compositor *PrintCompositor) IgnoreTag(tag *gtk.TextTag)
- func (compositor *PrintCompositor) LeftMargin(unit gtk.Unit) float64
- func (compositor *PrintCompositor) LineNumbersFontName() string
- func (compositor *PrintCompositor) NPages() int
- func (compositor *PrintCompositor) Paginate(context *gtk.PrintContext) bool
- func (compositor *PrintCompositor) PaginationProgress() float64
- func (compositor *PrintCompositor) PrintFooter() bool
- func (compositor *PrintCompositor) PrintHeader() bool
- func (compositor *PrintCompositor) PrintLineNumbers() uint
- func (compositor *PrintCompositor) RightMargin(unit gtk.Unit) float64
- func (compositor *PrintCompositor) SetBodyFontName(fontName string)
- func (compositor *PrintCompositor) SetBottomMargin(margin float64, unit gtk.Unit)
- func (compositor *PrintCompositor) SetFooterFontName(fontName string)
- func (compositor *PrintCompositor) SetFooterFormat(separator bool, left, center, right string)
- func (compositor *PrintCompositor) SetHeaderFontName(fontName string)
- func (compositor *PrintCompositor) SetHeaderFormat(separator bool, left, center, right string)
- func (compositor *PrintCompositor) SetHighlightSyntax(highlight bool)
- func (compositor *PrintCompositor) SetLeftMargin(margin float64, unit gtk.Unit)
- func (compositor *PrintCompositor) SetLineNumbersFontName(fontName string)
- func (compositor *PrintCompositor) SetPrintFooter(print bool)
- func (compositor *PrintCompositor) SetPrintHeader(print bool)
- func (compositor *PrintCompositor) SetPrintLineNumbers(interval uint)
- func (compositor *PrintCompositor) SetRightMargin(margin float64, unit gtk.Unit)
- func (compositor *PrintCompositor) SetTabWidth(width uint)
- func (compositor *PrintCompositor) SetTopMargin(margin float64, unit gtk.Unit)
- func (compositor *PrintCompositor) SetWrapMode(wrapMode gtk.WrapMode)
- func (compositor *PrintCompositor) TabWidth() uint
- func (compositor *PrintCompositor) TopMargin(unit gtk.Unit) float64
- func (compositor *PrintCompositor) WrapMode() gtk.WrapMode
- type PrintCompositorClass
- type PrintCompositorOverrides
- type Region
- func (region *Region) AddRegion(regionToAdd *Region)
- func (region *Region) AddSubregion(Start, End *gtk.TextIter)
- func (region *Region) Bounds() (start, end *gtk.TextIter, ok bool)
- func (region *Region) Buffer() *gtk.TextBuffer
- func (region1 *Region) IntersectRegion(region2 *Region) *Region
- func (region *Region) IntersectSubregion(Start, End *gtk.TextIter) *Region
- func (region *Region) IsEmpty() bool
- func (region *Region) StartRegionIter() *RegionIter
- func (region *Region) String() string
- func (region *Region) SubtractRegion(regionToSubtract *Region)
- func (region *Region) SubtractSubregion(Start, End *gtk.TextIter)
- type RegionClass
- type RegionIter
- type RegionOverrides
- type SchedulerCallback
- type SearchContext
- func (search *SearchContext) Backward(iter *gtk.TextIter) (matchStart, matchEnd *gtk.TextIter, hasWrappedAround, ok bool)
- func (search *SearchContext) BackwardFinish(result gio.AsyncResulter) (matchStart, matchEnd *gtk.TextIter, hasWrappedAround bool, goerr error)
- func (search *SearchContext) Buffer() *Buffer
- func (search *SearchContext) Forward(iter *gtk.TextIter) (matchStart, matchEnd *gtk.TextIter, hasWrappedAround, ok bool)
- func (search *SearchContext) ForwardFinish(result gio.AsyncResulter) (matchStart, matchEnd *gtk.TextIter, hasWrappedAround bool, goerr error)
- func (search *SearchContext) Highlight() bool
- func (search *SearchContext) MatchStyle() *Style
- func (search *SearchContext) OccurrencePosition(matchStart, matchEnd *gtk.TextIter) int
- func (search *SearchContext) OccurrencesCount() int
- func (search *SearchContext) RegexError() error
- func (search *SearchContext) Replace(matchStart, matchEnd *gtk.TextIter, replace string, replaceLength int) error
- func (search *SearchContext) ReplaceAll(replace string, replaceLength int) (uint, error)
- func (search *SearchContext) SetHighlight(highlight bool)
- func (search *SearchContext) SetMatchStyle(matchStyle *Style)
- func (search *SearchContext) Settings() *SearchSettings
- type SearchContextClass
- type SearchContextOverrides
- type SearchSettings
- func (settings *SearchSettings) AtWordBoundaries() bool
- func (settings *SearchSettings) CaseSensitive() bool
- func (settings *SearchSettings) RegexEnabled() bool
- func (settings *SearchSettings) SearchText() string
- func (settings *SearchSettings) SetAtWordBoundaries(atWordBoundaries bool)
- func (settings *SearchSettings) SetCaseSensitive(caseSensitive bool)
- func (settings *SearchSettings) SetRegexEnabled(regexEnabled bool)
- func (settings *SearchSettings) SetSearchText(searchText string)
- func (settings *SearchSettings) SetWrapAround(wrapAround bool)
- func (settings *SearchSettings) WrapAround() bool
- type SearchSettingsClass
- type SearchSettingsOverrides
- type SmartHomeEndType
- type Snippet
- func (snippet *Snippet) AddChunk(chunk *SnippetChunk)
- func (snippet *Snippet) Context() *SnippetContext
- func (snippet *Snippet) Copy() *Snippet
- func (snippet *Snippet) Description() string
- func (snippet *Snippet) FocusPosition() int
- func (snippet *Snippet) LanguageID() string
- func (snippet *Snippet) NChunks() uint
- func (snippet *Snippet) Name() string
- func (snippet *Snippet) NthChunk(nth uint) *SnippetChunk
- func (snippet *Snippet) SetDescription(description string)
- func (snippet *Snippet) SetLanguageID(languageId string)
- func (snippet *Snippet) SetName(name string)
- func (snippet *Snippet) SetTrigger(trigger string)
- func (snippet *Snippet) Trigger() string
- type SnippetChunk
- func (chunk *SnippetChunk) Context() *SnippetContext
- func (chunk *SnippetChunk) Copy() *SnippetChunk
- func (chunk *SnippetChunk) FocusPosition() int
- func (chunk *SnippetChunk) SetContext(context *SnippetContext)
- func (chunk *SnippetChunk) SetFocusPosition(focusPosition int)
- func (chunk *SnippetChunk) SetSpec(spec string)
- func (chunk *SnippetChunk) SetText(text string)
- func (chunk *SnippetChunk) SetTextSet(textSet bool)
- func (chunk *SnippetChunk) SetTooltipText(tooltipText string)
- func (chunk *SnippetChunk) Spec() string
- func (chunk *SnippetChunk) Text() string
- func (chunk *SnippetChunk) TextSet() bool
- func (chunk *SnippetChunk) TooltipText() string
- type SnippetChunkClass
- type SnippetChunkOverrides
- type SnippetClass
- type SnippetContext
- func (self *SnippetContext) ClearVariables()
- func (self *SnippetContext) ConnectChanged(f func()) coreglib.SignalHandle
- func (self *SnippetContext) Expand(input string) string
- func (self *SnippetContext) SetConstant(key, value string)
- func (self *SnippetContext) SetLinePrefix(linePrefix string)
- func (self *SnippetContext) SetTabWidth(tabWidth int)
- func (self *SnippetContext) SetUseSpaces(useSpaces bool)
- func (self *SnippetContext) SetVariable(key, value string)
- func (self *SnippetContext) Variable(key string) string
- type SnippetContextClass
- type SnippetContextOverrides
- type SnippetManager
- func (self *SnippetManager) ListAll() *gio.ListModel
- func (self *SnippetManager) ListGroups() []string
- func (self *SnippetManager) ListMatching(group, languageId, triggerPrefix string) *gio.ListModel
- func (self *SnippetManager) SearchPath() []string
- func (self *SnippetManager) SetSearchPath(dirs []string)
- func (self *SnippetManager) Snippet(group, languageId, trigger string) *Snippet
- type SnippetManagerClass
- type SnippetManagerOverrides
- type SnippetOverrides
- type SortFlags
- type SpaceDrawer
- func (drawer *SpaceDrawer) BindMatrixSetting(settings *gio.Settings, key string, flags gio.SettingsBindFlags)
- func (drawer *SpaceDrawer) EnableMatrix() bool
- func (drawer *SpaceDrawer) Matrix() *glib.Variant
- func (drawer *SpaceDrawer) SetEnableMatrix(enableMatrix bool)
- func (drawer *SpaceDrawer) SetMatrix(matrix *glib.Variant)
- func (drawer *SpaceDrawer) SetTypesForLocations(locations SpaceLocationFlags, types SpaceTypeFlags)
- func (drawer *SpaceDrawer) TypesForLocations(locations SpaceLocationFlags) SpaceTypeFlags
- type SpaceDrawerClass
- type SpaceDrawerOverrides
- type SpaceLocationFlags
- type SpaceTypeFlags
- type Style
- type StyleClass
- type StyleOverrides
- type StyleScheme
- func (scheme *StyleScheme) Authors() []string
- func (scheme *StyleScheme) Description() string
- func (scheme *StyleScheme) Filename() string
- func (scheme *StyleScheme) ID() string
- func (scheme *StyleScheme) Metadata(name string) string
- func (scheme *StyleScheme) Name() string
- func (scheme *StyleScheme) Style(styleId string) *Style
- type StyleSchemeChooser
- type StyleSchemeChooserButton
- type StyleSchemeChooserButtonClass
- type StyleSchemeChooserButtonOverrides
- type StyleSchemeChooserInterface
- type StyleSchemeChooserWidget
- type StyleSchemeChooserWidgetClass
- type StyleSchemeChooserWidgetOverrides
- type StyleSchemeChooserer
- type StyleSchemeClass
- type StyleSchemeManager
- func (manager *StyleSchemeManager) AppendSearchPath(path string)
- func (manager *StyleSchemeManager) ForceRescan()
- func (manager *StyleSchemeManager) PrependSearchPath(path string)
- func (manager *StyleSchemeManager) Scheme(schemeId string) *StyleScheme
- func (manager *StyleSchemeManager) SchemeIDs() []string
- func (manager *StyleSchemeManager) SearchPath() []string
- func (manager *StyleSchemeManager) SetSearchPath(path []string)
- type StyleSchemeManagerClass
- type StyleSchemeManagerOverrides
- type StyleSchemeOverrides
- type StyleSchemePreview
- type StyleSchemePreviewClass
- type StyleSchemePreviewOverrides
- type Tag
- type TagClass
- type TagOverrides
- type View
- func (view *View) AutoIndent() bool
- func (view *View) BackgroundPattern() BackgroundPatternType
- func (view *View) Completion() *Completion
- func (view *View) ConnectChangeCase(f func(caseType ChangeCaseType)) coreglib.SignalHandle
- func (view *View) ConnectChangeNumber(f func(count int)) coreglib.SignalHandle
- func (view *View) ConnectJoinLines(f func()) coreglib.SignalHandle
- func (view *View) ConnectLineMarkActivated(f func(iter *gtk.TextIter, button uint, state gdk.ModifierType, nPresses int)) coreglib.SignalHandle
- func (view *View) ConnectMoveLines(f func(down bool)) coreglib.SignalHandle
- func (view *View) ConnectMoveToMatchingBracket(f func(extendSelection bool)) coreglib.SignalHandle
- func (view *View) ConnectMoveWords(f func(count int)) coreglib.SignalHandle
- func (view *View) ConnectShowCompletion(f func()) coreglib.SignalHandle
- func (view *View) ConnectSmartHomeEnd(f func(iter *gtk.TextIter, count int)) coreglib.SignalHandle
- func (view *View) EnableSnippets() bool
- func (view *View) Gutter(windowType gtk.TextWindowType) *Gutter
- func (view *View) HighlightCurrentLine() bool
- func (view *View) Hover() *Hover
- func (view *View) IndentLines(start, end *gtk.TextIter)
- func (view *View) IndentOnTab() bool
- func (view *View) IndentWidth() int
- func (view *View) Indenter() *Indenter
- func (view *View) InsertSpacesInsteadOfTabs() bool
- func (view *View) MarkAttributes(category string, priority *int) *MarkAttributes
- func (view *View) PushSnippet(snippet *Snippet, location *gtk.TextIter)
- func (view *View) RightMarginPosition() uint
- func (view *View) SetAutoIndent(enable bool)
- func (view *View) SetBackgroundPattern(backgroundPattern BackgroundPatternType)
- func (view *View) SetEnableSnippets(enableSnippets bool)
- func (view *View) SetHighlightCurrentLine(highlight bool)
- func (view *View) SetIndentOnTab(enable bool)
- func (view *View) SetIndentWidth(width int)
- func (view *View) SetIndenter(indenter Indenterer)
- func (view *View) SetInsertSpacesInsteadOfTabs(enable bool)
- func (view *View) SetMarkAttributes(category string, attributes *MarkAttributes, priority int)
- func (view *View) SetRightMarginPosition(pos uint)
- func (view *View) SetShowLineMarks(show bool)
- func (view *View) SetShowLineNumbers(show bool)
- func (view *View) SetShowRightMargin(show bool)
- func (view *View) SetSmartBackspace(smartBackspace bool)
- func (view *View) SetSmartHomeEnd(smartHomeEnd SmartHomeEndType)
- func (view *View) SetTabWidth(width uint)
- func (view *View) ShowLineMarks() bool
- func (view *View) ShowLineNumbers() bool
- func (view *View) ShowRightMargin() bool
- func (view *View) SmartBackspace() bool
- func (view *View) SmartHomeEnd() SmartHomeEndType
- func (view *View) SpaceDrawer() *SpaceDrawer
- func (view *View) TabWidth() uint
- func (view *View) UnindentLines(start, end *gtk.TextIter)
- func (view *View) VisualColumn(iter *gtk.TextIter) uint
- type ViewClass
- type ViewGutterPosition
- type ViewOverrides
- type VimIMContext
- func (self *VimIMContext) CommandBarText() string
- func (self *VimIMContext) CommandText() string
- func (self *VimIMContext) ConnectEdit(f func(view *View, path string)) coreglib.SignalHandle
- func (self *VimIMContext) ConnectExecuteCommand(f func(command string) (ok bool)) coreglib.SignalHandle
- func (self *VimIMContext) ConnectFormatText(f func(begin, end *gtk.TextIter)) coreglib.SignalHandle
- func (self *VimIMContext) ConnectWrite(f func(view *View, path string)) coreglib.SignalHandle
- func (self *VimIMContext) ExecuteCommand(command string)
- type VimIMContextClass
- type VimIMContextOverrides
Constants ¶
const MAJOR_VERSION = 5
MAJOR_VERSION: like gtk_source_get_major_version(), but from the headers used at application compile time, rather than from the library linked against at application run time.
const MICRO_VERSION = 0
MICRO_VERSION: like gtk_source_get_micro_version(), but from the headers used at application compile time, rather than from the library linked against at application run time.
const MINOR_VERSION = 8
MINOR_VERSION: like gtk_source_get_minor_version(), but from the headers used at application compile time, rather than from the library linked against at application run time.
Variables ¶
var ( GTypeBackgroundPatternType = coreglib.Type(C.gtk_source_background_pattern_type_get_type()) GTypeBracketMatchType = coreglib.Type(C.gtk_source_bracket_match_type_get_type()) GTypeChangeCaseType = coreglib.Type(C.gtk_source_change_case_type_get_type()) GTypeCompletionActivation = coreglib.Type(C.gtk_source_completion_activation_get_type()) GTypeCompletionColumn = coreglib.Type(C.gtk_source_completion_column_get_type()) GTypeCompressionType = coreglib.Type(C.gtk_source_compression_type_get_type()) GTypeNewlineType = coreglib.Type(C.gtk_source_newline_type_get_type()) GTypeSmartHomeEndType = coreglib.Type(C.gtk_source_smart_home_end_type_get_type()) GTypeViewGutterPosition = coreglib.Type(C.gtk_source_view_gutter_position_get_type()) GTypeSortFlags = coreglib.Type(C.gtk_source_sort_flags_get_type()) )
GType values.
var ( GTypeFileLoaderError = coreglib.Type(C.gtk_source_file_loader_error_get_type()) GTypeFileLoader = coreglib.Type(C.gtk_source_file_loader_get_type()) )
GType values.
var ( GTypeFileSaverError = coreglib.Type(C.gtk_source_file_saver_error_get_type()) GTypeFileSaverFlags = coreglib.Type(C.gtk_source_file_saver_flags_get_type()) GTypeFileSaver = coreglib.Type(C.gtk_source_file_saver_get_type()) )
GType values.
var ( GTypeGutterRendererAlignmentMode = coreglib.Type(C.gtk_source_gutter_renderer_alignment_mode_get_type()) GTypeGutterRenderer = coreglib.Type(C.gtk_source_gutter_renderer_get_type()) )
GType values.
var ( GTypeSpaceLocationFlags = coreglib.Type(C.gtk_source_space_location_flags_get_type()) GTypeSpaceTypeFlags = coreglib.Type(C.gtk_source_space_type_flags_get_type()) GTypeSpaceDrawer = coreglib.Type(C.gtk_source_space_drawer_get_type()) )
GType values.
var (
GTypeBuffer = coreglib.Type(C.gtk_source_buffer_get_type())
)
GType values.
var (
GTypeCompletion = coreglib.Type(C.gtk_source_completion_get_type())
)
GType values.
var (
GTypeCompletionCell = coreglib.Type(C.gtk_source_completion_cell_get_type())
)
GType values.
var (
GTypeCompletionContext = coreglib.Type(C.gtk_source_completion_context_get_type())
)
GType values.
var (
GTypeCompletionProposal = coreglib.Type(C.gtk_source_completion_proposal_get_type())
)
GType values.
var (
GTypeCompletionProvider = coreglib.Type(C.gtk_source_completion_provider_get_type())
)
GType values.
var (
GTypeCompletionSnippets = coreglib.Type(C.gtk_source_completion_snippets_get_type())
)
GType values.
var (
GTypeCompletionWords = coreglib.Type(C.gtk_source_completion_words_get_type())
)
GType values.
var (
GTypeEncoding = coreglib.Type(C.gtk_source_encoding_get_type())
)
GType values.
var (
GTypeFile = coreglib.Type(C.gtk_source_file_get_type())
)
GType values.
var (
GTypeGutter = coreglib.Type(C.gtk_source_gutter_get_type())
)
GType values.
var (
GTypeGutterLines = coreglib.Type(C.gtk_source_gutter_lines_get_type())
)
GType values.
var (
GTypeGutterRendererPixbuf = coreglib.Type(C.gtk_source_gutter_renderer_pixbuf_get_type())
)
GType values.
var (
GTypeGutterRendererText = coreglib.Type(C.gtk_source_gutter_renderer_text_get_type())
)
GType values.
var (
GTypeHover = coreglib.Type(C.gtk_source_hover_get_type())
)
GType values.
var (
GTypeHoverContext = coreglib.Type(C.gtk_source_hover_context_get_type())
)
GType values.
var (
GTypeHoverDisplay = coreglib.Type(C.gtk_source_hover_display_get_type())
)
GType values.
var (
GTypeHoverProvider = coreglib.Type(C.gtk_source_hover_provider_get_type())
)
GType values.
var (
GTypeIndenter = coreglib.Type(C.gtk_source_indenter_get_type())
)
GType values.
var (
GTypeLanguage = coreglib.Type(C.gtk_source_language_get_type())
)
GType values.
var (
GTypeLanguageManager = coreglib.Type(C.gtk_source_language_manager_get_type())
)
GType values.
var (
GTypeMap = coreglib.Type(C.gtk_source_map_get_type())
)
GType values.
var (
GTypeMark = coreglib.Type(C.gtk_source_mark_get_type())
)
GType values.
var (
GTypeMarkAttributes = coreglib.Type(C.gtk_source_mark_attributes_get_type())
)
GType values.
var (
GTypePrintCompositor = coreglib.Type(C.gtk_source_print_compositor_get_type())
)
GType values.
var (
GTypeRegion = coreglib.Type(C.gtk_source_region_get_type())
)
GType values.
var (
GTypeSearchContext = coreglib.Type(C.gtk_source_search_context_get_type())
)
GType values.
var (
GTypeSearchSettings = coreglib.Type(C.gtk_source_search_settings_get_type())
)
GType values.
var (
GTypeSnippet = coreglib.Type(C.gtk_source_snippet_get_type())
)
GType values.
var (
GTypeSnippetChunk = coreglib.Type(C.gtk_source_snippet_chunk_get_type())
)
GType values.
var (
GTypeSnippetContext = coreglib.Type(C.gtk_source_snippet_context_get_type())
)
GType values.
var (
GTypeSnippetManager = coreglib.Type(C.gtk_source_snippet_manager_get_type())
)
GType values.
var (
GTypeStyle = coreglib.Type(C.gtk_source_style_get_type())
)
GType values.
var (
GTypeStyleScheme = coreglib.Type(C.gtk_source_style_scheme_get_type())
)
GType values.
var (
GTypeStyleSchemeChooser = coreglib.Type(C.gtk_source_style_scheme_chooser_get_type())
)
GType values.
var (
GTypeStyleSchemeChooserButton = coreglib.Type(C.gtk_source_style_scheme_chooser_button_get_type())
)
GType values.
var (
GTypeStyleSchemeChooserWidget = coreglib.Type(C.gtk_source_style_scheme_chooser_widget_get_type())
)
GType values.
var (
GTypeStyleSchemeManager = coreglib.Type(C.gtk_source_style_scheme_manager_get_type())
)
GType values.
var (
GTypeStyleSchemePreview = coreglib.Type(C.gtk_source_style_scheme_preview_get_type())
)
GType values.
var (
GTypeTag = coreglib.Type(C.gtk_source_tag_get_type())
)
GType values.
var (
GTypeView = coreglib.Type(C.gtk_source_view_get_type())
)
GType values.
var (
GTypeVimIMContext = coreglib.Type(C.gtk_source_vim_im_context_get_type())
)
GType values.
Functions ¶
func CheckVersion ¶
CheckVersion: like GTK_SOURCE_CHECK_VERSION, but the check for gtk_source_check_version is at runtime instead of compile time. This is useful for compiling against older versions of GtkSourceView, but using features from newer versions.
The function takes the following parameters:
- major version to check.
- minor version to check.
- micro version to check.
The function returns the following values:
- ok: TRUE if the version of the GtkSourceView currently loaded is the same as or newer than the passed-in version.
func CompletionFuZZYHighlight ¶
CompletionFuZZYHighlight: this will add <b> tags around matched characters in haystack based on casefold_query.
The function takes the following parameters:
- haystack: string to be highlighted.
- casefoldQuery: typed-text used to highlight haystack.
The function returns the following values:
- attrList (optional) or NULL.
func CompletionFuZZYMatch ¶
CompletionFuZZYMatch: this helper function can do a fuzzy match for you giving a haystack and casefolded needle.
Casefold your needle using glib.UTF8Casefold() before running the query.
Score will be set with the score of the match upon success. Otherwise, it will be set to zero.
The function takes the following parameters:
- haystack (optional): string to be searched.
- casefoldNeedle: g_utf8_casefold() version of the needle.
The function returns the following values:
- priority (optional): optional location for the score of the match.
- ok: TRUE if haystack matched casefold_needle, otherwise FALSE.
func FileLoaderErrorQuark ¶
func FileLoaderErrorQuark() glib.Quark
The function returns the following values:
func FileSaverErrorQuark ¶
func FileSaverErrorQuark() glib.Quark
The function returns the following values:
func Finalize ¶
func Finalize()
Finalize: free the resources allocated by GtkSourceView. For example it unrefs the singleton objects.
It is not mandatory to call this function, it's just to be friendlier to memory debugging tools. This function is meant to be called at the end of main(). It can be called several times.
func GetMajorVersion ¶
func GetMajorVersion() uint
GetMajorVersion returns the major version number of the GtkSourceView library. (e.g. in GtkSourceView version 3.20.0 this is 3.)
This function is in the library, so it represents the GtkSourceView library your code is running against. Contrast with the K_SOURCE_MAJOR_VERSION macro, which represents the major version of the GtkSourceView headers you have included when compiling your code.
The function returns the following values:
- guint: major version number of the GtkSourceView library.
func GetMicroVersion ¶
func GetMicroVersion() uint
GetMicroVersion returns the micro version number of the GtkSourceView library. (e.g. in GtkSourceView version 3.20.0 this is 0.)
This function is in the library, so it represents the GtkSourceView library your code is running against. Contrast with the K_SOURCE_MICRO_VERSION macro, which represents the micro version of the GtkSourceView headers you have included when compiling your code.
The function returns the following values:
- guint: micro version number of the GtkSourceView library.
func GetMinorVersion ¶
func GetMinorVersion() uint
GetMinorVersion returns the minor version number of the GtkSourceView library. (e.g. in GtkSourceView version 3.20.0 this is 20.)
This function is in the library, so it represents the GtkSourceView library your code is running against. Contrast with the K_SOURCE_MINOR_VERSION macro, which represents the minor version of the GtkSourceView headers you have included when compiling your code.
The function returns the following values:
- guint: minor version number of the GtkSourceView library.
func Init ¶
func Init()
Init initializes the GtkSourceView library (e.g. for the internationalization).
This function can be called several times, but is meant to be called at the beginning of main(), before any other GtkSourceView function call.
func SchedulerAdd ¶
func SchedulerAdd(callback SchedulerCallback) uint
SchedulerAdd: simplified version of scheduler_add_full.
The function takes the following parameters:
- callback to execute.
The function returns the following values:
func SchedulerAddFull ¶
func SchedulerAddFull(callback SchedulerCallback) uint
SchedulerAddFull adds a new callback that will be executed as time permits on the main thread.
This is useful when you need to do a lot of background work but want to do it incrementally.
callback will be provided a deadline that it should complete it's work by (or near) and can be checked using glib.GetMonotonicTime() for comparison.
Use scheduler_remove to remove the handler.
The function takes the following parameters:
- callback to execute.
The function returns the following values:
func SchedulerRemove ¶
func SchedulerRemove(handlerId uint)
SchedulerRemove removes a scheduler callback previously registered with scheduler_add or scheduler_add_full.
The function takes the following parameters:
- handlerId: handler id.
func UtilsEscapeSearchText ¶
UtilsEscapeSearchText: use this function to escape the following characters: \n, \r, \t and \.
For a regular expression search, use g_regex_escape_string() instead.
One possible use case is to take the TextBuffer's selection and put it in a search entry. The selection can contain tabulations, newlines, etc. So it's better to escape those special characters to better fit in the search entry.
See also: utils_unescape_search_text.
<warning> Warning: the escape and unescape functions are not reciprocal! For example, escape (unescape (\)) = \\. So avoid cycles such as: search entry -> unescape -> search settings -> escape -> search entry. The original search entry text may be modified. </warning>.
The function takes the following parameters:
- text to escape.
The function returns the following values:
- utf8: escaped text.
func UtilsUnescapeSearchText ¶
UtilsUnescapeSearchText: use this function before searchsettings.SetSearchText, to unescape the following sequences of characters: \n, \r, \t and \\. The purpose is to easily write those characters in a search entry.
Note that unescaping the search text is not needed for regular expression searches.
See also: utils_escape_search_text.
The function takes the following parameters:
- text to unescape.
The function returns the following values:
- utf8: unescaped text.
Types ¶
type BackgroundPatternType ¶
const ( // SourceBackgroundPatternTypeNone: no pattern. SourceBackgroundPatternTypeNone BackgroundPatternType = iota // SourceBackgroundPatternTypeGrid: grid pattern. SourceBackgroundPatternTypeGrid )
func (BackgroundPatternType) String ¶
func (b BackgroundPatternType) String() string
String returns the name in string for BackgroundPatternType.
type BracketMatchType ¶
const ( // SourceBracketMatchNone: there is no bracket to match. SourceBracketMatchNone BracketMatchType = iota // SourceBracketMatchOutOfRange: matching a bracket failed because the // maximum range was reached. SourceBracketMatchOutOfRange // SourceBracketMatchNotFound: matching bracket was not found. SourceBracketMatchNotFound // SourceBracketMatchFound: matching bracket was found. SourceBracketMatchFound )
func (BracketMatchType) String ¶
func (b BracketMatchType) String() string
String returns the name in string for BracketMatchType.
type Buffer ¶
type Buffer struct { gtk.TextBuffer // contains filtered or unexported fields }
Buffer subclass of gtk.TextBuffer.
A GtkSourceBuffer object is the model for view widgets. It extends the gtk.TextBuffer class by adding features useful to display and edit source code such as syntax highlighting and bracket matching.
To create a GtkSourceBuffer use gtksource.Buffer.New or gtksource.Buffer.NewWithLanguage. The second form is just a convenience function which allows you to initially set a language. You can also directly create a view and get its buffer with gtk.TextView.GetBuffer().
The highlighting is enabled by default, but you can disable it with buffer.SetHighlightSyntax.
Context Classes:
It is possible to retrieve some information from the syntax highlighting engine. The default context classes that are applied to regions of a GtkSourceBuffer:
- **comment**: the region delimits a comment;
- **no-spell-check**: the region should not be spell checked;
- **path**: the region delimits a path to a file;
- **string**: the region delimits a string.
Custom language definition files can create their own context classes, since the functions like buffer.IterHasContextClass take a string parameter as the context class.
GtkSourceBuffer provides an API to access the context classes: buffer.IterHasContextClass, buffer.GetContextClassesAtIter, buffer.IterForwardToContextClassToggle and buffer.IterBackwardToContextClassToggle.
And the gtksource.Buffer::highlight-updated signal permits to be notified when a context class region changes.
Each context class has also an associated gtk.TextTag with the name gtksourceview:context-classes:<name>. For example to retrieve the gtk.TextTag for the string context class, one can write:
GtkTextTagTable *tag_table; GtkTextTag *tag; tag_table = gtk_text_buffer_get_tag_table (buffer); tag = gtk_text_tag_table_lookup (tag_table, "gtksourceview:context-classes:string");
The tag must be used for read-only purposes.
Accessing a context class via the associated gtk.TextTag is less convenient than the GtkSourceBuffer API, because:
- The tag doesn't always exist, you need to listen to the gtk.TextTagTable::tag-added and gtk.TextTagTable::tag-removed signals.
- Instead of the gtksource.Buffer::highlight-updated signal, you can listen to the gtk.TextBuffer::apply-tag and gtk.TextBuffer::remove-tag signals.
A possible use-case for accessing a context class via the associated gtk.TextTag is to read the region but without adding a hard dependency on the GtkSourceView library (for example for a spell-checking library that wants to read the no-spell-check region).
func NewBuffer ¶
func NewBuffer(table *gtk.TextTagTable) *Buffer
NewBuffer creates a new source buffer.
The function takes the following parameters:
- table (optional) or NULL to create a new one.
The function returns the following values:
- buffer: new source buffer.
func NewBufferWithLanguage ¶
NewBufferWithLanguage creates a new source buffer using the highlighting patterns in language.
This is equivalent to creating a new source buffer with a new tag table and then calling buffer.SetLanguage.
The function takes the following parameters:
- language: SourceLanguage.
The function returns the following values:
- buffer: new source buffer which will highlight text according to the highlighting patterns in language.
func (*Buffer) ChangeCase ¶
func (buffer *Buffer) ChangeCase(caseType ChangeCaseType, start, end *gtk.TextIter)
ChangeCase changes the case of the text between the specified iterators.
Since 5.4, this function will update the position of start and end to surround the modified text.
The function takes the following parameters:
- caseType: how to change the case.
- start: TextIter.
- end: TextIter.
func (*Buffer) ConnectBracketMatched ¶
func (buffer *Buffer) ConnectBracketMatched(f func(iter *gtk.TextIter, state BracketMatchType)) coreglib.SignalHandle
ConnectBracketMatched: iter is set to a valid iterator pointing to the matching bracket if state is GTK_SOURCE_BRACKET_MATCH_FOUND. Otherwise iter is meaningless.
The signal is emitted only when the state changes, typically when the cursor moves.
A use-case for this signal is to show messages in a gtk.Statusbar.
func (*Buffer) ConnectCursorMoved ¶
func (buffer *Buffer) ConnectCursorMoved(f func()) coreglib.SignalHandle
ConnectCursorMoved: "cursor-moved" signal is emitted when then insertion mark has moved.
func (*Buffer) ConnectHighlightUpdated ¶
func (buffer *Buffer) ConnectHighlightUpdated(f func(start, end *gtk.TextIter)) coreglib.SignalHandle
ConnectHighlightUpdated signal is emitted when the syntax highlighting and context classes (./class.Buffer.html#context-classes) are updated in a certain region of the buffer.
func (*Buffer) ConnectSourceMarkUpdated ¶
func (buffer *Buffer) ConnectSourceMarkUpdated(f func(mark *gtk.TextMark)) coreglib.SignalHandle
ConnectSourceMarkUpdated signal is emitted each time a mark is added to, moved or removed from the buffer.
func (*Buffer) ContextClassesAtIter ¶
ContextClassesAtIter: get all defined context classes at iter.
See the buffer description for the list of default context classes.
The function takes the following parameters:
- iter: TextIter.
The function returns the following values:
- utf8s: new NULL terminated array of context class names. Use g_strfreev() to free the array if it is no longer needed.
func (*Buffer) CreateSourceMark ¶
CreateSourceMark creates a source mark in the buffer of category category.
A source mark is a gtk.TextMark but organized into categories. Depending on the category a pixbuf can be specified that will be displayed along the line of the mark.
Like a gtk.TextMark, a mark can be anonymous if the passed name is NULL. Also, the buffer owns the marks so you shouldn't unreference it.
Marks always have left gravity and are moved to the beginning of the line when the user deletes the line they were in.
Typical uses for a source mark are bookmarks, breakpoints, current executing instruction indication in a source file, etc..
The function takes the following parameters:
- name (optional) of the mark, or NULL.
- category: string defining the mark category.
- where: location to place the mark.
The function returns the following values:
- mark: new mark, owned by the buffer.
func (*Buffer) EnsureHighlight ¶
func (buffer *Buffer) EnsureHighlight(start, end *gtk.TextIter)
EnsureHighlight forces buffer to analyze and highlight the given area synchronously.
**Note**:
This is a potentially slow operation and should be used only when you need to make sure that some text not currently visible is highlighted, for instance before printing.
The function takes the following parameters:
- start of the area to highlight.
- end of the area to highlight.
func (*Buffer) HighlightMatchingBrackets ¶
HighlightMatchingBrackets determines whether bracket match highlighting is activated for the source buffer.
The function returns the following values:
- ok: TRUE if the source buffer will highlight matching brackets.
func (*Buffer) HighlightSyntax ¶
HighlightSyntax determines whether syntax highlighting is activated in the source buffer.
The function returns the following values:
- ok: TRUE if syntax highlighting is enabled, FALSE otherwise.
func (*Buffer) ImplicitTrailingNewline ¶
The function returns the following values:
- ok: whether the buffer has an implicit trailing newline.
func (*Buffer) IterHasContextClass ¶
IterHasContextClass: check if the class context_class is set on iter.
See the buffer description for the list of default context classes.
The function takes the following parameters:
- iter: TextIter.
- contextClass class to search for.
The function returns the following values:
- ok: whether iter has the context class.
func (*Buffer) JoinLines ¶
func (buffer *Buffer) JoinLines(start, end *gtk.TextIter)
JoinLines joins the lines of text between the specified iterators.
The function takes the following parameters:
- start: TextIter.
- end: TextIter.
func (*Buffer) Language ¶
Language returns the language associated with the buffer, see buffer.SetLanguage.
The returned object should not be unreferenced by the user.
The function returns the following values:
- language (optional): language associated with the buffer, or NULL.
func (*Buffer) RemoveSourceMarks ¶
RemoveSourceMarks: remove all marks of category between start and end from the buffer.
If category is NULL, all marks in the range will be removed.
The function takes the following parameters:
- start: TextIter.
- end: TextIter.
- category (optional) to search for, or NULL.
func (*Buffer) SetHighlightMatchingBrackets ¶
SetHighlightMatchingBrackets controls the bracket match highlighting function in the buffer.
If activated, when you position your cursor over a bracket character (a parenthesis, a square bracket, etc.) the matching opening or closing bracket character will be highlighted.
The function takes the following parameters:
- highlight: TRUE if you want matching brackets highlighted.
func (*Buffer) SetHighlightSyntax ¶
SetHighlightSyntax controls whether syntax is highlighted in the buffer.
If highlight is TRUE, the text will be highlighted according to the syntax patterns specified in the language set with buffer.SetLanguage.
If highlight is FALSE, syntax highlighting is disabled and all the gtk.TextTag objects that have been added by the syntax highlighting engine are removed from the buffer.
The function takes the following parameters:
- highlight: TRUE to enable syntax highlighting, FALSE to disable it.
func (*Buffer) SetImplicitTrailingNewline ¶
SetImplicitTrailingNewline sets whether the buffer has an implicit trailing newline.
If an explicit trailing newline is present in a gtk.TextBuffer, gtk.TextView shows it as an empty line. This is generally not what the user expects.
If implicit_trailing_newline is TRUE (the default value): - when a fileloader loads the content of a file into the buffer, the trailing newline (if present in the file) is not inserted into the buffer. - when a filesaver saves the content of the buffer into a file, a trailing newline is added to the file.
On the other hand, if implicit_trailing_newline is FALSE, the file's content is not modified when loaded into the buffer, and the buffer's content is not modified when saved into a file.
The function takes the following parameters:
- implicitTrailingNewline: new value.
func (*Buffer) SetLanguage ¶
SetLanguage associates a language with the buffer.
Note that a language affects not only the syntax highlighting, but also the context classes (./class.Buffer.html#context-classes). If you want to disable just the syntax highlighting, see buffer.SetHighlightSyntax.
The buffer holds a reference to language.
The function takes the following parameters:
- language (optional) to set, or NULL.
func (*Buffer) SetStyleScheme ¶
func (buffer *Buffer) SetStyleScheme(scheme *StyleScheme)
SetStyleScheme sets a stylescheme to be used by the buffer and the view.
Note that a stylescheme affects not only the syntax highlighting, but also other view features such as highlighting the current line, matching brackets, the line numbers, etc.
Instead of setting a NULL scheme, it is better to disable syntax highlighting with buffer.SetHighlightSyntax, and setting the stylescheme with the "classic" or "tango" ID, because those two style schemes follow more closely the GTK theme (for example for the background color).
The buffer holds a reference to scheme.
The function takes the following parameters:
- scheme (optional) or NULL.
func (*Buffer) SortLines ¶
SortLines: sort the lines of text between the specified iterators.
The function takes the following parameters:
- start: TextIter.
- end: TextIter.
- flags specifying how the sort should behave.
- column: sort considering the text starting at the given column.
func (*Buffer) SourceMarksAtIter ¶
SourceMarksAtIter returns the list of marks of the given category at iter.
If category is NULL it returns all marks at iter.
The function takes the following parameters:
- iter: iterator.
- category (optional) to search for, or NULL.
The function returns the following values:
- sList: a newly allocated List.
func (*Buffer) SourceMarksAtLine ¶
SourceMarksAtLine returns the list of marks of the given category at line.
If category is NULL, all marks at line are returned.
The function takes the following parameters:
- line number.
- category (optional) to search for, or NULL.
The function returns the following values:
- sList: a newly allocated List.
func (*Buffer) StyleScheme ¶
func (buffer *Buffer) StyleScheme() *StyleScheme
StyleScheme returns the stylescheme associated with the buffer, see buffer.SetStyleScheme.
The returned object should not be unreferenced by the user.
The function returns the following values:
- styleScheme (optional): stylescheme associated with the buffer, or NULL.
type BufferClass ¶
type BufferClass struct {
// contains filtered or unexported fields
}
BufferClass: instance of this type is always passed by reference.
func (*BufferClass) ParentClass ¶
func (b *BufferClass) ParentClass() *gtk.TextBufferClass
type BufferOverrides ¶
type BufferOverrides struct { // The function takes the following parameters: // // - iter // - state // BracketMatched func(iter *gtk.TextIter, state BracketMatchType) }
BufferOverrides contains methods that are overridable.
type ChangeCaseType ¶
const ( // SourceChangeCaseLower: change case to lowercase. SourceChangeCaseLower ChangeCaseType = iota // SourceChangeCaseUpper: change case to uppercase. SourceChangeCaseUpper // SourceChangeCaseToggle: toggle case of each character. SourceChangeCaseToggle // SourceChangeCaseTitle: capitalize each word. SourceChangeCaseTitle )
func (ChangeCaseType) String ¶
func (c ChangeCaseType) String() string
String returns the name in string for ChangeCaseType.
type Completion ¶
Completion: main Completion Object.
The completion system helps the user when they writes some text, such as words, command names, functions, and suchlike. Proposals can be shown, to complete the text the user is writing. Each proposal can contain an additional piece of information (for example documentation), that is displayed when the "Details" button is clicked.
Proposals are created via a completionprovider. There can be for example a provider to complete words (see completionwords), another provider for the completion of function names, etc. To add a provider, call completion.AddProvider.
When several providers match, they are all shown in the completion window, but one can switch between providers: see the SourceCompletion::move-page signal. It is also possible to activate the first proposals with key bindings, see the SourceCompletion:accelerators property.
The completionproposal interface represents a proposal.
If a proposal contains extra information (see GTK_SOURCE_COMPLETION_COLUMN_DETAILS), it will be displayed in a supplemental details window, which appears when the "Details" button is clicked.
Each view object is associated with a completion instance. This instance can be obtained with view.GetCompletion. The view class contains also the view::show-completion signal.
A same completionprovider object can be used for several GtkSourceCompletion's.
func (*Completion) AddProvider ¶
func (self *Completion) AddProvider(provider CompletionProviderer)
AddProvider adds a completionprovider to the list of providers to be queried for completion results.
The function takes the following parameters:
- provider: SourceCompletionProvider.
func (*Completion) BlockInteractive ¶
func (self *Completion) BlockInteractive()
func (*Completion) Buffer ¶
func (self *Completion) Buffer() *Buffer
Buffer gets the connected view's buffer.
The function returns the following values:
- buffer: SourceBuffer.
func (*Completion) ConnectHide ¶
func (self *Completion) ConnectHide(f func()) coreglib.SignalHandle
ConnectHide: "hide" signal is emitted when the completion window should be hidden.
func (*Completion) ConnectProviderAdded ¶
func (self *Completion) ConnectProviderAdded(f func(provider CompletionProviderer)) coreglib.SignalHandle
ConnectProviderAdded: "provided-added" signal is emitted when a new provider is added to the completion.
func (*Completion) ConnectProviderRemoved ¶
func (self *Completion) ConnectProviderRemoved(f func(provider CompletionProviderer)) coreglib.SignalHandle
ConnectProviderRemoved: "provided-removed" signal is emitted when a provider has been removed from the completion.
func (*Completion) ConnectShow ¶
func (self *Completion) ConnectShow(f func()) coreglib.SignalHandle
ConnectShow: "show" signal is emitted when the completion window should be shown.
func (*Completion) Hide ¶
func (self *Completion) Hide()
Hide emits the "hide" signal.
When the "hide" signal is emitted, the completion window will be dismissed.
func (*Completion) PageSize ¶
func (self *Completion) PageSize() uint
The function returns the following values:
func (*Completion) RemoveProvider ¶
func (self *Completion) RemoveProvider(provider CompletionProviderer)
RemoveProvider removes a completionprovider previously added with completion.AddProvider.
The function takes the following parameters:
- provider: SourceCompletionProvider.
func (*Completion) SetPageSize ¶
func (self *Completion) SetPageSize(pageSize uint)
The function takes the following parameters:
func (*Completion) Show ¶
func (self *Completion) Show()
Show emits the "show" signal.
When the "show" signal is emitted, the completion window will be displayed if there are any results available.
func (*Completion) UnblockInteractive ¶
func (self *Completion) UnblockInteractive()
func (*Completion) View ¶
func (self *Completion) View() *View
View gets the view that owns the completion.
The function returns the following values:
- view: SourceView.
type CompletionActivation ¶
const ( SourceCompletionActivationNone CompletionActivation = iota SourceCompletionActivationInteractive SourceCompletionActivationUserRequested )
func (CompletionActivation) String ¶
func (c CompletionActivation) String() string
String returns the name in string for CompletionActivation.
type CompletionCell ¶
type CompletionCell struct { gtk.Widget // contains filtered or unexported fields }
CompletionCell: widget for single cell of completion proposal.
The GtkSourceCompletionCell widget provides a container to display various types of information with the completion display.
Each proposal may consist of multiple cells depending on the complexity of the proposal. For example, programming language proposals may contain a cell for the "left-hand-side" of an operation along with the "typed-text" for a function name and "parameters". They may also optionally set an icon to signify the kind of result.
A completionprovider should implement the completionprovider.Display virtual function to control how to convert data from their completionproposal to content for the GtkSourceCompletionCell.
func (*CompletionCell) Column ¶
func (self *CompletionCell) Column() CompletionColumn
The function returns the following values:
func (*CompletionCell) GetWidget ¶
func (self *CompletionCell) GetWidget() gtk.Widgetter
GetWidget gets the child Widget, if any.
The function returns the following values:
- widget (optional) or NULL.
func (*CompletionCell) SetGIcon ¶
func (self *CompletionCell) SetGIcon(gicon gio.Iconner)
The function takes the following parameters:
func (*CompletionCell) SetIconName ¶
func (self *CompletionCell) SetIconName(iconName string)
The function takes the following parameters:
func (*CompletionCell) SetMarkup ¶
func (self *CompletionCell) SetMarkup(markup string)
The function takes the following parameters:
func (*CompletionCell) SetPaintable ¶
func (self *CompletionCell) SetPaintable(paintable gdk.Paintabler)
The function takes the following parameters:
func (*CompletionCell) SetText ¶
func (self *CompletionCell) SetText(text string)
SetText sets the text for the column cell. Use NULL to unset.
The function takes the following parameters:
- text (optional) to set or NULL.
func (*CompletionCell) SetTextWithAttributes ¶
func (self *CompletionCell) SetTextWithAttributes(text string, attrs *pango.AttrList)
The function takes the following parameters:
- text
- attrs
func (*CompletionCell) SetWidget ¶
func (self *CompletionCell) SetWidget(child gtk.Widgetter)
The function takes the following parameters:
type CompletionCellClass ¶
type CompletionCellClass struct {
// contains filtered or unexported fields
}
CompletionCellClass: instance of this type is always passed by reference.
func (*CompletionCellClass) ParentClass ¶
func (c *CompletionCellClass) ParentClass() *gtk.WidgetClass
type CompletionCellOverrides ¶
type CompletionCellOverrides struct { }
CompletionCellOverrides contains methods that are overridable.
type CompletionClass ¶
type CompletionClass struct {
// contains filtered or unexported fields
}
CompletionClass: instance of this type is always passed by reference.
type CompletionColumn ¶
const ( SourceCompletionColumnIcon CompletionColumn = iota SourceCompletionColumnBefore SourceCompletionColumnTypedText SourceCompletionColumnAfter SourceCompletionColumnComment SourceCompletionColumnDetails )
func (CompletionColumn) String ¶
func (c CompletionColumn) String() string
String returns the name in string for CompletionColumn.
type CompletionContext ¶
type CompletionContext struct { *coreglib.Object gio.ListModel // contains filtered or unexported fields }
CompletionContext: context of a completion.
GtkSourceCompletionContext contains information about an attept to display completion proposals to the user based on typed text in the view.
When typing, completion may use registered completionprovider to determine if there may be results which could be displayed. If so, a GtkSourceCompletionContext is created with information that is provided to the completionprovider to populate results which might be useful to the user.
completionprovider are expected to provide gio.ListModel with completionproposal which may be joined together in a list of results for the user. They are also responsible for how the contents are displayed using completioncell which allows for some level of customization.
func (*CompletionContext) Activation ¶
func (self *CompletionContext) Activation() CompletionActivation
Activation gets the mode for which the context was activated.
The function returns the following values:
func (*CompletionContext) Bounds ¶
func (self *CompletionContext) Bounds() (begin, end *gtk.TextIter, ok bool)
Bounds gets the bounds for the completion, which is the beginning of the current word (taking break characters into account) to the current insertion cursor.
If begin is non-NULL, it will be set to the start position of the current word being completed.
If end is non-NULL, it will be set to the insertion cursor for the current word being completed.
The function returns the following values:
- begin (optional): TextIter.
- end (optional): TextIter.
- ok: TRUE if the marks are still valid and begin or end was set.
func (*CompletionContext) Buffer ¶
func (self *CompletionContext) Buffer() *Buffer
Buffer gets the underlying buffer used by the context.
This is a convenience function to get the buffer via the SourceCompletion property.
The function returns the following values:
- buffer (optional) or NULL.
func (*CompletionContext) Busy ¶
func (self *CompletionContext) Busy() bool
Busy gets the "busy" property. This is set to TRUE while the completion context is actively fetching proposals from registered SourceCompletionProvider's.
The function returns the following values:
- ok: TRUE if the context is busy.
func (*CompletionContext) Completion ¶
func (self *CompletionContext) Completion() *Completion
Completion gets the SourceCompletion that created the context.
The function returns the following values:
- completion (optional) or NULL.
func (*CompletionContext) ConnectProviderModelChanged ¶
func (self *CompletionContext) ConnectProviderModelChanged(f func(provider CompletionProviderer, model gio.ListModeller)) coreglib.SignalHandle
ConnectProviderModelChanged is emitted when a provider changes a model.
This signal is primarily useful for SourceCompletionProvider's that want to track other providers in context. For example, it can be used to create a "top results" provider.
func (*CompletionContext) Empty ¶
func (self *CompletionContext) Empty() bool
Empty checks if any proposals have been provided to the context.
Out of convenience, this function will return TRUE if self is NULL.
The function returns the following values:
- ok: TRUE if there are no proposals in the context.
func (*CompletionContext) Language ¶
func (self *CompletionContext) Language() *Language
Language gets the language of the underlying buffer, if any.
The function returns the following values:
- language (optional) or NULL.
func (*CompletionContext) ListProviders ¶
func (self *CompletionContext) ListProviders() *gio.ListModel
ListProviders gets the providers that are associated with the context.
The function returns the following values:
- listModel of SourceCompletionProvider.
func (*CompletionContext) ProposalsForProvider ¶
func (self *CompletionContext) ProposalsForProvider(provider CompletionProviderer) *gio.ListModel
ProposalsForProvider gets the Model associated with the provider.
You can connect to SourceCompletionContext::model-changed to receive notifications about when the model has been replaced by a new model.
The function takes the following parameters:
- provider: SourceCompletionProvider.
The function returns the following values:
- listModel (optional) or NULL.
func (*CompletionContext) SetProposalsForProvider ¶
func (self *CompletionContext) SetProposalsForProvider(provider CompletionProviderer, results gio.ListModeller)
SetProposalsForProvider: this function allows providers to update their results for a context outside of a call to completionprovider.PopulateAsync.
This can be used to immediately return results for a provider while it does additional asynchronous work. Doing so will allow the completions to update while the operation is in progress.
The function takes the following parameters:
- provider: SourceCompletionProvider.
- results (optional) or NULL.
func (*CompletionContext) View ¶
func (self *CompletionContext) View() *View
View gets the text view for the context.
The function returns the following values:
- view (optional) or NULL.
func (*CompletionContext) Word ¶
func (self *CompletionContext) Word() string
Word gets the word that is being completed up to the position of the insert mark.
The function returns the following values:
- utf8: string containing the current word.
type CompletionContextClass ¶
type CompletionContextClass struct {
// contains filtered or unexported fields
}
CompletionContextClass: instance of this type is always passed by reference.
type CompletionContextOverrides ¶
type CompletionContextOverrides struct { }
CompletionContextOverrides contains methods that are overridable.
type CompletionOverrides ¶
type CompletionOverrides struct { }
CompletionOverrides contains methods that are overridable.
type CompletionProposal ¶
CompletionProposal: interface for completion proposals.
This interface is used to denote that an object is capable of being a completion proposal for completion.
Currently, no method or functions are required but additional methods may be added in the future. Proposals created by SourceCompletionProvider can use gobject.IMPLEMENTINTERFACE() to implement this with NULL for the interface init function.
CompletionProposal wraps an interface. This means the user can get the underlying type by calling Cast().
func (*CompletionProposal) TypedText ¶
func (proposal *CompletionProposal) TypedText() string
TypedText gets the typed-text for the proposal, if supported by the implementation.
Implementing this virtual-function is optional, but can be useful to allow external tooling to compare results.
The function returns the following values:
- utf8 (optional): newly allocated string, or NULL.
type CompletionProposalInterface ¶
type CompletionProposalInterface struct {
// contains filtered or unexported fields
}
CompletionProposalInterface: instance of this type is always passed by reference.
type CompletionProposaller ¶
type CompletionProposaller interface { coreglib.Objector // TypedText gets the typed-text for the proposal, if supported by the // implementation. TypedText() string }
CompletionProposaller describes CompletionProposal's interface methods.
type CompletionProvider ¶
CompletionProvider: completion provider interface.
You must implement this interface to provide proposals to completion.
In most cases, implementations of this interface will want to use completionprovider.PopulateAsync to asynchronously populate the results to avoid blocking the main loop.
CompletionProvider wraps an interface. This means the user can get the underlying type by calling Cast().
func (*CompletionProvider) Activate ¶
func (self *CompletionProvider) Activate(context *CompletionContext, proposal CompletionProposaller)
Activate: this function requests proposal to be activated by the SourceCompletionProvider.
What the provider does to activate the proposal is specific to that provider. Many providers may choose to insert a SourceSnippet with edit points the user may cycle through.
See also: snippet, snippetchunk, view.PushSnippet.
The function takes the following parameters:
- context: SourceCompletionContext.
- proposal: SourceCompletionProposal.
func (*CompletionProvider) Display ¶
func (self *CompletionProvider) Display(context *CompletionContext, proposal CompletionProposaller, cell *CompletionCell)
Display: this function requests that the SourceCompletionProvider prepares cell to display the contents of proposal.
Based on cells column type, you may want to display different information.
This allows for columns of information among completion proposals resulting in better alignment of similar content (icons, return types, method names, and parameter lists).
The function takes the following parameters:
- context: SourceCompletionContext.
- proposal: SourceCompletionProposal.
- cell: SourceCompletionCell.
func (*CompletionProvider) IsTrigger ¶
func (self *CompletionProvider) IsTrigger(iter *gtk.TextIter, ch uint32) bool
IsTrigger: this function is used to determine if a character inserted into the text editor should cause a new completion request to be triggered.
An example would be period '.' which might indicate that the user wants to complete method or field names of an object.
This method will only trigger when text is inserted into the TextBuffer while the completion list is visible and a proposal is selected. Incremental key-presses (like shift, control, or alt) are not triggerable.
The function takes the following parameters:
- iter: TextIter.
- ch of the character inserted.
The function returns the following values:
func (*CompletionProvider) KeyActivates ¶
func (self *CompletionProvider) KeyActivates(context *CompletionContext, proposal CompletionProposaller, keyval uint, state gdk.ModifierType) bool
KeyActivates: this function is used to determine if a key typed by the user should activate proposal (resulting in committing the text to the editor).
This is useful when using languages where convention may lead to less typing by the user. One example may be the use of "." or "-" to expand a field access in the C programming language.
The function takes the following parameters:
- context: SourceCompletionContext.
- proposal: SourceCompletionProposal.
- keyval such as gdk.KEYPeriod.
- state or 0.
The function returns the following values:
func (*CompletionProvider) PopulateFinish ¶
func (self *CompletionProvider) PopulateFinish(result gio.AsyncResulter) (*gio.ListModel, error)
PopulateFinish completes an asynchronous operation to populate a completion provider.
The function takes the following parameters:
- result provided to callback.
The function returns the following values:
- listModel of SourceCompletionProposal.
func (*CompletionProvider) Priority ¶
func (self *CompletionProvider) Priority(context *CompletionContext) int
Priority: this function should return the priority of self in context.
The priority is used to sort groups of completion proposals by provider so that higher priority providers results are shown above lower priority providers.
Higher value indicates higher priority.
The function takes the following parameters:
- context: SourceCompletionContext.
The function returns the following values:
func (*CompletionProvider) Refilter ¶
func (self *CompletionProvider) Refilter(context *CompletionContext, model gio.ListModeller)
Refilter: this function can be used to filter results previously provided to the completioncontext by the SourceCompletionProvider.
This can happen as the user types additional text onto the word so that previously matched items may be removed from the list instead of generating new gio.ListModel of results.
The function takes the following parameters:
- context: SourceCompletionContext.
- model: Model.
func (*CompletionProvider) Title ¶
func (self *CompletionProvider) Title() string
Title gets the title of the completion provider, if any.
Currently, titles are not displayed in the completion results, but may be at some point in the future when non-NULL.
The function returns the following values:
- utf8 (optional): title for the provider or NULL.
type CompletionProviderInterface ¶
type CompletionProviderInterface struct {
// contains filtered or unexported fields
}
CompletionProviderInterface: instance of this type is always passed by reference.
type CompletionProviderer ¶
type CompletionProviderer interface { coreglib.Objector // Activate: this function requests proposal to be activated by the // SourceCompletionProvider. Activate(context *CompletionContext, proposal CompletionProposaller) // Display: this function requests that the SourceCompletionProvider // prepares cell to display the contents of proposal. Display(context *CompletionContext, proposal CompletionProposaller, cell *CompletionCell) // Priority: this function should return the priority of self in context. Priority(context *CompletionContext) int // Title gets the title of the completion provider, if any. Title() string // IsTrigger: this function is used to determine if a character inserted // into the text editor should cause a new completion request to be // triggered. IsTrigger(iter *gtk.TextIter, ch uint32) bool // KeyActivates: this function is used to determine if a key typed by the // user should activate proposal (resulting in committing the text to the // editor). KeyActivates(context *CompletionContext, proposal CompletionProposaller, keyval uint, state gdk.ModifierType) bool // PopulateFinish completes an asynchronous operation to populate a // completion provider. PopulateFinish(result gio.AsyncResulter) (*gio.ListModel, error) // Refilter: this function can be used to filter results previously provided // to the completioncontext by the SourceCompletionProvider. Refilter(context *CompletionContext, model gio.ListModeller) }
CompletionProviderer describes CompletionProvider's interface methods.
type CompletionSnippets ¶
type CompletionSnippets struct { *coreglib.Object CompletionProvider // contains filtered or unexported fields }
CompletionSnippets: completionprovider for the completion of snippets.
The GtkSourceCompletionSnippets is an example of an implementation of the completionprovider interface. The proposals are snippets registered with the snippetmanager.
func NewCompletionSnippets ¶
func NewCompletionSnippets() *CompletionSnippets
The function returns the following values:
type CompletionSnippetsClass ¶
type CompletionSnippetsClass struct {
// contains filtered or unexported fields
}
CompletionSnippetsClass: instance of this type is always passed by reference.
type CompletionSnippetsOverrides ¶
type CompletionSnippetsOverrides struct { }
CompletionSnippetsOverrides contains methods that are overridable.
type CompletionWords ¶
type CompletionWords struct { *coreglib.Object CompletionProvider // contains filtered or unexported fields }
CompletionWords: completionprovider for the completion of words.
The GtkSourceCompletionWords is an example of an implementation of the completionprovider interface. The proposals are words appearing in the registered gtk.TextBuffers.
func NewCompletionWords ¶
func NewCompletionWords(title string) *CompletionWords
The function takes the following parameters:
- title (optional) for the provider, or NULL.
The function returns the following values:
- completionWords: new SourceCompletionWords provider.
func (*CompletionWords) Register ¶
func (words *CompletionWords) Register(buffer *gtk.TextBuffer)
Register registers buffer in the words provider.
The function takes the following parameters:
- buffer: TextBuffer.
func (*CompletionWords) Unregister ¶
func (words *CompletionWords) Unregister(buffer *gtk.TextBuffer)
Unregister unregisters buffer from the words provider.
The function takes the following parameters:
- buffer: TextBuffer.
type CompletionWordsClass ¶
type CompletionWordsClass struct {
// contains filtered or unexported fields
}
CompletionWordsClass: instance of this type is always passed by reference.
type CompletionWordsOverrides ¶
type CompletionWordsOverrides struct { }
CompletionWordsOverrides contains methods that are overridable.
type CompressionType ¶
const ( // SourceCompressionTypeNone: plain text. SourceCompressionTypeNone CompressionType = iota // SourceCompressionTypeGzip: gzip compression. SourceCompressionTypeGzip )
func (CompressionType) String ¶
func (c CompressionType) String() string
String returns the name in string for CompressionType.
type Encoding ¶
type Encoding struct {
// contains filtered or unexported fields
}
Encoding: character encoding.
The SourceEncoding boxed type represents a character encoding. It is used for example by SourceFile. Note that the text in GTK widgets is always encoded in UTF-8.
An instance of this type is always passed by reference.
func EncodingGetAll ¶
func EncodingGetAll() []*Encoding
EncodingGetAll gets all encodings.
The function returns the following values:
- sList: list of all SourceEncoding's. Free with g_slist_free().
func EncodingGetCurrent ¶
func EncodingGetCurrent() *Encoding
EncodingGetCurrent gets the SourceEncoding for the current locale.
See also glib.GetCharset().
The function returns the following values:
- encoding: current locale encoding.
func EncodingGetDefaultCandidates ¶
func EncodingGetDefaultCandidates() []*Encoding
EncodingGetDefaultCandidates gets the list of default candidate encodings to try when loading a file.
See fileloader.SetCandidateEncodings.
This function returns a different list depending on the current locale (i.e. language, country and default encoding). The UTF-8 encoding and the current locale encoding are guaranteed to be present in the returned list.
The function returns the following values:
- sList: list of default candidate encodings. Free with g_slist_free().
func EncodingGetFromCharset ¶
EncodingGetFromCharset gets a SourceEncoding from a character set such as "UTF-8" or "ISO-8859-1".
The function takes the following parameters:
- charset: character set.
The function returns the following values:
- encoding (optional): corresponding SourceEncoding, or NULL if not found.
func EncodingGetUTF8 ¶
func EncodingGetUTF8() *Encoding
The function returns the following values:
- encoding: UTF-8 encoding.
func (*Encoding) Charset ¶
Charset gets the character set of the SourceEncoding, such as "UTF-8" or "ISO-8859-1".
The function returns the following values:
- utf8: character set of the SourceEncoding.
func (*Encoding) Copy ¶
Copy: used by language bindings.
The function returns the following values:
- encoding: copy of enc.
type File ¶
File: on-disk representation of a buffer.
A GtkSourceFile object is the on-disk representation of a buffer. With a GtkSourceFile, you can create and configure a fileloader and filesaver which take by default the values of the GtkSourceFile properties (except for the file loader which auto-detect some properties). On a successful load or save operation, the GtkSourceFile properties are updated. If an operation fails, the GtkSourceFile properties have still the previous valid values.
func NewFile ¶
func NewFile() *File
The function returns the following values:
- file: new SourceFile object.
func (*File) CheckFileOnDisk ¶
func (file *File) CheckFileOnDisk()
CheckFileOnDisk checks synchronously the file on disk, to know whether the file is externally modified, or has been deleted, and whether the file is read-only.
SourceFile doesn't create a gio.FileMonitor to track those properties, so this function needs to be called instead. Creating lots of gio.FileMonitor's would take lots of resources.
Since this function is synchronous, it is advised to call it only on local files. See file.IsLocal.
func (*File) CompressionType ¶
func (file *File) CompressionType() CompressionType
The function returns the following values:
- compressionType: compression type.
func (*File) Encoding ¶
Encoding: encoding is initially NULL. After a successful file loading or saving operation, the encoding is non-NULL.
The function returns the following values:
- encoding: character encoding.
func (*File) IsDeleted ¶
IsDeleted returns whether the file has been deleted. If the file:location is NULL, returns FALSE.
To have an up-to-date value, you must first call file.CheckFileOnDisk.
The function returns the following values:
- ok: whether the file has been deleted.
func (*File) IsExternallyModified ¶
IsExternallyModified returns whether the file is externally modified. If the file:location is NULL, returns FALSE.
To have an up-to-date value, you must first call file.CheckFileOnDisk.
The function returns the following values:
- ok: whether the file is externally modified.
func (*File) IsLocal ¶
IsLocal returns whether the file is local. If the file:location is NULL, returns FALSE.
The function returns the following values:
- ok: whether the file is local.
func (*File) IsReadonly ¶
IsReadonly returns whether the file is read-only. If the file:location is NULL, returns FALSE.
To have an up-to-date value, you must first call file.CheckFileOnDisk.
The function returns the following values:
- ok: whether the file is read-only.
func (*File) Location ¶
func (file *File) Location() *gio.File
The function returns the following values:
- ret: #GFile.
func (*File) NewlineType ¶
func (file *File) NewlineType() NewlineType
The function returns the following values:
- newlineType: newline type.
func (*File) SetLocation ¶
func (file *File) SetLocation(location gio.Filer)
SetLocation sets the location.
The function takes the following parameters:
- location (optional): new #GFile, or NULL.
type FileClass ¶
type FileClass struct {
// contains filtered or unexported fields
}
FileClass: instance of this type is always passed by reference.
type FileLoader ¶
FileLoader: load a file into a GtkSourceBuffer.
A GtkSourceFileLoader object permits to load the contents of a gio.File or a gio.InputStream into a buffer.
A file loader should be used only for one load operation, including errors handling. If an error occurs, you can reconfigure the loader and relaunch the operation with fileloader.LoadAsync.
Running a GtkSourceFileLoader is an undoable action for the buffer.
After a file loading, the buffer is reset to the contents provided by the gio.File or gio.InputStream, so the buffer is set as “unmodified”, that is, gtk.TextBuffer.SetModified() is called with FALSE. If the contents isn't saved somewhere (for example if you load from stdin), then you should probably call gtk.TextBuffer.SetModified() with TRUE after calling fileloader.LoadFinish.
func NewFileLoader ¶
func NewFileLoader(buffer *Buffer, file *File) *FileLoader
NewFileLoader creates a new GtkSourceFileLoader object. The contents is read from the file's location.
If not already done, call file.SetLocation before calling this constructor. The previous location is anyway not needed, because as soon as the file loading begins, the buffer is emptied.
The function takes the following parameters:
- buffer to load the contents into.
- file: SourceFile.
The function returns the following values:
- fileLoader: new SourceFileLoader object.
func NewFileLoaderFromStream ¶
func NewFileLoaderFromStream(buffer *Buffer, file *File, stream gio.InputStreamer) *FileLoader
NewFileLoaderFromStream creates a new SourceFileLoader object. The contents is read from stream.
The function takes the following parameters:
- buffer to load the contents into.
- file: SourceFile.
- stream to load, e.g. stdin.
The function returns the following values:
- fileLoader: new SourceFileLoader object.
func (*FileLoader) Buffer ¶
func (loader *FileLoader) Buffer() *Buffer
The function returns the following values:
- buffer to load the contents into.
func (*FileLoader) CompressionType ¶
func (loader *FileLoader) CompressionType() CompressionType
The function returns the following values:
- compressionType: detected compression type.
func (*FileLoader) Encoding ¶
func (loader *FileLoader) Encoding() *Encoding
The function returns the following values:
- encoding: detected file encoding.
func (*FileLoader) File ¶
func (loader *FileLoader) File() *File
The function returns the following values:
- file: SourceFile.
func (*FileLoader) InputStream ¶
func (loader *FileLoader) InputStream() gio.InputStreamer
The function returns the following values:
- inputStream (optional) to load, or NULL if a #GFile is used.
func (*FileLoader) LoadFinish ¶
func (loader *FileLoader) LoadFinish(result gio.AsyncResulter) error
LoadFinish finishes a file loading started with fileloader.LoadAsync.
If the contents has been loaded, the following file properties will be updated: the location, the encoding, the newline type and the compression type.
The function takes the following parameters:
- result: Result.
func (*FileLoader) Location ¶
func (loader *FileLoader) Location() *gio.File
The function returns the following values:
- file (optional) to load, or NULL if an input stream is used.
func (*FileLoader) NewlineType ¶
func (loader *FileLoader) NewlineType() NewlineType
The function returns the following values:
- newlineType: detected newline type.
func (*FileLoader) SetCandidateEncodings ¶
func (loader *FileLoader) SetCandidateEncodings(candidateEncodings []*Encoding)
SetCandidateEncodings sets the candidate encodings for the file loading.
The encodings are tried in the same order as the list.
For convenience, candidate_encodings can contain duplicates. Only the first occurrence of a duplicated encoding is kept in the list.
By default the candidate encodings are (in that order in the list):
1. If set, the file's encoding as returned by file.GetEncoding. 2. The default candidates as returned by encoding.GetDefaultCandidates().
The function takes the following parameters:
- candidateEncodings: list of SourceEncoding<!-- -->s.
type FileLoaderClass ¶
type FileLoaderClass struct {
// contains filtered or unexported fields
}
FileLoaderClass: instance of this type is always passed by reference.
type FileLoaderError ¶
FileLoaderError: error code used with the GTK_SOURCE_FILE_LOADER_ERROR domain.
const ( // SourceFileLoaderErrorTooBig: file is too big. SourceFileLoaderErrorTooBig FileLoaderError = iota // SourceFileLoaderErrorEncodingAutoDetectionFailed: it is not possible to // detect the encoding automatically. SourceFileLoaderErrorEncodingAutoDetectionFailed // SourceFileLoaderErrorConversionFallback: there was an encoding conversion // error and it was needed to use a fallback character. SourceFileLoaderErrorConversionFallback )
func (FileLoaderError) String ¶
func (f FileLoaderError) String() string
String returns the name in string for FileLoaderError.
type FileLoaderOverrides ¶
type FileLoaderOverrides struct { }
FileLoaderOverrides contains methods that are overridable.
type FileOverrides ¶
type FileOverrides struct { }
FileOverrides contains methods that are overridable.
type FileSaver ¶
FileSaver: save a buffer into a file.
A GtkSourceFileSaver object permits to save a buffer into a gio.File.
A file saver should be used only for one save operation, including errors handling. If an error occurs, you can reconfigure the saver and relaunch the operation with filesaver.SaveAsync.
func NewFileSaver ¶
NewFileSaver creates a new SourceFileSaver object. The buffer will be saved to the file's location.
This constructor is suitable for a simple "save" operation, when the file already contains a non-NULL file:location.
The function takes the following parameters:
- buffer to save.
- file: SourceFile.
The function returns the following values:
- fileSaver: new SourceFileSaver object.
func NewFileSaverWithTarget ¶
NewFileSaverWithTarget creates a new SourceFileSaver object with a target location.
When the file saving is finished successfully, target_location is set to the file's file:location property. If an error occurs, the previous valid location is still available in file.
This constructor is suitable for a "save as" operation, or for saving a new buffer for the first time.
The function takes the following parameters:
- buffer to save.
- file: SourceFile.
- targetLocation where to save the buffer to.
The function returns the following values:
- fileSaver: new SourceFileSaver object.
func (*FileSaver) CompressionType ¶
func (saver *FileSaver) CompressionType() CompressionType
The function returns the following values:
- compressionType: compression type.
func (*FileSaver) Flags ¶
func (saver *FileSaver) Flags() FileSaverFlags
The function returns the following values:
- fileSaverFlags: flags.
func (*FileSaver) Location ¶
func (saver *FileSaver) Location() *gio.File
The function returns the following values:
- file where to save the buffer to.
func (*FileSaver) NewlineType ¶
func (saver *FileSaver) NewlineType() NewlineType
The function returns the following values:
- newlineType: newline type.
func (*FileSaver) SaveFinish ¶
SaveFinish finishes a file saving started with filesaver.SaveAsync.
If the file has been saved successfully, the following file properties will be updated: the location, the encoding, the newline type and the compression type.
Since the 3.20 version, gtk.TextBuffer.SetModified() is called with FALSE if the file has been saved successfully.
The function takes the following parameters:
- result: Result.
func (*FileSaver) SetCompressionType ¶
func (saver *FileSaver) SetCompressionType(compressionType CompressionType)
SetCompressionType sets the compression type. By default the compression type is taken from the SourceFile.
The function takes the following parameters:
- compressionType: new compression type.
func (*FileSaver) SetEncoding ¶
SetEncoding sets the encoding. If encoding is NULL, the UTF-8 encoding will be set.
By default the encoding is taken from the SourceFile.
The function takes the following parameters:
- encoding (optional): new encoding, or NULL for UTF-8.
func (*FileSaver) SetFlags ¶
func (saver *FileSaver) SetFlags(flags FileSaverFlags)
The function takes the following parameters:
- flags: new flags.
func (*FileSaver) SetNewlineType ¶
func (saver *FileSaver) SetNewlineType(newlineType NewlineType)
SetNewlineType sets the newline type. By default the newline type is taken from the SourceFile.
The function takes the following parameters:
- newlineType: new newline type.
type FileSaverClass ¶
type FileSaverClass struct {
// contains filtered or unexported fields
}
FileSaverClass: instance of this type is always passed by reference.
type FileSaverError ¶
FileSaverError: error code used with the GTK_SOURCE_FILE_SAVER_ERROR domain.
const ( // SourceFileSaverErrorInvalidChars: buffer contains invalid characters. SourceFileSaverErrorInvalidChars FileSaverError = iota // SourceFileSaverErrorExternallyModified: file is externally modified. SourceFileSaverErrorExternallyModified )
func (FileSaverError) String ¶
func (f FileSaverError) String() string
String returns the name in string for FileSaverError.
type FileSaverFlags ¶
FileSaverFlags flags to define the behavior of a filesaverflags.
const ( // SourceFileSaverFlagsNone: no flags. SourceFileSaverFlagsNone FileSaverFlags = 0b0 // SourceFileSaverFlagsIgnoreInvalidChars: ignore invalid characters. SourceFileSaverFlagsIgnoreInvalidChars FileSaverFlags = 0b1 // SourceFileSaverFlagsIgnoreModificationTime: save file despite external // modifications. SourceFileSaverFlagsIgnoreModificationTime FileSaverFlags = 0b10 // SourceFileSaverFlagsCreateBackup: create a backup before saving the file. SourceFileSaverFlagsCreateBackup FileSaverFlags = 0b100 )
func (FileSaverFlags) Has ¶
func (f FileSaverFlags) Has(other FileSaverFlags) bool
Has returns true if f contains other.
func (FileSaverFlags) String ¶
func (f FileSaverFlags) String() string
String returns the names in string for FileSaverFlags.
type FileSaverOverrides ¶
type FileSaverOverrides struct { }
FileSaverOverrides contains methods that are overridable.
type Gutter ¶
type Gutter struct { gtk.Widget // contains filtered or unexported fields }
Gutter object for view.
The GtkSourceGutter object represents the left or right gutter of the text view. It is used by view to draw the line numbers and marks that might be present on a line. By packing additional gutterrenderer objects in the gutter, you can extend the gutter with your own custom drawings.
To get a GtkSourceGutter, use the view.GetGutter function.
The gutter works very much the same way as cells rendered in a gtk.TreeView. The concept is similar, with the exception that the gutter does not have an underlying gtk.TreeModel. The builtin line number renderer is at position GTK_SOURCE_VIEW_GUTTER_POSITION_LINES (-30) and the marks renderer is at GTK_SOURCE_VIEW_GUTTER_POSITION_MARKS (-20). The gutter sorts the renderers in ascending order, from left to right. So the marks are displayed on the right of the line numbers.
func (*Gutter) Insert ¶
func (gutter *Gutter) Insert(renderer GutterRendererer, position int) bool
Insert renderer into the gutter. If renderer is yet unowned then gutter claims its ownership. Otherwise just increases renderer's reference count. renderer cannot be already inserted to another gutter.
The function takes the following parameters:
- renderer: gutter renderer (must inherit from SourceGutterRenderer).
- position: renderer position.
The function returns the following values:
- ok: TRUE if operation succeeded. Otherwise FALSE.
func (*Gutter) Remove ¶
func (gutter *Gutter) Remove(renderer GutterRendererer)
The function takes the following parameters:
func (*Gutter) Reorder ¶
func (gutter *Gutter) Reorder(renderer GutterRendererer, position int)
Reorder reorders renderer in gutter to new position.
The function takes the following parameters:
- renderer: CellRenderer.
- position: new renderer position.
type GutterClass ¶
type GutterClass struct {
// contains filtered or unexported fields
}
GutterClass: instance of this type is always passed by reference.
func (*GutterClass) ParentClass ¶
func (g *GutterClass) ParentClass() *gtk.WidgetClass
type GutterLines ¶
GutterLines: collected information about visible lines.
The GtkSourceGutterLines object is used to collect information about visible lines.
Use this from your gutterrenderer::query-data to collect the necessary information on visible lines. Doing so reduces the number of passes through the text btree allowing GtkSourceView to reach more frames-per-second while performing kinetic scrolling.
func (*GutterLines) AddClass ¶
func (lines *GutterLines) AddClass(line uint, name string)
AddClass adds the class name to line.
name will be converted to a glib.Quark as part of this process. A faster version of this function is available via gutterlines.AddQclass for situations where the glib.Quark is known ahead of time.
The function takes the following parameters:
- line number starting from zero.
- name class name.
func (*GutterLines) AddQclass ¶
func (lines *GutterLines) AddQclass(line uint, qname glib.Quark)
AddQclass adds the class denoted by qname to line.
You may check if a line has qname by calling gutterlines.HasQclass.
You can remove qname by calling gutterlines.RemoveQclass.
The function takes the following parameters:
- line number starting from zero.
- qname class name as a #GQuark.
func (*GutterLines) Buffer ¶
func (lines *GutterLines) Buffer() *gtk.TextBuffer
Buffer gets the gtk.TextBuffer that the GtkSourceGutterLines represents.
The function returns the following values:
- textBuffer: TextBuffer.
func (*GutterLines) First ¶
func (lines *GutterLines) First() uint
First gets the line number (starting from 0) for the first line that is user visible.
The function returns the following values:
- guint: line number starting from 0.
func (*GutterLines) HasAnyClass ¶
func (lines *GutterLines) HasAnyClass(line uint) bool
HasAnyClass checks to see if the line has any GQuark classes set. This can be used to help renderer implementations avoid work if nothing has been set on the class.
The function takes the following parameters:
- line contained within lines.
The function returns the following values:
- ok: TRUE if any quark was set for the line.
func (*GutterLines) HasClass ¶
func (lines *GutterLines) HasClass(line uint, name string) bool
HasClass checks to see if gutterlines.AddClass was called with the name for line.
A faster version of this function is provided via gutterlines.HasQclass for situations where the quark is known ahead of time.
The function takes the following parameters:
- line number starting from zero.
- name class name that may be converted, to a #GQuark.
The function returns the following values:
- ok: TRUE if line contains name.
func (*GutterLines) HasQclass ¶
func (lines *GutterLines) HasQclass(line uint, qname glib.Quark) bool
HasQclass checks to see if gutterlines.AddQclass was called with the quark denoted by qname for line.
The function takes the following parameters:
- line number starting from zero.
- qname containing the class name.
The function returns the following values:
- ok: TRUE if line contains qname.
func (*GutterLines) IsCursor ¶
func (lines *GutterLines) IsCursor(line uint) bool
IsCursor checks to see if line contains the insertion cursor.
The function takes the following parameters:
- line number starting from zero.
The function returns the following values:
- ok: TRUE if the insertion cursor is on line.
func (*GutterLines) IsPrelit ¶
func (lines *GutterLines) IsPrelit(line uint) bool
IsPrelit checks to see if line is marked as prelit. Generally, this means the mouse pointer is over the line within the gutter.
The function takes the following parameters:
- line number starting from zero.
The function returns the following values:
- ok: TRUE if the line is prelit.
func (*GutterLines) IsSelected ¶
func (lines *GutterLines) IsSelected(line uint) bool
IsSelected checks to see if the view had a selection and if that selection overlaps line in some way.
The function takes the following parameters:
- line number starting from zero.
The function returns the following values:
- ok: TRUE if the line contains a selection.
func (*GutterLines) IterAtLine ¶
func (lines *GutterLines) IterAtLine(line uint) *gtk.TextIter
IterAtLine gets a TextIter for the current buffer at line.
The function takes the following parameters:
- line number.
The function returns the following values:
- iter: location for a TextIter.
func (*GutterLines) Last ¶
func (lines *GutterLines) Last() uint
Last gets the line number (starting from 0) for the last line that is user visible.
The function returns the following values:
- guint: line number starting from 0.
func (*GutterLines) LineYrange ¶
func (lines *GutterLines) LineYrange(line uint, mode GutterRendererAlignmentMode) (y, height int)
LineYrange gets the Y range for a line based on mode.
The value for y is relative to the renderers widget coordinates.
The function takes the following parameters:
- line number starting from zero.
- mode: SourceGutterRendererAlignmentMode.
The function returns the following values:
- y: location for the Y position in widget coordinates.
- height: line height based on mode.
func (*GutterLines) RemoveClass ¶
func (lines *GutterLines) RemoveClass(line uint, name string)
RemoveClass removes the class matching name from line.
A faster version of this function is available via gutterlines.RemoveQclass for situations where the #GQuark is known ahead of time.
The function takes the following parameters:
- line number starting from zero.
- name class name.
func (*GutterLines) RemoveQclass ¶
func (lines *GutterLines) RemoveQclass(line uint, qname glib.Quark)
RemoveQclass reverses a call to gutterlines.AddQclass by removing the glib.Quark matching qname.
The function takes the following parameters:
- line number starting from zero.
- qname to remove from line.
func (*GutterLines) View ¶
func (lines *GutterLines) View() *gtk.TextView
View gets the gtk.TextView that the GtkSourceGutterLines represents.
The function returns the following values:
- textView: TextView.
type GutterLinesClass ¶
type GutterLinesClass struct {
// contains filtered or unexported fields
}
GutterLinesClass: instance of this type is always passed by reference.
type GutterLinesOverrides ¶
type GutterLinesOverrides struct { }
GutterLinesOverrides contains methods that are overridable.
type GutterOverrides ¶
type GutterOverrides struct { }
GutterOverrides contains methods that are overridable.
type GutterRenderer ¶
type GutterRenderer struct { gtk.Widget // contains filtered or unexported fields }
GutterRenderer: gutter cell renderer.
A GtkSourceGutterRenderer represents a column in a gutter. The column contains one cell for each visible line of the gtk.TextBuffer. Due to text wrapping, a cell can thus span multiple lines of the gtk.TextView. In this case, gutterrendereralignmentmode controls the alignment of the cell.
The gutter renderer is a gtk.Widget and is measured using the normal widget measurement facilities. The width of the gutter will be determined by the measurements of the gutter renderers.
The width of a gutter renderer generally takes into account the entire text buffer. For instance, to display the line numbers, if the buffer contains 100 lines, the gutter renderer will always set its width such as three digits can be printed, even if only the first 20 lines are shown. Another strategy is to take into account only the visible lines. In this case, only two digits are necessary to display the line numbers of the first 20 lines. To take another example, the gutter renderer for marks doesn't need to take into account the text buffer to announce its width. It only depends on the icons size displayed in the gutter column.
When the available size to render a cell is greater than the required size to render the cell contents, the cell contents can be aligned horizontally and vertically with gutterrenderer.SetAlignmentMode.
The cells rendering occurs using gtk.Widget.Snapshot(). Implementations should use gtk_source_gutter_renderer_get_lines() to retrieve information about the lines to be rendered. To help with aligning content which takes into account the padding and alignment of a cell, implementations may call gutterrenderer.AlignCell for a given line number with the width and height measurement of the content they width to render.
func BaseGutterRenderer ¶
func BaseGutterRenderer(obj GutterRendererer) *GutterRenderer
BaseGutterRenderer returns the underlying base object.
func (*GutterRenderer) Activate ¶
func (renderer *GutterRenderer) Activate(iter *gtk.TextIter, area *gdk.Rectangle, button uint, state gdk.ModifierType, nPresses int)
Activate emits the gutterrenderer::activate signal of the renderer. This is called from gutter and should never have to be called manually.
The function takes the following parameters:
- iter at the start of the line where the renderer is activated.
- area of the cell area where the renderer is activated.
- button that was pressed.
- state: ModifierType.
- nPresses: number of button presses.
func (*GutterRenderer) AlignCell ¶
func (renderer *GutterRenderer) AlignCell(line uint, width, height float32) (x, y float32)
AlignCell locates where to render content that is width x height based on the renderers alignment and padding.
The location will be placed into x and y and is relative to the renderer's coordinates.
It is encouraged that renderers use this function when snappshotting to ensure consistent placement of their contents.
The function takes the following parameters:
- line number for content.
- width of the content to draw.
- height of the content to draw.
The function returns the following values:
- x: x position to render the content.
- y: y position to render the content.
func (*GutterRenderer) AlignmentMode ¶
func (renderer *GutterRenderer) AlignmentMode() GutterRendererAlignmentMode
AlignmentMode: get the alignment mode.
The alignment mode describes the manner in which the renderer is aligned (see gutterrenderer:xalign and gutterrenderer:yalign).
The function returns the following values:
- gutterRendererAlignmentMode: SourceGutterRendererAlignmentMode.
func (*GutterRenderer) Buffer ¶
func (renderer *GutterRenderer) Buffer() *Buffer
Buffer gets the buffer for which the gutter renderer is drawing.
The function returns the following values:
- buffer (optional) or NULL.
func (*GutterRenderer) ConnectActivate ¶
func (renderer *GutterRenderer) ConnectActivate(f func(iter *gtk.TextIter, area *gdk.Rectangle, button uint, state gdk.ModifierType, nPresses int)) coreglib.SignalHandle
ConnectActivate: signal is emitted when the renderer is activated.
func (*GutterRenderer) ConnectQueryActivatable ¶
func (renderer *GutterRenderer) ConnectQueryActivatable(f func(iter *gtk.TextIter, area *gdk.Rectangle) (ok bool)) coreglib.SignalHandle
ConnectQueryActivatable: signal is emitted when the renderer can possibly be activated.
func (*GutterRenderer) ConnectQueryData ¶
func (renderer *GutterRenderer) ConnectQueryData(f func(object *coreglib.Object, p0 uint)) coreglib.SignalHandle
func (*GutterRenderer) QueryActivatable ¶
func (renderer *GutterRenderer) QueryActivatable(iter *gtk.TextIter, area *gdk.Rectangle) bool
QueryActivatable: get whether the renderer is activatable at the location provided. This is called from gutter to determine whether a renderer is activatable using the mouse pointer.
The function takes the following parameters:
- iter at the start of the line to be activated.
- area of the cell area to be activated.
The function returns the following values:
- ok: TRUE if the renderer can be activated, FALSE otherwise.
func (*GutterRenderer) SetAlignmentMode ¶
func (renderer *GutterRenderer) SetAlignmentMode(mode GutterRendererAlignmentMode)
SetAlignmentMode: set the alignment mode. The alignment mode describes the manner in which the renderer is aligned (see gutterrenderer:xalign and gutterrenderer:yalign).
The function takes the following parameters:
- mode: SourceGutterRendererAlignmentMode.
func (*GutterRenderer) SetXAlign ¶
func (renderer *GutterRenderer) SetXAlign(xalign float32)
SetXAlign adjusts the xalign property.
This may be used to adjust where within the cell rectangle the renderer will draw.
The function takes the following parameters:
- xalign: y padding for the drawing cell.
func (*GutterRenderer) SetXpad ¶
func (renderer *GutterRenderer) SetXpad(xpad int)
SetXpad adjusts the xpad property.
This may be used to adjust the cell rectangle that the renderer will use to draw.
The function takes the following parameters:
- xpad: y padding for the drawing cell.
func (*GutterRenderer) SetYAlign ¶
func (renderer *GutterRenderer) SetYAlign(yalign float32)
SetYAlign adjusts the yalign property.
This may be used to adjust where within the cell rectangle the renderer will draw.
The function takes the following parameters:
- yalign: y padding for the drawing cell.
func (*GutterRenderer) SetYpad ¶
func (renderer *GutterRenderer) SetYpad(ypad int)
SetYpad adjusts the ypad property.
This may be used to adjust the cell rectangle that the renderer will use to draw.
The function takes the following parameters:
- ypad: y padding for the drawing cell.
func (*GutterRenderer) View ¶
func (renderer *GutterRenderer) View() *View
View: get the view associated to the gutter renderer.
The function returns the following values:
- view: SourceView.
func (*GutterRenderer) XAlign ¶
func (renderer *GutterRenderer) XAlign() float32
XAlign gets the xalign property.
This may be used to adjust where within the cell rectangle the renderer will draw.
The function returns the following values:
func (*GutterRenderer) Xpad ¶
func (renderer *GutterRenderer) Xpad() int
Xpad gets the xpad property.
This may be used to adjust the cell rectangle that the renderer will use to draw.
The function returns the following values:
func (*GutterRenderer) YAlign ¶
func (renderer *GutterRenderer) YAlign() float32
YAlign gets the yalign property.
This may be used to adjust where within the cell rectangle the renderer will draw.
The function returns the following values:
func (*GutterRenderer) Ypad ¶
func (renderer *GutterRenderer) Ypad() int
Ypad gets the ypad property.
This may be used to adjust the cell rectangle that the renderer will use to draw.
The function returns the following values:
type GutterRendererAlignmentMode ¶
GutterRendererAlignmentMode: alignment mode of the renderer, when a cell spans multiple lines (due to text wrapping).
const ( // SourceGutterRendererAlignmentModeCell: full cell. SourceGutterRendererAlignmentModeCell GutterRendererAlignmentMode = iota // SourceGutterRendererAlignmentModeFirst: first line. SourceGutterRendererAlignmentModeFirst // SourceGutterRendererAlignmentModeLast: last line. SourceGutterRendererAlignmentModeLast )
func (GutterRendererAlignmentMode) String ¶
func (g GutterRendererAlignmentMode) String() string
String returns the name in string for GutterRendererAlignmentMode.
type GutterRendererClass ¶
type GutterRendererClass struct {
// contains filtered or unexported fields
}
GutterRendererClass: instance of this type is always passed by reference.
func (*GutterRendererClass) ParentClass ¶
func (g *GutterRendererClass) ParentClass() *gtk.WidgetClass
type GutterRendererOverrides ¶
type GutterRendererOverrides struct { // Activate emits the gutterrenderer::activate signal of the renderer. // This is called from gutter and should never have to be called manually. // // The function takes the following parameters: // // - iter at the start of the line where the renderer is activated. // - area of the cell area where the renderer is activated. // - button that was pressed. // - state: ModifierType. // - nPresses: number of button presses. // Activate func(iter *gtk.TextIter, area *gdk.Rectangle, button uint, state gdk.ModifierType, nPresses int) // The function takes the following parameters: // Begin func(lines *GutterLines) // ChangeBuffer: this is called when the text buffer changes for renderer. // // The function takes the following parameters: // // - oldBuffer (optional): old TextBuffer. // ChangeBuffer func(oldBuffer *Buffer) // ChangeView: this is called when the text view changes for renderer. // // The function takes the following parameters: // // - oldView (optional): old TextView. // ChangeView func(oldView *View) End func() // QueryActivatable: get whether the renderer is activatable at the location // provided. This is called from gutter to determine whether a renderer is // activatable using the mouse pointer. // // The function takes the following parameters: // // - iter at the start of the line to be activated. // - area of the cell area to be activated. // // The function returns the following values: // // - ok: TRUE if the renderer can be activated, FALSE otherwise. // QueryActivatable func(iter *gtk.TextIter, area *gdk.Rectangle) bool // The function takes the following parameters: // // - lines // - line // QueryData func(lines *GutterLines, line uint) // The function takes the following parameters: // // - snapshot // - lines // - line // SnapshotLine func(snapshot *gtk.Snapshot, lines *GutterLines, line uint) }
GutterRendererOverrides contains methods that are overridable.
type GutterRendererPixbuf ¶
type GutterRendererPixbuf struct { GutterRenderer // contains filtered or unexported fields }
GutterRendererPixbuf renders a pixbuf in the gutter.
A GtkSourceGutterRendererPixbuf can be used to render an image in a cell of gutter.
func NewGutterRendererPixbuf ¶
func NewGutterRendererPixbuf() *GutterRendererPixbuf
NewGutterRendererPixbuf: create a new SourceGutterRendererPixbuf.
The function returns the following values:
- gutterRendererPixbuf: SourceGutterRenderer.
func (*GutterRendererPixbuf) GIcon ¶
func (renderer *GutterRendererPixbuf) GIcon() *gio.Icon
GIcon: get the gicon of the renderer.
The function returns the following values:
- icon: #GIcon.
func (*GutterRendererPixbuf) IconName ¶
func (renderer *GutterRendererPixbuf) IconName() string
The function returns the following values:
func (*GutterRendererPixbuf) OverlayPaintable ¶
func (renderer *GutterRendererPixbuf) OverlayPaintable(paintable gdk.Paintabler)
OverlayPaintable allows overlaying a paintable on top of any other image that has been set for the pixbuf. This will be applied when the widget is next snapshot.
The function takes the following parameters:
- paintable: Paintable.
func (*GutterRendererPixbuf) Paintable ¶
func (renderer *GutterRendererPixbuf) Paintable() *gdk.Paintable
Paintable gets a gdk.Paintable that was set with gutterrendererpixbuf.SetPaintable.
The function returns the following values:
- paintable (optional) or NULL.
func (*GutterRendererPixbuf) Pixbuf ¶
func (renderer *GutterRendererPixbuf) Pixbuf() *gdkpixbuf.Pixbuf
Pixbuf: get the pixbuf of the renderer.
The function returns the following values:
- pixbuf: Pixbuf.
func (*GutterRendererPixbuf) SetGIcon ¶
func (renderer *GutterRendererPixbuf) SetGIcon(icon gio.Iconner)
The function takes the following parameters:
- icon (optional): icon, or NULL.
func (*GutterRendererPixbuf) SetIconName ¶
func (renderer *GutterRendererPixbuf) SetIconName(iconName string)
The function takes the following parameters:
- iconName (optional): icon name, or NULL.
func (*GutterRendererPixbuf) SetPaintable ¶
func (renderer *GutterRendererPixbuf) SetPaintable(paintable gdk.Paintabler)
The function takes the following parameters:
- paintable (optional): paintable, or NULL.
func (*GutterRendererPixbuf) SetPixbuf ¶
func (renderer *GutterRendererPixbuf) SetPixbuf(pixbuf *gdkpixbuf.Pixbuf)
The function takes the following parameters:
- pixbuf (optional): pixbuf, or NULL.
type GutterRendererPixbufClass ¶
type GutterRendererPixbufClass struct {
// contains filtered or unexported fields
}
GutterRendererPixbufClass: instance of this type is always passed by reference.
func (*GutterRendererPixbufClass) ParentClass ¶
func (g *GutterRendererPixbufClass) ParentClass() *GutterRendererClass
type GutterRendererPixbufOverrides ¶
type GutterRendererPixbufOverrides struct { }
GutterRendererPixbufOverrides contains methods that are overridable.
type GutterRendererText ¶
type GutterRendererText struct { GutterRenderer // contains filtered or unexported fields }
GutterRendererText renders text in the gutter.
A GtkSourceGutterRendererText can be used to render text in a cell of gutter.
func NewGutterRendererText ¶
func NewGutterRendererText() *GutterRendererText
NewGutterRendererText: create a new SourceGutterRendererText.
The function returns the following values:
- gutterRendererText: SourceGutterRenderer.
func (*GutterRendererText) Measure ¶
func (renderer *GutterRendererText) Measure(text string) (width, height int)
Measure measures the text provided using the pango layout used by the SourceGutterRendererText.
The function takes the following parameters:
- text to measure.
The function returns the following values:
- width (optional): location to store the width of the text in pixels, or NULL.
- height (optional): location to store the height of the text in pixels, or NULL.
func (*GutterRendererText) MeasureMarkup ¶
func (renderer *GutterRendererText) MeasureMarkup(markup string) (width, height int)
MeasureMarkup measures the pango markup provided using the pango layout used by the SourceGutterRendererText.
The function takes the following parameters:
- markup: pango markup to measure.
The function returns the following values:
- width (optional): location to store the width of the text in pixels, or NULL.
- height (optional): location to store the height of the text in pixels, or NULL.
func (*GutterRendererText) SetMarkup ¶
func (renderer *GutterRendererText) SetMarkup(markup string, length int)
The function takes the following parameters:
- markup
- length
func (*GutterRendererText) SetText ¶
func (renderer *GutterRendererText) SetText(text string, length int)
The function takes the following parameters:
- text
- length
type GutterRendererTextClass ¶
type GutterRendererTextClass struct {
// contains filtered or unexported fields
}
GutterRendererTextClass: instance of this type is always passed by reference.
func (*GutterRendererTextClass) ParentClass ¶
func (g *GutterRendererTextClass) ParentClass() *GutterRendererClass
type GutterRendererTextOverrides ¶
type GutterRendererTextOverrides struct { }
GutterRendererTextOverrides contains methods that are overridable.
type GutterRendererer ¶
GutterRendererer describes types inherited from class GutterRenderer.
To get the original type, the caller must assert this to an interface or another type.
type Hover ¶
Hover: interactive tooltips.
GtkSourceHover allows a view to provide contextual information. When enabled, if the user hovers over a word in the text editor, a series of registered hoverprovider can populate a hoverdisplay with useful information.
To enable call view.GetHover and add hoverprovider using hover.AddProvider. To disable, remove all registered providers with hover.RemoveProvider.
You can change how long to wait to display the interactive tooltip by setting the hover:hover-delay property in milliseconds.
func (*Hover) AddProvider ¶
func (self *Hover) AddProvider(provider HoverProviderer)
The function takes the following parameters:
func (*Hover) RemoveProvider ¶
func (self *Hover) RemoveProvider(provider HoverProviderer)
The function takes the following parameters:
type HoverClass ¶
type HoverClass struct {
// contains filtered or unexported fields
}
HoverClass: instance of this type is always passed by reference.
type HoverContext ¶
HoverContext: context for populating hoverdisplay contents.
GtkSourceHoverContext contains information about the request to populate contents for a hoverdisplay.
It can be used to retrieve the view, buffer, and gtk.TextIter for the regions of text which are being displayed.
Use hovercontext.GetBounds to get the word that was requested. hovercontext.GetIter will get you the location of the pointer when the request was made.
func (*HoverContext) Bounds ¶
func (self *HoverContext) Bounds() (begin, end *gtk.TextIter, ok bool)
Bounds gets the current word bounds of the hover.
If begin is non-NULL, it will be set to the start position of the current word being hovered.
If end is non-NULL, it will be set to the end position for the current word being hovered.
The function returns the following values:
- begin (optional): TextIter.
- end (optional): TextIter.
- ok: TRUE if the marks are still valid and begin or end was set.
func (*HoverContext) Buffer ¶
func (self *HoverContext) Buffer() *Buffer
Buffer: convenience function to get the buffer.
The function returns the following values:
- buffer for the view.
func (*HoverContext) Iter ¶
func (self *HoverContext) Iter(iter *gtk.TextIter) bool
The function takes the following parameters:
The function returns the following values:
func (*HoverContext) View ¶
func (self *HoverContext) View() *View
The function returns the following values:
- view that owns the context.
type HoverContextClass ¶
type HoverContextClass struct {
// contains filtered or unexported fields
}
HoverContextClass: instance of this type is always passed by reference.
type HoverContextOverrides ¶
type HoverContextOverrides struct { }
HoverContextOverrides contains methods that are overridable.
type HoverDisplay ¶
type HoverDisplay struct { gtk.Widget // contains filtered or unexported fields }
HoverDisplay: display for interactive tooltips.
GtkSourceHoverDisplay is a gtk.Widget that may be populated with widgets to be displayed to the user in interactive tooltips. The children widgets are packed vertically using a gtk.Box.
Implement the hoverprovider interface to be notified of when to populate a GtkSourceHoverDisplay on behalf of the user.
func (*HoverDisplay) Append ¶
func (self *HoverDisplay) Append(child gtk.Widgetter)
The function takes the following parameters:
func (*HoverDisplay) InsertAfter ¶
func (self *HoverDisplay) InsertAfter(child, sibling gtk.Widgetter)
The function takes the following parameters:
- child
- sibling
func (*HoverDisplay) Prepend ¶
func (self *HoverDisplay) Prepend(child gtk.Widgetter)
The function takes the following parameters:
func (*HoverDisplay) Remove ¶
func (self *HoverDisplay) Remove(child gtk.Widgetter)
The function takes the following parameters:
type HoverDisplayClass ¶
type HoverDisplayClass struct {
// contains filtered or unexported fields
}
HoverDisplayClass: instance of this type is always passed by reference.
func (*HoverDisplayClass) ParentClass ¶
func (h *HoverDisplayClass) ParentClass() *gtk.WidgetClass
type HoverDisplayOverrides ¶
type HoverDisplayOverrides struct { }
HoverDisplayOverrides contains methods that are overridable.
type HoverOverrides ¶
type HoverOverrides struct { }
HoverOverrides contains methods that are overridable.
type HoverProvider ¶
HoverProvider: interface to populate interactive tooltips.
GtkSourceHoverProvider is an interface that should be implemented to extend the contents of a hoverdisplay. This is typical in editors that interact external tooling such as those utilizing Language Server Protocol.
If you can populate the hoverdisplay synchronously, use hoverprovider.Populate. Otherwise, interface implementations that may take additional time should use hoverprovider.PopulateAsync to avoid blocking the main loop.
HoverProvider wraps an interface. This means the user can get the underlying type by calling Cast().
func (*HoverProvider) PopulateFinish ¶
func (self *HoverProvider) PopulateFinish(result gio.AsyncResulter) error
The function takes the following parameters:
type HoverProviderInterface ¶
type HoverProviderInterface struct {
// contains filtered or unexported fields
}
HoverProviderInterface: instance of this type is always passed by reference.
type HoverProviderer ¶
HoverProviderer describes HoverProvider's interface methods.
type Indenter ¶
Indenter: auto-indentation interface.
By default, view can auto-indent as you type when view:auto-indent is enabled. The indentation simply copies the previous lines indentation.
This can be changed by implementing GtkSourceIndenter and setting the view:indenter property.
Implementors of this interface should implement both indenter.IsTrigger and indenter.Indent.
indenter.IsTrigger is called upon key-press to determine of the key press should trigger an indentation. The default implementation of the interface checks to see if the key was gdk.KEYReturn or gdk.KEYKPEnter without GDK_SHIFT_MASK set.
indenter.Indent is called after text has been inserted into buffer when indenter.IsTrigger returned TRUE. The gtk.TextIter is placed directly after the inserted character or characters.
It may be beneficial to move the insertion mark using gtk.TextBuffer.SelectRange() depending on how the indenter changes the indentation.
All changes are encapsulated within a single user action so that the user may undo them using standard undo/redo accelerators.
Indenter wraps an interface. This means the user can get the underlying type by calling Cast().
func (*Indenter) IsTrigger ¶
func (self *Indenter) IsTrigger(view *View, location *gtk.TextIter, state gdk.ModifierType, keyval uint) bool
IsTrigger: this function is used to determine if a key pressed should cause the indenter to automatically indent.
The default implementation of this virtual method will check to see if keyval is gdk.KEYReturn or gdk.KEYKPEnter and state does not have GDK_SHIFT_MASK set. This is to allow the user to avoid indentation when Shift+Return is pressed. Other indenters may want to copy this behavior to provide a consistent experience to users.
The function takes the following parameters:
- view: SourceView.
- location where ch is to be inserted.
- state: modifier state for the insertion.
- keyval pressed such as gdk.KEYReturn.
The function returns the following values:
- ok: TRUE if indentation should be automatically triggered; otherwise FALSE and no indentation will be performed.
type IndenterInterface ¶
type IndenterInterface struct {
// contains filtered or unexported fields
}
IndenterInterface: virtual function table for SourceIndenter.
An instance of this type is always passed by reference.
type Indenterer ¶
type Indenterer interface { coreglib.Objector // IsTrigger: this function is used to determine if a key pressed should // cause the indenter to automatically indent. IsTrigger(view *View, location *gtk.TextIter, state gdk.ModifierType, keyval uint) bool }
Indenterer describes Indenter's interface methods.
type Language ¶
Language represents a syntax highlighted language.
A GtkSourceLanguage represents a programming or markup language, affecting syntax highlighting and context classes (./class.Buffer.html#context-classes).
Use languagemanager to obtain a GtkSourceLanguage instance, and buffer.SetLanguage to apply it to a buffer.
func (*Language) Globs ¶
Globs returns the globs associated to this language.
This is just an utility wrapper around language.GetMetadata to retrieve the "globs" metadata property and split it into an array.
The function returns the following values:
- utf8s (optional): a newly-allocated NULL terminated array containing the globs or NULL if no globs are found. The returned array must be freed with g_strfreev().
func (*Language) Hidden ¶
Hidden returns whether the language should be hidden from the user.
The function returns the following values:
- ok: TRUE if the language should be hidden, FALSE otherwise.
func (*Language) ID ¶
ID returns the ID of the language.
The ID is not locale-dependent.The returned string is owned by language and should not be freed or modified.
The function returns the following values:
- utf8: ID of language.
func (*Language) MIMETypes ¶
MIMETypes returns the mime types associated to this language.
This is just an utility wrapper around language.GetMetadata to retrieve the "mimetypes" metadata property and split it into an array.
The function returns the following values:
- utf8s (optional): a newly-allocated NULL terminated array containing the mime types or NULL if no mime types are found. The returned array must be freed with g_strfreev().
func (*Language) Metadata ¶
The function takes the following parameters:
- name: metadata property name.
The function returns the following values:
- utf8 (optional): value of property name stored in the metadata of language or NULL if language does not contain the specified metadata property. The returned string is owned by language and should not be freed or modified.
func (*Language) Name ¶
Name returns the localized name of the language.
The returned string is owned by language and should not be freed or modified.
The function returns the following values:
- utf8: name of language.
func (*Language) Section ¶
Section returns the localized section of the language.
Each language belong to a section (ex. HTML belongs to the Markup section). The returned string is owned by language and should not be freed or modified.
The function returns the following values:
- utf8: section of language.
func (*Language) StyleFallback ¶
StyleFallback returns the ID of the style to use if the specified style_id is not present in the current style scheme.
The function takes the following parameters:
- styleId: style ID.
The function returns the following values:
- utf8 (optional): ID of the style to use if the specified style_id is not present in the current style scheme or NULL if the style has no fallback defined. The returned string is owned by the language and must not be modified.
func (*Language) StyleIDs ¶
StyleIDs returns the ids of the styles defined by this language.
The function returns the following values:
- utf8s (optional): a newly-allocated NULL terminated array containing ids of the styles defined by this language or NULL if no style is defined. The returned array must be freed with g_strfreev().
func (*Language) StyleName ¶
StyleName returns the name of the style with ID style_id defined by this language.
The function takes the following parameters:
- styleId: style ID.
The function returns the following values:
- utf8 (optional): name of the style with ID style_id defined by this language or NULL if the style has no name or there is no style with ID style_id defined by this language. The returned string is owned by the language and must not be modified.
type LanguageClass ¶
type LanguageClass struct {
// contains filtered or unexported fields
}
LanguageClass: instance of this type is always passed by reference.
type LanguageManager ¶
LanguageManager provides access to languages.
GtkSourceLanguageManager is an object which processes language description files and creates and stores language objects, and provides API to access them.
Use languagemanager.GetDefault() to retrieve the default instance of GtkSourceLanguageManager, and languagemanager.GuessLanguage to get a language for given file name and content type.
func LanguageManagerGetDefault ¶
func LanguageManagerGetDefault() *LanguageManager
LanguageManagerGetDefault returns the default SourceLanguageManager instance.
The function returns the following values:
- languageManager value is owned by GtkSourceView library and must not be unref'ed.
func NewLanguageManager ¶
func NewLanguageManager() *LanguageManager
NewLanguageManager creates a new language manager.
If you do not need more than one language manager or a private language manager instance then use languagemanager.GetDefault() instead.
The function returns the following values:
- languageManager: new SourceLanguageManager.
func (*LanguageManager) AppendSearchPath ¶
func (lm *LanguageManager) AppendSearchPath(path string)
AppendSearchPath appends path to the list of directories where the manager looks for language files.
See languagemanager.SetSearchPath for details.
The function takes the following parameters:
- path: directory or a filename.
func (*LanguageManager) GuessLanguage ¶
func (lm *LanguageManager) GuessLanguage(filename, contentType string) *Language
GuessLanguage picks a language for given file name and content type, according to the information in lang files.
Either filename or content_type may be NULL. This function can be used as follows:
GtkSourceLanguage *lang; GtkSourceLanguageManager *manager; lm = gtk_source_language_manager_get_default (); lang = gtk_source_language_manager_guess_language (manager, filename, NULL); gtk_source_buffer_set_language (buffer, lang);
or
GtkSourceLanguage *lang = NULL; GtkSourceLanguageManager *manager; gboolean result_uncertain; gchar *content_type; content_type = g_content_type_guess (filename, NULL, 0, &result_uncertain); if (result_uncertain) { g_free (content_type); content_type = NULL; } manager = gtk_source_language_manager_get_default (); lang = gtk_source_language_manager_guess_language (manager, filename, content_type); gtk_source_buffer_set_language (buffer, lang); g_free (content_type);
etc. Use language.GetMIMETypes and language.GetGlobs if you need full control over file -> language mapping.
The function takes the following parameters:
- filename (optional) in Glib filename encoding, or NULL.
- contentType (optional): content type (as in GIO API), or NULL.
The function returns the following values:
- language (optional) or NULL if there is no suitable language for given filename and/or content_type. Return value is owned by lm and should not be freed.
func (*LanguageManager) Language ¶
func (lm *LanguageManager) Language(id string) *Language
Language gets the language identified by the given id in the language manager.
The function takes the following parameters:
- id: language id.
The function returns the following values:
- language (optional) or NULL if there is no language identified by the given id. Return value is owned by lm and should not be freed.
func (*LanguageManager) LanguageIDs ¶
func (lm *LanguageManager) LanguageIDs() []string
LanguageIDs returns the ids of the available languages.
The function returns the following values:
- utf8s (optional): a NULL-terminated array of strings containing the ids of the available languages or NULL if no language is available. The array is sorted alphabetically according to the language name. The array is owned by lm and must not be modified.
func (*LanguageManager) PrependSearchPath ¶
func (lm *LanguageManager) PrependSearchPath(path string)
PrependSearchPath prepends path to the list of directories where the manager looks for language files.
See languagemanager.SetSearchPath for details.
The function takes the following parameters:
- path: directory or a filename.
func (*LanguageManager) SearchPath ¶
func (lm *LanguageManager) SearchPath() []string
SearchPath gets the list directories where lm looks for language files.
The function returns the following values:
- utf8s: NULL-terminated array containing a list of language files directories. The array is owned by lm and must not be modified.
func (*LanguageManager) SetSearchPath ¶
func (lm *LanguageManager) SetSearchPath(dirs []string)
SetSearchPath sets the list of directories where the lm looks for language files.
If dirs is NULL, the search path is reset to default.
At the moment this function can be called only before the language files are loaded for the first time. In practice to set a custom search path for a GtkSourceLanguageManager, you have to call this function right after creating it.
Since GtkSourceView 5.4 this function will allow you to provide paths in the form of "resource:///" URIs to embedded GResources. They must contain the path of a directory within the GResource.
The function takes the following parameters:
- dirs (optional): NULL-terminated array of strings or NULL.
type LanguageManagerClass ¶
type LanguageManagerClass struct {
// contains filtered or unexported fields
}
LanguageManagerClass: instance of this type is always passed by reference.
type LanguageManagerOverrides ¶
type LanguageManagerOverrides struct { }
LanguageManagerOverrides contains methods that are overridable.
type LanguageOverrides ¶
type LanguageOverrides struct { }
LanguageOverrides contains methods that are overridable.
type Map ¶
type Map struct { View // contains filtered or unexported fields }
Map: widget that displays a map for a specific view.
GtkSourceMap is a widget that maps the content of a view into a smaller view so the user can have a quick overview of the whole document.
This works by connecting a view to to the GtkSourceMap using the map:view property or map.SetView.
GtkSourceMap is a view object. This means that you can add a gutterrenderer to a gutter in the same way you would for a view. One example might be a gutterrenderer that shows which lines have changed in the document.
Additionally, it is desirable to match the font of the GtkSourceMap and the view used for editing. Therefore, map:font-desc should be used to set the target font. You will need to adjust this to the desired font size for the map. A 1pt font generally seems to be an appropriate font size. "Monospace 1" is the default. See pango.FontDescription.SetSize() for how to alter the size of an existing pango.FontDescription.
When FontConfig is available, GtkSourceMap will try to use a bundled "block" font to make the map more legible.
func NewMap ¶
func NewMap() *Map
NewMap creates a new GtkSourceMap.
The function returns the following values:
- _map: new SourceMap.
type MapClass ¶
type MapClass struct {
// contains filtered or unexported fields
}
MapClass: instance of this type is always passed by reference.
func (*MapClass) ParentClass ¶
type MapOverrides ¶
type MapOverrides struct { }
MapOverrides contains methods that are overridable.
type Mark ¶
type Mark struct { gtk.TextMark // contains filtered or unexported fields }
Mark object for buffer.
A GtkSourceMark marks a position in the text where you want to display additional info. It is based on gtk.TextMark and thus is still valid after the text has changed though its position may change.
GtkSourceMarks are organized in categories which you have to set when you create the mark. Each category can have a priority, a pixbuf and other associated attributes. See view.SetMarkAttributes. The pixbuf will be displayed in the margin at the line where the mark residents if the view:show-line-marks property is set to TRUE. If there are multiple marks in the same line, the pixbufs will be drawn on top of each other. The mark with the highest priority will be drawn on top.
func NewMark ¶
NewMark creates a text mark.
Add it to a buffer using gtk.TextBuffer.AddMark(). If name is NULL, the mark is anonymous; otherwise, the mark can be retrieved by name using gtk.TextBuffer.GetMark(). Normally marks are created using the utility function buffer.CreateSourceMark.
The function takes the following parameters:
- name (optional): name of the SourceMark or NULL.
- category is used to classify marks according to common characteristics (e.g. all the marks representing a bookmark could belong to the "bookmark" category, or all the marks representing a compilation error could belong to "error" category).
The function returns the following values:
- mark: new SourceMark that can be added using gtk.TextBuffer.AddMark().
func (*Mark) Category ¶
Category returns the mark category.
The function returns the following values:
- utf8: category of the SourceMark.
func (*Mark) Next ¶
Next returns the next GtkSourceMark in the buffer or NULL if the mark was not added to a buffer.
If there is no next mark, NULL will be returned.
If category is NULL, looks for marks of any category.
The function takes the following parameters:
- category (optional): string specifying the mark category, or NULL.
The function returns the following values:
- ret (optional): next SourceMark, or NULL.
func (*Mark) Prev ¶
Prev returns the previous GtkSourceMark in the buffer or NULL if the mark was not added to a buffer.
If there is no previous mark, NULL is returned.
If category is NULL, looks for marks of any category.
The function takes the following parameters:
- category: string specifying the mark category, or NULL.
The function returns the following values:
- ret (optional) previous SourceMark, or NULL.
type MarkAttributes ¶
MarkAttributes: source mark attributes object.
GtkSourceMarkAttributes is an object specifying attributes used by a view to visually show lines marked with marks of a specific category. It allows you to define a background color of a line, an icon shown in gutter and tooltips.
The background color is used as a background of a line where a mark is placed and it can be set with markattributes.SetBackground. To check if any custom background color was defined and what color it is, use markattributes.GetBackground.
An icon is a graphic element which is shown in the gutter of a view. An example use is showing a red filled circle in a debugger to show that a breakpoint was set in certain line. To get an icon that will be placed in a gutter, first a base for it must be specified and then markattributes.RenderIcon must be called. There are several ways to specify a base for an icon:
- markattributes.SetIconName
- markattributes.SetGIcon
- markattributes.SetPixbuf
Using any of the above functions overrides the one used earlier. But note that a getter counterpart of earlier used function can still return some value, but it is just not used when rendering the proper icon.
To provide meaningful tooltips for a given mark of a category, you should connect to markattributes::query-tooltip-text or markattributes::query-tooltip-markup where the latter takes precedence.
func NewMarkAttributes ¶
func NewMarkAttributes() *MarkAttributes
NewMarkAttributes creates a new source mark attributes.
The function returns the following values:
- markAttributes: new source mark attributes.
func (*MarkAttributes) Background ¶
func (attributes *MarkAttributes) Background() (*gdk.RGBA, bool)
Background stores background color in background.
The function returns the following values:
- background: RGBA.
- ok: whether background color for attributes was set.
func (*MarkAttributes) ConnectQueryTooltipMarkup ¶
func (attributes *MarkAttributes) ConnectQueryTooltipMarkup(f func(mark *Mark) (utf8 string)) coreglib.SignalHandle
ConnectQueryTooltipMarkup: code should connect to this signal to provide a tooltip for given mark. The tooltip can contain a markup.
func (*MarkAttributes) ConnectQueryTooltipText ¶
func (attributes *MarkAttributes) ConnectQueryTooltipText(f func(mark *Mark) (utf8 string)) coreglib.SignalHandle
ConnectQueryTooltipText: code should connect to this signal to provide a tooltip for given mark. The tooltip should be just a plain text.
func (*MarkAttributes) GIcon ¶
func (attributes *MarkAttributes) GIcon() *gio.Icon
GIcon gets a gio.Icon to be used as a base for rendered icon.
Note that the icon can be NULL if it wasn't set earlier.
The function returns the following values:
- icon: icon. The icon belongs to attributes and should not be unreffed.
func (*MarkAttributes) IconName ¶
func (attributes *MarkAttributes) IconName() string
IconName gets a name of an icon to be used as a base for rendered icon.
Note that the icon name can be NULL if it wasn't set earlier.
The function returns the following values:
- utf8: icon name. The string belongs to attributes and should not be freed.
func (*MarkAttributes) Pixbuf ¶
func (attributes *MarkAttributes) Pixbuf() *gdkpixbuf.Pixbuf
Pixbuf gets a gdkpixbuf.Pixbuf to be used as a base for rendered icon.
Note that the pixbuf can be NULL if it wasn't set earlier.
The function returns the following values:
- pixbuf: pixbuf. The pixbuf belongs to attributes and should not be unreffed.
func (*MarkAttributes) RenderIcon ¶
func (attributes *MarkAttributes) RenderIcon(widget gtk.Widgetter, size int) *gdk.Paintable
RenderIcon renders an icon of given size.
The base of the icon is set by the last call to one of:
- markattributes.SetPixbuf
- markattributes.SetGIcon
- markattributes.SetIconName
size cannot be lower than 1.
The function takes the following parameters:
- widget of which style settings may be used.
- size of the rendered icon.
The function returns the following values:
- paintable The paintable belongs to attributes and should not be unreffed.
func (*MarkAttributes) SetBackground ¶
func (attributes *MarkAttributes) SetBackground(background *gdk.RGBA)
SetBackground sets background color to the one given in background.
The function takes the following parameters:
- background: RGBA.
func (*MarkAttributes) SetGIcon ¶
func (attributes *MarkAttributes) SetGIcon(gicon gio.Iconner)
SetGIcon sets an icon to be used as a base for rendered icon.
The function takes the following parameters:
- gicon to be used.
func (*MarkAttributes) SetIconName ¶
func (attributes *MarkAttributes) SetIconName(iconName string)
SetIconName sets a name of an icon to be used as a base for rendered icon.
The function takes the following parameters:
- iconName: name of an icon to be used.
func (*MarkAttributes) SetPixbuf ¶
func (attributes *MarkAttributes) SetPixbuf(pixbuf *gdkpixbuf.Pixbuf)
SetPixbuf sets a pixbuf to be used as a base for rendered icon.
The function takes the following parameters:
- pixbuf to be used.
func (*MarkAttributes) TooltipMarkup ¶
func (attributes *MarkAttributes) TooltipMarkup(mark *Mark) string
TooltipMarkup queries for a tooltip by emitting a markattributes::query-tooltip-markup signal.
The tooltip may contain a markup.
The function takes the following parameters:
- mark: SourceMark.
The function returns the following values:
- utf8: tooltip. The returned string should be freed by using g_free() when done with it.
func (*MarkAttributes) TooltipText ¶
func (attributes *MarkAttributes) TooltipText(mark *Mark) string
TooltipText queries for a tooltip by emitting a markattributes::query-tooltip-text signal.
The tooltip is a plain text.
The function takes the following parameters:
- mark: SourceMark.
The function returns the following values:
- utf8: tooltip. The returned string should be freed by using g_free() when done with it.
type MarkAttributesClass ¶
type MarkAttributesClass struct {
// contains filtered or unexported fields
}
MarkAttributesClass: instance of this type is always passed by reference.
type MarkAttributesOverrides ¶
type MarkAttributesOverrides struct { }
MarkAttributesOverrides contains methods that are overridable.
type MarkClass ¶
type MarkClass struct {
// contains filtered or unexported fields
}
MarkClass: instance of this type is always passed by reference.
func (*MarkClass) ParentClass ¶
func (m *MarkClass) ParentClass() *gtk.TextMarkClass
type MarkOverrides ¶
type MarkOverrides struct { }
MarkOverrides contains methods that are overridable.
type NewlineType ¶
const ( // SourceNewlineTypeLf: line feed, used on UNIX. SourceNewlineTypeLf NewlineType = iota // SourceNewlineTypeCr: carriage return, used on Mac. SourceNewlineTypeCr // SourceNewlineTypeCrLf: carriage return followed by a line feed, used on // Windows. SourceNewlineTypeCrLf )
func (NewlineType) String ¶
func (n NewlineType) String() string
String returns the name in string for NewlineType.
type PrintCompositor ¶
PrintCompositor: compose a buffer for printing.
The GtkSourcePrintCompositor object is used to compose a buffer for printing. You can set various configuration options to customize the printed output. GtkSourcePrintCompositor is designed to be used with the high-level printing API of gtk+, i.e. gtk.PrintOperation.
The margins specified in this object are the layout margins: they define the blank space bordering the printed area of the pages. They must not be confused with the "print margins", i.e. the parts of the page that the printer cannot print on, defined in the gtk.PageSetup objects. If the specified layout margins are smaller than the "print margins", the latter ones are used as a fallback by the GtkSourcePrintCompositor object, so that the printed area is not clipped.
func NewPrintCompositor ¶
func NewPrintCompositor(buffer *Buffer) *PrintCompositor
NewPrintCompositor creates a new print compositor that can be used to print buffer.
The function takes the following parameters:
- buffer to print.
The function returns the following values:
- printCompositor: new print compositor object.
func NewPrintCompositorFromView ¶
func NewPrintCompositorFromView(view *View) *PrintCompositor
NewPrintCompositorFromView creates a new print compositor that can be used to print the buffer associated with view.
This constructor sets some configuration properties to make the printed output match view as much as possible. The properties set are printcompositor:tab-width, printcompositor:highlight-syntax, printcompositor:wrap-mode, printcompositor:body-font-name and printcompositor:print-line-numbers.
The function takes the following parameters:
- view to get configuration from.
The function returns the following values:
- printCompositor: new print compositor object.
func (*PrintCompositor) BodyFontName ¶
func (compositor *PrintCompositor) BodyFontName() string
BodyFontName returns the name of the font used to print the text body.
The returned string must be freed with g_free().
The function returns the following values:
- utf8: new string containing the name of the font used to print the text body.
func (*PrintCompositor) BottomMargin ¶
func (compositor *PrintCompositor) BottomMargin(unit gtk.Unit) float64
BottomMargin gets the bottom margin in units of unit.
The function takes the following parameters:
- unit for the return value.
The function returns the following values:
- gdouble: bottom margin.
func (*PrintCompositor) Buffer ¶
func (compositor *PrintCompositor) Buffer() *Buffer
Buffer gets the buffer associated with the compositor.
The returned object reference is owned by the compositor object and should not be unreferenced.
The function returns the following values:
- buffer associated with the compositor.
func (*PrintCompositor) DrawPage ¶
func (compositor *PrintCompositor) DrawPage(context *gtk.PrintContext, pageNr int)
DrawPage: draw page page_nr for printing on the the Cairo context encapsuled in context.
This method has been designed to be called in the handler of the gtk.PrintOperation::drawPage signal as shown in the following example:
// Signal handler for the GtkPrintOperation::draw_page signal static void draw_page (GtkPrintOperation *operation, GtkPrintContext *context, gint page_nr, gpointer user_data) { GtkSourcePrintCompositor *compositor; compositor = GTK_SOURCE_PRINT_COMPOSITOR (user_data); gtk_source_print_compositor_draw_page (compositor, context, page_nr); }.
The function takes the following parameters:
- context encapsulating the context information that is required when drawing the page for printing.
- pageNr: number of the page to print.
func (*PrintCompositor) FooterFontName ¶
func (compositor *PrintCompositor) FooterFontName() string
FooterFontName returns the name of the font used to print the page footer.
The returned string must be freed with g_free().
The function returns the following values:
- utf8: new string containing the name of the font used to print the page footer.
func (*PrintCompositor) HeaderFontName ¶
func (compositor *PrintCompositor) HeaderFontName() string
HeaderFontName returns the name of the font used to print the page header.
The returned string must be freed with g_free().
The function returns the following values:
- utf8: new string containing the name of the font used to print the page header.
func (*PrintCompositor) HighlightSyntax ¶
func (compositor *PrintCompositor) HighlightSyntax() bool
HighlightSyntax determines whether the printed text will be highlighted according to the buffer rules.
Note that highlighting will happen only if the buffer to print has highlighting activated.
The function returns the following values:
- ok: TRUE if the printed output will be highlighted.
func (*PrintCompositor) IgnoreTag ¶
func (compositor *PrintCompositor) IgnoreTag(tag *gtk.TextTag)
IgnoreTag specifies a tag whose style should be ignored when compositing the document to the printable page.
The function takes the following parameters:
- tag: TextTag.
func (*PrintCompositor) LeftMargin ¶
func (compositor *PrintCompositor) LeftMargin(unit gtk.Unit) float64
LeftMargin gets the left margin in units of unit.
The function takes the following parameters:
- unit for the return value.
The function returns the following values:
- gdouble: left margin.
func (*PrintCompositor) LineNumbersFontName ¶
func (compositor *PrintCompositor) LineNumbersFontName() string
LineNumbersFontName returns the name of the font used to print line numbers on the left margin.
The returned string must be freed with g_free().
The function returns the following values:
- utf8: new string containing the name of the font used to print line numbers on the left margin.
func (*PrintCompositor) NPages ¶
func (compositor *PrintCompositor) NPages() int
NPages returns the number of pages in the document or <code>-1</code> if the document has not been completely paginated.
The function returns the following values:
- gint: number of pages in the document or <code>-1</code> if the document has not been completely paginated.
func (*PrintCompositor) Paginate ¶
func (compositor *PrintCompositor) Paginate(context *gtk.PrintContext) bool
Paginate the document associated with the compositor.
In order to support non-blocking pagination, document is paginated in small chunks. Each time printcompositor.Paginate is invoked, a chunk of the document is paginated. To paginate the entire document, printcompositor.Paginate must be invoked multiple times. It returns TRUE if the document has been completely paginated, otherwise it returns FALSE.
This method has been designed to be invoked in the handler of the gtk.PrintOperation::paginate signal, as shown in the following example:
// Signal handler for the GtkPrintOperation::paginate signal static gboolean paginate (GtkPrintOperation *operation, GtkPrintContext *context, gpointer user_data) { GtkSourcePrintCompositor *compositor; compositor = GTK_SOURCE_PRINT_COMPOSITOR (user_data); if (gtk_source_print_compositor_paginate (compositor, context)) { gint n_pages; n_pages = gtk_source_print_compositor_get_n_pages (compositor); gtk_print_operation_set_n_pages (operation, n_pages); return TRUE; } return FALSE; }
If you don't need to do pagination in chunks, you can simply do it all in the gtk.PrintOperation::begin-print handler, and set the number of pages from there, like in the following example:
// Signal handler for the GtkPrintOperation::begin-print signal static void begin_print (GtkPrintOperation *operation, GtkPrintContext *context, gpointer user_data) { GtkSourcePrintCompositor *compositor; gint n_pages; compositor = GTK_SOURCE_PRINT_COMPOSITOR (user_data); while (!gtk_source_print_compositor_paginate (compositor, context)); n_pages = gtk_source_print_compositor_get_n_pages (compositor); gtk_print_operation_set_n_pages (operation, n_pages); }.
The function takes the following parameters:
- context whose parameters (e.g. paper size, print margins, etc.) are used by the the compositor to paginate the document.
The function returns the following values:
- ok: TRUE if the document has been completely paginated, FALSE otherwise.
func (*PrintCompositor) PaginationProgress ¶
func (compositor *PrintCompositor) PaginationProgress() float64
PaginationProgress returns the current fraction of the document pagination that has been completed.
The function returns the following values:
- gdouble: fraction from 0.0 to 1.0 inclusive.
func (*PrintCompositor) PrintFooter ¶
func (compositor *PrintCompositor) PrintFooter() bool
PrintFooter determines if a footer is set to be printed for each page.
A footer will be printed if this function returns TRUE **and** some format strings have been specified with printcompositor.SetFooterFormat.
The function returns the following values:
- ok: TRUE if the footer is set to be printed.
func (*PrintCompositor) PrintHeader ¶
func (compositor *PrintCompositor) PrintHeader() bool
PrintHeader determines if a header is set to be printed for each page.
A header will be printed if this function returns TRUE **and** some format strings have been specified with printcompositor.SetHeaderFormat.
The function returns the following values:
- ok: TRUE if the header is set to be printed.
func (*PrintCompositor) PrintLineNumbers ¶
func (compositor *PrintCompositor) PrintLineNumbers() uint
PrintLineNumbers returns the interval used for line number printing.
If the value is 0, no line numbers will be printed. The default value is 1 (i.e. numbers printed in all lines).
The function returns the following values:
- guint: interval of printed line numbers.
func (*PrintCompositor) RightMargin ¶
func (compositor *PrintCompositor) RightMargin(unit gtk.Unit) float64
RightMargin gets the right margin in units of unit.
The function takes the following parameters:
- unit for the return value.
The function returns the following values:
- gdouble: right margin.
func (*PrintCompositor) SetBodyFontName ¶
func (compositor *PrintCompositor) SetBodyFontName(fontName string)
SetBodyFontName sets the default font for the printed text.
font_name should be a string representation of a font description Pango can understand. (e.g. "Monospace 10"). See pango.FontDescription().FromString for a description of the format of the string representation.
This function cannot be called anymore after the first call to the printcompositor.Paginate function.
The function takes the following parameters:
- fontName: name of the default font for the body text.
func (*PrintCompositor) SetBottomMargin ¶
func (compositor *PrintCompositor) SetBottomMargin(margin float64, unit gtk.Unit)
SetBottomMargin sets the bottom margin used by compositor.
The function takes the following parameters:
- margin: new bottom margin in units of unit.
- unit units for margin.
func (*PrintCompositor) SetFooterFontName ¶
func (compositor *PrintCompositor) SetFooterFontName(fontName string)
SetFooterFontName sets the font for printing the page footer.
If NULL is supplied, the default font (i.e. the one being used for the text) will be used instead.
font_name should be a string representation of a font description Pango can understand. (e.g. "Monospace 10"). See pango.FontDescription().FromString for a description of the format of the string representation.
This function cannot be called anymore after the first call to the printcompositor.Paginate function.
The function takes the following parameters:
- fontName (optional): name of the font for the footer text, or NULL.
func (*PrintCompositor) SetFooterFormat ¶
func (compositor *PrintCompositor) SetFooterFormat(separator bool, left, center, right string)
SetFooterFormat: see printcompositor.SetHeaderFormat for more information about the parameters.
The function takes the following parameters:
- separator: TRUE if you want a separator line to be printed.
- left (optional): format string to print on the left of the footer.
- center (optional): format string to print on the center of the footer.
- right (optional): format string to print on the right of the footer.
func (*PrintCompositor) SetHeaderFontName ¶
func (compositor *PrintCompositor) SetHeaderFontName(fontName string)
SetHeaderFontName sets the font for printing the page header.
If NULL is supplied, the default font (i.e. the one being used for the text) will be used instead.
font_name should be a string representation of a font description Pango can understand. (e.g. "Monospace 10"). See pango.FontDescription().FromString for a description of the format of the string representation.
This function cannot be called anymore after the first call to the printcompositor.Paginate function.
The function takes the following parameters:
- fontName (optional): name of the font for header text, or NULL.
func (*PrintCompositor) SetHeaderFormat ¶
func (compositor *PrintCompositor) SetHeaderFormat(separator bool, left, center, right string)
SetHeaderFormat sets strftime like header format strings, to be printed on the left, center and right of the top of each page.
The strings may include strftime(3) codes which will be expanded at print time. A subset of strftime() codes are accepted, see glib.DateTime.Format() for more details on the accepted format specifiers. Additionally the following format specifiers are accepted:
- #N: the page number
- #Q: the page count.
separator specifies if a solid line should be drawn to separate the header from the document text.
If NULL is given for any of the three arguments, that particular string will not be printed.
For the header to be printed, in addition to specifying format strings, you need to enable header printing with printcompositor.SetPrintHeader.
This function cannot be called anymore after the first call to the printcompositor.Paginate function.
The function takes the following parameters:
- separator: TRUE if you want a separator line to be printed.
- left (optional): format string to print on the left of the header.
- center (optional): format string to print on the center of the header.
- right (optional): format string to print on the right of the header.
func (*PrintCompositor) SetHighlightSyntax ¶
func (compositor *PrintCompositor) SetHighlightSyntax(highlight bool)
SetHighlightSyntax sets whether the printed text will be highlighted according to the buffer rules. Both color and font style are applied.
This function cannot be called anymore after the first call to the printcompositor.Paginate function.
The function takes the following parameters:
- highlight: whether syntax should be highlighted.
func (*PrintCompositor) SetLeftMargin ¶
func (compositor *PrintCompositor) SetLeftMargin(margin float64, unit gtk.Unit)
SetLeftMargin sets the left margin used by compositor.
The function takes the following parameters:
- margin: new left margin in units of unit.
- unit units for margin.
func (*PrintCompositor) SetLineNumbersFontName ¶
func (compositor *PrintCompositor) SetLineNumbersFontName(fontName string)
SetLineNumbersFontName sets the font for printing line numbers on the left margin.
If NULL is supplied, the default font (i.e. the one being used for the text) will be used instead.
font_name should be a string representation of a font description Pango can understand. (e.g. "Monospace 10"). See pango.FontDescription().FromString for a description of the format of the string representation.
This function cannot be called anymore after the first call to the printcompositor.Paginate function.
The function takes the following parameters:
- fontName (optional): name of the font for line numbers, or NULL.
func (*PrintCompositor) SetPrintFooter ¶
func (compositor *PrintCompositor) SetPrintFooter(print bool)
SetPrintFooter sets whether you want to print a footer in each page.
The footer consists of three pieces of text and an optional line separator, configurable with printcompositor.SetFooterFormat.
Note that by default the footer format is unspecified, and if it's empty it will not be printed, regardless of this setting.
This function cannot be called anymore after the first call to the printcompositor.Paginate function.
The function takes the following parameters:
- print: TRUE if you want the footer to be printed.
func (*PrintCompositor) SetPrintHeader ¶
func (compositor *PrintCompositor) SetPrintHeader(print bool)
SetPrintHeader sets whether you want to print a header in each page.
The header consists of three pieces of text and an optional line separator, configurable with printcompositor.SetHeaderFormat.
Note that by default the header format is unspecified, and if it's empty it will not be printed, regardless of this setting.
This function cannot be called anymore after the first call to the printcompositor.Paginate function.
The function takes the following parameters:
- print: TRUE if you want the header to be printed.
func (*PrintCompositor) SetPrintLineNumbers ¶
func (compositor *PrintCompositor) SetPrintLineNumbers(interval uint)
SetPrintLineNumbers sets the interval for printed line numbers.
If interval is 0 no numbers will be printed. If greater than 0, a number will be printed every interval lines (i.e. 1 will print all line numbers).
Maximum accepted value for interval is 100.
This function cannot be called anymore after the first call to the printcompositor.Paginate function.
The function takes the following parameters:
- interval for printed line numbers.
func (*PrintCompositor) SetRightMargin ¶
func (compositor *PrintCompositor) SetRightMargin(margin float64, unit gtk.Unit)
SetRightMargin sets the right margin used by compositor.
The function takes the following parameters:
- margin: new right margin in units of unit.
- unit units for margin.
func (*PrintCompositor) SetTabWidth ¶
func (compositor *PrintCompositor) SetTabWidth(width uint)
SetTabWidth sets the width of tabulation in characters for printed text.
This function cannot be called anymore after the first call to the printcompositor.Paginate function.
The function takes the following parameters:
- width of tab in characters.
func (*PrintCompositor) SetTopMargin ¶
func (compositor *PrintCompositor) SetTopMargin(margin float64, unit gtk.Unit)
SetTopMargin sets the top margin used by compositor.
The function takes the following parameters:
- margin: new top margin in units of unit.
- unit units for margin.
func (*PrintCompositor) SetWrapMode ¶
func (compositor *PrintCompositor) SetWrapMode(wrapMode gtk.WrapMode)
SetWrapMode sets the line wrapping mode for the printed text.
This function cannot be called anymore after the first call to the printcompositor.Paginate function.
The function takes the following parameters:
- wrapMode: WrapMode.
func (*PrintCompositor) TabWidth ¶
func (compositor *PrintCompositor) TabWidth() uint
TabWidth returns the width of tabulation in characters for printed text.
The function returns the following values:
- guint: width of tab.
func (*PrintCompositor) TopMargin ¶
func (compositor *PrintCompositor) TopMargin(unit gtk.Unit) float64
TopMargin gets the top margin in units of unit.
The function takes the following parameters:
- unit for the return value.
The function returns the following values:
- gdouble: top margin.
func (*PrintCompositor) WrapMode ¶
func (compositor *PrintCompositor) WrapMode() gtk.WrapMode
WrapMode gets the line wrapping mode for the printed text.
The function returns the following values:
- wrapMode: line wrap mode.
type PrintCompositorClass ¶
type PrintCompositorClass struct {
// contains filtered or unexported fields
}
PrintCompositorClass: instance of this type is always passed by reference.
type PrintCompositorOverrides ¶
type PrintCompositorOverrides struct { }
PrintCompositorOverrides contains methods that are overridable.
type Region ¶
Region utility.
A GtkSourceRegion permits to store a group of subregions of a gtk.TextBuffer. GtkSourceRegion stores the subregions with pairs of gtk.TextMark's, so the region is still valid after insertions and deletions in the gtk.TextBuffer.
The gtk.TextMark for the start of a subregion has a left gravity, while the gtk.TextMark for the end of a subregion has a right gravity.
The typical use-case of GtkSourceRegion is to scan a gtk.TextBuffer chunk by chunk, not the whole buffer at once to not block the user interface. The GtkSourceRegion represents in that case the remaining region to scan. You can listen to the gtk.TextBuffer::insert-text and gtk.TextBuffer::delete-range signals to update the GtkSourceRegion accordingly.
To iterate through the subregions, you need to use a regioniter, for example:
GtkSourceRegion *region; GtkSourceRegionIter region_iter; gtk_source_region_get_start_region_iter (region, ®ion_iter); while (!gtk_source_region_iter_is_end (®ion_iter)) { GtkTextIter subregion_start; GtkTextIter subregion_end; if (!gtk_source_region_iter_get_subregion (®ion_iter, &subregion_start, &subregion_end)) { break; } // Do something useful with the subregion. gtk_source_region_iter_next (®ion_iter); }.
func NewRegion ¶
func NewRegion(buffer *gtk.TextBuffer) *Region
The function takes the following parameters:
- buffer: TextBuffer.
The function returns the following values:
- region: new SourceRegion object for buffer.
func (*Region) AddRegion ¶
AddRegion adds region_to_add to region.
region_to_add is not modified.
The function takes the following parameters:
- regionToAdd (optional) to add to region, or NULL.
func (*Region) AddSubregion ¶
func (region *Region) AddSubregion(Start, End *gtk.TextIter)
AddSubregion adds the subregion delimited by _start and _end to region.
The function takes the following parameters:
- Start: start of the subregion.
- End: end of the subregion.
func (*Region) Bounds ¶
Bounds gets the start and end bounds of the region.
The function returns the following values:
- start (optional): iterator to initialize with the start of region, or NULL.
- end (optional): iterator to initialize with the end of region, or NULL.
- ok: TRUE if start and end have been set successfully (if non-NULL), or FALSE if the region is empty.
func (*Region) Buffer ¶
func (region *Region) Buffer() *gtk.TextBuffer
The function returns the following values:
- textBuffer (optional): TextBuffer.
func (*Region) IntersectRegion ¶
IntersectRegion returns the intersection between region1 and region2.
region1 and region2 are not modified.
The function takes the following parameters:
- region2 (optional) or NULL.
The function returns the following values:
- region (optional): intersection as a SourceRegion object.
func (*Region) IntersectSubregion ¶
IntersectSubregion returns the intersection between region and the subregion delimited by _start and _end.
region is not modified.
The function takes the following parameters:
- Start: start of the subregion.
- End: end of the subregion.
The function returns the following values:
- ret (optional): intersection as a new SourceRegion.
func (*Region) IsEmpty ¶
IsEmpty returns whether the region is empty.
A NULL region is considered empty.
The function returns the following values:
- ok: whether the region is empty.
func (*Region) StartRegionIter ¶
func (region *Region) StartRegionIter() *RegionIter
StartRegionIter initializes a regioniter to the first subregion of region.
If region is empty, iter will be initialized to the end iterator.
The function returns the following values:
- iter: iterator to initialize to the first subregion.
func (*Region) String ¶
String gets a string represention of region, for debugging purposes.
The returned string contains the character offsets of the subregions. It doesn't include a newline character at the end of the string.
The function returns the following values:
- utf8 (optional): string represention of region. Free with g_free() when no longer needed.
func (*Region) SubtractRegion ¶
SubtractRegion subtracts region_to_subtract from region.
region_to_subtract is not modified.
The function takes the following parameters:
- regionToSubtract (optional) to subtract from region, or NULL.
func (*Region) SubtractSubregion ¶
func (region *Region) SubtractSubregion(Start, End *gtk.TextIter)
SubtractSubregion subtracts the subregion delimited by _start and _end from region.
The function takes the following parameters:
- Start: start of the subregion.
- End: end of the subregion.
type RegionClass ¶
type RegionClass struct {
// contains filtered or unexported fields
}
RegionClass: instance of this type is always passed by reference.
type RegionIter ¶
type RegionIter struct {
// contains filtered or unexported fields
}
RegionIter: opaque datatype.
Ignore all its fields and initialize the iter with region.GetStartRegionIter.
An instance of this type is always passed by reference.
func (*RegionIter) IsEnd ¶
func (iter *RegionIter) IsEnd() bool
The function returns the following values:
- ok: whether iter is the end iterator.
func (*RegionIter) Next ¶
func (iter *RegionIter) Next() bool
Next moves iter to the next subregion.
The function returns the following values:
- ok: TRUE if iter moved and is dereferenceable, or FALSE if iter has been set to the end iterator.
func (*RegionIter) Subregion ¶
func (iter *RegionIter) Subregion() (start *gtk.TextIter, end *gtk.TextIter, ok bool)
Subregion gets the subregion at this iterator.
The function returns the following values:
- start (optional): iterator to initialize with the subregion start, or NULL.
- end (optional): iterator to initialize with the subregion end, or NULL.
- ok: TRUE if start and end have been set successfully (if non-NULL), or FALSE if iter is the end iterator or if the region is empty.
type RegionOverrides ¶
type RegionOverrides struct { }
RegionOverrides contains methods that are overridable.
type SchedulerCallback ¶
SchedulerCallback: this function is called incrementally to process additional background work. A deadline is provided which can be checked using glib.GetMonotonicTime() so that additional work can be processed each frame.
This is useful for situations where you are incrementally performing background work such as spell checking or semantic syntax highlighting.
type SearchContext ¶
SearchContext: search context.
A GtkSourceSearchContext is used for the search and replace in a buffer. The search settings are represented by a searchsettings object. There can be a many-to-many relationship between buffers and search settings, with the search contexts in-between: a search settings object can be shared between several search contexts; and a buffer can contain several search contexts at the same time.
The total number of search occurrences can be retrieved with searchcontext.GetOccurrencesCount. To know the position of a certain match, use searchcontext.GetOccurrencePosition.
The buffer is scanned asynchronously, so it doesn't block the user interface. For each search, the buffer is scanned at most once. After that, navigating through the occurrences doesn't require to re-scan the buffer entirely.
To search forward, use searchcontext.Forward or searchcontext.ForwardAsync for the asynchronous version. The backward search is done similarly. To replace a search match, or all matches, use searchcontext.Replace and searchcontext.ReplaceAll.
The search occurrences are highlighted by default. To disable it, use searchcontext.SetHighlight. You can enable the search highlighting for several GtkSourceSearchContexts attached to the same buffer. Moreover, each of those GtkSourceSearchContexts can have a different text style associated. Use searchcontext.SetMatchStyle to specify the style to apply on search matches.
Note that the searchcontext:highlight and searchcontext:match-style properties are in the GtkSourceSearchContext class, not searchsettings. Appearance settings should be tied to one, and only one buffer, as different buffers can have different style scheme associated (a searchsettings object can be bound indirectly to several buffers).
The concept of "current match" doesn't exist yet. A way to highlight differently the current match is to select it.
A search occurrence's position doesn't depend on the cursor position or other parameters. Take for instance the buffer "aaaa" with the search text "aa". The two occurrences are at positions [0:2] and [2:4]. If you begin to search at position 1, you will get the occurrence [2:4], not [1:3]. This is a prerequisite for regular expression searches. The pattern ".*" matches the entire line. If the cursor is at the middle of the line, you don't want the rest of the line as the occurrence, you want an entire line. (As a side note, regular expression searches can also match multiple lines.)
In the GtkSourceView source code, there is an example of how to use the search and replace API: see the tests/test-search.c file. It is a mini application for the search and replace, with a basic user interface.
func NewSearchContext ¶
func NewSearchContext(buffer *Buffer, settings *SearchSettings) *SearchContext
NewSearchContext creates a new search context, associated with buffer, and customized with settings.
If settings is NULL, a new searchsettings object will be created, that you can retrieve with searchcontext.GetSettings.
The function takes the following parameters:
- buffer: SourceBuffer.
- settings (optional) or NULL.
The function returns the following values:
- searchContext: new search context.
func (*SearchContext) Backward ¶
func (search *SearchContext) Backward(iter *gtk.TextIter) (matchStart, matchEnd *gtk.TextIter, hasWrappedAround, ok bool)
Backward synchronous backward search.
It is recommended to use the asynchronous functions instead, to not block the user interface. However, if you are sure that the buffer is small, this function is more convenient to use.
If the searchsettings:wrap-around property is FALSE, this function doesn't try to wrap around.
The has_wrapped_around out parameter is set independently of whether a match is found. So if this function returns FALSE, has_wrapped_around will have the same value as the searchsettings:wrap-around property.
The function takes the following parameters:
- iter: start of search.
The function returns the following values:
- matchStart (optional): return location for start of match, or NULL.
- matchEnd (optional): return location for end of match, or NULL.
- hasWrappedAround (optional): return location to know whether the search has wrapped around, or NULL.
- ok: whether a match was found.
func (*SearchContext) BackwardFinish ¶
func (search *SearchContext) BackwardFinish(result gio.AsyncResulter) (matchStart, matchEnd *gtk.TextIter, hasWrappedAround bool, goerr error)
BackwardFinish finishes a backward search started with searchcontext.BackwardAsync.
See the documentation of searchcontext.Backward for more details.
The function takes the following parameters:
- result: Result.
The function returns the following values:
- matchStart (optional): return location for start of match, or NULL.
- matchEnd (optional): return location for end of match, or NULL.
- hasWrappedAround (optional): return location to know whether the search has wrapped around, or NULL.
func (*SearchContext) Buffer ¶
func (search *SearchContext) Buffer() *Buffer
The function returns the following values:
- buffer: associated buffer.
func (*SearchContext) Forward ¶
func (search *SearchContext) Forward(iter *gtk.TextIter) (matchStart, matchEnd *gtk.TextIter, hasWrappedAround, ok bool)
Forward synchronous forward search.
It is recommended to use the asynchronous functions instead, to not block the user interface. However, if you are sure that the buffer is small, this function is more convenient to use.
If the searchsettings:wrap-around property is FALSE, this function doesn't try to wrap around.
The has_wrapped_around out parameter is set independently of whether a match is found. So if this function returns FALSE, has_wrapped_around will have the same value as the searchsettings:wrap-around property.
The function takes the following parameters:
- iter: start of search.
The function returns the following values:
- matchStart (optional): return location for start of match, or NULL.
- matchEnd (optional): return location for end of match, or NULL.
- hasWrappedAround (optional): return location to know whether the search has wrapped around, or NULL.
- ok: whether a match was found.
func (*SearchContext) ForwardFinish ¶
func (search *SearchContext) ForwardFinish(result gio.AsyncResulter) (matchStart, matchEnd *gtk.TextIter, hasWrappedAround bool, goerr error)
ForwardFinish finishes a forward search started with searchcontext.ForwardAsync.
See the documentation of searchcontext.Forward for more details.
The function takes the following parameters:
- result: Result.
The function returns the following values:
- matchStart (optional): return location for start of match, or NULL.
- matchEnd (optional): return location for end of match, or NULL.
- hasWrappedAround (optional): return location to know whether the search has wrapped around, or NULL.
func (*SearchContext) Highlight ¶
func (search *SearchContext) Highlight() bool
The function returns the following values:
- ok: whether to highlight the search occurrences.
func (*SearchContext) MatchStyle ¶
func (search *SearchContext) MatchStyle() *Style
The function returns the following values:
- style to apply on search matches.
func (*SearchContext) OccurrencePosition ¶
func (search *SearchContext) OccurrencePosition(matchStart, matchEnd *gtk.TextIter) int
OccurrencePosition gets the position of a search occurrence.
If the buffer is not already fully scanned, the position may be unknown, and -1 is returned. If 0 is returned, it means that this part of the buffer has already been scanned, and that match_start and match_end don't delimit an occurrence.
The function takes the following parameters:
- matchStart: start of the occurrence.
- matchEnd: end of the occurrence.
The function returns the following values:
- gint: position of the search occurrence. The first occurrence has the position 1 (not 0). Returns 0 if match_start and match_end don't delimit an occurrence. Returns -1 if the position is not yet known.
func (*SearchContext) OccurrencesCount ¶
func (search *SearchContext) OccurrencesCount() int
OccurrencesCount gets the total number of search occurrences.
If the buffer is not already fully scanned, the total number of occurrences is unknown, and -1 is returned.
The function returns the following values:
- gint: total number of search occurrences, or -1 if unknown.
func (*SearchContext) RegexError ¶
func (search *SearchContext) RegexError() error
RegexError: regular expression patterns must follow certain rules. If searchsettings:search-text breaks a rule, the error can be retrieved with this function.
The error domain is glib.RegexError.
Free the return value with glib.Error.Free().
The function returns the following values:
- err (optional) or NULL if the pattern is valid.
func (*SearchContext) Replace ¶
func (search *SearchContext) Replace(matchStart, matchEnd *gtk.TextIter, replace string, replaceLength int) error
Replace replaces a search match by another text. If match_start and match_end doesn't correspond to a search match, FALSE is returned.
match_start and match_end iters are revalidated to point to the replacement text boundaries.
For a regular expression replacement, you can check if replace is valid by calling glib.Regex().CheckReplacement. The replace text can contain backreferences.
The function takes the following parameters:
- matchStart: start of the match to replace.
- matchEnd: end of the match to replace.
- replace: replacement text.
- replaceLength: length of replace in bytes, or -1.
func (*SearchContext) ReplaceAll ¶
func (search *SearchContext) ReplaceAll(replace string, replaceLength int) (uint, error)
ReplaceAll replaces all search matches by another text.
It is a synchronous function, so it can block the user interface.
For a regular expression replacement, you can check if replace is valid by calling glib.Regex().CheckReplacement. The replace text can contain backreferences.
The function takes the following parameters:
- replace: replacement text.
- replaceLength: length of replace in bytes, or -1.
The function returns the following values:
- guint: number of replaced matches.
func (*SearchContext) SetHighlight ¶
func (search *SearchContext) SetHighlight(highlight bool)
SetHighlight enables or disables the search occurrences highlighting.
The function takes the following parameters:
- highlight: setting.
func (*SearchContext) SetMatchStyle ¶
func (search *SearchContext) SetMatchStyle(matchStyle *Style)
SetMatchStyle: set the style to apply on search matches.
If match_style is NULL, default theme's scheme 'match-style' will be used. To enable or disable the search highlighting, use searchcontext.SetHighlight.
The function takes the following parameters:
- matchStyle (optional) or NULL.
func (*SearchContext) Settings ¶
func (search *SearchContext) Settings() *SearchSettings
The function returns the following values:
- searchSettings: search settings.
type SearchContextClass ¶
type SearchContextClass struct {
// contains filtered or unexported fields
}
SearchContextClass: instance of this type is always passed by reference.
type SearchContextOverrides ¶
type SearchContextOverrides struct { }
SearchContextOverrides contains methods that are overridable.
type SearchSettings ¶
SearchSettings: search settings.
A GtkSourceSearchSettings object represents the settings of a search. The search settings can be associated with one or several searchcontexts.
func NewSearchSettings ¶
func NewSearchSettings() *SearchSettings
NewSearchSettings creates a new search settings object.
The function returns the following values:
- searchSettings: new search settings object.
func (*SearchSettings) AtWordBoundaries ¶
func (settings *SearchSettings) AtWordBoundaries() bool
The function returns the following values:
- ok: whether to search at word boundaries.
func (*SearchSettings) CaseSensitive ¶
func (settings *SearchSettings) CaseSensitive() bool
The function returns the following values:
- ok: whether the search is case sensitive.
func (*SearchSettings) RegexEnabled ¶
func (settings *SearchSettings) RegexEnabled() bool
The function returns the following values:
- ok: whether to search by regular expressions.
func (*SearchSettings) SearchText ¶
func (settings *SearchSettings) SearchText() string
SearchText gets the text to search.
The return value must not be freed.
You may be interested to call utils_escape_search_text after this function.
The function returns the following values:
- utf8 (optional): text to search, or NULL if the search is disabled.
func (*SearchSettings) SetAtWordBoundaries ¶
func (settings *SearchSettings) SetAtWordBoundaries(atWordBoundaries bool)
SetAtWordBoundaries: change whether the search is done at word boundaries.
If at_word_boundaries is TRUE, a search match must start and end a word. The match can span multiple words. See also gtk.TextIter.StartsWord() and gtk.TextIter.EndsWord().
The function takes the following parameters:
- atWordBoundaries: setting.
func (*SearchSettings) SetCaseSensitive ¶
func (settings *SearchSettings) SetCaseSensitive(caseSensitive bool)
SetCaseSensitive enables or disables the case sensitivity for the search.
The function takes the following parameters:
- caseSensitive: setting.
func (*SearchSettings) SetRegexEnabled ¶
func (settings *SearchSettings) SetRegexEnabled(regexEnabled bool)
SetRegexEnabled enables or disables whether to search by regular expressions.
If enabled, the searchsettings:search-text property contains the pattern of the regular expression.
searchcontext uses #GRegex when regex search is enabled. See the Regular expression syntax (https://developer.gnome.org/glib/stable/glib-regex-syntax.html) page in the GLib reference manual.
The function takes the following parameters:
- regexEnabled: setting.
func (*SearchSettings) SetSearchText ¶
func (settings *SearchSettings) SetSearchText(searchText string)
SetSearchText sets the text to search.
If search_text is NULL or is empty, the search will be disabled. A copy of search_text will be made, so you can safely free search_text after a call to this function.
You may be interested to call utils_unescape_search_text before this function.
The function takes the following parameters:
- searchText (optional): nul-terminated text to search, or NULL to disable the search.
func (*SearchSettings) SetWrapAround ¶
func (settings *SearchSettings) SetWrapAround(wrapAround bool)
SetWrapAround enables or disables the wrap around search.
If wrap_around is TRUE, the forward search continues at the beginning of the buffer if no search occurrences are found. Similarly, the backward search continues to search at the end of the buffer.
The function takes the following parameters:
- wrapAround: setting.
func (*SearchSettings) WrapAround ¶
func (settings *SearchSettings) WrapAround() bool
The function returns the following values:
- ok: whether to wrap around the search.
type SearchSettingsClass ¶
type SearchSettingsClass struct {
// contains filtered or unexported fields
}
SearchSettingsClass: instance of this type is always passed by reference.
type SearchSettingsOverrides ¶
type SearchSettingsOverrides struct { }
SearchSettingsOverrides contains methods that are overridable.
type SmartHomeEndType ¶
const ( // SourceSmartHomeEndDisabled: smart-home-end disabled. SourceSmartHomeEndDisabled SmartHomeEndType = iota // SourceSmartHomeEndBefore: move to the first/last non-whitespace character // on the first press of the HOME/END keys and to the beginning/end of the // line on the second press. SourceSmartHomeEndBefore // SourceSmartHomeEndAfter: move to the beginning/end of the line on the // first press of the HOME/END keys and to the first/last non-whitespace // character on the second press. SourceSmartHomeEndAfter // SourceSmartHomeEndAlways always move to the first/last non-whitespace // character when the HOME/END keys are pressed. SourceSmartHomeEndAlways )
func (SmartHomeEndType) String ¶
func (s SmartHomeEndType) String() string
String returns the name in string for SmartHomeEndType.
type Snippet ¶
Snippet: quick insertion code snippets.
The GtkSourceSnippet represents a series of chunks that can quickly be inserted into the view.
Snippets are defined in XML files which are loaded by the snippetmanager. Alternatively, applications can create snippets on demand and insert them into the view using view.PushSnippet.
Snippet chunks can reference other snippet chunks as well as post-process the values from other chunks such as capitalization.
func NewSnippet ¶
NewSnippet creates a new SourceSnippet.
The function takes the following parameters:
- trigger (optional) word.
- languageId (optional): source language.
The function returns the following values:
- snippet: new SourceSnippet.
func NewSnippetParsed ¶
NewSnippetParsed parses the snippet formatted text into a series of chunks and adds them to a new SourceSnippet.
The function takes the following parameters:
- text: formatted snippet text to parse.
The function returns the following values:
- snippet: newly parsed SourceSnippet, or NULL upon failure and error is set.
func (*Snippet) AddChunk ¶
func (snippet *Snippet) AddChunk(chunk *SnippetChunk)
AddChunk appends chunk to the snippet.
This may only be called before the snippet has been expanded.
The function takes the following parameters:
- chunk: SourceSnippetChunk.
func (*Snippet) Context ¶
func (snippet *Snippet) Context() *SnippetContext
Context gets the context used for expanding the snippet.
The function returns the following values:
- snippetContext (optional): SourceSnippetContext.
func (*Snippet) Copy ¶
Copy does a deep copy of the snippet.
The function returns the following values:
- ret: new SourceSnippet.
func (*Snippet) Description ¶
Description gets the description for the snippet.
The function returns the following values:
func (*Snippet) FocusPosition ¶
FocusPosition gets the current focus for the snippet.
This is changed as the user tabs through focus locations.
The function returns the following values:
- gint focus position, or -1 if unset.
func (*Snippet) LanguageID ¶
LanguageID gets the language-id used for the source snippet.
The language identifier should be one that matches a source language language:id property.
The function returns the following values:
- utf8: language identifier.
func (*Snippet) NChunks ¶
NChunks gets the number of chunks in the snippet.
Note that not all chunks are editable.
The function returns the following values:
- guint: number of chunks.
func (*Snippet) Name ¶
Name gets the name for the snippet.
The function returns the following values:
func (*Snippet) NthChunk ¶
func (snippet *Snippet) NthChunk(nth uint) *SnippetChunk
NthChunk gets the chunk at nth.
The function takes the following parameters:
- nth chunk to get.
The function returns the following values:
- snippetChunk: SourceSnippetChunk.
func (*Snippet) SetDescription ¶
SetDescription sets the description for the snippet.
The function takes the following parameters:
- description: snippet description.
func (*Snippet) SetLanguageID ¶
SetLanguageID sets the language identifier for the snippet.
This should match the language:id identifier.
The function takes the following parameters:
- languageId: language identifier for the snippet.
func (*Snippet) SetName ¶
SetName sets the name for the snippet.
The function takes the following parameters:
- name: snippet name.
func (*Snippet) SetTrigger ¶
SetTrigger sets the trigger for the snippet.
The function takes the following parameters:
- trigger word.
type SnippetChunk ¶
type SnippetChunk struct { coreglib.InitiallyUnowned // contains filtered or unexported fields }
SnippetChunk: chunk of text within the source snippet.
The GtkSourceSnippetChunk represents a single chunk of text that may or may not be an edit point within the snippet. Chunks that are an edit point (also called a tab stop) have the snippetchunk:focus-position property set.
func NewSnippetChunk ¶
func NewSnippetChunk() *SnippetChunk
NewSnippetChunk: create a new GtkSourceSnippetChunk that can be added to a snippet.
The function returns the following values:
func (*SnippetChunk) Context ¶
func (chunk *SnippetChunk) Context() *SnippetContext
Context gets the context for the snippet insertion.
The function returns the following values:
- snippetContext: SourceSnippetContext.
func (*SnippetChunk) Copy ¶
func (chunk *SnippetChunk) Copy() *SnippetChunk
Copy copies the source snippet.
The function returns the following values:
- snippetChunk: SourceSnippetChunk.
func (*SnippetChunk) FocusPosition ¶
func (chunk *SnippetChunk) FocusPosition() int
FocusPosition gets the snippetchunk:focus-position.
The focus-position is used to determine how many tabs it takes for the snippet to advanced to this chunk.
A focus-position of zero will be the last focus position of the snippet and snippet editing ends when it has been reached.
A focus-position of -1 means the chunk cannot be focused by the user.
The function returns the following values:
- gint: focus-position.
func (*SnippetChunk) SetContext ¶
func (chunk *SnippetChunk) SetContext(context *SnippetContext)
The function takes the following parameters:
func (*SnippetChunk) SetFocusPosition ¶
func (chunk *SnippetChunk) SetFocusPosition(focusPosition int)
SetFocusPosition sets the snippetchunk:focus-position property.
The focus-position is used to determine how many tabs it takes for the snippet to advanced to this chunk.
A focus-position of zero will be the last focus position of the snippet and snippet editing ends when it has been reached.
A focus-position of -1 means the chunk cannot be focused by the user.
The function takes the following parameters:
- focusPosition: focus-position.
func (*SnippetChunk) SetSpec ¶
func (chunk *SnippetChunk) SetSpec(spec string)
SetSpec sets the specification for the chunk.
The specification is evaluated for variables when other chunks are edited within the snippet context. If the user has changed the text, the snippetchunk:text and snippetchunk:text-set properties are updated.
The function takes the following parameters:
- spec: new specification for the chunk.
func (*SnippetChunk) SetText ¶
func (chunk *SnippetChunk) SetText(text string)
SetText sets the text for the snippet chunk.
This is usually used by the snippet engine to update the text, but may be useful when creating custom snippets to avoid expansion of any specification.
The function takes the following parameters:
- text of the property.
func (*SnippetChunk) SetTextSet ¶
func (chunk *SnippetChunk) SetTextSet(textSet bool)
SetTextSet sets the snippetchunk:text-set property.
This is typically set when the user has edited a snippet chunk by the snippet engine.
The function takes the following parameters:
- textSet: property value.
func (*SnippetChunk) SetTooltipText ¶
func (chunk *SnippetChunk) SetTooltipText(tooltipText string)
The function takes the following parameters:
func (*SnippetChunk) Spec ¶
func (chunk *SnippetChunk) Spec() string
Spec gets the specification for the chunk.
The specification is evaluated for variables when other chunks are edited within the snippet context. If the user has changed the text, the snippetchunk:text and snippetchunk:text-set properties are updated.
The function returns the following values:
- utf8 (optional): specification, if any.
func (*SnippetChunk) Text ¶
func (chunk *SnippetChunk) Text() string
Text gets the snippetchunk:text property.
The text property is updated when the user edits the text of the chunk. If it has not been edited, the snippetchunk:spec property is returned.
The function returns the following values:
- utf8: text of the chunk.
func (*SnippetChunk) TextSet ¶
func (chunk *SnippetChunk) TextSet() bool
TextSet gets the snippetchunk:text-set property.
This is typically set when the user has edited a snippet chunk.
The function returns the following values:
func (*SnippetChunk) TooltipText ¶
func (chunk *SnippetChunk) TooltipText() string
The function returns the following values:
type SnippetChunkClass ¶
type SnippetChunkClass struct {
// contains filtered or unexported fields
}
SnippetChunkClass: instance of this type is always passed by reference.
type SnippetChunkOverrides ¶
type SnippetChunkOverrides struct { }
SnippetChunkOverrides contains methods that are overridable.
type SnippetClass ¶
type SnippetClass struct {
// contains filtered or unexported fields
}
SnippetClass: instance of this type is always passed by reference.
type SnippetContext ¶
SnippetContext: context for expanding snippetchunk.
This class is currently used primary as a hashtable. However, the longer term goal is to have it hold onto a GjsContext as well as other languages so that snippetchunk can expand themselves by executing script within the context.
The snippet will build the context and then expand each of the chunks during the insertion/edit phase.
func NewSnippetContext ¶
func NewSnippetContext() *SnippetContext
NewSnippetContext creates a new SourceSnippetContext.
Generally, this isn't needed unless you are controlling the expansion of snippets manually.
The function returns the following values:
- snippetContext: SourceSnippetContext.
func (*SnippetContext) ClearVariables ¶
func (self *SnippetContext) ClearVariables()
ClearVariables removes all variables from the context.
func (*SnippetContext) ConnectChanged ¶
func (self *SnippetContext) ConnectChanged(f func()) coreglib.SignalHandle
ConnectChanged: signal is emitted when a change has been discovered in one of the chunks of the snippet which has caused a variable or other dynamic data within the context to have changed.
func (*SnippetContext) Expand ¶
func (self *SnippetContext) Expand(input string) string
The function takes the following parameters:
The function returns the following values:
func (*SnippetContext) SetConstant ¶
func (self *SnippetContext) SetConstant(key, value string)
SetConstant sets a constatnt within the context.
This is similar to a variable set with snippetcontext.SetVariable but is expected to not change during use of the snippet.
Examples would be the date or users name.
The function takes the following parameters:
- key: constant name.
- value of the constant.
func (*SnippetContext) SetLinePrefix ¶
func (self *SnippetContext) SetLinePrefix(linePrefix string)
The function takes the following parameters:
func (*SnippetContext) SetTabWidth ¶
func (self *SnippetContext) SetTabWidth(tabWidth int)
The function takes the following parameters:
func (*SnippetContext) SetUseSpaces ¶
func (self *SnippetContext) SetUseSpaces(useSpaces bool)
The function takes the following parameters:
func (*SnippetContext) SetVariable ¶
func (self *SnippetContext) SetVariable(key, value string)
SetVariable sets a variable within the context.
This variable may be overridden by future updates to the context.
The function takes the following parameters:
- key: variable name.
- value for the variable.
func (*SnippetContext) Variable ¶
func (self *SnippetContext) Variable(key string) string
Variable gets the current value for a variable named key.
The function takes the following parameters:
- key: name of the variable.
The function returns the following values:
- utf8 (optional): value for the variable, or NULL.
type SnippetContextClass ¶
type SnippetContextClass struct {
// contains filtered or unexported fields
}
SnippetContextClass: instance of this type is always passed by reference.
type SnippetContextOverrides ¶
type SnippetContextOverrides struct { }
SnippetContextOverrides contains methods that are overridable.
type SnippetManager ¶
SnippetManager provides access to snippet.
GtkSourceSnippetManager is an object which processes snippet description files and creates snippet objects.
Use snippetmanager.GetDefault() to retrieve the default instance of GtkSourceSnippetManager.
Use snippetmanager.GetSnippet to retrieve snippets for a given snippets.
func SnippetManagerGetDefault ¶
func SnippetManagerGetDefault() *SnippetManager
SnippetManagerGetDefault returns the default SourceSnippetManager instance.
The function returns the following values:
- snippetManager which is owned by GtkSourceView library and must not be unref'd.
func (*SnippetManager) ListAll ¶
func (self *SnippetManager) ListAll() *gio.ListModel
ListAll gets a gio.ListModel of all snippets.
This can be used to get an unfiltered list of all of the snippets known to the snippet manager.
The function returns the following values:
- listModel: gio.ListModel of gtksource.Snippet.
func (*SnippetManager) ListGroups ¶
func (self *SnippetManager) ListGroups() []string
ListGroups: list all the known groups within the snippet manager.
The result should be freed with g_free(), and the individual strings are owned by self and should never be freed by the caller.
The function returns the following values:
- utf8s: An array of strings which should be freed with g_free().
func (*SnippetManager) ListMatching ¶
func (self *SnippetManager) ListMatching(group, languageId, triggerPrefix string) *gio.ListModel
ListMatching queries the known snippets for those matching group, language_id, and/or trigger_prefix.
If any of these are NULL, they will be ignored when filtering the available snippets.
The gio.ListModel only contains information about the available snippets until gio.ListModel.GetItem() is called for a specific snippet. This helps reduce the number of gobject.Object's that are created at runtime to those needed by the calling application.
The function takes the following parameters:
- group (optional) name or NULL.
- languageId (optional) or NULL.
- triggerPrefix (optional): prefix for a trigger to activate.
The function returns the following values:
- listModel of SourceSnippet.
func (*SnippetManager) SearchPath ¶
func (self *SnippetManager) SearchPath() []string
SearchPath gets the list directories where self looks for snippet files.
The function returns the following values:
- utf8s: NULL-terminated array containing a list of snippet files directories. The array is owned by lm and must not be modified.
func (*SnippetManager) SetSearchPath ¶
func (self *SnippetManager) SetSearchPath(dirs []string)
SetSearchPath sets the list of directories in which the GtkSourceSnippetManager looks for snippet files.
If dirs is NULL, the search path is reset to default.
At the moment this function can be called only before the snippet files are loaded for the first time. In practice to set a custom search path for a GtkSourceSnippetManager, you have to call this function right after creating it.
The function takes the following parameters:
- dirs (optional): NULL-terminated array of strings or NULL.
func (*SnippetManager) Snippet ¶
func (self *SnippetManager) Snippet(group, languageId, trigger string) *Snippet
Snippet queries the known snippets for the first matching group, language_id, and/or trigger.
If group or language_id are NULL, they will be ignored.
The function takes the following parameters:
- group (optional) name or NULL.
- languageId (optional) or NULL.
- trigger for the snippet.
The function returns the following values:
- snippet (optional) or NULL if no matching snippet was found.
type SnippetManagerClass ¶
type SnippetManagerClass struct {
// contains filtered or unexported fields
}
SnippetManagerClass: instance of this type is always passed by reference.
type SnippetManagerOverrides ¶
type SnippetManagerOverrides struct { }
SnippetManagerOverrides contains methods that are overridable.
type SnippetOverrides ¶
type SnippetOverrides struct { }
SnippetOverrides contains methods that are overridable.
type SortFlags ¶
const ( // SourceSortFlagsNone: no flags specified. SourceSortFlagsNone SortFlags = 0b0 // SourceSortFlagsCaseSensitive: case sensitive sort. SourceSortFlagsCaseSensitive SortFlags = 0b1 // SourceSortFlagsReverseOrder: sort in reverse order. SourceSortFlagsReverseOrder SortFlags = 0b10 // SourceSortFlagsRemoveDuplicates: remove duplicates. SourceSortFlagsRemoveDuplicates SortFlags = 0b100 )
type SpaceDrawer ¶
SpaceDrawer: represent white space characters with symbols.
SourceSpaceDrawer provides a way to visualize white spaces, by drawing symbols.
Call view.GetSpaceDrawer to get the GtkSourceSpaceDrawer instance of a certain view.
By default, no white spaces are drawn because the spacedrawer:enable-matrix is FALSE.
To draw white spaces, spacedrawer.SetTypesForLocations can be called to set the spacedrawer:matrix property (by default all space types are enabled at all locations). Then call spacedrawer.SetEnableMatrix.
For a finer-grained method, there is also the tag's tag:draw-spaces property.
Example ¶
To draw non-breaking spaces everywhere and draw all types of trailing spaces except newlines:
gtk_source_space_drawer_set_types_for_locations (space_drawer, GTK_SOURCE_SPACE_LOCATION_ALL, GTK_SOURCE_SPACE_TYPE_NBSP); gtk_source_space_drawer_set_types_for_locations (space_drawer, GTK_SOURCE_SPACE_LOCATION_TRAILING, GTK_SOURCE_SPACE_TYPE_ALL & ~GTK_SOURCE_SPACE_TYPE_NEWLINE); gtk_source_space_drawer_set_enable_matrix (space_drawer, TRUE);
Use-case: draw unwanted white spaces
A possible use-case is to draw only unwanted white spaces. Examples:
- Draw all trailing spaces.
- If the indentation and alignment must be done with spaces, draw tabs.
And non-breaking spaces can always be drawn, everywhere, to distinguish them from normal spaces.
func NewSpaceDrawer ¶
func NewSpaceDrawer() *SpaceDrawer
NewSpaceDrawer creates a new SourceSpaceDrawer object.
Useful for storing space drawing settings independently of a view.
The function returns the following values:
- spaceDrawer: new SourceSpaceDrawer.
func (*SpaceDrawer) BindMatrixSetting ¶
func (drawer *SpaceDrawer) BindMatrixSetting(settings *gio.Settings, key string, flags gio.SettingsBindFlags)
BindMatrixSetting binds the spacedrawer:matrix property to a gio.Settings key.
The gio.Settings key must be of the same type as the spacedrawer:matrix property, that is, "au".
The gio.Settings.Bind() function cannot be used, because the default GIO mapping functions don't support glib.Variant properties (maybe it will be supported by a future GIO version, in which case this function can be deprecated).
The function takes the following parameters:
- settings #GSettings object.
- key settings key to bind.
- flags for the binding.
func (*SpaceDrawer) EnableMatrix ¶
func (drawer *SpaceDrawer) EnableMatrix() bool
The function returns the following values:
- ok: whether the SourceSpaceDrawer:matrix property is enabled.
func (*SpaceDrawer) Matrix ¶
func (drawer *SpaceDrawer) Matrix() *glib.Variant
Matrix gets the value of the spacedrawer:matrix property, as a glib.Variant.
An empty array can be returned in case the matrix is a zero matrix.
The spacedrawer.GetTypesForLocations function may be more convenient to use.
The function returns the following values:
- variant value as a new floating #GVariant instance.
func (*SpaceDrawer) SetEnableMatrix ¶
func (drawer *SpaceDrawer) SetEnableMatrix(enableMatrix bool)
SetEnableMatrix sets whether the spacedrawer:matrix property is enabled.
The function takes the following parameters:
- enableMatrix: new value.
func (*SpaceDrawer) SetMatrix ¶
func (drawer *SpaceDrawer) SetMatrix(matrix *glib.Variant)
SetMatrix sets a new value to the spacedrawer:matrix property, as a glib.Variant.
If matrix is NULL, then an empty array is set.
If matrix is floating, it is consumed.
The spacedrawer.SetTypesForLocations function may be more convenient to use.
The function takes the following parameters:
- matrix (optional): new matrix value, or NULL.
func (*SpaceDrawer) SetTypesForLocations ¶
func (drawer *SpaceDrawer) SetTypesForLocations(locations SpaceLocationFlags, types SpaceTypeFlags)
SetTypesForLocations modifies the spacedrawer:matrix property at the specified locations.
The function takes the following parameters:
- locations: one or several SourceSpaceLocationFlags.
- types: combination of SourceSpaceTypeFlags.
func (*SpaceDrawer) TypesForLocations ¶
func (drawer *SpaceDrawer) TypesForLocations(locations SpaceLocationFlags) SpaceTypeFlags
TypesForLocations: if only one location is specified, this function returns what kind of white spaces are drawn at that location.
The value is retrieved from the spacedrawer:matrix property.
If several locations are specified, this function returns the logical AND for those locations. Which means that if a certain kind of white space is present in the return value, then that kind of white space is drawn at all the specified locations.
The function takes the following parameters:
- locations: one or several SourceSpaceLocationFlags.
The function returns the following values:
- spaceTypeFlags: combination of SourceSpaceTypeFlags.
type SpaceDrawerClass ¶
type SpaceDrawerClass struct {
// contains filtered or unexported fields
}
SpaceDrawerClass: instance of this type is always passed by reference.
type SpaceDrawerOverrides ¶
type SpaceDrawerOverrides struct { }
SpaceDrawerOverrides contains methods that are overridable.
type SpaceLocationFlags ¶
SpaceLocationFlags contains flags for white space locations.
If a line contains only white spaces (no text), the white spaces match both GTK_SOURCE_SPACE_LOCATION_LEADING and GTK_SOURCE_SPACE_LOCATION_TRAILING.
const ( // SourceSpaceLocationNone: no flags. SourceSpaceLocationNone SpaceLocationFlags = 0b0 // SourceSpaceLocationLeading: leading white spaces on a line, i.e. // the indentation. SourceSpaceLocationLeading SpaceLocationFlags = 0b1 // SourceSpaceLocationInsideText: white spaces inside a line of text. SourceSpaceLocationInsideText SpaceLocationFlags = 0b10 // SourceSpaceLocationTrailing: trailing white spaces on a line. SourceSpaceLocationTrailing SpaceLocationFlags = 0b100 // SourceSpaceLocationAll: white spaces anywhere. SourceSpaceLocationAll SpaceLocationFlags = 0b111 )
func (SpaceLocationFlags) Has ¶
func (s SpaceLocationFlags) Has(other SpaceLocationFlags) bool
Has returns true if s contains other.
func (SpaceLocationFlags) String ¶
func (s SpaceLocationFlags) String() string
String returns the names in string for SpaceLocationFlags.
type SpaceTypeFlags ¶
SpaceTypeFlags contains flags for white space types.
const ( // SourceSpaceTypeNone: no flags. SourceSpaceTypeNone SpaceTypeFlags = 0b0 // SourceSpaceTypeSpace: space character. SourceSpaceTypeSpace SpaceTypeFlags = 0b1 // SourceSpaceTypeTab: tab character. SourceSpaceTypeTab SpaceTypeFlags = 0b10 // SourceSpaceTypeNewline: line break character. If the // SourceBuffer:implicit-trailing-newline property is TRUE, // SourceSpaceDrawer also draws a line break at the end of the buffer. SourceSpaceTypeNewline SpaceTypeFlags = 0b100 // SourceSpaceTypeNbsp: non-breaking space character. SourceSpaceTypeNbsp SpaceTypeFlags = 0b1000 // SourceSpaceTypeAll: all white spaces. SourceSpaceTypeAll SpaceTypeFlags = 0b1111 )
func (SpaceTypeFlags) Has ¶
func (s SpaceTypeFlags) Has(other SpaceTypeFlags) bool
Has returns true if s contains other.
func (SpaceTypeFlags) String ¶
func (s SpaceTypeFlags) String() string
String returns the names in string for SpaceTypeFlags.
type Style ¶
Style represents a style.
The GtkSourceStyle structure is used to describe text attributes which are set when given style is used.
func (*Style) Apply ¶
func (style *Style) Apply(tag *gtk.TextTag)
Apply: this function modifies the gtk.TextTag properties that are related to the SourceStyle properties. Other gtk.TextTag properties are left untouched.
If style is non-NULL, applies style to tag.
If style is NULL, the related *-set properties of gtk.TextTag are set to FALSE.
The function takes the following parameters:
- tag to apply styles to.
type StyleClass ¶
type StyleClass struct {
// contains filtered or unexported fields
}
StyleClass: instance of this type is always passed by reference.
type StyleOverrides ¶
type StyleOverrides struct { }
StyleOverrides contains methods that are overridable.
type StyleScheme ¶
StyleScheme controls the appearance of view.
SourceStyleScheme contains all the text styles to be used in view and buffer. For instance, it contains text styles for syntax highlighting, it may contain foreground and background color for non-highlighted text, color for the line numbers, current line highlighting, bracket matching, etc.
Style schemes are stored in XML files. The format of a scheme file is documented in the style scheme reference (./style-reference.html).
The two style schemes with IDs "classic" and "tango" follow more closely the GTK theme (for example for the background color).
func (*StyleScheme) Authors ¶
func (scheme *StyleScheme) Authors() []string
The function returns the following values:
- utf8s (optional): a NULL-terminated array containing the scheme authors or NULL if no author is specified by the style scheme.
func (*StyleScheme) Description ¶
func (scheme *StyleScheme) Description() string
The function returns the following values:
- utf8 (optional): scheme description (if defined), or NULL.
func (*StyleScheme) Filename ¶
func (scheme *StyleScheme) Filename() string
The function returns the following values:
- utf8 (optional): scheme file name if the scheme was created parsing a style scheme file or NULL in the other cases.
func (*StyleScheme) ID ¶
func (scheme *StyleScheme) ID() string
The function returns the following values:
- utf8: scheme id.
func (*StyleScheme) Metadata ¶
func (scheme *StyleScheme) Metadata(name string) string
Metadata gets a metadata property from the style scheme.
The function takes the following parameters:
- name: metadata property name.
The function returns the following values:
- utf8 (optional): value of property name stored in the metadata of scheme or NULL if scheme does not contain the specified metadata property.
func (*StyleScheme) Name ¶
func (scheme *StyleScheme) Name() string
The function returns the following values:
- utf8: scheme name.
func (*StyleScheme) Style ¶
func (scheme *StyleScheme) Style(styleId string) *Style
The function takes the following parameters:
- styleId: id of the style to retrieve.
The function returns the following values:
- style (optional) which corresponds to style_id in the scheme, or NULL when no style with this name found. It is owned by scheme and may not be unref'ed.
type StyleSchemeChooser ¶
StyleSchemeChooser: interface implemented by widgets for choosing style schemes.
GtkSourceStyleSchemeChooser is an interface that is implemented by widgets for choosing style schemes.
In GtkSourceView, the main widgets that implement this interface are styleschemechooserwidget and styleschemechooserbutton.
StyleSchemeChooser wraps an interface. This means the user can get the underlying type by calling Cast().
func (*StyleSchemeChooser) SetStyleScheme ¶
func (chooser *StyleSchemeChooser) SetStyleScheme(scheme *StyleScheme)
SetStyleScheme sets the scheme.
The function takes the following parameters:
- scheme: SourceStyleScheme.
func (*StyleSchemeChooser) StyleScheme ¶
func (chooser *StyleSchemeChooser) StyleScheme() *StyleScheme
StyleScheme gets the currently-selected scheme.
The function returns the following values:
- styleScheme: currently-selected scheme.
type StyleSchemeChooserButton ¶
type StyleSchemeChooserButton struct { gtk.Button *coreglib.Object StyleSchemeChooser // contains filtered or unexported fields }
StyleSchemeChooserButton: button to launch a style scheme selection dialog.
The GtkSourceStyleSchemeChooserButton is a button which displays the currently selected style scheme and allows to open a style scheme selection dialog to change the style scheme. It is suitable widget for selecting a style scheme in a preference dialog.
In GtkSourceStyleSchemeChooserButton, a styleschemechooserwidget is used to provide a dialog for selecting style schemes.
func NewStyleSchemeChooserButton ¶
func NewStyleSchemeChooserButton() *StyleSchemeChooserButton
NewStyleSchemeChooserButton creates a new SourceStyleSchemeChooserButton.
The function returns the following values:
- styleSchemeChooserButton: new SourceStyleSchemeChooserButton.
type StyleSchemeChooserButtonClass ¶
type StyleSchemeChooserButtonClass struct {
// contains filtered or unexported fields
}
StyleSchemeChooserButtonClass: instance of this type is always passed by reference.
func (*StyleSchemeChooserButtonClass) Parent ¶
func (s *StyleSchemeChooserButtonClass) Parent() *gtk.ButtonClass
type StyleSchemeChooserButtonOverrides ¶
type StyleSchemeChooserButtonOverrides struct { }
StyleSchemeChooserButtonOverrides contains methods that are overridable.
type StyleSchemeChooserInterface ¶
type StyleSchemeChooserInterface struct {
// contains filtered or unexported fields
}
StyleSchemeChooserInterface: instance of this type is always passed by reference.
type StyleSchemeChooserWidget ¶
type StyleSchemeChooserWidget struct { gtk.Widget *coreglib.Object StyleSchemeChooser // contains filtered or unexported fields }
StyleSchemeChooserWidget: widget for choosing style schemes.
The GtkSourceStyleSchemeChooserWidget widget lets the user select a style scheme. By default, the chooser presents a predefined list of style schemes.
To change the initially selected style scheme, use styleschemechooser.SetStyleScheme. To get the selected style scheme use styleschemechooser.GetStyleScheme.
func NewStyleSchemeChooserWidget ¶
func NewStyleSchemeChooserWidget() *StyleSchemeChooserWidget
NewStyleSchemeChooserWidget creates a new SourceStyleSchemeChooserWidget.
The function returns the following values:
- styleSchemeChooserWidget: new SourceStyleSchemeChooserWidget.
type StyleSchemeChooserWidgetClass ¶
type StyleSchemeChooserWidgetClass struct {
// contains filtered or unexported fields
}
StyleSchemeChooserWidgetClass: instance of this type is always passed by reference.
func (*StyleSchemeChooserWidgetClass) Parent ¶
func (s *StyleSchemeChooserWidgetClass) Parent() *gtk.WidgetClass
type StyleSchemeChooserWidgetOverrides ¶
type StyleSchemeChooserWidgetOverrides struct { }
StyleSchemeChooserWidgetOverrides contains methods that are overridable.
type StyleSchemeChooserer ¶
type StyleSchemeChooserer interface { coreglib.Objector // StyleScheme gets the currently-selected scheme. StyleScheme() *StyleScheme // SetStyleScheme sets the scheme. SetStyleScheme(scheme *StyleScheme) }
StyleSchemeChooserer describes StyleSchemeChooser's interface methods.
type StyleSchemeClass ¶
type StyleSchemeClass struct {
// contains filtered or unexported fields
}
StyleSchemeClass: instance of this type is always passed by reference.
type StyleSchemeManager ¶
StyleSchemeManager provides access to styleschemes.
func NewStyleSchemeManager ¶
func NewStyleSchemeManager() *StyleSchemeManager
NewStyleSchemeManager creates a new style manager.
If you do not need more than one style manager then use styleschememanager.GetDefault() instead.
The function returns the following values:
- styleSchemeManager: new SourceStyleSchemeManager.
func StyleSchemeManagerGetDefault ¶
func StyleSchemeManagerGetDefault() *StyleSchemeManager
StyleSchemeManagerGetDefault returns the default SourceStyleSchemeManager instance.
The function returns the following values:
- styleSchemeManager Return value is owned by GtkSourceView library and must not be unref'ed.
func (*StyleSchemeManager) AppendSearchPath ¶
func (manager *StyleSchemeManager) AppendSearchPath(path string)
AppendSearchPath appends path to the list of directories where the manager looks for style scheme files.
See styleschememanager.SetSearchPath for details.
The function takes the following parameters:
- path: directory or a filename.
func (*StyleSchemeManager) ForceRescan ¶
func (manager *StyleSchemeManager) ForceRescan()
ForceRescan: mark any currently cached information about the available style schems as invalid.
All the available style schemes will be reloaded next time the manager is accessed.
func (*StyleSchemeManager) PrependSearchPath ¶
func (manager *StyleSchemeManager) PrependSearchPath(path string)
PrependSearchPath prepends path to the list of directories where the manager looks for style scheme files.
See styleschememanager.SetSearchPath for details.
The function takes the following parameters:
- path: directory or a filename.
func (*StyleSchemeManager) Scheme ¶
func (manager *StyleSchemeManager) Scheme(schemeId string) *StyleScheme
Scheme looks up style scheme by id.
The function takes the following parameters:
- schemeId: style scheme id to find.
The function returns the following values:
- styleScheme (optional) object. The returned value is owned by manager and must not be unref'ed.
func (*StyleSchemeManager) SchemeIDs ¶
func (manager *StyleSchemeManager) SchemeIDs() []string
SchemeIDs returns the ids of the available style schemes.
The function returns the following values:
- utf8s (optional): a NULL-terminated array of strings containing the ids of the available style schemes or NULL if no style scheme is available. The array is sorted alphabetically according to the scheme name. The array is owned by the manager and must not be modified.
func (*StyleSchemeManager) SearchPath ¶
func (manager *StyleSchemeManager) SearchPath() []string
SearchPath returns the current search path for the manager.
See styleschememanager.SetSearchPath for details.
The function returns the following values:
- utf8s: NULL-terminated array of string containing the search path. The array is owned by the manager and must not be modified.
func (*StyleSchemeManager) SetSearchPath ¶
func (manager *StyleSchemeManager) SetSearchPath(path []string)
SetSearchPath sets the list of directories where the manager looks for style scheme files.
If path is NULL, the search path is reset to default.
The function takes the following parameters:
- path (optional): NULL-terminated array of strings or NULL.
type StyleSchemeManagerClass ¶
type StyleSchemeManagerClass struct {
// contains filtered or unexported fields
}
StyleSchemeManagerClass: instance of this type is always passed by reference.
type StyleSchemeManagerOverrides ¶
type StyleSchemeManagerOverrides struct { }
StyleSchemeManagerOverrides contains methods that are overridable.
type StyleSchemeOverrides ¶
type StyleSchemeOverrides struct { }
StyleSchemeOverrides contains methods that are overridable.
type StyleSchemePreview ¶
type StyleSchemePreview struct { gtk.Widget *coreglib.Object gtk.Actionable // contains filtered or unexported fields }
StyleSchemePreview: preview widget for stylescheme.
This widget provides a convenient gtk.Widget to preview a stylescheme.
The styleschemepreview:selected property can be used to manage the selection state of a single preview widget.
func NewStyleSchemePreview ¶
func NewStyleSchemePreview(scheme *StyleScheme) *StyleSchemePreview
NewStyleSchemePreview creates a new SourceStyleSchemePreview to preview the style scheme provided in scheme.
The function takes the following parameters:
- scheme: SourceStyleScheme.
The function returns the following values:
- styleSchemePreview: Widget.
func (*StyleSchemePreview) ConnectActivate ¶
func (self *StyleSchemePreview) ConnectActivate(f func()) coreglib.SignalHandle
func (*StyleSchemePreview) Scheme ¶
func (self *StyleSchemePreview) Scheme() *StyleScheme
Scheme gets the SourceStyleScheme previewed by the widget.
The function returns the following values:
- styleScheme: SourceStyleScheme.
func (*StyleSchemePreview) Selected ¶
func (self *StyleSchemePreview) Selected() bool
The function returns the following values:
func (*StyleSchemePreview) SetSelected ¶
func (self *StyleSchemePreview) SetSelected(selected bool)
The function takes the following parameters:
type StyleSchemePreviewClass ¶
type StyleSchemePreviewClass struct {
// contains filtered or unexported fields
}
StyleSchemePreviewClass: instance of this type is always passed by reference.
func (*StyleSchemePreviewClass) ParentClass ¶
func (s *StyleSchemePreviewClass) ParentClass() *gtk.WidgetClass
type StyleSchemePreviewOverrides ¶
type StyleSchemePreviewOverrides struct { }
StyleSchemePreviewOverrides contains methods that are overridable.
type Tag ¶
type Tag struct { gtk.TextTag // contains filtered or unexported fields }
Tag: tag that can be applied to text in a buffer.
GtkSourceTag is a subclass of gtk.TextTag that adds properties useful for the GtkSourceView library.
If, for a certain tag, gtk.TextTag is sufficient, it's better that you create a gtk.TextTag, not a tag.
func NewTag ¶
NewTag creates a GtkSourceTag.
Configure the tag using object arguments, i.e. using gobject.Object.Set().
For usual cases, buffer.CreateSourceTag is more convenient to use.
The function takes the following parameters:
- name (optional): tag name, or NULL.
The function returns the following values:
- tag: new GtkSourceTag.
type TagClass ¶
type TagClass struct {
// contains filtered or unexported fields
}
TagClass: instance of this type is always passed by reference.
func (*TagClass) ParentClass ¶
func (t *TagClass) ParentClass() *gtk.TextTagClass
type TagOverrides ¶
type TagOverrides struct { }
TagOverrides contains methods that are overridable.
type View ¶
type View struct { gtk.TextView // contains filtered or unexported fields }
View subclass of gtk.TextView.
GtkSourceView is the main class of the GtkSourceView library. Use a buffer to display text with a GtkSourceView.
This class provides:
- Show the line numbers;
- Show a right margin;
- Highlight the current line;
- Indentation settings;
- Configuration for the Home and End keyboard keys;
- Configure and show line marks;
- And a few other things.
An easy way to test all these features is to use the test-widget mini-program provided in the GtkSourceView repository, in the tests/ directory.
GtkSourceView as GtkBuildable ¶
The GtkSourceView implementation of the gtk.Buildable interface exposes the view:completion object with the internal-child "completion".
An example of a UI definition fragment with GtkSourceView:
<object class="GtkSourceView" id="source_view"> <property name="tab-width">4</property> <property name="auto-indent">True</property> <child internal-child="completion"> <object class="GtkSourceCompletion"> <property name="select-on-show">False</property> </object> </child> </object>
Changing the Font ¶
Gtk CSS provides the best way to change the font for a GtkSourceView in a manner that allows for components like map to scale the desired font.
GtkCssProvider *provider = gtk_css_provider_new (); gtk_css_provider_load_from_data (provider, "textview { font-family: Monospace; font-size: 8pt; }", -1, NULL); gtk_style_context_add_provider (gtk_widget_get_style_context (view), GTK_STYLE_PROVIDER (provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); g_object_unref (provider);
If you need to adjust the font or size of font within a portion of the document only, you should use a gtk.TextTag with the gtk.TextTag:family or gtk.TextTag:scale set so that the font size may be scaled relative to the default font set in CSS.
func NewView ¶
func NewView() *View
NewView creates a new GtkSourceView.
By default, an empty buffer will be lazily created and can be retrieved with gtk.TextView.GetBuffer().
If you want to specify your own buffer, either override the gtk.TextView.CreateBuffer() factory method, or use view.NewWithBuffer.
The function returns the following values:
- view: new SourceView.
func NewViewWithBuffer ¶
NewViewWithBuffer creates a new SourceView widget displaying the buffer buffer.
One buffer can be shared among many widgets.
The function takes the following parameters:
- buffer: SourceBuffer.
The function returns the following values:
- view: new SourceView.
func (*View) AutoIndent ¶
AutoIndent returns whether auto-indentation of text is enabled.
The function returns the following values:
- ok: TRUE if auto indentation is enabled.
func (*View) BackgroundPattern ¶
func (view *View) BackgroundPattern() BackgroundPatternType
BackgroundPattern returns the SourceBackgroundPatternType specifying if and how the background pattern should be displayed for this view.
The function returns the following values:
- backgroundPatternType: SourceBackgroundPatternType.
func (*View) Completion ¶
func (view *View) Completion() *Completion
Completion gets the completion associated with view.
The returned object is guaranteed to be the same for the lifetime of view. Each GtkSourceView object has a different completion.
The function returns the following values:
- completion associated with view.
func (*View) ConnectChangeCase ¶
func (view *View) ConnectChangeCase(f func(caseType ChangeCaseType)) coreglib.SignalHandle
ConnectChangeCase: keybinding signal to change case of the text at the current cursor position.
func (*View) ConnectChangeNumber ¶
func (view *View) ConnectChangeNumber(f func(count int)) coreglib.SignalHandle
ConnectChangeNumber: keybinding signal to edit a number at the current cursor position.
func (*View) ConnectJoinLines ¶
func (view *View) ConnectJoinLines(f func()) coreglib.SignalHandle
ConnectJoinLines: keybinding signal to join the lines currently selected.
func (*View) ConnectLineMarkActivated ¶
func (view *View) ConnectLineMarkActivated(f func(iter *gtk.TextIter, button uint, state gdk.ModifierType, nPresses int)) coreglib.SignalHandle
ConnectLineMarkActivated is emitted when a line mark has been activated (for instance when there was a button press in the line marks gutter).
You can use iter to determine on which line the activation took place.
func (*View) ConnectMoveLines ¶
func (view *View) ConnectMoveLines(f func(down bool)) coreglib.SignalHandle
ConnectMoveLines: signal is a keybinding which gets emitted when the user initiates moving a line.
The default binding key is Alt+Up/Down arrow. And moves the currently selected lines, or the current line up or down by one line.
func (*View) ConnectMoveToMatchingBracket ¶
func (view *View) ConnectMoveToMatchingBracket(f func(extendSelection bool)) coreglib.SignalHandle
ConnectMoveToMatchingBracket: keybinding signal to move the cursor to the matching bracket.
func (*View) ConnectMoveWords ¶
func (view *View) ConnectMoveWords(f func(count int)) coreglib.SignalHandle
ConnectMoveWords: signal is a keybinding which gets emitted when the user initiates moving a word.
The default binding key is Alt+Left/Right Arrow and moves the current selection, or the current word by one word.
func (*View) ConnectShowCompletion ¶
func (view *View) ConnectShowCompletion(f func()) coreglib.SignalHandle
ConnectShowCompletion: signal is a key binding signal which gets emitted when the user requests a completion, by pressing <keycombo><keycap>Control</keycap><keycap>space</keycap></keycombo>.
This will create a completioncontext with the activation type as GTK_SOURCE_COMPLETION_ACTIVATION_USER_REQUESTED.
Applications should not connect to it, but may emit it with gobject.SignalEmitByName() if they need to activate the completion by another means, for example with another key binding or a menu entry.
func (*View) ConnectSmartHomeEnd ¶
func (view *View) ConnectSmartHomeEnd(f func(iter *gtk.TextIter, count int)) coreglib.SignalHandle
ConnectSmartHomeEnd is emitted when a the cursor was moved according to the smart home end setting.
The signal is emitted after the cursor is moved, but during the gtk.TextView::move-cursor action. This can be used to find out whether the cursor was moved by a normal home/end or by a smart home/end.
func (*View) EnableSnippets ¶
EnableSnippets gets the view:enable-snippets property.
If TRUE, matching snippets found in the snippetmanager may be expanded when the user presses Tab after a word in the view.
The function returns the following values:
- ok: TRUE if enabled.
func (*View) Gutter ¶
Gutter returns the gutter object associated with window_type for view.
Only GTK_TEXT_WINDOW_LEFT and GTK_TEXT_WINDOW_RIGHT are supported, respectively corresponding to the left and right gutter. The line numbers and mark category icons are rendered in the left gutter.
The function takes the following parameters:
- windowType: gutter window type.
The function returns the following values:
- gutter: SourceGutter.
func (*View) HighlightCurrentLine ¶
HighlightCurrentLine returns whether the current line is highlighted.
The function returns the following values:
- ok: TRUE if the current line is highlighted.
func (*View) Hover ¶
Hover gets the hover associated with view.
The returned object is guaranteed to be the same for the lifetime of view. Each view object has a different hover.
The function returns the following values:
- hover associated with view.
func (*View) IndentLines ¶
func (view *View) IndentLines(start, end *gtk.TextIter)
IndentLines inserts one indentation level at the beginning of the specified lines. The empty lines are not indented.
The function takes the following parameters:
- start of the first line to indent.
- end of the last line to indent.
func (*View) IndentOnTab ¶
IndentOnTab returns whether when the tab key is pressed the current selection should get indented instead of replaced with the \t character.
The function returns the following values:
- ok: TRUE if the selection is indented when tab is pressed.
func (*View) IndentWidth ¶
IndentWidth returns the number of spaces to use for each step of indent.
See view.SetIndentWidth for details.
The function returns the following values:
- gint: indent width.
func (*View) Indenter ¶
Indenter gets the view:indenter property.
The function returns the following values:
- indenter (optional) or NULL.
func (*View) InsertSpacesInsteadOfTabs ¶
InsertSpacesInsteadOfTabs returns whether when inserting a tabulator character it should be replaced by a group of space characters.
The function returns the following values:
- ok: TRUE if spaces are inserted instead of tabs.
func (*View) MarkAttributes ¶
func (view *View) MarkAttributes(category string, priority *int) *MarkAttributes
MarkAttributes gets attributes and priority for the category.
The function takes the following parameters:
- category: category.
- priority: place where priority of the category will be stored.
The function returns the following values:
- markAttributes for the category. The object belongs to view, so it must not be unreffed.
func (*View) PushSnippet ¶
PushSnippet inserts a new snippet at location
If another snippet was already active, it will be paused and the new snippet will become active. Once the focus positions of snippet have been exhausted, editing will return to the previous snippet.
The function takes the following parameters:
- snippet: SourceSnippet.
- location (optional) or NULL for the cursor position.
func (*View) RightMarginPosition ¶
RightMarginPosition gets the position of the right margin in the given view.
The function returns the following values:
- guint: position of the right margin.
func (*View) SetAutoIndent ¶
SetAutoIndent: if TRUE auto-indentation of text is enabled.
When Enter is pressed to create a new line, the auto-indentation inserts the same indentation as the previous line. This is **not** a "smart indentation" where an indentation level is added or removed depending on the context.
The function takes the following parameters:
- enable: whether to enable auto indentation.
func (*View) SetBackgroundPattern ¶
func (view *View) SetBackgroundPattern(backgroundPattern BackgroundPatternType)
SetBackgroundPattern: set if and how the background pattern should be displayed.
The function takes the following parameters:
- backgroundPattern: SourceBackgroundPatternType.
func (*View) SetEnableSnippets ¶
SetEnableSnippets sets the view:enable-snippets property.
If enable_snippets is TRUE, matching snippets found in the snippetmanager may be expanded when the user presses Tab after a word in the view.
The function takes the following parameters:
- enableSnippets: if snippets should be enabled.
func (*View) SetHighlightCurrentLine ¶
SetHighlightCurrentLine: if highlight is TRUE the current line will be highlighted.
The function takes the following parameters:
- highlight: whether to highlight the current line.
func (*View) SetIndentOnTab ¶
SetIndentOnTab: if TRUE, when the tab key is pressed when several lines are selected, the selected lines are indented of one level instead of being replaced with a \t character. Shift+Tab unindents the selection.
If the first or last line is not selected completely, it is also indented or unindented.
When the selection doesn't span several lines, the tab key always replaces the selection with a normal \t character.
The function takes the following parameters:
- enable: whether to indent a block when tab is pressed.
func (*View) SetIndentWidth ¶
SetIndentWidth sets the number of spaces to use for each step of indent when the tab key is pressed.
If width is -1, the value of the view:tab-width property will be used.
The view:indent-width interacts with the view:insert-spaces-instead-of-tabs property and view:tab-width. An example will be clearer:
If the view:indent-width is 4 and view:tab-width is 8 and view:insert-spaces-instead-of-tabs is FALSE, then pressing the tab key at the beginning of a line will insert 4 spaces. So far so good. Pressing the tab key a second time will remove the 4 spaces and insert a \t character instead (since view:tab-width is 8). On the other hand, if view:insert-spaces-instead-of-tabs is TRUE, the second tab key pressed will insert 4 more spaces for a total of 8 spaces in the gtk.TextBuffer.
The test-widget program (available in the GtkSourceView repository) may be useful to better understand the indentation settings (enable the space drawing!).
The function takes the following parameters:
- width: indent width in characters.
func (*View) SetIndenter ¶
func (view *View) SetIndenter(indenter Indenterer)
SetIndenter sets the indenter for view to indenter.
Note that the indenter will not be used unless SourceView:auto-indent has been set to TRUE.
The function takes the following parameters:
- indenter (optional) or NULL.
func (*View) SetInsertSpacesInsteadOfTabs ¶
SetInsertSpacesInsteadOfTabs: if TRUE a tab key pressed is replaced by a group of space characters.
Of course it is still possible to insert a real \t programmatically with the gtk.TextBuffer API.
The function takes the following parameters:
- enable: whether to insert spaces instead of tabs.
func (*View) SetMarkAttributes ¶
func (view *View) SetMarkAttributes(category string, attributes *MarkAttributes, priority int)
SetMarkAttributes sets attributes and priority for the category.
The function takes the following parameters:
- category: category.
- attributes: mark attributes.
- priority of the category.
func (*View) SetRightMarginPosition ¶
SetRightMarginPosition sets the position of the right margin in the given view.
The function takes the following parameters:
- pos: width in characters where to position the right margin.
func (*View) SetShowLineMarks ¶
SetShowLineMarks: if TRUE line marks will be displayed beside the text.
The function takes the following parameters:
- show: whether line marks should be displayed.
func (*View) SetShowLineNumbers ¶
SetShowLineNumbers: if TRUE line numbers will be displayed beside the text.
The function takes the following parameters:
- show: whether line numbers should be displayed.
func (*View) SetShowRightMargin ¶
SetShowRightMargin: if TRUE a right margin is displayed.
The function takes the following parameters:
- show: whether to show a right margin.
func (*View) SetSmartBackspace ¶
SetSmartBackspace: when set to TRUE, pressing the Backspace key will try to delete spaces up to the previous tab stop.
The function takes the following parameters:
- smartBackspace: whether to enable smart Backspace handling.
func (*View) SetSmartHomeEnd ¶
func (view *View) SetSmartHomeEnd(smartHomeEnd SmartHomeEndType)
SetSmartHomeEnd: set the desired movement of the cursor when HOME and END keys are pressed.
The function takes the following parameters:
- smartHomeEnd: desired behavior among SourceSmartHomeEndType.
func (*View) SetTabWidth ¶
SetTabWidth sets the width of tabulation in characters.
The TextBuffer still contains \t characters, but they can take a different visual width in a view widget.
The function takes the following parameters:
- width of tab in characters.
func (*View) ShowLineMarks ¶
ShowLineMarks returns whether line marks are displayed beside the text.
The function returns the following values:
- ok: TRUE if the line marks are displayed.
func (*View) ShowLineNumbers ¶
ShowLineNumbers returns whether line numbers are displayed beside the text.
The function returns the following values:
- ok: TRUE if the line numbers are displayed.
func (*View) ShowRightMargin ¶
ShowRightMargin returns whether a right margin is displayed.
The function returns the following values:
- ok: TRUE if the right margin is shown.
func (*View) SmartBackspace ¶
SmartBackspace returns TRUE if pressing the Backspace key will try to delete spaces up to the previous tab stop.
The function returns the following values:
- ok: TRUE if smart Backspace handling is enabled.
func (*View) SmartHomeEnd ¶
func (view *View) SmartHomeEnd() SmartHomeEndType
SmartHomeEnd returns a smarthomeendtype end value specifying how the cursor will move when HOME and END keys are pressed.
The function returns the following values:
- smartHomeEndType: SourceSmartHomeEndType value.
func (*View) SpaceDrawer ¶
func (view *View) SpaceDrawer() *SpaceDrawer
SpaceDrawer gets the spacedrawer associated with view.
The returned object is guaranteed to be the same for the lifetime of view. Each view object has a different spacedrawer.
The function returns the following values:
- spaceDrawer associated with view.
func (*View) TabWidth ¶
TabWidth returns the width of tabulation in characters.
The function returns the following values:
- guint: width of tab.
func (*View) UnindentLines ¶
func (view *View) UnindentLines(start, end *gtk.TextIter)
UnindentLines removes one indentation level at the beginning of the specified lines.
The function takes the following parameters:
- start of the first line to indent.
- end of the last line to indent.
func (*View) VisualColumn ¶
VisualColumn determines the visual column at iter taking into consideration the view:tab-width of view.
The function takes the following parameters:
- iter: position in view.
The function returns the following values:
- guint: visual column at iter.
type ViewClass ¶
type ViewClass struct {
// contains filtered or unexported fields
}
ViewClass: instance of this type is always passed by reference.
func (*ViewClass) ParentClass ¶
func (v *ViewClass) ParentClass() *gtk.TextViewClass
type ViewGutterPosition ¶
const ( // SourceViewGutterPositionLines: gutter position of the lines renderer. SourceViewGutterPositionLines ViewGutterPosition = -30 // SourceViewGutterPositionMarks: gutter position of the marks renderer. SourceViewGutterPositionMarks ViewGutterPosition = -20 )
func (ViewGutterPosition) String ¶
func (v ViewGutterPosition) String() string
String returns the name in string for ViewGutterPosition.
type ViewOverrides ¶
type ViewOverrides struct { // The function takes the following parameters: // // - iter // - button // - state // - nPresses // LineMarkActivated func(iter *gtk.TextIter, button uint, state gdk.ModifierType, nPresses int) // The function takes the following parameters: // MoveLines func(down bool) // The function takes the following parameters: // MoveWords func(step int) // PushSnippet inserts a new snippet at location // // If another snippet was already active, it will be paused and the new // snippet will become active. Once the focus positions of snippet have been // exhausted, editing will return to the previous snippet. // // The function takes the following parameters: // // - snippet: SourceSnippet. // - location (optional) or NULL for the cursor position. // PushSnippet func(snippet *Snippet, location *gtk.TextIter) ShowCompletion func() }
ViewOverrides contains methods that are overridable.
type VimIMContext ¶
type VimIMContext struct { gtk.IMContext // contains filtered or unexported fields }
VimIMContext: vim emulation.
The GtkSourceVimIMContext is a gtk.IMContext implementation that can be used to provide Vim-like editing controls within a view.
The GtkSourceViMIMContext will process incoming gdk.KeyEvent as the user types. It should be used in conjunction with a gtk.EventControllerKey.
Various features supported by GtkSourceVimIMContext include:
- Normal, Insert, Replace, Visual, and Visual Line modes
- Support for an integrated command bar and current command preview
- Search and replace
- Motions and Text Objects
- History replay
- Jumplists within the current file
- Registers including the system and primary clipboards
- Creation and motion to marks
- Some commonly used Vim commands
It is recommended that applications display the contents of vimimcontext:command-bar-text and vimimcontext:command-text to the user as they represent the command-bar and current command preview found in Vim.
GtkSourceVimIMContext attempts to work with additional gtk.IMContext implementations such as IBus by querying the gtk.TextView before processing the command in states which support it (notably Insert and Replace modes).
GtkEventController *key; GtkIMContext *im_context; GtkWidget *view; view = gtk_source_view_new (); im_context = gtk_source_vim_im_context_new (); key = gtk_event_controller_key_new (); gtk_event_controller_key_set_im_context (GTK_EVENT_CONTROLLER_KEY (key), im_context); gtk_event_controller_set_propagation_phase (key, GTK_PHASE_CAPTURE); gtk_widget_add_controller (view, key); gtk_im_context_set_client_widget (im_context, view); g_object_bind_property (im_context, "command-bar-text", command_bar_label, "label", 0); g_object_bind_property (im_context, "command-text", command_label, "label", 0);.
func NewVimIMContext ¶
func NewVimIMContext() *VimIMContext
The function returns the following values:
func (*VimIMContext) CommandBarText ¶
func (self *VimIMContext) CommandBarText() string
CommandBarText gets the current command-bar text as it is entered by the user.
The function returns the following values:
- utf8: string containing the command-bar text.
func (*VimIMContext) CommandText ¶
func (self *VimIMContext) CommandText() string
CommandText gets the current command text as it is entered by the user.
The function returns the following values:
- utf8: string containing the command text.
func (*VimIMContext) ConnectEdit ¶
func (self *VimIMContext) ConnectEdit(f func(view *View, path string)) coreglib.SignalHandle
ConnectEdit requests the application open the file found at path.
If path is NULL, then the current file should be reloaded from storage.
This may be executed in relation to the user running the :edit or :e commands.
func (*VimIMContext) ConnectExecuteCommand ¶
func (self *VimIMContext) ConnectExecuteCommand(f func(command string) (ok bool)) coreglib.SignalHandle
ConnectExecuteCommand: signal is emitted when a command should be executed. This might be something like :wq or :e <path>.
If the application chooses to implement this, it should return TRUE from this signal to indicate the command has been handled.
func (*VimIMContext) ConnectFormatText ¶
func (self *VimIMContext) ConnectFormatText(f func(begin, end *gtk.TextIter)) coreglib.SignalHandle
ConnectFormatText requests that the application format the text between begin and end.
func (*VimIMContext) ConnectWrite ¶
func (self *VimIMContext) ConnectWrite(f func(view *View, path string)) coreglib.SignalHandle
ConnectWrite requests the application save the file.
If a filename was provided, it will be available to the signal handler as path. This may be executed in relation to the user running the :write or :w commands.
func (*VimIMContext) ExecuteCommand ¶
func (self *VimIMContext) ExecuteCommand(command string)
ExecuteCommand executes command as if it was typed into the command bar by the user except that this does not emit the vimimcontext::execute-command signal.
The function takes the following parameters:
- command text.
type VimIMContextClass ¶
type VimIMContextClass struct {
// contains filtered or unexported fields
}
VimIMContextClass: instance of this type is always passed by reference.
func (*VimIMContextClass) ParentClass ¶
func (v *VimIMContextClass) ParentClass() *gtk.IMContextClass
type VimIMContextOverrides ¶
type VimIMContextOverrides struct { }
VimIMContextOverrides contains methods that are overridable.
Source Files ¶
- gtksource.go
- gtksource_export.go
- gtksourcebuffer.go
- gtksourcebuffer_export.go
- gtksourcecompletion.go
- gtksourcecompletion_export.go
- gtksourcecompletioncell.go
- gtksourcecompletioncontext.go
- gtksourcecompletioncontext_export.go
- gtksourcecompletionproposal.go
- gtksourcecompletionprovider.go
- gtksourcecompletionsnippets.go
- gtksourcecompletionwords.go
- gtksourceencoding.go
- gtksourcefile.go
- gtksourcefileloader.go
- gtksourcefilesaver.go
- gtksourcegutter.go
- gtksourcegutterlines.go
- gtksourcegutterrenderer.go
- gtksourcegutterrenderer_export.go
- gtksourcegutterrendererpixbuf.go
- gtksourcegutterrenderertext.go
- gtksourcehover.go
- gtksourcehovercontext.go
- gtksourcehoverdisplay.go
- gtksourcehoverprovider.go
- gtksourceindenter.go
- gtksourceinit.go
- gtksourcelanguage.go
- gtksourcelanguagemanager.go
- gtksourcemap.go
- gtksourcemark.go
- gtksourcemarkattributes.go
- gtksourcemarkattributes_export.go
- gtksourceprintcompositor.go
- gtksourceregion.go
- gtksourcescheduler_5_2.go
- gtksourcescheduler_5_2_export.go
- gtksourcesearchcontext.go
- gtksourcesearchsettings.go
- gtksourcesnippet.go
- gtksourcesnippetchunk.go
- gtksourcesnippetcontext.go
- gtksourcesnippetcontext_export.go
- gtksourcesnippetmanager.go
- gtksourcespacedrawer.go
- gtksourcestyle.go
- gtksourcestylescheme.go
- gtksourcestyleschemechooser.go
- gtksourcestyleschemechooserbutton.go
- gtksourcestyleschemechooserwidget.go
- gtksourcestyleschememanager.go
- gtksourcestyleschemepreview.go
- gtksourcestyleschemepreview_5_4.go
- gtksourcetag.go
- gtksourcetypes.go
- gtksourceutils.go
- gtksourceversion.go
- gtksourceview.go
- gtksourceview_export.go
- gtksourcevimimcontext.go
- gtksourcevimimcontext_5_4.go
- gtksourcevimimcontext_export.go