void gSlider::setMark(bool vl) { if (vl == _mark) return; _mark = vl; gtk_scale_clear_marks(GTK_SCALE(widget)); updateMark(); }
void gSlider::updateMark() { int i; int step; if (!_mark) return; gtk_scale_clear_marks(GTK_SCALE(widget)); step = _page_step; while (step < ((_max - _min) / 20)) step *= 2; for (i = _min; i <= _max; i += step) gtk_scale_add_mark(GTK_SCALE(widget), i, isVertical() ? GTK_POS_TOP : GTK_POS_RIGHT, NULL); }
static void update_scale_marks (GvcBalanceBar *bar) { gchar *str_lower = NULL, *str_upper = NULL; gdouble lower, upper; gtk_scale_clear_marks (GTK_SCALE (bar->priv->scale)); switch (bar->priv->btype) { case BALANCE_TYPE_RL: str_lower = g_strdup_printf ("<small>%s</small>", C_("balance", "Left")); str_upper = g_strdup_printf ("<small>%s</small>", C_("balance", "Right")); break; case BALANCE_TYPE_FR: str_lower = g_strdup_printf ("<small>%s</small>", C_("balance", "Rear")); str_upper = g_strdup_printf ("<small>%s</small>", C_("balance", "Front")); break; case BALANCE_TYPE_LFE: str_lower = g_strdup_printf ("<small>%s</small>", C_("balance", "Minimum")); str_upper = g_strdup_printf ("<small>%s</small>", C_("balance", "Maximum")); break; } lower = gtk_adjustment_get_lower (bar->priv->adjustment); gtk_scale_add_mark (GTK_SCALE (bar->priv->scale), lower, GTK_POS_BOTTOM, str_lower); upper = gtk_adjustment_get_upper (bar->priv->adjustment); gtk_scale_add_mark (GTK_SCALE (bar->priv->scale), upper, GTK_POS_BOTTOM, str_upper); g_free (str_lower); g_free (str_upper); if (bar->priv->btype != BALANCE_TYPE_LFE) gtk_scale_add_mark (GTK_SCALE (bar->priv->scale), (upper - lower) / 2 + lower, GTK_POS_BOTTOM, NULL); }
static void extra (GtkToggleButton *button) { gboolean value; value = gtk_toggle_button_get_active (button); if (value) { gtk_scale_add_mark (GTK_SCALE (extra_scale), extra_marks[0], GTK_POS_TOP, NULL); gtk_scale_add_mark (GTK_SCALE (extra_scale), extra_marks[1], GTK_POS_TOP, NULL); } else { gtk_scale_clear_marks (GTK_SCALE (extra_scale)); gtk_scale_add_mark (GTK_SCALE (extra_scale), marks[0], GTK_POS_BOTTOM, NULL); gtk_scale_add_mark (GTK_SCALE (extra_scale), marks[1], GTK_POS_BOTTOM, NULL); gtk_scale_add_mark (GTK_SCALE (extra_scale), marks[2], GTK_POS_BOTTOM, NULL); } }
void widget_hscale_refresh(variable *var) { GList *element; gchar *act; gint initialised = FALSE; #ifdef DEBUG_TRANSITS fprintf(stderr, "%s(): Entering.\n", __func__); #endif /* Get initialised state of widget */ if (g_object_get_data(G_OBJECT(var->Widget), "_initialised") != NULL) initialised = (gint)g_object_get_data(G_OBJECT(var->Widget), "_initialised"); /* The <input> tag... */ act = attributeset_get_first(&element, var->Attributes, ATTR_INPUT); while (act) { if (input_is_shell_command(act)) widget_hscale_input_by_command(var, act + 8); /* input file stock = "File:", input file = "File:/path/to/file" */ if (strncasecmp(act, "file:", 5) == 0 && strlen(act) > 5) { if (!initialised) { /* Check for file-monitor and create if requested */ widget_file_monitor_try_create(var, act + 5); } widget_hscale_input_by_file(var, act + 5); } act = attributeset_get_next(&element, var->Attributes, ATTR_INPUT); } /* The <item> tags... */ if (attributeset_is_avail(var->Attributes, ATTR_ITEM)) { #if GTK_CHECK_VERSION(2,16,0) gtk_scale_clear_marks(GTK_SCALE(var->Widget)); #endif widget_hscale_input_by_items(var); } /* Initialise these only once at start-up */ if (!initialised) { /* Apply directives */ if (attributeset_is_avail(var->Attributes, ATTR_LABEL)) fprintf(stderr, "%s(): <label> not implemented for this widget.\n", __func__); if (attributeset_is_avail(var->Attributes, ATTR_DEFAULT)) { gtk_range_set_value(GTK_RANGE(var->Widget), atof(attributeset_get_first(&element, var->Attributes, ATTR_DEFAULT))); } if (attributeset_is_avail(var->Attributes, ATTR_HEIGHT)) fprintf(stderr, "%s(): <height> not implemented for this widget.\n", __func__); if (attributeset_is_avail(var->Attributes, ATTR_WIDTH)) fprintf(stderr, "%s(): <width> not implemented for this widget.\n", __func__); if ((attributeset_cmp_left(var->Attributes, ATTR_SENSITIVE, "false")) || (attributeset_cmp_left(var->Attributes, ATTR_SENSITIVE, "disabled")) || /* Deprecated */ (attributeset_cmp_left(var->Attributes, ATTR_SENSITIVE, "no")) || (attributeset_cmp_left(var->Attributes, ATTR_SENSITIVE, "0"))) gtk_widget_set_sensitive(var->Widget, FALSE); /* Connect signals */ g_signal_connect(G_OBJECT(var->Widget), "value-changed", G_CALLBACK(on_any_widget_value_changed_event), (gpointer)var->Attributes); } #ifdef DEBUG_TRANSITS fprintf(stderr, "%s(): Exiting.\n", __func__); #endif }
void Scale::clearMarks() { gtk_scale_clear_marks(GTK_SCALE(widget)); }