Styling
PBAppearance
Opaque object handle:
This object maintains an internal reference count. When the reference count reaches zero, the object will be automatically deallocated. To increment the reference count, call PBAppearanceRetain; to decrement the reference count, call PBAppearanceRelease. These functions are thread-safe.
PBStyleID
Enumeration/bitset of type uint32_t:
Constants
PBStyleID_EMPTY
PBStyleID_EMPTY = 0
PBStyleID_ONE_LINE_INPUT
PBStyleID_ONE_LINE_INPUT = 21
PBStyleID_BORDER_OUTSIDE
PBStyleID_BORDER_OUTSIDE = 24
PBStyleID_TABLE_ITEM
PBStyleID_TABLE_ITEM = 38
PBStyleID_HORIZONTAL_SEPARATOR
PBStyleID_HORIZONTAL_SEPARATOR = 43
PBStyleID_CODE_BLOCK
PBStyleID_CODE_BLOCK = 47
PBStyleID_QUOTE_BLOCK
PBStyleID_QUOTE_BLOCK = 48
PBStyleID_HORIZONTAL_RULE
PBStyleID_HORIZONTAL_RULE = 49
PBStyleID_HORIZONTAL_LINE
PBStyleID_HORIZONTAL_LINE = 52
PBStyleID_PUSH_BUTTON_SMALL
PBStyleID_PUSH_BUTTON_SMALL = 53
PBStyleID_TAB_SWITCHER_BOTTOM
PBStyleID_TAB_SWITCHER_BOTTOM = 54
PBStyleID_DOCUMENT_TITLE
PBStyleID_DOCUMENT_TITLE = 55
PBStyleID_DOCUMENT_MARGIN
PBStyleID_DOCUMENT_MARGIN = 56
PBStyleID_VERTICAL_LINE
PBStyleID_VERTICAL_LINE = 57
PBCursorID
Enumeration/bitset of type uint8_t:
Constants
PBCursorID_ARROW
PBCursorID_ARROW = 0
PBCursorID_IBEAM
PBCursorID_IBEAM = 1
PBCursorID_HIDDEN
PBCursorID_HIDDEN = 3
PBCursorID_SPLIT_HORIZONTAL
PBCursorID_SPLIT_HORIZONTAL = 4
PBCursorID_SPLIT_VERTICAL
PBCursorID_SPLIT_VERTICAL = 5
PBCursorID_HAND_POINT
PBCursorID_HAND_POINT = 6
PBLayoutMetricsFlags
Enumeration/bitset of type uint16_t:
Constants
PBLayoutMetrics_WIDTH_EXACT
PBLayoutMetrics_WIDTH_EXACT = 1<<0
PBLayoutMetrics_HEIGHT_EXACT
PBLayoutMetrics_HEIGHT_EXACT = 1<<1
PBLayoutMetrics
Structure: The layout metrics of an element.
Fields
flags (PBLayoutMetricsFlags): Flags bitwise OR-ed together specifying additional options.
widthExact (int32_t
): The preferred width of the element to return from PBElementMeasure. Requires the PBLayoutMetrics_WIDTH_EXACT flag. Otherwise, the preferred width of the element is determined by the element's layout algorithm.
heightExact (int32_t
): The preferred height of the element to return from PBElementMeasure. Requires the PBLayoutMetrics_HEIGHT_EXACT flag. Otherwise, the preferred height of the element is determined by the element's layout algorithm.
gap (int32_t
): In the standard layout algorithm, this determines the spacing between each pair of adjacent child elements.
insets (PBRectangle): In the standard layout algorithms, this determines the minimum spacing between the edges of the element and its child elements.
See Also
PBElementSetStyle
Function: Set an element's style to a preset style.
Syntax (C/C++)
void PBElementSetStyle(PBElementRef element, PBStyleID styleID);
Syntax (Python)
ElementSetStyle(element, styleID)
Parameters and Return Values
[in] element (referenced PBElement): The element to modify.
[in] styleID (PBStyleID): The preset style identifier. This will determine the element's layout metrics and appearance.
Discussion
The element will be repainted later in the event loop and necessary relayouting will be requested.
Example (C/C++)
PBElementSetStyle((PBElement *) panel, PBStyleID_BORDER_OUTSIDE);
See Also
PBElementGetLayoutMetrics
Function: Get the layout metrics of an element, as determined by its style, scaled to appear in its window.
Syntax (C/C++)
PBLayoutMetrics PBElementGetLayoutMetrics(PBElementRef element);
Syntax (Python)
ElementGetLayoutMetrics(element) -> (layoutMetrics)
Parameters and Return Values
[in] element (referenced PBElement): The element.
[out] layoutMetrics (PBLayoutMetrics): Its style's layout metrics, with all dimensions given in pixels.
Discussion
You can change an element's layout metrics directly with PBElementSetCustomStyle. Changing its style with PBElementSetStyle will also cause the metrics to change.
The window's scale factor will be used to convert the dimensions in the metrics from dps to pixels automatically each time the scale factor changes.