Merge pull request #457 from vivien/text-variable
[tig.git] / include / tig / graph.h
bloba24a6fd0725e1354ac6497fc844feb14267d0f83
1 /* Copyright (c) 2006-2015 Jonas Fonseca <jonas.fonseca@gmail.com>
3 * This program is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU General Public License as
5 * published by the Free Software Foundation; either version 2 of
6 * the License, or (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
14 #ifndef TIG_GRAPH_H
15 #define TIG_GRAPH_H
17 #include "tig/types.h"
19 #define GRAPH_COMMIT_COLOR (-1)
20 #define GRAPH_COLORS 14
22 struct graph;
23 struct graph_symbol;
25 struct graph_canvas {
26 size_t size; /* The width of the graph array. */
27 struct graph_symbol *symbols; /* Symbols for this row. */
30 typedef bool (*graph_symbol_iterator_fn)(void *, const struct graph *graph, const struct graph_symbol *, int color_id, bool);
32 struct graph {
33 void *private;
35 void (*done)(struct graph *graph);
36 void (*done_rendering)(struct graph *graph);
38 bool (*add_commit)(struct graph *graph, struct graph_canvas *canvas,
39 const char *id, const char *parents, bool is_boundary);
40 bool (*add_parent)(struct graph *graph, const char *parent);
41 bool (*render_parents)(struct graph *graph, struct graph_canvas *canvas);
43 void (*foreach_symbol)(const struct graph *graph, const struct graph_canvas *canvas, graph_symbol_iterator_fn fn, void *data);
45 const char *(*symbol_to_ascii)(const struct graph_symbol *symbol);
46 const char *(*symbol_to_utf8)(const struct graph_symbol *symbol);
47 const chtype *(*symbol_to_chtype)(const struct graph_symbol *symbol);
50 struct graph *init_graph(enum graph_display display);
52 #endif
54 /* vim: set ts=8 sw=8 noexpandtab: */