gntslider.h

Go to the documentation of this file.
00001 
00005 /*
00006  * GNT - The GLib Ncurses Toolkit
00007  *
00008  * GNT is the legal property of its developers, whose names are too numerous
00009  * to list here.  Please refer to the COPYRIGHT file distributed with this
00010  * source distribution.
00011  *
00012  * This library is free software; you can redistribute it and/or modify
00013  * it under the terms of the GNU General Public License as published by
00014  * the Free Software Foundation; either version 2 of the License, or
00015  * (at your option) any later version.
00016  *
00017  * This program is distributed in the hope that it will be useful,
00018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  * GNU General Public License for more details.
00021  *
00022  * You should have received a copy of the GNU General Public License
00023  * along with this program; if not, write to the Free Software
00024  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
00025  */
00026 
00027 #ifndef GNT_SLIDER_H
00028 #define GNT_SLIDER_H
00029 
00030 #include "gntwidget.h"
00031 #include "gnt.h"
00032 #include "gntlabel.h"
00033 
00034 #define GNT_TYPE_SLIDER             (gnt_slider_get_gtype())
00035 #define GNT_SLIDER(obj)             (G_TYPE_CHECK_INSTANCE_CAST((obj), GNT_TYPE_SLIDER, GntSlider))
00036 #define GNT_SLIDER_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST((klass), GNT_TYPE_SLIDER, GntSliderClass))
00037 #define GNT_IS_SLIDER(obj)          (G_TYPE_CHECK_INSTANCE_TYPE((obj), GNT_TYPE_SLIDER))
00038 #define GNT_IS_SLIDER_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE((klass), GNT_TYPE_SLIDER))
00039 #define GNT_SLIDER_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS((obj), GNT_TYPE_SLIDER, GntSliderClass))
00040 
00041 #define GNT_SLIDER_FLAGS(obj)                (GNT_SLIDER(obj)->priv.flags)
00042 #define GNT_SLIDER_SET_FLAGS(obj, flags)     (GNT_SLIDER_FLAGS(obj) |= flags)
00043 #define GNT_SLIDER_UNSET_FLAGS(obj, flags)   (GNT_SLIDER_FLAGS(obj) &= ~(flags))
00044 
00045 typedef struct _GntSlider           GntSlider;
00046 typedef struct _GntSliderPriv       GntSliderPriv;
00047 typedef struct _GntSliderClass      GntSliderClass;
00048 
00049 struct _GntSlider
00050 {
00051     GntWidget parent;
00052 
00053     gboolean vertical;
00054 
00055     int max;        /* maximum value */
00056     int min;        /* minimum value */
00057     int step;       /* amount to change at each step */
00058     int current;    /* current value */
00059     int smallstep;
00060     int largestep;
00061 };
00062 
00063 struct _GntSliderClass
00064 {
00065     GntWidgetClass parent;
00066 
00067     void (*changed)(GntSlider *slider, int);
00068     void (*gnt_reserved1)(void);
00069     void (*gnt_reserved2)(void);
00070     void (*gnt_reserved3)(void);
00071     void (*gnt_reserved4)(void);
00072 };
00073 
00074 G_BEGIN_DECLS
00075 
00081 GType gnt_slider_get_gtype(void);
00082 
00083 #define gnt_hslider_new(max, min) gnt_slider_new(FALSE, max, min)
00084 #define gnt_vslider_new(max, min) gnt_slider_new(TRUE, max, min)
00085 
00097 GntWidget * gnt_slider_new(gboolean orient, int max, int min);
00098 
00108 void gnt_slider_set_range(GntSlider *slider, int max, int min);
00109 
00118 void gnt_slider_set_step(GntSlider *slider, int step);
00119 
00128 void gnt_slider_set_small_step(GntSlider *slider, int step);
00129 
00138 void gnt_slider_set_large_step(GntSlider *slider, int step);
00139 
00151 int gnt_slider_advance_step(GntSlider *slider, int steps);
00152 
00161 void gnt_slider_set_value(GntSlider *slider, int value);
00162 
00171 int gnt_slider_get_value(GntSlider *slider);
00172 
00181 void gnt_slider_reflect_label(GntSlider *slider, GntLabel *label);
00182 
00183 
00184 G_END_DECLS
00185 
00186 #endif /* GNT_SLIDER_H */