gi-gtksource-5.0.1: GtkSource bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.GtkSource.Objects.SnippetContext

Description

Context for expanding [classsnippetChunk].

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 [classsnippetChunk] can expand themselves by executing script within the context.

The [classsnippet] will build the context and then expand each of the chunks during the insertion/edit phase.

Synopsis

Exported types

newtype SnippetContext Source #

Memory-managed wrapper type.

Constructors

SnippetContext (ManagedPtr SnippetContext) 

Instances

Instances details
Eq SnippetContext Source # 
Instance details

Defined in GI.GtkSource.Objects.SnippetContext

GObject SnippetContext Source # 
Instance details

Defined in GI.GtkSource.Objects.SnippetContext

ManagedPtrNewtype SnippetContext Source # 
Instance details

Defined in GI.GtkSource.Objects.SnippetContext

TypedObject SnippetContext Source # 
Instance details

Defined in GI.GtkSource.Objects.SnippetContext

Methods

glibType :: IO GType

HasParentTypes SnippetContext Source # 
Instance details

Defined in GI.GtkSource.Objects.SnippetContext

IsGValue (Maybe SnippetContext) Source #

Convert SnippetContext to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.GtkSource.Objects.SnippetContext

Methods

gvalueGType_ :: IO GType

gvalueSet_ :: Ptr GValue -> Maybe SnippetContext -> IO ()

gvalueGet_ :: Ptr GValue -> IO (Maybe SnippetContext)

type ParentTypes SnippetContext Source # 
Instance details

Defined in GI.GtkSource.Objects.SnippetContext

type ParentTypes SnippetContext = '[Object]

class (GObject o, IsDescendantOf SnippetContext o) => IsSnippetContext o Source #

Type class for types which can be safely cast to SnippetContext, for instance with toSnippetContext.

Instances

Instances details
(GObject o, IsDescendantOf SnippetContext o) => IsSnippetContext o Source # 
Instance details

Defined in GI.GtkSource.Objects.SnippetContext

toSnippetContext :: (MonadIO m, IsSnippetContext o) => o -> m SnippetContext Source #

Cast to SnippetContext, for types for which this is known to be safe. For general casts, use castTo.

Methods

clearVariables

snippetContextClearVariables Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnippetContext a) 
=> a

self: a SnippetContext

-> m () 

Removes all variables from the context.

expand

snippetContextExpand :: (HasCallStack, MonadIO m, IsSnippetContext a) => a -> Text -> m Text Source #

No description available in the introspection data.

getVariable

snippetContextGetVariable Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnippetContext a) 
=> a

self: a SnippetContext

-> Text

key: the name of the variable

-> m (Maybe Text)

Returns: the value for the variable, or Nothing

Gets the current value for a variable named key.

new

snippetContextNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m SnippetContext

Returns: a SnippetContext

Creates a new SnippetContext.

Generally, this isn't needed unless you are controlling the expansion of snippets manually.

setConstant

snippetContextSetConstant Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnippetContext a) 
=> a

self: a SnippetContext

-> Text

key: the constant name

-> Text

value: the value of the constant

-> m () 

Sets a constatnt within the context.

This is similar to a variable set with [methodsnippetContext.set_variable] but is expected to not change during use of the snippet.

Examples would be the date or users name.

setLinePrefix

snippetContextSetLinePrefix :: (HasCallStack, MonadIO m, IsSnippetContext a) => a -> Text -> m () Source #

No description available in the introspection data.

setTabWidth

snippetContextSetTabWidth :: (HasCallStack, MonadIO m, IsSnippetContext a) => a -> Int32 -> m () Source #

No description available in the introspection data.

setUseSpaces

snippetContextSetUseSpaces :: (HasCallStack, MonadIO m, IsSnippetContext a) => a -> Bool -> m () Source #

No description available in the introspection data.

setVariable

snippetContextSetVariable Source #

Arguments

:: (HasCallStack, MonadIO m, IsSnippetContext a) 
=> a

self: a SnippetContext

-> Text

key: the variable name

-> Text

value: the value for the variable

-> m () 

Sets a variable within the context.

This variable may be overridden by future updates to the context.

Signals

changed

type SnippetContextChangedCallback = IO () Source #

The 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.

afterSnippetContextChanged :: (IsSnippetContext a, MonadIO m) => a -> ((?self :: a) => SnippetContextChangedCallback) -> m SignalHandlerId Source #

Connect a signal handler for the changed signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after snippetContext #changed callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit ?self parameter. Note that this requires activating the ImplicitParams GHC extension.

onSnippetContextChanged :: (IsSnippetContext a, MonadIO m) => a -> ((?self :: a) => SnippetContextChangedCallback) -> m SignalHandlerId Source #

Connect a signal handler for the changed signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on snippetContext #changed callback