1 /*
2  * markdown-gtk-compat.h - Part of the Geany Markdown plugin
3  *
4  * Copyright 2012 Matthew Brush <mbrush@codebrainz.ca>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19  * MA 02110-1301, USA.
20  *
21  *
22  */
23 
24 #ifndef MARKDOWN_GTK_COMPAT_H_
25 #define MARKDOWN_GTK_COMPAT_H_
26 
27 #if !GTK_CHECK_VERSION(3, 4, 0)
28 # define MarkdownGtkTable GtkTable
29 # define MARKDOWN_GTK_TABLE GTK_TABLE
30 # define markdown_gtk_table_set_row_spacing(table, spacing) \
31     gtk_table_set_row_spacings(table, spacing)
32 # define markdown_gtk_table_set_col_spacing(table, spacing) \
33     gtk_table_set_col_spacings(table, spacing)
34 #else
35 # define MarkdownGtkTable GtkGrid
36 # define MARKDOWN_GTK_TABLE GTK_GRID
37 # define markdown_gtk_table_set_row_spacing(table, spacing) \
38     gtk_grid_set_row_spacing(table, spacing)
39 # define markdown_gtk_table_set_col_spacing(table, spacing) \
40     gtk_grid_set_column_spacing(table, spacing)
41 #endif
42 
43 typedef struct {
44   guint8 red;
45   guint8 green;
46   guint8 blue;
47 } MarkdownColor;
48 
49 GtkWidget *markdown_gtk_table_new(guint rows, guint columns, gboolean homogeneous);
50 
51 void markdown_gtk_table_attach(MarkdownGtkTable *table, GtkWidget *child,
52   guint left_attach, guint right_attach, guint top_attach, guint bottom_attach,
53   GtkAttachOptions xoptions, GtkAttachOptions yoptions);
54 
55 GtkWidget *markdown_gtk_color_button_new_with_color(MarkdownColor *color);
56 
57 gboolean markdown_color_parse(const gchar *spec, MarkdownColor *color);
58 
59 void markdown_gtk_color_button_get_color(GtkColorButton *button, MarkdownColor *color);
60 
61 #endif /* MARKDOWN_GTK_COMPAT_H_ */
62