Class Attribute
- All Implemented Interfaces:
Proxy
PangoAttribute
structure represents the common portions of all
attributes.
Particular types of attributes include this structure as their initial
portion. The common portion of the attribute holds the range to which
the value in the type-specific part of the attribute applies and should
be initialized using init(org.gnome.pango.AttrClass)
. By default, an attribute
will have an all-inclusive range of [0,G_MAXUINT
].
-
Constructor Summary
ConstructorDescriptionAllocate a new Attribute.Allocate a new Attribute.Attribute
(MemorySegment address) Create a Attribute proxy instance for the provided memory address.Allocate a new Attribute with the fields set to the provided values.Allocate a new Attribute with the fields set to the provided values. -
Method Summary
Modifier and TypeMethodDescriptionasColor()
Returns the attribute cast toPangoAttrColor
.asFloat()
Returns the attribute cast toPangoAttrFloat
.Returns the attribute cast toPangoAttrFontDesc
.Returns the attribute cast toPangoAttrFontFeatures
.asInt()
Returns the attribute cast toPangoAttrInt
.Returns the attribute cast toPangoAttrLanguage
.asShape()
Returns the attribute cast toPangoAttrShape
.asSize()
Returns the attribute cast toPangoAttrSize
.asString()
Returns the attribute cast toPangoAttrString
.copy()
Make a copy of an attribute.void
destroy()
Destroy aPangoAttribute
and free all associated memory.boolean
Compare two attributes for equality.static MemoryLayout
The memory layout of the native struct.static Type
getType()
Get the GType of the Attribute classvoid
Initializes this Attribute's klass toklass
, it's start_index toPANGO_ATTR_INDEX_FROM_TEXT_BEGINNING
and end_index toPANGO_ATTR_INDEX_TO_TEXT_END
such that the attribute applies to the entire text by default.int
Read the value of the fieldend_index
.Read the value of the fieldklass
.int
Read the value of the fieldstart_index
.void
writeEndIndex
(int endIndex) Write a value in the fieldend_index
.void
writeKlass
(AttrClass klass) Write a value in the fieldklass
.void
writeStartIndex
(int startIndex) Write a value in the fieldstart_index
.Methods inherited from class io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
Attribute
Create a Attribute proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
Attribute
Allocate a new Attribute.- Parameters:
arena
- to control the memory allocation scope
-
Attribute
public Attribute()Allocate a new Attribute. The memory is allocated withArena.ofAuto()
. -
Attribute
Allocate a new Attribute with the fields set to the provided values.- Parameters:
klass
- value for the fieldklass
startIndex
- value for the fieldstartIndex
endIndex
- value for the fieldendIndex
arena
- to control the memory allocation scope
-
Attribute
Allocate a new Attribute with the fields set to the provided values. The memory is allocated withArena.ofAuto()
.- Parameters:
klass
- value for the fieldklass
startIndex
- value for the fieldstartIndex
endIndex
- value for the fieldendIndex
-
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
readKlass
Read the value of the fieldklass
.- Returns:
- The value of the field
klass
-
writeKlass
Write a value in the fieldklass
.- Parameters:
klass
- The new value for the fieldklass
-
readStartIndex
public int readStartIndex()Read the value of the fieldstart_index
.- Returns:
- The value of the field
start_index
-
writeStartIndex
public void writeStartIndex(int startIndex) Write a value in the fieldstart_index
.- Parameters:
startIndex
- The new value for the fieldstart_index
-
readEndIndex
public int readEndIndex()Read the value of the fieldend_index
.- Returns:
- The value of the field
end_index
-
writeEndIndex
public void writeEndIndex(int endIndex) Write a value in the fieldend_index
.- Parameters:
endIndex
- The new value for the fieldend_index
-
asColor
Returns the attribute cast toPangoAttrColor
.This is mainly useful for language bindings.
- Returns:
- The attribute as
PangoAttrColor
, ornull
if it's not a color attribute
-
asFloat
Returns the attribute cast toPangoAttrFloat
.This is mainly useful for language bindings.
- Returns:
- The attribute as
PangoAttrFloat
, ornull
if it's not a floating point attribute
-
asFontDesc
Returns the attribute cast toPangoAttrFontDesc
.This is mainly useful for language bindings.
- Returns:
- The attribute as
PangoAttrFontDesc
, ornull
if it's not a font description attribute
-
asFontFeatures
Returns the attribute cast toPangoAttrFontFeatures
.This is mainly useful for language bindings.
- Returns:
- The attribute as
PangoAttrFontFeatures
, ornull
if it's not a font features attribute
-
asInt
Returns the attribute cast toPangoAttrInt
.This is mainly useful for language bindings.
- Returns:
- The attribute as
PangoAttrInt
, ornull
if it's not an integer attribute
-
asLanguage
Returns the attribute cast toPangoAttrLanguage
.This is mainly useful for language bindings.
- Returns:
- The attribute as
PangoAttrLanguage
, ornull
if it's not a language attribute
-
asShape
Returns the attribute cast toPangoAttrShape
.This is mainly useful for language bindings.
- Returns:
- The attribute as
PangoAttrShape
, ornull
if it's not a shape attribute
-
asSize
Returns the attribute cast toPangoAttrSize
.This is mainly useful for language bindings.
- Returns:
- The attribute as
PangoAttrSize
, or NULL if it's not a size attribute
-
asString
Returns the attribute cast toPangoAttrString
.This is mainly useful for language bindings.
- Returns:
- The attribute as
PangoAttrString
, ornull
if it's not a string attribute
-
copy
-
destroy
public void destroy()Destroy aPangoAttribute
and free all associated memory. -
equal
Compare two attributes for equality.This compares only the actual value of the two attributes and not the ranges that the attributes apply to.
- Parameters:
attr2
- anotherPangoAttribute
- Returns:
true
if the two attributes have the same value
-
init
Initializes this Attribute's klass toklass
, it's start_index toPANGO_ATTR_INDEX_FROM_TEXT_BEGINNING
and end_index toPANGO_ATTR_INDEX_TO_TEXT_END
such that the attribute applies to the entire text by default.- Parameters:
klass
- aPangoAttrClass
-