1 #ifndef BOXCOMPAT_H
2 #define BOXCOMPAT_H
3 /*
4     roxterm - VTE/GTK terminal emulator with tabs
5     Copyright (C) 2004-2015 Tony Houghton <h@realh.co.uk>
6 
7     This program is free software; you can redistribute it and/or modify
8     it under the terms of the GNU General Public License as published by
9     the Free Software Foundation; either version 2 of the License, or
10     (at your option) any later version.
11 
12     This program is distributed in the hope that it will be useful,
13     but WITHOUT ANY WARRANTY; without even the implied warranty of
14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15     GNU General Public License for more details.
16 
17     You should have received a copy of the GNU General Public License
18     along with this program; if not, write to the Free Software
19     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20 */
21 
22 /* Makes it easy to migrate from GtkBox to GtkGrid */
23 
24 #ifndef DEFNS_H
25 #include "defns.h"
26 #endif
27 
box_compat_pack(GtkWidget * box,GtkWidget * child,gboolean hexpand,gboolean vexpand,int hspacing,int vspacing)28 inline static void box_compat_pack(GtkWidget *box, GtkWidget *child,
29         gboolean hexpand, gboolean vexpand, int hspacing, int vspacing)
30 {
31     gtk_container_add(GTK_CONTAINER(box), child);
32     g_object_set(child, "hexpand", hexpand, "vexpand", vexpand,
33             "margin-start", hspacing, "margin-end", hspacing,
34             "margin-top", vspacing, "margin-bottom", vspacing,
35             NULL);
36 }
37 
box_compat_packh(GtkWidget * box,GtkWidget * child,gboolean expand,int spacing)38 inline static void box_compat_packh(GtkWidget *box, GtkWidget *child,
39         gboolean expand, int spacing)
40 {
41     box_compat_pack(box, child, expand, TRUE, spacing / 2, 0);
42 }
43 
box_compat_packv(GtkWidget * box,GtkWidget * child,gboolean expand,int spacing)44 inline static void box_compat_packv(GtkWidget *box, GtkWidget *child,
45         gboolean expand, int spacing)
46 {
47     box_compat_pack(box, child, TRUE, expand, 0, spacing / 2);
48 }
49 
50 #endif /* BOXCOMPAT_H */
51 
52 /* vi:set sw=4 ts=4 noet cindent cino= */
53