]> Pileus Git - ~andy/gtk/blob - gtk/gtkprogressbar.h
Massive padding addition to class structures.
[~andy/gtk] / gtk / gtkprogressbar.h
1 /* GTK - The GIMP Toolkit
2  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3  *
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.
8  *
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.
13  *
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.
18  */
19
20 /*
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/. 
25  */
26
27 #ifndef __GTK_PROGRESS_BAR_H__
28 #define __GTK_PROGRESS_BAR_H__
29
30
31 #include <gdk/gdk.h>
32 #include <gtk/gtkprogress.h>
33
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif /* __cplusplus */
38
39
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))
46
47
48 typedef struct _GtkProgressBar       GtkProgressBar;
49 typedef struct _GtkProgressBarClass  GtkProgressBarClass;
50
51 typedef enum
52 {
53   GTK_PROGRESS_CONTINUOUS,
54   GTK_PROGRESS_DISCRETE
55 } GtkProgressBarStyle;
56
57 typedef enum
58 {
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;
64
65 struct _GtkProgressBar
66 {
67   GtkProgress progress;
68
69   GtkProgressBarStyle bar_style;
70   GtkProgressBarOrientation orientation;
71
72   guint blocks;
73   gint  in_block;
74
75   gint  activity_pos;
76   guint activity_step;
77   guint activity_blocks;
78
79   gdouble pulse_fraction;
80   
81   guint activity_dir : 1;
82 };
83
84 struct _GtkProgressBarClass
85 {
86   GtkProgressClass parent_class;
87
88   /* Padding for future expansion */
89   void (*_gtk_reserved1) (void);
90   void (*_gtk_reserved2) (void);
91   void (*_gtk_reserved3) (void);
92   void (*_gtk_reserved4) (void);
93 };
94
95
96 GtkType    gtk_progress_bar_get_type             (void) G_GNUC_CONST;
97 GtkWidget* gtk_progress_bar_new                  (void);
98
99 /*
100  * GtkProgress/GtkProgressBar had serious problems in GTK 1.2.
101  * 
102  *  - Only 3 or 4 functions are really needed for 95% of progress  
103  *    interfaces; GtkProgress[Bar] had about 25 functions, and 
104  *    didn't even include these 3 or 4.
105  *  - In activity mode, the API involves setting the adjustment 
106  *    to any random value, just to have the side effect of 
107  *    calling the progress bar update function - the adjustment
108  *    is totally ignored in activity mode
109  *  - You set the activity step as a pixel value, which means to 
110  *    set the activity step you basically need to connect to 
111  *    size_allocate
112  *  - There are ctree_set_expander_style()-functions, to randomly 
113  *    change look-and-feel for no good reason
114  *  - The split between GtkProgress and GtkProgressBar makes no sense 
115  *    to me whatsoever.
116  *  
117  * This was a big wart on GTK and made people waste lots of time,
118  * both learning and using the interface.
119  * 
120  * So, I have added what I feel is the correct API, and marked all the
121  * rest deprecated. However, the changes are 100% backward-compatible and
122  * should break no existing code.
123  *
124  * The following 9 functions are the new programming interface. 
125  */
126 void       gtk_progress_bar_pulse                (GtkProgressBar *pbar);
127 void       gtk_progress_bar_set_text             (GtkProgressBar *pbar,
128                                                   const gchar    *text);
129 void       gtk_progress_bar_set_fraction         (GtkProgressBar *pbar,
130                                                   gdouble         fraction);
131
132 void       gtk_progress_bar_set_pulse_step       (GtkProgressBar *pbar,
133                                                   gdouble         fraction);
134 void       gtk_progress_bar_set_orientation      (GtkProgressBar *pbar,
135                                                   GtkProgressBarOrientation orientation);
136
137 G_CONST_RETURN gchar* gtk_progress_bar_get_text       (GtkProgressBar *pbar);
138 gdouble               gtk_progress_bar_get_fraction   (GtkProgressBar *pbar);
139 gdouble               gtk_progress_bar_get_pulse_step (GtkProgressBar *pbar);
140
141 GtkProgressBarOrientation gtk_progress_bar_get_orientation (GtkProgressBar *pbar);
142
143
144 #ifndef GTK_DISABLE_DEPRECATED
145
146 /* Everything below here is deprecated */
147 GtkWidget* gtk_progress_bar_new_with_adjustment  (GtkAdjustment  *adjustment);
148 void       gtk_progress_bar_set_bar_style        (GtkProgressBar *pbar,
149                                                   GtkProgressBarStyle style);
150 void       gtk_progress_bar_set_discrete_blocks  (GtkProgressBar *pbar,
151                                                   guint           blocks);
152 /* set_activity_step() is not only deprecated, it doesn't even work.
153  * (Of course, it wasn't usable anyway, you had to set it from a size_allocate
154  * handler or something)
155  */
156 void       gtk_progress_bar_set_activity_step    (GtkProgressBar *pbar,
157                                                   guint           step);
158 void       gtk_progress_bar_set_activity_blocks  (GtkProgressBar *pbar,
159                                                   guint           blocks);
160 void       gtk_progress_bar_update               (GtkProgressBar *pbar,
161                                                   gdouble         percentage);
162
163 #endif /* GTK_DISABLE_DEPRECATED */
164
165 #ifdef __cplusplus
166 }
167 #endif /* __cplusplus */
168
169
170 #endif /* __GTK_PROGRESS_BAR_H__ */