1 /* giwvslider.h - GiwVSlider widget's header 2 Copyright (C) 2006 Alexandre Pereira Bueno, Eduardo Parente Ribeiro 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.1 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 Free Software 16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 18 Maintainers 19 Alexandre Pereira Bueno - alpebu@yahoo.com.br 20 James Scott Jr <skoona@users.sourceforge.net> 21 */ 22 23 #ifndef __GIW_VSLIDER_H__ 24 #define __GIW_VSLIDER_H__ 25 26 #include <gdk/gdk.h> 27 #include <gtk/gtk.h> 28 29 G_BEGIN_DECLS 30 31 #define GIW_TYPE_VSLIDER (giw_vslider_get_type ()) 32 #define GIW_VSLIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIW_TYPE_VSLIDER, GiwVSlider)) 33 #define GIW_VSLIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIW_TYPE_VSLIDER, GiwVSliderClass)) 34 #define GIW_IS_VSLIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIW_TYPE_VSLIDER)) 35 #define GIW_IS_VSLIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIW_TYPE_VSLIDER)) 36 #define GIW_VSLIDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIW_TYPE_VSLIDER, GiwVSliderClass)) 37 38 typedef enum { 39 GIW_VSLIDER_MOUSE_DISABLED, 40 GIW_VSLIDER_MOUSE_AUTOMATIC, 41 GIW_VSLIDER_MOUSE_DELAYED 42 } GiwVSliderMousePolicy; 43 44 typedef struct _GiwVSlider GiwVSlider; 45 typedef struct _GiwVSliderClass GiwVSliderClass; 46 47 struct _GiwVSlider { 48 #if GTK_CHECK_VERSION(3, 0, 0) 49 GtkWidget parent_instance; 50 #endif 51 GtkWidget widget; 52 53 GtkAdjustment *adjustment; 54 55 gint major_ticks; // Number of major ticks in the vslider 56 gint minor_ticks; // Number of minor ticks between each major ticks 57 gint legend_digits; //Number of digits of the legend (counting the "." and the signal "-" if exists) 58 59 // Button currently pressed or 0 if none 60 guint8 button; 61 62 // Policy of mouse (GIW_VSLIDER_MOUSE_DISABLED, GIW_VSLIDER_MOUSE_AUTOMATIC, GIW_VSLIDER_MOUSE_DELAYED) 63 gint mouse_policy; 64 65 // phantom value, the phantom button's value when using the mouse delayed mouse policy 66 gdouble phantom_value; 67 68 // For drawing: 69 gint height, width; // VSlider height and width 70 gint x, y; // Position of the vslider image relative to te widget window corner 71 gdouble major_dy; //Space between major ticks 72 gdouble minor_dy; //Space between minor ticks 73 gint legend_width, legend_height; 74 gint button_x, button_y, button_w, button_h; // The button position and dimensions 75 gint pbutton_x, pbutton_y, pbutton_w, pbutton_h; // The phantom button position and dimensions 76 PangoLayout **legends; // All the layouts of all the legends 77 78 // Types for drawing the button (they change when the button in pressed, or the pointer is over it) 79 GtkStateType button_state; 80 GtkShadowType button_shadow; 81 82 gulong chsig; 83 gulong vchsig; 84 }; 85 86 struct _GiwVSliderClass { 87 GtkWidgetClass parent_class; 88 }; 89 90 GtkWidget *giw_vslider_new(GtkAdjustment *adjustment); 91 GtkWidget *giw_vslider_new_with_adjustment(gdouble value, gdouble lower, gdouble upper); 92 GType giw_vslider_get_type(void) G_GNUC_CONST; 93 void giw_vslider_set_value(GiwVSlider *vslider, gdouble value); 94 gdouble giw_vslider_get_value(GiwVSlider *vslider); 95 GtkAdjustment *giw_vslider_get_adjustment(GiwVSlider *vslider); 96 void giw_vslider_set_adjustment(GiwVSlider *vslider, GtkAdjustment *adjustment); 97 void giw_vslider_set_legends_digits(GiwVSlider *vslider, gint digits); 98 void giw_vslider_set_mouse_policy(GiwVSlider *vslider, GiwVSliderMousePolicy policy); 99 void giw_vslider_set_major_ticks_number(GiwVSlider *vslider, gint number); 100 void giw_vslider_set_minor_ticks_number(GiwVSlider *vslider, gint number); 101 102 G_END_DECLS 103 104 #endif /* __GIW_VSLIDER_H__ */ 105