ComponentProtocol
public protocol ComponentProtocol
AtkComponent should be implemented by most if not all UI elements
with an actual on-screen presence, i.e. components which can be
said to have a screen-coordinate bounding box. Virtually all
widgets will need to have AtkComponent implementations provided
for their corresponding AtkObject class. In short, only UI
elements which are not GUI elements will omit this ATK interface.
A possible exception might be textual information with a
transparent background, in which case text glyph bounding box
information is provided by AtkText.
The ComponentProtocol protocol exposes the methods and properties of an underlying AtkComponent 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 Component.
Alternatively, use ComponentRef as a lighweight, unowned reference if you already have an instance you just want to use.
-
Untyped pointer to the underlying
AtkComponentinstance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get } -
component_ptrDefault implementationTyped pointer to the underlying
AtkComponentinstance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
AtkComponentinstance.Declaration
Swift
var component_ptr: UnsafeMutablePointer<AtkComponent>! { get } -
Required Initialiser for types conforming to
ComponentProtocolDeclaration
Swift
init(raw: UnsafeMutableRawPointer)
-
connect(signal:Extension methodflags: handler: ) Connect a Swift signal handler to the given, typed
ComponentSignalNamesignalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: ComponentSignalName, flags f: ConnectFlags = ConnectFlags(0), handler h: @escaping SignalHandler) -> IntParameters
signalThe signal to connect
flagsThe connection flags to use
dataA pointer to user data to provide to the callback
destroyDataA
GClosureNotifyC function to destroy the data pointed to byuserDatahandlerThe Swift signal handler (function or callback) to invoke on the given signal
Return Value
The signal handler ID (always greater than 0 for successful connections)
-
connect(signal:Extension methodflags: data: destroyData: signalHandler: ) Connect a C signal handler to the given, typed
ComponentSignalNamesignalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: ComponentSignalName, flags f: ConnectFlags = ConnectFlags(0), data userData: gpointer!, destroyData destructor: GClosureNotify? = nil, signalHandler h: @escaping GCallback) -> IntParameters
signalThe signal to connect
flagsThe connection flags to use
dataA pointer to user data to provide to the callback
destroyDataA
GClosureNotifyC function to destroy the data pointed to byuserDatasignalHandlerThe C function to be called on the given signal
Return Value
The signal handler ID (always greater than 0 for successful connections)
-
onBoundsChanged(flags:Extension methodhandler: ) The ‘bounds-changed" signal is emitted when the bposition or size of the component changes.
Note
This represents the underlyingbounds-changedsignalDeclaration
Swift
@discardableResult @inlinable func onBoundsChanged(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ComponentRef, _ arg1: RectangleRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
arg1The AtkRectangle giving the new position and size.
handlerThe signal handler to call Run the given callback whenever the
boundsChangedsignal is emitted -
boundsChangedSignalExtension methodTyped
bounds-changedsignal for using theconnect(signal:)methodsDeclaration
Swift
static var boundsChangedSignal: ComponentSignalName { get }
-
addFocus(handler:Extension method) Add the specified handler to the set of functions to be called when this object receives focus events (in or out). If the handler is already added it is not added again
add_focus_handler is deprecated: If you need to track when an object gains or lose the focus, use the #AtkObject::state-change “focused” notification instead.
Declaration
Swift
@available(*, deprecated) @inlinable func addFocus(handler: AtkFocusHandler?) -> Int -
contains(x:Extension methody: coordType: ) Checks whether the specified point is within the extent of the
component.Toolkit implementor note: ATK provides a default implementation for this virtual method. In general there are little reason to re-implement it.
Declaration
Swift
@inlinable func contains(x: Int, y: Int, coordType: AtkCoordType) -> Bool -
getAlpha()Extension methodReturns the alpha value (i.e. the opacity) for this
component, on a scale from 0 (fully transparent) to 1.0 (fully opaque).Declaration
Swift
@inlinable func getAlpha() -> Double -
getExtents(x:Extension methody: width: height: coordType: ) Gets the rectangle which gives the extent of the
component.If the extent can not be obtained (e.g. a non-embedded plug or missing support), all of x, y, width, height are set to -1.
Declaration
Swift
@inlinable func getExtents(x: UnsafeMutablePointer<gint>! = nil, y: UnsafeMutablePointer<gint>! = nil, width: UnsafeMutablePointer<gint>! = nil, height: UnsafeMutablePointer<gint>! = nil, coordType: AtkCoordType) -
getLayer()Extension methodGets the layer of the component.
Declaration
Swift
@inlinable func getLayer() -> AtkLayer -
getMdiZorder()Extension methodGets the zorder of the component. The value G_MININT will be returned if the layer of the component is not ATK_LAYER_MDI or ATK_LAYER_WINDOW.
Declaration
Swift
@inlinable func getMdiZorder() -> Int -
getPosition(x:Extension methody: coordType: ) Gets the position of
componentin the form of a point specifyingcomponent‘s top-left corner.If the position can not be obtained (e.g. a non-embedded plug or missing support), x and y are set to -1.
get_position is deprecated: Since 2.12. Use atk_component_get_extents() instead.
Declaration
Swift
@available(*, deprecated) @inlinable func getPosition(x: UnsafeMutablePointer<gint>! = nil, y: UnsafeMutablePointer<gint>! = nil, coordType: AtkCoordType) -
getSize(width:Extension methodheight: ) Gets the size of the
componentin terms of width and height.If the size can not be obtained (e.g. a non-embedded plug or missing support), width and height are set to -1.
get_size is deprecated: Since 2.12. Use atk_component_get_extents() instead.
Declaration
Swift
@available(*, deprecated) @inlinable func getSize(width: UnsafeMutablePointer<gint>! = nil, height: UnsafeMutablePointer<gint>! = nil) -
grabFocus()Extension methodGrabs focus for this
component.Declaration
Swift
@inlinable func grabFocus() -> Bool -
refAccessibleAtPoint(x:Extension methody: coordType: ) Gets a reference to the accessible child, if one exists, at the coordinate point specified by
xandy.Declaration
Swift
@inlinable func refAccessibleAtPoint(x: Int, y: Int, coordType: AtkCoordType) -> Atk.ObjectRef! -
removeFocusHandler(handlerId:Extension method) Remove the handler specified by
handler_idfrom the list of functions to be executed when this object receives focus events (in or out).remove_focus_handler is deprecated: If you need to track when an object gains or lose the focus, use the #AtkObject::state-change “focused” notification instead.
Declaration
Swift
@available(*, deprecated) @inlinable func removeFocusHandler(handlerId: Int) -
scrollTo(type:Extension method) Makes
componentvisible on the screen by scrolling all necessary parents.Contrary to atk_component_set_position, this does not actually move
componentin its parent, this only makes the parents scroll so that the object shows up on the screen, given its current position within the parents.Declaration
Swift
@inlinable func scrollTo(type: AtkScrollType) -> Bool -
scrollToPoint(coords:Extension methodx: y: ) Move the top-left of
componentto a given position of the screen by scrolling all necessary parents.Declaration
Swift
@inlinable func scrollToPoint(coords: AtkCoordType, x: Int, y: Int) -> Bool -
setExtents(x:Extension methody: width: height: coordType: ) Sets the extents of
component.Declaration
Swift
@inlinable func setExtents(x: Int, y: Int, width: Int, height: Int, coordType: AtkCoordType) -> Bool -
setPosition(x:Extension methody: coordType: ) Sets the position of
component.Contrary to atk_component_scroll_to, this does not trigger any scrolling, this just moves
componentin its parent.Declaration
Swift
@inlinable func setPosition(x: Int, y: Int, coordType: AtkCoordType) -> Bool -
setSize(width:Extension methodheight: ) Set the size of the
componentin terms of width and height.Declaration
Swift
@inlinable func setSize(width: Int, height: Int) -> Bool -
alphaExtension methodReturns the alpha value (i.e. the opacity) for this
component, on a scale from 0 (fully transparent) to 1.0 (fully opaque).Declaration
Swift
@inlinable var alpha: Double { get } -
layerExtension methodGets the layer of the component.
Declaration
Swift
@inlinable var layer: AtkLayer { get } -
mdiZorderExtension methodGets the zorder of the component. The value G_MININT will be returned if the layer of the component is not ATK_LAYER_MDI or ATK_LAYER_WINDOW.
Declaration
Swift
@inlinable var mdiZorder: Int { get }
View on GitHub
Install in Dash
ComponentProtocol Protocol Reference