Layers that render templated content such as timeline items.
More...
|
| 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...
|
| |
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:
- it is modulated by a LayoutLayerMode, the context it is shown in, e.g. a detailed card or a compact pin in the Timeline list;
- it exposes generic methods: layout_create(), layout_destroy() and layout_get_size();
- it is built from the set of attributes it displays;
- sub-types are instantiated by LayoutId rather than through specialized constructors.
.attributes = &item->attr_list,
.app_id = &item->header.parent_id,
.context = &info,
};
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.
◆ LayoutColors
| Data Fields |
|
GColor |
bg_color |
Background color. |
|
GColor |
primary_color |
Primary (foreground) color. |
|
GColor |
secondary_color |
Secondary color. |
◆ LayoutLayerImpl
◆ LayoutLayer
Base of all layouts; can be cast to a Layer.
Constructor of a LayoutLayer.
- Parameters
-
| config | Configuration; each layout type expects specific attributes and context. |
- Returns
- New layout, allocated on the calling task's heap.
◆ 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. |
◆ LayerLayerModeSetter
Change the mode of a layout.
- Parameters
-
| layout | Layout. |
| final_mode | New mode. |
◆ LayoutLayerContextGetter
| typedef void *(* LayoutLayerContextGetter) (struct LayoutLayer *layout) |
Get the type-specific context of a layout.
- Parameters
-
- Returns
- Context; the notification layout returns its TimelineItem.
◆ LayoutLayerDestructor
| typedef void(* LayoutLayerDestructor) (struct LayoutLayer *layout) |
◆ 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
-
| ctx | Graphics context the layout is rendered in. |
| layout | Layout. |
- Returns
- Size of the content.
◆ LayoutVerifier
| typedef bool(* LayoutVerifier) (bool existing_attributes[]) |
Check whether attributes satisfy the requirements of a layout.
- Parameters
-
| existing_attributes | Array of NumAttributeIds flags, indexed by AttributeId. |
- Returns
- true if the required attributes are present.
◆ 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.
|
◆ layout_create()
Create a layout of a type.
- Parameters
-
| id | Layout type; LayoutIdTest creates a generic layout. Must not be LayoutIdUnknown. |
| config | Configuration. |
- Returns
- New layout, allocated on the calling task's heap.
◆ layout_destroy()
Destroy a layout with its type's destructor.
- Parameters
-
◆ layout_get_colors()
Get the colors of a layout.
- Parameters
-
- Returns
- Layout colors, or defaults on black and white platforms or if the type has none.
◆ layout_get_context()
Get the type-specific context of a layout.
- Parameters
-
- Returns
- Context, or NULL if the type has none.
◆ layout_get_notification_colors()
Get the colors of a notification layout.
On black and white platforms the colors follow the notification design preference.
- Parameters
-
- Returns
- Colors.
◆ layout_get_size()
| GSize layout_get_size |
( |
GContext * |
ctx, |
|
|
LayoutLayer * |
layout |
|
) |
| |
Get the size of a layout's content.
- Parameters
-
| ctx | Graphics context. |
| layout | Layout. |
- Returns
- Size of the content.
◆ layout_set_mode()
Change the mode of a layout.
- Parameters
-
| layout | Layout. |
| final_mode | New mode. |
◆ layout_verify()
| bool layout_verify |
( |
bool |
existing_attributes[], |
|
|
LayoutId |
id |
|
) |
| |
Check whether attributes satisfy the requirements of a layout type.
- Parameters
-
| existing_attributes | Array of NumAttributeIds flags, indexed by AttributeId. |
| id | Layout type. |
- Returns
- true if valid; always true for LayoutIdTest, false for unknown or unimplemented types.