annotate finch/libgnt/gntslider.h @ 18411:3849776d0f71

Fix some crashes resulting from rejecting file-transfer requests.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sun, 01 Jul 2007 17:05:16 +0000
parents f1dbe3151051
children 3b19fa8d0177
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18352
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
1 /**
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
2 * @file gntslider.h Slider API
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
3 * @ingroup gnt
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
4 */
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
5 /*
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
6 * GNT - The GLib Ncurses Toolkit
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
7 *
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
8 * GNT is the legal property of its developers, whose names are too numerous
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
9 * to list here. Please refer to the COPYRIGHT file distributed with this
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
10 * source distribution.
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
11 *
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
12 * This library is free software; you can redistribute it and/or modify
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
13 * it under the terms of the GNU General Public License as published by
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
14 * the Free Software Foundation; either version 2 of the License, or
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
15 * (at your option) any later version.
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
16 *
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
17 * This program is distributed in the hope that it will be useful,
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
20 * GNU General Public License for more details.
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
21 *
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
22 * You should have received a copy of the GNU General Public License
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
23 * along with this program; if not, write to the Free Software
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
25 */
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
26
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
27 #ifndef GNT_SLIDER_H
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
28 #define GNT_SLIDER_H
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
29
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
30 #include "gntwidget.h"
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
31 #include "gnt.h"
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
32 #include "gntlabel.h"
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
33
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
34 #define GNT_TYPE_SLIDER (gnt_slider_get_gtype())
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
35 #define GNT_SLIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GNT_TYPE_SLIDER, GntSlider))
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
36 #define GNT_SLIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GNT_TYPE_SLIDER, GntSliderClass))
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
37 #define GNT_IS_SLIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GNT_TYPE_SLIDER))
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
38 #define GNT_IS_SLIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GNT_TYPE_SLIDER))
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
39 #define GNT_SLIDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GNT_TYPE_SLIDER, GntSliderClass))
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
40
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
41 #define GNT_SLIDER_FLAGS(obj) (GNT_SLIDER(obj)->priv.flags)
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
42 #define GNT_SLIDER_SET_FLAGS(obj, flags) (GNT_SLIDER_FLAGS(obj) |= flags)
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
43 #define GNT_SLIDER_UNSET_FLAGS(obj, flags) (GNT_SLIDER_FLAGS(obj) &= ~(flags))
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
44
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
45 typedef struct _GntSlider GntSlider;
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
46 typedef struct _GntSliderPriv GntSliderPriv;
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
47 typedef struct _GntSliderClass GntSliderClass;
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
48
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
49 struct _GntSlider
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
50 {
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
51 GntWidget parent;
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
52
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
53 gboolean vertical;
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
54
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
55 int max; /* maximum value */
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
56 int min; /* minimum value */
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
57 int step; /* amount to change at each step */
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
58 int current; /* current value */
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
59 };
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
60
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
61 struct _GntSliderClass
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
62 {
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
63 GntWidgetClass parent;
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
64
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
65 void (*changed)(GntSlider *slider, int);
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
66 void (*gnt_reserved1)(void);
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
67 void (*gnt_reserved2)(void);
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
68 void (*gnt_reserved3)(void);
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
69 void (*gnt_reserved4)(void);
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
70 };
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
71
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
72 G_BEGIN_DECLS
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
73
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
74 /**
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
75 * @return The GType for GntSlider
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
76 */
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
77 GType gnt_slider_get_gtype(void);
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
78
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
79 #define gnt_hslider_new(max, min) gnt_slider_new(FALSE, max, min)
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
80 #define gnt_vslider_new(max, min) gnt_slider_new(TRUE, max, min)
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
81
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
82 /**
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
83 * Create a new slider.
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
84 *
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
85 * @param orient A vertical slider is created if @c TRUE, otherwise the slider is horizontal.
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
86 * @param max The maximum value for the slider
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
87 * @param min The minimum value for the slider
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
88 *
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
89 * @return The newly created slider
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
90 */
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
91 GntWidget * gnt_slider_new(gboolean orient, int max, int min);
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
92
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
93 /**
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
94 * Set the range of the slider.
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
95 *
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
96 * @param slider The slider
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
97 * @param max The maximum value
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
98 * @param min The minimum value
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
99 */
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
100 void gnt_slider_set_range(GntSlider *slider, int max, int min);
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
101
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
102 /**
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
103 * Sets the amount of change at each step.
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
104 *
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
105 * @param slider The slider
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
106 * @param step The amount for each ste
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
107 */
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
108 void gnt_slider_set_step(GntSlider *slider, int step);
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
109
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
110 /**
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
111 * Advance the slider forward or backward.
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
112 *
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
113 * @param slider The slider
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
114 * @param steps The number of amounts to change, positive to change
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
115 * forward, negative to change backward
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
116 *
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
117 * @return The value of the slider after the change
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
118 */
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
119 int gnt_slider_advance_step(GntSlider *slider, int steps);
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
120
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
121 /**
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
122 * Set the current value for the slider.
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
123 *
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
124 * @param slider The slider
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
125 * @param value The current value
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
126 */
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
127 void gnt_slider_set_value(GntSlider *slider, int value);
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
128
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
129 /**
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
130 * Update a label with the value of the slider whenever the value changes.
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
131 *
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
132 * @param slider The slider
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
133 * @param label The label to update
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
134 */
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
135 void gnt_slider_reflect_label(GntSlider *slider, GntLabel *label);
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
136
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
137 G_END_DECLS
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
138
f1dbe3151051 Add a slider widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
139 #endif /* GNT_SLIDER_H */