1 /* GTK - The GIMP Toolkit
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library 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 GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
21 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
22 * file for a list of people on the GTK+ Team. See the ChangeLog
23 * files for a list of changes. These files are distributed with
24 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
27 #ifndef __GTK_PROGRESS_BAR_H__
28 #define __GTK_PROGRESS_BAR_H__
32 #include <gtk/gtkprogress.h>
37 #endif /* __cplusplus */
40 #define GTK_TYPE_PROGRESS_BAR (gtk_progress_bar_get_type ())
41 #define GTK_PROGRESS_BAR(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_PROGRESS_BAR, GtkProgressBar))
42 #define GTK_PROGRESS_BAR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_PROGRESS_BAR, GtkProgressBarClass))
43 #define GTK_IS_PROGRESS_BAR(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_PROGRESS_BAR))
44 #define GTK_IS_PROGRESS_BAR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_PROGRESS_BAR))
45 #define GTK_PROGRESS_BAR_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_PROGRESS_BAR, GtkProgressBarClass))
48 typedef struct _GtkProgressBar GtkProgressBar;
49 typedef struct _GtkProgressBarClass GtkProgressBarClass;
53 GTK_PROGRESS_CONTINUOUS,
55 } GtkProgressBarStyle;
59 GTK_PROGRESS_LEFT_TO_RIGHT,
60 GTK_PROGRESS_RIGHT_TO_LEFT,
61 GTK_PROGRESS_BOTTOM_TO_TOP,
62 GTK_PROGRESS_TOP_TO_BOTTOM
63 } GtkProgressBarOrientation;
65 struct _GtkProgressBar
69 GtkProgressBarStyle bar_style;
70 GtkProgressBarOrientation orientation;
77 guint activity_blocks;
79 gfloat pulse_fraction;
81 guint activity_dir : 1;
84 struct _GtkProgressBarClass
86 GtkProgressClass parent_class;
90 GtkType gtk_progress_bar_get_type (void) G_GNUC_CONST;
91 GtkWidget* gtk_progress_bar_new (void);
94 * GtkProgress/GtkProgressBar had serious problems in GTK 1.2.
96 * - Only 3 or 4 functions are really needed for 95% of progress
97 * interfaces; GtkProgress[Bar] had about 25 functions, and
98 * didn't even include these 3 or 4.
99 * - In activity mode, the API involves setting the adjustment
100 * to any random value, just to have the side effect of
101 * calling the progress bar update function - the adjustment
102 * is totally ignored in activity mode
103 * - You set the activity step as a pixel value, which means to
104 * set the activity step you basically need to connect to
106 * - There are ctree_set_expander_style()-functions, to randomly
107 * change look-and-feel for no good reason
108 * - The split between GtkProgress and GtkProgressBar makes no sense
111 * This was a big wart on GTK and made people waste lots of time,
112 * both learning and using the interface.
114 * So, I have added what I feel is the correct API, and marked all the
115 * rest deprecated. However, the changes are 100% backward-compatible and
116 * should break no existing code.
118 * The following 5 functions are the new programming interface.
120 void gtk_progress_bar_pulse (GtkProgressBar *pbar);
121 void gtk_progress_bar_set_text (GtkProgressBar *pbar,
123 void gtk_progress_bar_set_fraction (GtkProgressBar *pbar,
126 void gtk_progress_bar_set_pulse_step (GtkProgressBar *pbar,
128 void gtk_progress_bar_set_orientation (GtkProgressBar *pbar,
129 GtkProgressBarOrientation orientation);
131 gchar* gtk_progress_bar_get_text (GtkProgressBar *pbar);
132 gfloat gtk_progress_bar_get_fraction (GtkProgressBar *pbar);
133 gfloat gtk_progress_bar_get_pulse_step (GtkProgressBar *pbar);
135 GtkProgressBarOrientation gtk_progress_bar_get_orientation (GtkProgressBar *pbar);
138 /* Everything below here is deprecated */
139 GtkWidget* gtk_progress_bar_new_with_adjustment (GtkAdjustment *adjustment);
140 void gtk_progress_bar_set_bar_style (GtkProgressBar *pbar,
141 GtkProgressBarStyle style);
142 void gtk_progress_bar_set_discrete_blocks (GtkProgressBar *pbar,
144 /* set_activity_step() is not only deprecated, it doesn't even work.
145 * (Of course, it wasn't usable anyway, you had to set it from a size_allocate
146 * handler or something)
148 void gtk_progress_bar_set_activity_step (GtkProgressBar *pbar,
150 void gtk_progress_bar_set_activity_blocks (GtkProgressBar *pbar,
152 void gtk_progress_bar_update (GtkProgressBar *pbar,
157 #endif /* __cplusplus */
160 #endif /* __GTK_PROGRESS_BAR_H__ */