1 #ifndef MULTITAB_LABEL_H
2 #define MULTITAB_LABEL_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 
23 #ifndef DEFNS_H
24 #include "defns.h"
25 #endif
26 
27 #include <glib-object.h>
28 
29 #define MULTITAB_TYPE_LABEL \
30         (multitab_label_get_type ())
31 #define MULTITAB_LABEL(obj) \
32         (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
33         MULTITAB_TYPE_LABEL, MultitabLabel))
34 #define MULTITAB_IS_LABEL(obj) \
35         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MULTITAB_TYPE_LABEL))
36 #define MULTITAB_LABEL_CLASS(klass) \
37         (G_TYPE_CHECK_CLASS_CAST ((klass), \
38         MULTITAB_TYPE_LABEL, MultitabLabelClass))
39 #define MULTITAB_IS_LABEL_CLASS(klass) \
40         (G_TYPE_CHECK_CLASS_TYPE ((klass), MULTITAB_TYPE_LABEL))
41 #define MULTITAB_LABEL_GET_CLASS(obj) \
42         (G_TYPE_INSTANCE_GET_CLASS ((obj), \
43         MULTITAB_TYPE_LABEL, MultitabLabelClass))
44 
45 typedef struct _MultitabLabel        MultitabLabel;
46 typedef struct _MultitabLabelClass   MultitabLabelClass;
47 
48 struct _MultitabLabel
49 {
50     GtkEventBox parent_instance;
51     GdkRGBA attention_color;
52     GtkLabel *label;
53     gboolean attention;
54     guint timeout_tag;
55     gboolean single;
56     gboolean fixed_width;
57     GtkWidget *parent;
58     int *best_width;
59 };
60 
61 struct _MultitabLabelClass
62 {
63     GtkEventBoxClass parent_class;
64     GtkCssProvider *style_provider;
65 };
66 
67 GType multitab_label_get_type (void);
68 
69 
70 /* best_width may not be used, depending on GTK version etc.
71  * parent should be the GtkNotebook containing the tab.
72  */
73 GtkWidget *
74 multitab_label_new (GtkWidget *parent, const char *text, int *best_width);
75 
76 void
77 multitab_label_set_parent (MultitabLabel *label,
78         GtkWidget *parent, int *best_width);
79 
80 void
81 multitab_label_set_text (MultitabLabel *label, const char *text);
82 
83 const char *
84 multitab_label_get_text (MultitabLabel *label);
85 
86 void
87 multitab_label_draw_attention (MultitabLabel *label);
88 
89 void
90 multitab_label_cancel_attention (MultitabLabel *label);
91 
92 void
93 multitab_label_set_attention_color (MultitabLabel *label,
94         const GdkRGBA *color);
95 
96 const GdkRGBA *
97 multitab_label_get_attention_color (MultitabLabel *label);
98 
99 /* Whether the tab is the only one in the window */
100 void
101 multitab_label_set_single (MultitabLabel *label, gboolean single);
102 
103 void
104 multitab_label_set_current(MultitabLabel *label, gboolean current);
105 
106 #endif /* MULTITAB_LABEL_H */
107