PebbleOS v4.47.0-512-g5285d4236
Loading...
Searching...
No Matches
Timeline layouts

Common base of the pin layouts (generic, calendar, weather, sports, alarm, health). More...

Data Structures

struct  TimelineLayoutInfo
 Timing information of the pin rendered by a TimelineLayout. More...
 
struct  TimelineLayout
 Layout rendering a pin; can be cast to a LayoutLayer. More...
 
struct  TimelineLayoutImpl
 Implementation of a TimelineLayout type. More...
 
struct  TimelineLayoutImpl.attributes
 Attributes shown in the pin view. More...
 

Macros

#define TIMELINE_MAX_BOX_HEIGHT   2500
 Maximum height of a card view, in pixels.
 
#define TIMELINE_TOP_MARGIN   10
 Top margin of the pin view, in pixels.
 
#define TIMELINE_CARD_ARROW_HEIGHT   13
 Height of the page break arrow of a card, in pixels.
 
#define TIMELINE_CARD_MARGIN   PBL_IF_RECT_ELSE(7, 12)
 Horizontal margin of a card, in pixels.
 
#define TIMELINE_CARD_TRANSITION_MS   (interpolate_moook_duration())
 Duration of the pin to card transition, in milliseconds.
 
#define TIMELINE_CARD_BODY_HEADER_MARGIN_HEIGHT
 Bottom margin of a card body section header, in pixels.
 
#define TIMELINE_CARD_BODY_MARGIN_HEIGHT
 Bottom margin of a card body section, in pixels.
 

Typedefs

typedef GTextNode *(* TimelineLayoutViewConstructor) (TimelineLayout *layout)
 Build the card view of a layout.
 
typedef void(* TimelineLayoutViewDeinitializer) (TimelineLayout *layout)
 Release resources of a card view before its nodes are destroyed.
 
typedef const char *(* TimelineLayoutPrimaryTextGetter) (const TimelineLayout *layout)
 Get the primary text of a layout.
 

Enumerations

enum  TimelineScrollDirection { TimelineScrollDirectionUp , TimelineScrollDirectionDown }
 Scroll direction of the Timeline. More...
 

Functions

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.
 

Detailed Description

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.


Data Structure Documentation

◆ 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

struct 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

Implementation of a TimelineLayout type.

Data Fields
struct TimelineLayoutImpl.attributes attributes Attributes shown in the pin view.
GAlign card_icon_align Alignment of the icon in the card.
TimelineResourceSize card_icon_size Size of the icon in the card.
TimelineLayoutViewConstructor card_view_constructor Builds the card view.
TimelineLayoutViewDeinitializer card_view_deinitializer Releases card view resources, may be NULL.
LayoutColors default_colors Colors used when the item has no color attributes.
TimelineResourceId default_icon Icon used when the item has none.
TimelineLayoutPrimaryTextGetter get_primary_text Optional, overrides the primary text of the pin and peek views when it returns non-NULL.

◆ TimelineLayoutImpl.attributes

struct TimelineLayoutImpl.attributes

Attributes shown in the pin view.

Data Fields
AttributeId primary_id Primary text attribute.
AttributeId secondary_id Secondary text attribute.

Macro Definition Documentation

◆ 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, /* This is the same as Medium until Small is designed */ \
/* small */ -2, /* medium */ -2, /* large */ \
2, /* This is the same as Large until ExtraLarge is designed */ /* extralarge */ 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, /* This is the same as Medium until Small is designed */ \
/* small */ 17, /* medium */ 17, /* large */ \
15, /* This is the same as Large until ExtraLarge is designed */ /* extralarge */ 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.

Typedef Documentation

◆ TimelineLayoutPrimaryTextGetter

typedef const char *(* TimelineLayoutPrimaryTextGetter) (const TimelineLayout *layout)

Get the primary text of a layout.

Parameters
layoutLayout.
Returns
Text, or NULL to use the primary attribute.

◆ TimelineLayoutViewConstructor

typedef GTextNode *(* TimelineLayoutViewConstructor) (TimelineLayout *layout)

Build the card view of a layout.

Parameters
layoutLayout.
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
layoutLayout.

Enumeration Type Documentation

◆ TimelineScrollDirection

Scroll direction of the Timeline.

Enumerator
TimelineScrollDirectionUp 

Timeline past.

TimelineScrollDirectionDown 

Timeline future.

Function Documentation

◆ timeline_layout_change_mode()

void timeline_layout_change_mode ( LayoutLayer *  layout,
LayoutLayerMode  final_mode 
)

Mode setter of timeline layouts; rebuilds the view for the new mode.

Parameters
layoutLayout.
final_modeNew mode.

◆ timeline_layout_create_card_view_from_config()

GTextNode * timeline_layout_create_card_view_from_config ( const TimelineLayout *  layout,
const LayoutNodeConfig *  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
layoutLayout.
configVertical 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
layoutLayout.
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
layoutLayout.
Returns
New node.

◆ timeline_layout_deinit()

void timeline_layout_deinit ( TimelineLayout *  timeline_layout)

Release the resources of a TimelineLayout without freeing it.

Parameters
timeline_layoutLayout.

◆ timeline_layout_deinit_view()

void timeline_layout_deinit_view ( TimelineLayout *  layout)

Destroy the view of a layout.

Parameters
layoutLayout.

◆ timeline_layout_destroy()

void timeline_layout_destroy ( LayoutLayer *  layout)

LayoutLayerDestructor of timeline layouts; deinitializes and frees the layout.

Parameters
layoutLayout.

◆ timeline_layout_get_colors()

const LayoutColors * timeline_layout_get_colors ( const LayoutLayer *  layout)

Colors getter of timeline layouts.

Parameters
layoutLayout.
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
ctxGraphics context.
layoutLayout.
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
boundsBounds of the layout.
scroll_directionTimeline direction.
[out]frameIcon frame.

◆ timeline_layout_get_icon_resource_id()

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.

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
modeLayout mode.
attributesAttributes of the item.
icon_sizeSize of the card icon.
fallback_resourceIcon 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_layoutLayout.
ctxGraphics context.
[out]size_outSize of the view.

◆ timeline_layout_init()

void timeline_layout_init ( TimelineLayout *  layout,
const LayoutLayerConfig *  config,
const TimelineLayoutImpl *  timeline_layout_impl 
)

Initialize a TimelineLayout, picking its icon from the attributes.

Parameters
[out]layoutLayout to initialize.
configConfiguration; its context must be a TimelineLayoutInfo.
timeline_layout_implImplementation.

◆ timeline_layout_init_info()

void timeline_layout_init_info ( TimelineLayoutInfo *  info,
TimelineItem *  item,
time_t  current_day 
)

Fill the timing information of a pin.

Marks the pin all day, in info and in item, if it spans current_day.

Parameters
[out]infoTiming information.
[in,out]itemPin.
current_dayMidnight of the day the pin is shown in.

◆ timeline_layout_init_view()

void timeline_layout_init_view ( TimelineLayout *  layout,
LayoutLayerMode  mode 
)

Build the view of a layout for a mode and measure it.

Parameters
layoutLayout.
modeMode to build the view for.

◆ timeline_layout_init_with_icon_id()

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.

Parameters
[out]layoutLayout to initialize.
configConfiguration; its context must be a TimelineLayoutInfo.
timeline_layout_implImplementation.
icon_resourceIcon; 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_layoutLayout.
ctxGraphics context.

◆ timeline_layout_time_text_update()

void timeline_layout_time_text_update ( const LayoutLayer *  layout,
const LayoutNodeTextDynamicConfig *  config,
char *  buffer,
bool  render 
)

LayoutNodeTextDynamicUpdate writing the start time of the pin.

Parameters
layoutLayout, a TimelineLayout.
configConfig of the node.
[out]bufferText buffer.
rendertrue when drawing.