Style module - SPStyleInterface
Module for manipulating single styles in the styles collection.
Constants
Styles number
See the Styles module.
Property number
Use this to specify which property should be manipulated by a
particular getter or setter function - what_prop
parameter. Always use the constants, the actual numbers may change in
future versions of SP.
Boolean
STYLE_RESOLVE = 1
STYLE_LOCAL = 2
STYLE_EMBEDABLE = 3
STYLE_FONT_B = 4
STYLE_FONT_I = 5
STYLE_FONT_U = 6
STYLE_FONT_S = 7
Text
STYLE_NAME = 11
STYLE_FONT_NAME = 12
Floating point
STYLE_ASS_ANGLE = 31
Integer
STYLE_FONT_SIZE = 41
STYLE_FONT_CHARSET = 42
STYLE_COLOR1 = 43
STYLE_COLOR2 = 44
STYLE_COLOR3 = 45
STYLE_COLORS = 46
STYLE_BORDER_STYLE = 47
STYLE_OUTLINE_W = 48
STYLE_SHADOW_W = 49
STYLE_SUB_POSITION = 50
STYLE_ALIGN = 51
STYLE_MARGIN_L = 52
STYLE_MARGIN_R = 53
STYLE_MARGIN_V = 54
STYLE_MARGIN_V2 = 55
STYLE_ASS_SCALE_X = 56
STYLE_ASS_SCALE_Y = 57
STYLE_ASS_SPACING = 58
STYLE_COLOR1_ALPHA = 59
STYLE_COLOR2_ALPHA = 60
STYLE_COLOR3_ALPHA = 61
STYLE_COLORS_ALPHA = 62
STYLE_INDEX = 63 (get only)
Border style
Possible values for Border style property:
STYLE_P_BST_DEFAULT = -1
STYLE_P_BST_OUTLINE = 1
STYLE_P_BST_BOX = 3
Subtitle position
Possible value for position of subtitles
STYLE_P_SUBPOS_DEFAULT = -1
STYLE_P_SUBPOS_BOTTOM = 0
STYLE_P_SUBPOS_CENTER = 1
STYLE_P_SUBPOS_TOP = 2
Subtitle text align
STYLE_P_SUBALIGN_DEFAULT = -1
STYLE_P_SUBALIGN_LEFT = 1
STYLE_P_SUBALIGN_CENTER = 2
STYLE_P_SUBALIGN_RIGHT = 3
Property getters and setters
These functions are used to set or get values of style properties.
Common parameters are:
- styles_no: select which styles
collection will be used
- style_id: determines which style will
be used. Can be of two types:
- Fixnum: specifies the index of the
style
- String: specifies the name of the
style
- what_prop: select what property shall
be used.
- prop_value: value of the property (for
setter function). Ensure that proper data type is passed, otherwise
access violations will occur!!!
Return value of getter function is either:
- nil: invalid styles collection or style
id
- property value otherwise.
Return value of setter function can be either:
- true: property was successfully set
- false: invalid styles collection
or style id
get_style_prop(styles_no, style_id,
what_prop)
- Get value of specified style property.
set_style_prop(styles_no, style_id,
what_prop, prop_val)
- Set value of specified style property.
Style manipulation methods
These functions of SPStyleInterface enable to call corresponding
methods of TStyle in SP. Common parameters are styles_no
and style_id with the same meaning as with
property
getters.
make_empty(styles_no, style_id)
- Makes the specified style empty (assign 'empty' values to all
properties)
is_empty(styles_no, style_id)
- Query whether the specified style is empty
- Return:
- true or false
depending on the state of the style
- nil if style does not exist
compact_default(styles_no, style_id)
- Compact the style, make it a descendant of default style - fill
'empty' values to all properties that have same value as the default
style. These values are resolved (filled in) on-the-fly when the
'Resolve' property of the style is true.
This compacted style reflects all changes to the default style, because
all its properties marked as 'empty' are in fact taken from the Default
style
style_equals(styles_no, style_id,
other_styles, other_style_id)
- Compare two styles whether they are equal (compare values of all
properties except the 'Name' property)