WidgetClassProtocol
public protocol WidgetClassProtocol
The WidgetClassProtocol
protocol exposes the methods and properties of an underlying GtkWidgetClass
instance.
The default implementation of these can be found in the protocol extension below.
For a concrete class that implements these methods and properties, see WidgetClass
.
Alternatively, use WidgetClassRef
as a lighweight, unowned
reference if you already have an instance you just want to use.
-
Untyped pointer to the underlying
GtkWidgetClass
instance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get }
-
_ptr
Default implementationTyped pointer to the underlying
GtkWidgetClass
instance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkWidgetClass
instance.Declaration
Swift
var _ptr: UnsafeMutablePointer<GtkWidgetClass>! { get }
-
Required Initialiser for types conforming to
WidgetClassProtocol
Declaration
Swift
init(raw: UnsafeMutableRawPointer)
-
add(shortcut:
Extension method) Installs a shortcut in
widget_class
.Every instance created for
widget_class
or its subclasses will inherit this shortcut and trigger it.Shortcuts added this way will be triggered in the
GTK_PHASE_BUBBLE
phase, which means they may also trigger if child widgets have focus.This function must only be used in class initialization functions otherwise it is not guaranteed that the shortcut will be installed.
Declaration
Swift
@inlinable func add<ShortcutT>(shortcut: ShortcutT) where ShortcutT : ShortcutProtocol
-
bindTemplateCallbackFull(callbackName:
Extension methodcallbackSymbol: ) Declares a
callback_symbol
to handlecallback_name
from the template XML defined forwidget_type
.This function is not supported after [method
Gtk.WidgetClass.set_template_scope
] has been used onwidget_class
. See [methodGtk.BuilderCScope.add_callback_symbol
].Note that this must be called from a composite widget classes class initializer after calling [method
Gtk.WidgetClass.set_template
].Declaration
Swift
@inlinable func bindTemplateCallbackFull(callbackName: UnsafePointer<CChar>!, callbackSymbol: GCallback?)
-
bindTemplateChildFull(name:
Extension methodinternalChild: structOffset: ) Automatically assign an object declared in the class template XML to be set to a location on a freshly built instance’s private data, or alternatively accessible via [method
Gtk.Widget.get_template_child
].The struct can point either into the public instance, then you should use
G_STRUCT_OFFSET(WidgetType, member)
forstruct_offset
, or in the private struct, then you should useG_PRIVATE_OFFSET(WidgetType, member)
.An explicit strong reference will be held automatically for the duration of your instance’s life cycle, it will be released automatically when
GObjectClass.dispose()
runs on your instance and if astruct_offset
that is!= 0
is specified, then the automatic location in your instance public or private data will be set tonil
. You can however access an automated child pointer the first time your classesGObjectClass.dispose()
runs, or alternatively in [signalGtk.Widget::destroy
].If
internal_child
is specified, [vfuncGtk.Buildable.get_internal_child
] will be automatically implemented by theGtkWidget
class so there is no need to implement it manually.The wrapper macros [func
Gtk.widget_class_bind_template_child
], [funcGtk.widget_class_bind_template_child_internal
], [funcGtk.widget_class_bind_template_child_private
] and [funcGtk.widget_class_bind_template_child_internal_private
] might be more convenient to use.Note that this must be called from a composite widget classes class initializer after calling [method
Gtk.WidgetClass.set_template
].Declaration
Swift
@inlinable func bindTemplateChildFull(name: UnsafePointer<CChar>!, internalChild: Bool, structOffset: gssize)
-
getAccessibleRole()
Extension methodRetrieves the accessible role used by the given
GtkWidget
class.Different accessible roles have different states, and are rendered differently by assistive technologies.
See also: [method
Gtk.Accessible.get_accessible_role
].Declaration
Swift
@inlinable func getAccessibleRole() -> GtkAccessibleRole
-
getActivateSignal()
Extension methodRetrieves the signal id for the activation signal.
the activation signal is set using [method
Gtk.WidgetClass.set_activate_signal
].Declaration
Swift
@inlinable func getActivateSignal() -> Int
-
getCssName()
Extension methodGets the name used by this class for matching in CSS code.
See [method
Gtk.WidgetClass.set_css_name
] for details.Declaration
Swift
@inlinable func getCssName() -> String!
-
getLayoutManagerType()
Extension methodRetrieves the type of the [class
Gtk.LayoutManager
] used by widgets of classwidget_class
.See also: [method
Gtk.WidgetClass.set_layout_manager_type
].Declaration
Swift
@inlinable func getLayoutManagerType() -> GType
-
installAction(actionName:
Extension methodparameterType: activate: ) This should be called at class initialization time to specify actions to be added for all instances of this class.
Actions installed by this function are stateless. The only state they have is whether they are enabled or not.
Declaration
Swift
@inlinable func installAction(actionName: UnsafePointer<CChar>!, parameterType: UnsafePointer<CChar>? = nil, activate: GtkWidgetActionActivateFunc?)
-
installPropertyAction(actionName:
Extension methodpropertyName: ) Installs an action called
action_name
onwidget_class
and binds its state to the value of theproperty_name
property.This function will perform a few santity checks on the property selected via
property_name
. Namely, the property must exist, must be readable, writable and must not be construct-only. There are also restrictions on the type of the given property, it must be boolean, int, unsigned int, double or string. If any of these conditions are not met, a critical warning will be printed and no action will be added.The state type of the action matches the property type.
If the property is boolean, the action will have no parameter and toggle the property value. Otherwise, the action will have a parameter of the same type as the property.
Declaration
Swift
@inlinable func installPropertyAction(actionName: UnsafePointer<CChar>!, propertyName: UnsafePointer<CChar>!)
-
queryAction(index:
Extension methodowner: actionName: parameterType: propertyName: ) Returns details about the
index_-th
action that has been installed forwidget_class
during class initialization.See [method
Gtk.WidgetClass.install_action
] for details on how to install actions.Note that this function will also return actions defined by parent classes. You can identify those by looking at
owner
.Declaration
Swift
@inlinable func queryAction(index: Int, owner: UnsafeMutablePointer<GType>!, actionName: UnsafeMutablePointer<UnsafePointer<CChar>?>!, parameterType: UnsafeMutablePointer<UnsafePointer<GVariantType>?>?, propertyName: UnsafeMutablePointer<UnsafePointer<CChar>?>?) -> Bool
-
set(accessibleRole:
Extension method) Sets the accessible role used by the given
GtkWidget
class.Different accessible roles have different states, and are rendered differently by assistive technologies.
Declaration
Swift
@inlinable func set(accessibleRole: GtkAccessibleRole)
-
setActivateSignal(signalId:
Extension method) Sets the
GtkWidgetClass.activate_signal
field with the givensignal_id
.The signal will be emitted when calling [method
Gtk.Widget.activate
].The
signal_id
must have been registered withg_signal_new()
org_signal_newv()
before calling this function.Declaration
Swift
@inlinable func setActivateSignal(signalId: Int)
-
setActivateSignalFromName(signalName:
Extension method) Sets the
GtkWidgetClass.activate_signal
field with the signal id for the givensignal_name
.The signal will be emitted when calling [method
Gtk.Widget.activate
].The
signal_name
ofwidget_type
must have been registered withg_signal_new()
org_signal_newv()
before calling this function.Declaration
Swift
@inlinable func setActivateSignalFromName(signalName: UnsafePointer<CChar>!)
-
setCss(name:
Extension method) Sets the name to be used for CSS matching of widgets.
If this function is not called for a given class, the name set on the parent class is used. By default,
GtkWidget
uses the name “widget”.Declaration
Swift
@inlinable func setCss(name: UnsafePointer<CChar>!)
-
setLayoutManager(type:
Extension method) Sets the type to be used for creating layout managers for widgets of
widget_class
.The given
type
must be a subtype of [classGtk.LayoutManager
].This function should only be called from class init functions of widgets.
Declaration
Swift
@inlinable func setLayoutManager(type: GType)
-
setTemplate(templateBytes:
Extension method) This should be called at class initialization time to specify the
GtkBuilder
XML to be used to extend a widget.For convenience, [method
Gtk.WidgetClass.set_template_from_resource
] is also provided.Note that any class that installs templates must call [method
Gtk.Widget.init_template
] in the widget’s instance initializer.Declaration
Swift
@inlinable func setTemplate<BytesT>(templateBytes: BytesT) where BytesT : BytesProtocol
-
setTemplateFromResource(resourceName:
Extension method) A convenience function that calls [method
Gtk.WidgetClass.set_template
] with the contents of aGResource
.Note that any class that installs templates must call [method
Gtk.Widget.init_template
] in the widget’s instance initializer.Declaration
Swift
@inlinable func setTemplateFromResource(resourceName: UnsafePointer<CChar>!)
-
setTemplate(scope:
Extension method) For use in language bindings, this will override the default
GtkBuilderScope
to be used when parsing GtkBuilder XML from this class’s template data.Note that this must be called from a composite widget classes class initializer after calling [method
GtkWidgetClass.set_template
].Declaration
Swift
@inlinable func setTemplate<BuilderScopeT>(scope: BuilderScopeT) where BuilderScopeT : BuilderScopeProtocol
-
accessibleRole
Extension methodRetrieves the accessible role used by the given
GtkWidget
class.Different accessible roles have different states, and are rendered differently by assistive technologies.
See also: [method
Gtk.Accessible.get_accessible_role
].Declaration
Swift
@inlinable var accessibleRole: GtkAccessibleRole { get nonmutating set }
-
activateSignal
Extension methodRetrieves the signal id for the activation signal.
the activation signal is set using [method
Gtk.WidgetClass.set_activate_signal
].Declaration
Swift
@inlinable var activateSignal: Int { get nonmutating set }
-
cssName
Extension methodGets the name used by this class for matching in CSS code.
See [method
Gtk.WidgetClass.set_css_name
] for details.Declaration
Swift
@inlinable var cssName: String! { get nonmutating set }
-
layoutManagerType
Extension methodRetrieves the type of the [class
Gtk.LayoutManager
] used by widgets of classwidget_class
.See also: [method
Gtk.WidgetClass.set_layout_manager_type
].Declaration
Swift
@inlinable var layoutManagerType: GType { get nonmutating set }
-
parentClass
Extension methodThe object class structure needs to be the first element in the widget class structure in order for the class mechanism to work correctly. This allows a GtkWidgetClass pointer to be cast to a GObjectClass pointer.
Declaration
Swift
@inlinable var parentClass: GInitiallyUnownedClass { get }