comparison finch/libgnt/gntprogressbar.h @ 26555:35430bc421c2

Add a simple progress-bar in libgnt. Closes #7797. committer: Sadrul Habib Chowdhury <imadil@gmail.com>
author Saleem Abdulrasool <compnerd@compnerd.org>
date Sun, 12 Apr 2009 18:10:03 +0000
parents
children cd7fa6306f85
comparison
equal deleted inserted replaced
26546:e7861a7978dc 26555:35430bc421c2
1 /**
2 * @file gntprogressbar.h Progress Bar API
3 * @ingroup gnt
4 **/
5 /**
6 * GNT - The GLib Ncurses Toolkit
7 *
8 * GNT is the legal property of its developers, whose names are too numerous
9 * to list here. Please refer to the COPYRIGHT file distributed with this
10 * source distribution.
11 *
12 * This library is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
25 **/
26
27 #ifndef GNT_PROGRESS_BAR_H
28 #define GNT_PROGRESS_BAR_H
29
30 #include "gnt.h"
31 #include "gntwidget.h"
32
33 #define GNT_TYPE_PROGRESS_BAR (gnt_progress_bar_get_type ())
34 #define GNT_PROGRESS_BAR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GNT_TYPE_PROGRESS_BAR, GntProgressBar))
35 #define GNT_PROGRESS_BAR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GNT_TYPE_PROGRESS_BAR, GntProgressBarClass))
36 #define GNT_IS_PROGRESS_BAR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNT_TYPE_PROGRESS_BAR))
37 #define GNT_IS_PROGRESS_BAR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GNT_TYPE_PROGRESS_BAR))
38 #define GNT_PROGRESS_BAR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GNT_TYPE_PROGRESS_BAR, GntProgressBarClass))
39
40 typedef enum _GntProgressBarOrientation
41 {
42 GNT_PROGRESS_LEFT_TO_RIGHT,
43 GNT_PROGRESS_RIGHT_TO_LEFT,
44 GNT_PROGRESS_BOTTOM_TO_TOP,
45 GNT_PROGRESS_TOP_TO_BOTTOM,
46 } GntProgressBarOrientation;
47
48 typedef struct _GntProgressBar
49 {
50 GntWidget parent;
51 } GntProgressBar;
52
53 typedef struct _GntProgressBarClass
54 {
55 GntWidgetClass parent;
56
57 void (*gnt_reserved1)(void);
58 void (*gnt_reserved2)(void);
59 void (*gnt_reserved3)(void);
60 void (*gnt_reserved4)(void);
61 } GntProgressBarClass;
62
63 G_BEGIN_DECLS
64
65 /**
66 * Get the GType for GntProgressBar
67 * @return The GType for GntProrgressBar
68 **/
69 GType
70 gnt_progress_bar_get_type (void);
71
72 /**
73 * Create a new GntProgressBar
74 * @return The new GntProgressBar
75 **/
76 GntWidget *
77 gnt_progress_bar_new (void);
78
79 /**
80 * Set the progress for a progress bar
81 *
82 * @param pbar The GntProgressBar
83 * @param fraction The value between 0 and 1 to display
84 **/
85 void
86 gnt_progress_bar_set_fraction (GntProgressBar *pbar, gdouble fraction);
87
88 /**
89 * Set the orientation for a progress bar
90 *
91 * @param pbar The GntProgressBar
92 * @param orientation The orientation to use
93 **/
94 void
95 gnt_progress_bar_set_orientation (GntProgressBar *pbar, GntProgressBarOrientation orientation);
96
97 /**
98 * Controls whether the progress value is shown
99 *
100 * @param pbar The GntProgressBar
101 * @param show A boolean indicating if the value is shown
102 **/
103 void
104 gnt_progress_bar_set_show_progress (GntProgressBar *pbar, gboolean show);
105
106 /**
107 * Get the progress that is displayed
108 *
109 * @param pbar The GntProgressBar
110 * @return The progress displayed as a value between 0 and 1
111 **/
112 gdouble
113 gnt_progress_bar_get_fraction (GntProgressBar *pbar);
114
115 /**
116 * Get the orientation for the progress bar
117 *
118 * @param pbar The GntProgressBar
119 * @return The current orientation of the progress bar
120 **/
121 GntProgressBarOrientation
122 gnt_progress_bar_get_orientation (GntProgressBar *pbar);
123
124 /**
125 * Get a boolean describing if the progress value is shown
126 *
127 * @param pbar The GntProgressBar
128 * @return A boolean @c true if the progress value is shown, @c false otherwise.
129 **/
130 gboolean
131 gnt_progress_bar_get_show_progress (GntProgressBar *pbar);
132
133 G_END_DECLS
134
135 #endif /* GNT_PROGRESS_BAR_H */