1 /*
2  * Copyright © 2009-2018 Siyan Panayotov <contact@siyanpanayotov.com>
3  *
4  * This file is part of Viewnior.
5  *
6  * Viewnior 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 3 of the License, or
9  * (at your option) any later version.
10  *
11  * Viewnior 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 Viewnior.  If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef __VNR_MESSAGE_AREA_H__
21 #define __VNR_MESSAGE_AREA_H__
22 
23 #include <glib.h>
24 #include <glib-object.h>
25 #include <gtk/gtk.h>
26 #include "vnr-window.h"
27 
28 G_BEGIN_DECLS
29 
30 typedef struct _VnrMessageArea VnrMessageArea;
31 typedef struct _VnrMessageAreaClass VnrMessageAreaClass;
32 
33 #define VNR_TYPE_MESSAGE_AREA             (vnr_message_area_get_type ())
34 #define VNR_MESSAGE_AREA(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), VNR_TYPE_MESSAGE_AREA, VnrMessageArea))
35 #define VNR_MESSAGE_AREA_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass),  VNR_TYPE_MESSAGE_AREA, VnrMessageAreaClass))
36 #define VNR_IS_MESSAGE_AREA(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VNR_TYPE_MESSAGE_AREA))
37 #define VNR_IS_MESSAGE_AREA_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass),  VNR_TYPE_MESSAGE_AREA))
38 #define VNR_MESSAGE_AREA_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj),  VNR_TYPE_MESSAGE_AREA, VnrMessageAreaClass))
39 
40 struct _VnrMessageArea {
41     GtkEventBox parent;
42 
43     VnrWindow *vnr_win;
44     GtkWidget *hbox;
45 
46     GtkWidget *image;
47     GtkWidget *message;
48 
49     GtkWidget *button_box;
50     GtkWidget *user_button;
51     GtkWidget *cancel_button;
52     GCallback c_handler;
53     gboolean with_button;
54 
55     gboolean initialized;
56     gboolean is_critical;
57 };
58 
59 struct _VnrMessageAreaClass {
60     GtkEventBoxClass parent_class;
61 };
62 
63 GType       vnr_message_area_get_type (void) G_GNUC_CONST;
64 
65 GtkWidget*  vnr_message_area_new      (void);
66 
67 void        vnr_message_area_show (VnrMessageArea *msg_area,
68                                    gboolean critical,
69                                    const char *message,
70                                    gboolean close_image);
71 
72 void        vnr_message_area_show_with_button (VnrMessageArea *msg_area,
73                                                gboolean critical,
74                                                const char *message,
75                                                gboolean close_image,
76                                                const gchar *button_stock_id,
77                                                GCallback c_handler);
78 
79 void        vnr_message_area_hide         (VnrMessageArea *msg_area);
80 
81 gboolean    vnr_message_area_is_critical  (VnrMessageArea *msg_area);
82 gboolean    vnr_message_area_is_visible  (VnrMessageArea *msg_area);
83 
84 G_END_DECLS
85 #endif /* __VNR_MESSAGE_AREA_H__ */
86