1 /* GSequencer - Advanced GTK Sequencer 2 * Copyright (C) 2005-2020 Joël Krähemann 3 * 4 * This file is part of GSequencer. 5 * 6 * GSequencer is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * GSequencer is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with GSequencer. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 #ifndef __AGS_DIAL_H__ 21 #define __AGS_DIAL_H__ 22 23 #include <glib.h> 24 #include <glib-object.h> 25 26 #include <gtk/gtk.h> 27 28 G_BEGIN_DECLS 29 30 #define AGS_TYPE_DIAL (ags_dial_get_type()) 31 #define AGS_DIAL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), AGS_TYPE_DIAL, AgsDial)) 32 #define AGS_DIAL_CLASS(class) (G_TYPE_CHECK_CLASS_CAST((class), AGS_TYPE_DIAL, AgsDialClass)) 33 #define AGS_IS_DIAL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), AGS_TYPE_DIAL)) 34 #define AGS_IS_DIAL_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE((class), AGS_TYPE_DIAL)) 35 #define AGS_DIAL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), AGS_TYPE_DIAL, AgsDialClass)) 36 37 #define AGS_DIAL_DEFAULT_PRECISION (8.0) 38 39 #define AGS_DIAL_DEFAULT_RADIUS (8) 40 #define AGS_DIAL_DEFAULT_OUTLINE_STRENGTH (4) 41 #define AGS_DIAL_DEFAULT_FONT_SIZE (12) 42 #define AGS_DIAL_DEFAULT_BUTTON_WIDTH (12) 43 #define AGS_DIAL_DEFAULT_BUTTON_HEIGHT (8) 44 #define AGS_DIAL_DEFAULT_MARGIN (4.0) 45 #define AGS_DIAL_DEFAULT_MARGIN_LEFT (AGS_DIAL_DEFAULT_MARGIN) 46 #define AGS_DIAL_DEFAULT_MARGIN_RIGHT (AGS_DIAL_DEFAULT_MARGIN) 47 48 #define AGS_DIAL_DEFAULT_HEIGHT (2 * (AGS_DIAL_DEFAULT_RADIUS + AGS_DIAL_DEFAULT_OUTLINE_STRENGTH + 1)) 49 #define AGS_DIAL_DEFAULT_WIDTH (2 * (AGS_DIAL_DEFAULT_BUTTON_WIDTH + AGS_DIAL_DEFAULT_MARGIN + AGS_DIAL_DEFAULT_RADIUS + AGS_DIAL_DEFAULT_OUTLINE_STRENGTH + 2)) 50 51 typedef struct _AgsDial AgsDial; 52 typedef struct _AgsDialClass AgsDialClass; 53 54 typedef enum{ 55 AGS_DIAL_WITH_BUTTONS = 1, 56 AGS_DIAL_MOUSE_BUTTON_PRESSED = 1 << 1, 57 AGS_DIAL_BUTTON_DOWN_PRESSED = 1 << 2, 58 AGS_DIAL_BUTTON_UP_PRESSED = 1 << 3, 59 AGS_DIAL_MOTION_CAPTURING_INIT = 1 << 4, 60 AGS_DIAL_MOTION_CAPTURING = 1 << 5, 61 AGS_DIAL_SEEMLESS_MODE = 1 << 6, 62 AGS_DIAL_INVERSE_LIGHT = 1 << 7, 63 }AgsDialFlags; 64 65 typedef enum{ 66 AGS_DIAL_INCREMENT, 67 AGS_DIAL_DECREMENT, 68 }AgsDialAction; 69 70 struct _AgsDial 71 { 72 GtkWidget widget; 73 74 guint flags; 75 76 guint radius; 77 guint outline_strength; 78 guint scale_precision; 79 guint scale_max_precision; 80 81 guint font_size; 82 gint button_width; 83 gint button_height; 84 gint margin_left; 85 gint margin_right; 86 87 gdouble tolerance; 88 gdouble negated_tolerance; 89 90 GtkAdjustment *adjustment; 91 92 gdouble gravity_x; 93 gdouble gravity_y; 94 gdouble current_x; 95 gdouble current_y; 96 }; 97 98 struct _AgsDialClass 99 { 100 GtkWidgetClass widget; 101 102 void (*value_changed)(AgsDial *dial); 103 }; 104 105 GType ags_dial_get_type(void); 106 107 /* getter and setter */ 108 void ags_dial_set_radius(AgsDial *dial, 109 guint radius); 110 guint ags_dial_get_radius(AgsDial *dial); 111 112 void ags_dial_set_outline_strength(AgsDial *dial, 113 guint outline_strength); 114 guint ags_dial_get_outline_strength(AgsDial *dial); 115 116 void ags_dial_set_scale_precision(AgsDial *dial, 117 guint scale_precision); 118 guint ags_dial_get_scale_precision(AgsDial *dial); 119 120 void ags_dial_set_font_size(AgsDial *dial, 121 guint font_size); 122 guint ags_dial_get_font_size(AgsDial *dial); 123 124 void ags_dial_set_button_width(AgsDial *dial, 125 gint button_width); 126 gint ags_dial_get_button_width(AgsDial *dial); 127 128 void ags_dial_set_button_height(AgsDial *dial, 129 gint button_height); 130 gint ags_dial_get_button_height(AgsDial *dial); 131 132 void ags_dial_set_margin_left(AgsDial *dial, 133 gint margin_left); 134 gint ags_dial_get_margin_left(AgsDial *dial); 135 136 void ags_dial_set_margin_right(AgsDial *dial, 137 gint margin_right); 138 gint ags_dial_get_margin_right(AgsDial *dial); 139 140 void ags_dial_set_adjustment(AgsDial *dial, 141 GtkAdjustment *adjustment); 142 GtkAdjustment* ags_dial_get_adjustment(AgsDial *dial); 143 144 /* events related */ 145 void ags_dial_value_changed(AgsDial *dial); 146 147 void ags_dial_set_value(AgsDial *dial, 148 gdouble value); 149 150 /* instantiate */ 151 AgsDial* ags_dial_new(); 152 153 G_END_DECLS 154 155 #endif /*__AGS_DIAL_H__*/ 156