summaryrefslogtreecommitdiff
path: root/src/core/expandos.h
blob: a937fcd1cca414e58e062d6254f6e87743317b5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef __EXPANDOS_H
#define __EXPANDOS_H

#include "signals.h"
#include "servers.h"

/* first argument of signal must match to active .. */
typedef enum {
        EXPANDO_ARG_NONE,
        EXPANDO_ARG_SERVER,
        EXPANDO_ARG_WINDOW,
	EXPANDO_ARG_WINDOW_ITEM,

	EXPANDO_NEVER /* special: expando never changes */
} ExpandoArg;

typedef char* (*EXPANDO_FUNC)
	(SERVER_REC *server, void *item, int *free_ret);

/* Create expando - overrides any existing ones.
   ... = signal, type, ..., NULL - list of signals that might change the
   value of this expando */
void expando_create(const char *key, EXPANDO_FUNC func, ...);
/* Add new signal to expando */
void expando_add_signal(const char *key, const char *signal, ExpandoArg arg);
/* Destroy expando */
void expando_destroy(const char *key, EXPANDO_FUNC func);

void expando_bind(const char *key, int funccount, SIGNAL_FUNC *funcs);
void expando_unbind(const char *key, int funccount, SIGNAL_FUNC *funcs);

/* internal: */
EXPANDO_FUNC expando_find_char(char chr);
EXPANDO_FUNC expando_find_long(const char *key);

void expandos_init(void);
void expandos_deinit(void);

#endif