Common base of the pin layouts (generic, calendar, weather, sports, alarm, health).
More...
|
| TimelineResourceId | timeline_layout_get_icon_resource_id (LayoutLayerMode mode, const AttributeList *attributes, TimelineResourceSize icon_size, TimelineResourceId fallback_resource) |
| | Pick the icon of a layout from its attributes.
|
| |
| void | timeline_layout_init (TimelineLayout *layout, const LayoutLayerConfig *config, const TimelineLayoutImpl *timeline_layout_impl) |
| | Initialize a TimelineLayout, picking its icon from the attributes.
|
| |
| void | timeline_layout_init_with_icon_id (TimelineLayout *layout, const LayoutLayerConfig *config, const TimelineLayoutImpl *timeline_layout_impl, TimelineResourceId icon_resource) |
| | Initialize a TimelineLayout with a given icon.
|
| |
| void | timeline_layout_init_info (TimelineLayoutInfo *info, TimelineItem *item, time_t current_day) |
| | Fill the timing information of a pin.
|
| |
| void | timeline_layout_deinit (TimelineLayout *timeline_layout) |
| | Release the resources of a TimelineLayout without freeing it.
|
| |
| void | timeline_layout_get_icon_frame (const GRect *bounds, TimelineScrollDirection scroll_direction, GRect *frame) |
| | Get the frame of the pin icon.
|
| |
| GSize | timeline_layout_get_content_size (GContext *ctx, LayoutLayer *layout) |
| | LayoutLayerSizeGetter of timeline layouts.
|
| |
| void | timeline_layout_destroy (LayoutLayer *layout) |
| | LayoutLayerDestructor of timeline layouts; deinitializes and frees the layout.
|
| |
| void | timeline_layout_change_mode (LayoutLayer *layout, LayoutLayerMode final_mode) |
| | Mode setter of timeline layouts; rebuilds the view for the new mode.
|
| |
| const LayoutColors * | timeline_layout_get_colors (const LayoutLayer *layout) |
| | Colors getter of timeline layouts.
|
| |
| void | timeline_layout_init_view (TimelineLayout *layout, LayoutLayerMode mode) |
| | Build the view of a layout for a mode and measure it.
|
| |
| void | timeline_layout_deinit_view (TimelineLayout *layout) |
| | Destroy the view of a layout.
|
| |
| void | timeline_layout_render_view (TimelineLayout *timeline_layout, GContext *ctx) |
| | Draw the view of a layout.
|
| |
| void | timeline_layout_get_size (TimelineLayout *timeline_layout, GContext *ctx, GSize *size_out) |
| | Measure the view of a layout.
|
| |
| GTextNode * | timeline_layout_create_card_view_from_config (const TimelineLayout *layout, const LayoutNodeConfig *config) |
| | Build a card view from a vertical container config.
|
| |
| GTextNodeCustom * | timeline_layout_create_icon_node (const TimelineLayout *layout) |
| | Create a node positioning the layout's icon.
|
| |
| GTextNodeCustom * | timeline_layout_create_page_break_node (const TimelineLayout *layout) |
| | Create a page break node, which draws the glance arrow.
|
| |
| void | timeline_layout_time_text_update (const LayoutLayer *layout, const LayoutNodeTextDynamicConfig *config, char *buffer, bool render) |
| | LayoutNodeTextDynamicUpdate writing the start time of the pin.
|
| |
Common base of the pin layouts (generic, calendar, weather, sports, alarm, health).
A TimelineLayout renders a pin either as a compact pin view (peek and Timeline list modes), built here from the primary and secondary attributes of its TimelineLayoutImpl, or as a card, built by the implementation's card view constructor. It owns the pin icon, chosen from the icon attributes for the mode. The LayoutLayerConfig context must be a TimelineLayoutInfo.
◆ TimelineLayoutInfo
| struct TimelineLayoutInfo |
Timing information of the pin rendered by a TimelineLayout.
| Data Fields |
|
bool |
all_day |
The pin is all day, or spans the whole current day. |
|
Uuid |
app_id |
App owning the pin. |
|
time_t |
current_day |
Midnight of the day the pin is shown in. |
|
uint32_t |
duration_s |
Duration in seconds. |
|
time_t |
end_time |
End time of the pin. |
|
unsigned int |
num_concurrent |
Number of concurrent events besides the first: 0 for a single event, 1 for two overlapping events. Only valid for Timeline Peek.
|
|
time_t |
pin_time |
Time shown on the pin: the end time on the last day of a multi-day event, else the start. |
|
TimelineScrollDirection |
scroll_direction |
Timeline direction the pin is shown in. |
|
time_t |
timestamp |
Start time of the pin. |
◆ TimelineLayout
Layout rendering a pin; can be cast to a LayoutLayer.
Layout rendering a pin.
| Data Fields |
|
LayoutColors |
colors |
Colors, from the color attributes or the implementation's defaults. |
|
bool |
has_page_break |
The card has a page break, enabling the special first scroll behavior. |
|
TimelineResourceInfo |
icon_info |
Timeline resource of the icon. |
|
KinoLayer |
icon_layer |
Pin icon. |
|
AppResourceInfo |
icon_res_info |
Resource of the pin icon. |
|
uint32_t |
icon_resource_id |
Resource id of the pin icon. |
|
GSize |
icon_size |
Size of the pin icon. |
|
const TimelineLayoutImpl * |
impl |
Implementation. |
|
TimelineLayoutInfo * |
info |
Timing of the pin, from the LayoutLayerConfig context. |
|
bool |
is_being_destroyed |
Set while being destroyed, so animation stopped handlers do not start more animations. |
|
LayoutLayer |
layout_layer |
Base layout. |
|
KinoLayer ** |
metric_icon_layers |
Icon layers of the metrics. |
|
unsigned int |
num_metric_icon_layers |
Number of metric icon layers. |
|
int16_t |
page_break_height |
Height of the content before the page break. |
|
Animation * |
transition_animation |
Transition animation, unscheduled on deinit. |
|
struct TimelineLayout * |
transition_layout |
Layout this one is transitioning to. |
|
GTextNode * |
view_node |
Root of the view. |
|
GSize |
view_size |
Size of the view. |
◆ TimelineLayoutImpl
| struct TimelineLayoutImpl |
◆ TimelineLayoutImpl.attributes
| struct TimelineLayoutImpl.attributes |
Attributes shown in the pin view.
◆ TIMELINE_CARD_ARROW_HEIGHT
| #define TIMELINE_CARD_ARROW_HEIGHT 13 |
Height of the page break arrow of a card, in pixels.
◆ TIMELINE_CARD_BODY_HEADER_MARGIN_HEIGHT
| #define TIMELINE_CARD_BODY_HEADER_MARGIN_HEIGHT |
Value: PREFERRED_CONTENT_SIZE_SWITCH( \
PreferredContentSizeDefault, \
-2, -2, \
2, 2)
Bottom margin of a card body section header, in pixels.
◆ TIMELINE_CARD_BODY_MARGIN_HEIGHT
| #define TIMELINE_CARD_BODY_MARGIN_HEIGHT |
Value: PREFERRED_CONTENT_SIZE_SWITCH( \
PreferredContentSizeDefault, \
17, 17, \
15, 15)
Bottom margin of a card body section, in pixels.
◆ TIMELINE_CARD_MARGIN
| #define TIMELINE_CARD_MARGIN PBL_IF_RECT_ELSE(7, 12) |
Horizontal margin of a card, in pixels.
◆ TIMELINE_CARD_TRANSITION_MS
| #define TIMELINE_CARD_TRANSITION_MS (interpolate_moook_duration()) |
Duration of the pin to card transition, in milliseconds.
◆ TIMELINE_MAX_BOX_HEIGHT
| #define TIMELINE_MAX_BOX_HEIGHT 2500 |
Maximum height of a card view, in pixels.
◆ TIMELINE_TOP_MARGIN
| #define TIMELINE_TOP_MARGIN 10 |
Top margin of the pin view, in pixels.
◆ TimelineLayoutPrimaryTextGetter
| typedef const char *(* TimelineLayoutPrimaryTextGetter) (const TimelineLayout *layout) |
Get the primary text of a layout.
- Parameters
-
- Returns
- Text, or NULL to use the primary attribute.
◆ TimelineLayoutViewConstructor
| typedef GTextNode *(* TimelineLayoutViewConstructor) (TimelineLayout *layout) |
Build the card view of a layout.
- Parameters
-
- Returns
- Root node of the card view.
◆ TimelineLayoutViewDeinitializer
| typedef void(* TimelineLayoutViewDeinitializer) (TimelineLayout *layout) |
Release resources of a card view before its nodes are destroyed.
- Parameters
-
◆ TimelineScrollDirection
Scroll direction of the Timeline.
| Enumerator |
|---|
| TimelineScrollDirectionUp | Timeline past.
|
| TimelineScrollDirectionDown | Timeline future.
|
◆ timeline_layout_change_mode()
Mode setter of timeline layouts; rebuilds the view for the new mode.
- Parameters
-
| layout | Layout. |
| final_mode | New mode. |
◆ timeline_layout_create_card_view_from_config()
Build a card view from a vertical container config.
Appends the headings and paragraphs and, if the item has a last updated time, a "Last updated" section.
- Parameters
-
| layout | Layout. |
| config | Vertical container config. |
- Returns
- Root node of the card view.
◆ timeline_layout_create_icon_node()
| GTextNodeCustom * timeline_layout_create_icon_node |
( |
const TimelineLayout * |
layout | ) |
|
Create a node positioning the layout's icon.
- Parameters
-
- Returns
- New node.
◆ timeline_layout_create_page_break_node()
| GTextNodeCustom * timeline_layout_create_page_break_node |
( |
const TimelineLayout * |
layout | ) |
|
Create a page break node, which draws the glance arrow.
- Parameters
-
- Returns
- New node.
◆ timeline_layout_deinit()
Release the resources of a TimelineLayout without freeing it.
- Parameters
-
◆ timeline_layout_deinit_view()
Destroy the view of a layout.
- Parameters
-
◆ timeline_layout_destroy()
LayoutLayerDestructor of timeline layouts; deinitializes and frees the layout.
- Parameters
-
◆ timeline_layout_get_colors()
Colors getter of timeline layouts.
- Parameters
-
- Returns
- Colors of the layout.
◆ timeline_layout_get_content_size()
| GSize timeline_layout_get_content_size |
( |
GContext * |
ctx, |
|
|
LayoutLayer * |
layout |
|
) |
| |
LayoutLayerSizeGetter of timeline layouts.
- Parameters
-
| ctx | Graphics context. |
| layout | Layout. |
- Returns
- Size of the view.
◆ timeline_layout_get_icon_frame()
| void timeline_layout_get_icon_frame |
( |
const GRect * |
bounds, |
|
|
TimelineScrollDirection |
scroll_direction, |
|
|
GRect * |
frame |
|
) |
| |
Get the frame of the pin icon.
- Parameters
-
| bounds | Bounds of the layout. |
| scroll_direction | Timeline direction. |
| [out] | frame | Icon frame. |
◆ timeline_layout_get_icon_resource_id()
Pick the icon of a layout from its attributes.
Cards try the icon attribute of icon_size first, then the tiny icon, then the pin icon; other modes try the pin icon, then the tiny icon, then the icon of icon_size.
- Parameters
-
| mode | Layout mode. |
| attributes | Attributes of the item. |
| icon_size | Size of the card icon. |
| fallback_resource | Icon used if no attribute is set. |
- Returns
- Timeline resource id.
◆ timeline_layout_get_size()
| void timeline_layout_get_size |
( |
TimelineLayout * |
timeline_layout, |
|
|
GContext * |
ctx, |
|
|
GSize * |
size_out |
|
) |
| |
Measure the view of a layout.
- Parameters
-
| timeline_layout | Layout. |
| ctx | Graphics context. |
| [out] | size_out | Size of the view. |
◆ timeline_layout_init()
Initialize a TimelineLayout, picking its icon from the attributes.
- Parameters
-
| [out] | layout | Layout to initialize. |
| config | Configuration; its context must be a TimelineLayoutInfo. |
| timeline_layout_impl | Implementation. |
◆ timeline_layout_init_info()
Fill the timing information of a pin.
Marks the pin all day, in info and in item, if it spans current_day.
- Parameters
-
| [out] | info | Timing information. |
| [in,out] | item | Pin. |
| current_day | Midnight of the day the pin is shown in. |
◆ timeline_layout_init_view()
Build the view of a layout for a mode and measure it.
- Parameters
-
| layout | Layout. |
| mode | Mode to build the view for. |
◆ timeline_layout_init_with_icon_id()
Initialize a TimelineLayout with a given icon.
- Parameters
-
| [out] | layout | Layout to initialize. |
| config | Configuration; its context must be a TimelineLayoutInfo. |
| timeline_layout_impl | Implementation. |
| icon_resource | Icon; the implementation's default icon is used if it cannot be loaded. |
◆ timeline_layout_render_view()
| void timeline_layout_render_view |
( |
TimelineLayout * |
timeline_layout, |
|
|
GContext * |
ctx |
|
) |
| |
Draw the view of a layout.
- Parameters
-
| timeline_layout | Layout. |
| ctx | Graphics context. |
◆ timeline_layout_time_text_update()
LayoutNodeTextDynamicUpdate writing the start time of the pin.
- Parameters
-
| layout | Layout, a TimelineLayout. |
| config | Config of the node. |
| [out] | buffer | Text buffer. |
| render | true when drawing. |