mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-06-24 02:55:39 +02:00
config: all particles now take a 'on_click_template' argument
This commit is contained in:
parent
3eebdbb5b0
commit
86425fbe48
7 changed files with 56 additions and 35 deletions
|
@ -19,16 +19,22 @@ expose(const struct exposable *exposable, cairo_t *cr, int x, int y, int height)
|
|||
static struct exposable *
|
||||
instantiate(const struct particle *particle, const struct tag_set *tags)
|
||||
{
|
||||
struct exposable *exposable = exposable_common_new(particle, NULL);
|
||||
char *on_click = tags_expand_template(particle->on_click_template, tags);
|
||||
|
||||
struct exposable *exposable = exposable_common_new(particle, on_click);
|
||||
exposable->begin_expose = &begin_expose;
|
||||
exposable->expose = &expose;
|
||||
|
||||
free(on_click);
|
||||
return exposable;
|
||||
}
|
||||
|
||||
struct particle *
|
||||
particle_empty_new(int left_margin, int right_margin)
|
||||
particle_empty_new(int left_margin, int right_margin,
|
||||
const char *on_click_template)
|
||||
{
|
||||
struct particle *particle = particle_common_new(left_margin, right_margin, NULL);
|
||||
struct particle *particle = particle_common_new(
|
||||
left_margin, right_margin, on_click_template);
|
||||
particle->destroy = &particle_default_destroy;
|
||||
particle->instantiate = &instantiate;
|
||||
return particle;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#pragma once
|
||||
#include "../particle.h"
|
||||
|
||||
struct particle *particle_empty_new(int left_margin, int right_margin);
|
||||
struct particle *particle_empty_new(
|
||||
int left_margin, int right_margin, const char *on_click_template);
|
||||
|
|
|
@ -139,10 +139,11 @@ particle_destroy(struct particle *particle)
|
|||
struct particle *
|
||||
particle_map_new(const char *tag, const struct particle_map *particle_map,
|
||||
size_t count, struct particle *default_particle,
|
||||
int left_margin, int right_margin)
|
||||
int left_margin, int right_margin,
|
||||
const char *on_click_template)
|
||||
{
|
||||
struct particle *particle = particle_common_new(
|
||||
left_margin, right_margin, NULL);
|
||||
left_margin, right_margin, on_click_template);
|
||||
particle->destroy = &particle_destroy;
|
||||
particle->instantiate = &instantiate;
|
||||
|
||||
|
|
|
@ -8,4 +8,5 @@ struct particle_map {
|
|||
|
||||
struct particle *particle_map_new(
|
||||
const char *tag, const struct particle_map *particle_map, size_t count,
|
||||
struct particle *default_particle, int left_margin, int right_margin);
|
||||
struct particle *default_particle, int left_margin, int right_margin,
|
||||
const char *on_click_template);
|
||||
|
|
|
@ -134,10 +134,11 @@ instantiate(const struct particle *particle, const struct tag_set *tags)
|
|||
|
||||
struct particle *
|
||||
particle_ramp_new(const char *tag, struct particle *particles[], size_t count,
|
||||
int left_margin, int right_margin)
|
||||
int left_margin, int right_margin,
|
||||
const char *on_click_template)
|
||||
{
|
||||
struct particle *particle = particle_common_new(
|
||||
left_margin, right_margin, NULL);
|
||||
left_margin, right_margin, on_click_template);
|
||||
particle->destroy = &particle_destroy;
|
||||
particle->instantiate = &instantiate;
|
||||
|
||||
|
|
|
@ -3,4 +3,4 @@
|
|||
|
||||
struct particle *particle_ramp_new(
|
||||
const char *tag, struct particle *particles[], size_t count,
|
||||
int left_margin, int right_margin);
|
||||
int left_margin, int right_margin, const char *on_click_template);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue