PebbleOS
Loading...
Searching...
No Matches
Data Structures | Typedefs | Enumerations | Functions
Layout layers

Layers that render templated content such as timeline items. More...

Data Structures

struct  LayoutColors
 Colors of a layout. More...
 
struct  LayoutLayerImpl
 Methods of a LayoutLayer type. More...
 
struct  LayoutLayerConstructor
 Base of all layouts; can be cast to a Layer. More...
 
struct  LayoutLayerConfig
 Configuration of a new LayoutLayer. More...
 

Typedefs

typedef void(* LayoutLayerDestructor) (struct LayoutLayer *layout)
 Destructor of a LayoutLayer.
 
typedef bool(* LayoutVerifier) (bool existing_attributes[])
 Check whether attributes satisfy the requirements of a layout.
 
typedef struct GSize(* LayoutLayerSizeGetter) (GContext *ctx, struct LayoutLayer *layout)
 Get the size of a layout's content, set by its text and icons.
 
typedef void(* LayerLayerModeSetter) (struct LayoutLayer *layout, LayoutLayerMode final_mode)
 Change the mode of a layout.
 
typedef void *(* LayoutLayerContextGetter) (struct LayoutLayer *layout)
 Get the type-specific context of a layout.
 

Enumerations

enum  LayoutLayerAnchorTextDirection { LayoutLayerAnchorTextDirectionUp , LayoutLayerAnchorTextDirectionDown }
 Direction in which text is anchored. More...
 
enum  LayoutId {
  LayoutIdUnknown = 0 , LayoutIdGeneric , LayoutIdCalendar , LayoutIdReminder ,
  LayoutIdNotification , LayoutIdCommNotification , LayoutIdWeather , LayoutIdSports ,
  LayoutIdAlarm , LayoutIdHealth , NumLayoutIds , LayoutIdTest
}
 Type of a LayoutLayer, which tells which attributes to expect. More...
 
enum  LayoutLayerMode {
  LayoutLayerModeNone = 0 , LayoutLayerModePeek , LayoutLayerModePinnedFat , LayoutLayerModePinnedThin ,
  LayoutLayerModeCard , NumLayoutLayerModes
}
 Context in which a layout is displayed. More...
 

Functions

LayoutLayer * layout_create (LayoutId id, const LayoutLayerConfig *config)
 Create a layout of a type.
 
bool layout_verify (bool existing_attributes[], LayoutId id)
 Check whether attributes satisfy the requirements of a layout type.
 
GSize layout_get_size (GContext *ctx, LayoutLayer *layout)
 Get the size of a layout's content.
 
const LayoutColors * layout_get_colors (const LayoutLayer *layout)
 Get the colors of a layout.
 
const LayoutColors * layout_get_notification_colors (const LayoutLayer *layout)
 Get the colors of a notification layout.
 
void layout_set_mode (LayoutLayer *layout, LayoutLayerMode final_mode)
 Change the mode of a layout.
 
void layout_destroy (LayoutLayer *layout)
 Destroy a layout with its type's destructor.
 
void * layout_get_context (LayoutLayer *layout)
 Get the type-specific context of a layout.
 

Detailed Description

Layers that render templated content such as timeline items.

A LayoutLayer displays a TimelineItem (pin, reminder or notification) from its attributes. It differs from a plain Layer in that:

const LayoutLayerConfig config = {
.frame = &frame,
.attributes = &item->attr_list,
.app_id = &item->header.parent_id,
.context = &info,
};
LayoutLayer *layout = layout_create(item->header.layout, &config);
layer_add_child(parent, (Layer *)layout);
...
layout_destroy(layout);
time_t time_util_get_midnight_of(time_t ts)
Get the local midnight starting the day of a time.
const GRect * frame
Frame of the layer.
Definition layout_layer.h:208
Base of all layouts; can be cast to a Layer.
Definition layout_layer.h:194
Configuration of a new LayoutLayer.
Definition layout_layer.h:206
LayoutLayer * layout_create(LayoutId id, const LayoutLayerConfig *config)
Create a layout of a type.
@ LayoutLayerModeCard
Card showing the details of a TimelineItem.
Definition layout_layer.h:106
Timing information of the pin rendered by a TimelineLayout.
Definition timeline_layout.h:93
void timeline_layout_init_info(TimelineLayoutInfo *info, TimelineItem *item, time_t current_day)
Fill the timing information of a pin.

Data Structure Documentation

◆ LayoutColors

struct LayoutColors

Colors of a layout.

Data Fields
GColor bg_color Background color.
GColor primary_color Primary (foreground) color.
GColor secondary_color Secondary color.

◆ LayoutLayerImpl

struct LayoutLayerImpl

Methods of a LayoutLayer type.

Data Fields
LayoutLayerContextGetter context_getter Context getter, may be NULL.
LayoutLayerDestructor destructor Destructor.
LayerLayerModeSetter mode_setter Mode setter.
LayoutLayerSizeGetter size_getter Content size getter.

◆ LayoutLayer

struct LayoutLayer

Base of all layouts; can be cast to a Layer.

Constructor of a LayoutLayer.

Parameters
configConfiguration; each layout type expects specific attributes and context.
Returns
New layout, allocated on the calling task's heap.
Data Fields
AttributeList * attributes Attributes displayed; not owned.
const LayoutLayerImpl * impl Methods of the layout type.
Layer layer Underlying layer.
LayoutLayerMode mode Current mode.

◆ LayoutLayerConfig

struct LayoutLayerConfig

Configuration of a new LayoutLayer.

Data Fields
const Uuid * app_id App owning the item, used to resolve app-published icons.
AttributeList * attributes Attributes to display; must outlive the layout.
void * context Type-specific context: a TimelineLayoutInfo for timeline layouts, a NotificationLayoutInfo for the notification and reminder layouts.
const GRect * frame Frame of the layer.
LayoutLayerMode mode Initial mode.

Typedef Documentation

◆ LayerLayerModeSetter

typedef void(* LayerLayerModeSetter) (struct LayoutLayer *layout, LayoutLayerMode final_mode)

Change the mode of a layout.

Parameters
layoutLayout.
final_modeNew mode.

◆ LayoutLayerContextGetter

typedef void *(* LayoutLayerContextGetter) (struct LayoutLayer *layout)

Get the type-specific context of a layout.

Parameters
layoutLayout.
Returns
Context; the notification layout returns its TimelineItem.

◆ LayoutLayerDestructor

typedef void(* LayoutLayerDestructor) (struct LayoutLayer *layout)

Destructor of a LayoutLayer.

Parameters
layoutLayout to destroy.

◆ LayoutLayerSizeGetter

typedef struct GSize(* LayoutLayerSizeGetter) (GContext *ctx, struct LayoutLayer *layout)

Get the size of a layout's content, set by its text and icons.

Parameters
ctxGraphics context the layout is rendered in.
layoutLayout.
Returns
Size of the content.

◆ LayoutVerifier

typedef bool(* LayoutVerifier) (bool existing_attributes[])

Check whether attributes satisfy the requirements of a layout.

Parameters
existing_attributesArray of NumAttributeIds flags, indexed by AttributeId.
Returns
true if the required attributes are present.

Enumeration Type Documentation

◆ LayoutId

enum LayoutId

Type of a LayoutLayer, which tells which attributes to expect.

Stored in CommonTimelineItemHeader::layout.

Enumerator
LayoutIdUnknown 

Not a valid id.

LayoutIdGeneric 

Generic pin; requires a title.

LayoutIdCalendar 

Calendar pin; requires a title.

LayoutIdReminder 

Reminder, rendered by the notification layout; requires a title.

LayoutIdNotification 

Notification; requires a title.

LayoutIdCommNotification 

Communication notification; not implemented, never verifies.

LayoutIdWeather 

Weather pin; requires a title and a location name.

LayoutIdSports 

Sports pin; requires a title.

LayoutIdAlarm 

Alarm pin; requires a title and a subtitle.

LayoutIdHealth 

Health pin; requires a title.

NumLayoutIds 

Number of layout ids.

LayoutIdTest 

Unit test layout with no attribute requirements, rendered as generic.

◆ LayoutLayerAnchorTextDirection

Direction in which text is anchored.

Enumerator
LayoutLayerAnchorTextDirectionUp 

Scrolling up, past mode.

LayoutLayerAnchorTextDirectionDown 

Scrolling down, future mode.

◆ LayoutLayerMode

Context in which a layout is displayed.

Enumerator
LayoutLayerModeNone 

No mode.

LayoutLayerModePeek 

Overlay shown like a partially obstructing HUD (Timeline Peek).

LayoutLayerModePinnedFat 

Menu-style mode in the Timeline app, fat first item.

LayoutLayerModePinnedThin 

Menu-style mode in the Timeline app, thin second item.

LayoutLayerModeCard 

Card showing the details of a TimelineItem.

NumLayoutLayerModes 

Number of modes.

Function Documentation

◆ layout_create()

LayoutLayer * layout_create ( LayoutId  id,
const LayoutLayerConfig *  config 
)

Create a layout of a type.

Parameters
idLayout type; LayoutIdTest creates a generic layout. Must not be LayoutIdUnknown.
configConfiguration.
Returns
New layout, allocated on the calling task's heap.

◆ layout_destroy()

void layout_destroy ( LayoutLayer *  layout)

Destroy a layout with its type's destructor.

Parameters
layoutLayout.

◆ layout_get_colors()

const LayoutColors * layout_get_colors ( const LayoutLayer *  layout)

Get the colors of a layout.

Parameters
layoutLayout.
Returns
Layout colors, or defaults on black and white platforms or if the type has none.

◆ layout_get_context()

void * layout_get_context ( LayoutLayer *  layout)

Get the type-specific context of a layout.

Parameters
layoutLayout.
Returns
Context, or NULL if the type has none.

◆ layout_get_notification_colors()

const LayoutColors * layout_get_notification_colors ( const LayoutLayer *  layout)

Get the colors of a notification layout.

On black and white platforms the colors follow the notification design preference.

Parameters
layoutLayout.
Returns
Colors.

◆ layout_get_size()

GSize layout_get_size ( GContext *  ctx,
LayoutLayer *  layout 
)

Get the size of a layout's content.

Parameters
ctxGraphics context.
layoutLayout.
Returns
Size of the content.

◆ layout_set_mode()

void layout_set_mode ( LayoutLayer *  layout,
LayoutLayerMode  final_mode 
)

Change the mode of a layout.

Parameters
layoutLayout.
final_modeNew mode.

◆ layout_verify()

bool layout_verify ( bool  existing_attributes[],
LayoutId  id 
)

Check whether attributes satisfy the requirements of a layout type.

Parameters
existing_attributesArray of NumAttributeIds flags, indexed by AttributeId.
idLayout type.
Returns
true if valid; always true for LayoutIdTest, false for unknown or unimplemented types.