1 /* GIMP - The GNU Image Manipulation Program
2  * Copyright (C) 1995 Spencer Kimball and Peter Mattis
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef __GIMP_STATUSBAR_H__
19 #define __GIMP_STATUSBAR_H__
20 
21 G_BEGIN_DECLS
22 
23 
24 /*  maximal length of the format string for the cursor-coordinates  */
25 #define CURSOR_FORMAT_LENGTH 32
26 
27 
28 #define GIMP_TYPE_STATUSBAR            (gimp_statusbar_get_type ())
29 #define GIMP_STATUSBAR(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_STATUSBAR, GimpStatusbar))
30 #define GIMP_STATUSBAR_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_STATUSBAR, GimpStatusbarClass))
31 #define GIMP_IS_STATUSBAR(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_STATUSBAR))
32 #define GIMP_IS_STATUSBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_STATUSBAR))
33 #define GIMP_STATUSBAR_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_STATUSBAR, GimpStatusbarClass))
34 
35 typedef struct _GimpStatusbarClass GimpStatusbarClass;
36 
37 struct _GimpStatusbar
38 {
39   GtkStatusbar         parent_instance;
40 
41   GimpDisplayShell    *shell;
42 
43   GSList              *messages;
44   GHashTable          *context_ids;
45   guint                seq_context_id;
46 
47   GdkPixbuf           *icon;
48   GHashTable          *icon_hash;
49 
50   guint                temp_context_id;
51   guint                temp_timeout_id;
52   GimpMessageSeverity  temp_severity;
53 
54   gchar                cursor_format_str[CURSOR_FORMAT_LENGTH];
55   gchar                cursor_format_str_f[CURSOR_FORMAT_LENGTH];
56   gchar                length_format_str[CURSOR_FORMAT_LENGTH];
57 
58   GtkWidget           *cursor_label;
59   GtkWidget           *unit_combo;
60   GtkWidget           *scale_combo;
61   GtkWidget           *rotate_widget;
62   GtkWidget           *rotate_label;
63   GtkWidget           *horizontal_flip_icon;
64   GtkWidget           *vertical_flip_icon;
65   GtkWidget           *label; /* same as GtkStatusbar->label */
66 
67   GtkWidget           *progressbar;
68   GtkWidget           *cancel_button;
69   gboolean             progress_active;
70   gboolean             progress_shown;
71   gdouble              progress_value;
72   guint64              progress_last_update_time;
73 };
74 
75 struct _GimpStatusbarClass
76 {
77   GtkStatusbarClass parent_class;
78 };
79 
80 
81 GType       gimp_statusbar_get_type              (void) G_GNUC_CONST;
82 GtkWidget * gimp_statusbar_new                   (void);
83 
84 void        gimp_statusbar_set_shell             (GimpStatusbar       *statusbar,
85                                                   GimpDisplayShell    *shell);
86 
87 gboolean    gimp_statusbar_get_visible           (GimpStatusbar       *statusbar);
88 void        gimp_statusbar_set_visible           (GimpStatusbar       *statusbar,
89                                                   gboolean             visible);
90 void        gimp_statusbar_empty                 (GimpStatusbar       *statusbar);
91 void        gimp_statusbar_fill                  (GimpStatusbar       *statusbar);
92 
93 void        gimp_statusbar_override_window_title (GimpStatusbar       *statusbar);
94 void        gimp_statusbar_restore_window_title  (GimpStatusbar       *statusbar);
95 
96 void        gimp_statusbar_push                  (GimpStatusbar       *statusbar,
97                                                   const gchar         *context,
98                                                   const gchar         *icon_name,
99                                                   const gchar         *format,
100                                                   ...) G_GNUC_PRINTF (4, 5);
101 void        gimp_statusbar_push_valist           (GimpStatusbar       *statusbar,
102                                                   const gchar         *context,
103                                                   const gchar         *icon_name,
104                                                   const gchar         *format,
105                                                   va_list              args) G_GNUC_PRINTF (4, 0);
106 void        gimp_statusbar_push_coords           (GimpStatusbar       *statusbar,
107                                                   const gchar         *context,
108                                                   const gchar         *icon_name,
109                                                   GimpCursorPrecision  precision,
110                                                   const gchar         *title,
111                                                   gdouble              x,
112                                                   const gchar         *separator,
113                                                   gdouble              y,
114                                                   const gchar         *help);
115 void        gimp_statusbar_push_length           (GimpStatusbar       *statusbar,
116                                                   const gchar         *context,
117                                                   const gchar         *icon_name,
118                                                   const gchar         *title,
119                                                   GimpOrientationType  axis,
120                                                   gdouble              value,
121                                                   const gchar         *help);
122 void        gimp_statusbar_replace               (GimpStatusbar       *statusbar,
123                                                   const gchar         *context,
124                                                   const gchar         *icon_name,
125                                                   const gchar         *format,
126                                                   ...) G_GNUC_PRINTF (4, 5);
127 void        gimp_statusbar_replace_valist        (GimpStatusbar       *statusbar,
128                                                   const gchar         *context,
129                                                   const gchar         *icon_name,
130                                                   const gchar         *format,
131                                                   va_list              args) G_GNUC_PRINTF (4, 0);
132 const gchar * gimp_statusbar_peek                (GimpStatusbar       *statusbar,
133                                                   const gchar         *context);
134 void        gimp_statusbar_pop                   (GimpStatusbar       *statusbar,
135                                                   const gchar         *context);
136 
137 void        gimp_statusbar_push_temp             (GimpStatusbar       *statusbar,
138                                                   GimpMessageSeverity  severity,
139                                                   const gchar         *icon_name,
140                                                   const gchar         *format,
141                                                   ...) G_GNUC_PRINTF (4, 5);
142 void        gimp_statusbar_push_temp_valist      (GimpStatusbar       *statusbar,
143                                                   GimpMessageSeverity  severity,
144                                                   const gchar         *icon_name,
145                                                   const gchar         *format,
146                                                   va_list              args) G_GNUC_PRINTF (4, 0);
147 void        gimp_statusbar_pop_temp              (GimpStatusbar       *statusbar);
148 
149 void        gimp_statusbar_update_cursor         (GimpStatusbar       *statusbar,
150                                                   GimpCursorPrecision  precision,
151                                                   gdouble              x,
152                                                   gdouble              y);
153 void        gimp_statusbar_clear_cursor          (GimpStatusbar       *statusbar);
154 
155 
156 G_END_DECLS
157 
158 #endif /* __GIMP_STATUSBAR_H__ */
159