当前位置: 首页>>代码示例>>C++>>正文


C++ GTK_SCALE函数代码示例

本文整理汇总了C++中GTK_SCALE函数的典型用法代码示例。如果您正苦于以下问题:C++ GTK_SCALE函数的具体用法?C++ GTK_SCALE怎么用?C++ GTK_SCALE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GTK_SCALE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int
main (int argc, char *argv[])
{
  GstElement *bin;
  GstElement *src, *capsfilter, *equalizer, *spectrum, *audioconvert, *sink;
  GstCaps *caps;
  GstBus *bus;
  GtkWidget *appwindow, *vbox, *hbox, *widget;
  int i;

  gst_init (&argc, &argv);
  gtk_init (&argc, &argv);

  bin = gst_pipeline_new ("bin");

  /* White noise */
  src = gst_element_factory_make ("audiotestsrc", "src");
  g_object_set (G_OBJECT (src), "wave", 5, "volume", 0.8, NULL);

  /* Force float32 samples */
  capsfilter = gst_element_factory_make ("capsfilter", "capsfilter");
  caps =
      gst_caps_new_simple ("audio/x-raw-float", "width", G_TYPE_INT, 32, NULL);
  g_object_set (capsfilter, "caps", caps, NULL);

  equalizer = gst_element_factory_make ("equalizer-nbands", "equalizer");
  g_object_set (G_OBJECT (equalizer), "num-bands", NBANDS, NULL);

  spectrum = gst_element_factory_make ("spectrum", "spectrum");
  g_object_set (G_OBJECT (spectrum), "bands", spect_bands, "threshold", -80,
      "message", TRUE, "interval", 500 * GST_MSECOND, NULL);

  audioconvert = gst_element_factory_make ("audioconvert", "audioconvert");

  sink = gst_element_factory_make ("autoaudiosink", "sink");

  gst_bin_add_many (GST_BIN (bin), src, capsfilter, equalizer, spectrum,
      audioconvert, sink, NULL);
  if (!gst_element_link_many (src, capsfilter, equalizer, spectrum,
          audioconvert, sink, NULL)) {
    fprintf (stderr, "can't link elements\n");
    exit (1);
  }

  bus = gst_element_get_bus (bin);
  gst_bus_add_watch (bus, message_handler, NULL);
  gst_object_unref (bus);

  appwindow = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  g_signal_connect (G_OBJECT (appwindow), "destroy",
      G_CALLBACK (on_window_destroy), NULL);
  vbox = gtk_vbox_new (FALSE, 6);

  drawingarea = gtk_drawing_area_new ();
  gtk_widget_set_size_request (drawingarea, spect_bands, spect_height);
  g_signal_connect (G_OBJECT (drawingarea), "configure-event",
      G_CALLBACK (on_configure_event), (gpointer) spectrum);
  gtk_box_pack_start (GTK_BOX (vbox), drawingarea, TRUE, TRUE, 0);

  hbox = gtk_hbox_new (FALSE, 20);

  for (i = 0; i < NBANDS; i++) {
    GstObject *band;
    gdouble freq;
    gdouble bw;
    gdouble gain;
    gchar *label;
    GtkWidget *frame, *scales_hbox;

    band = gst_child_proxy_get_child_by_index (GST_CHILD_PROXY (equalizer), i);
    g_assert (band != NULL);
    g_object_get (G_OBJECT (band), "freq", &freq, NULL);
    g_object_get (G_OBJECT (band), "bandwidth", &bw, NULL);
    g_object_get (G_OBJECT (band), "gain", &gain, NULL);

    label = g_strdup_printf ("%d Hz", (int) (freq + 0.5));
    frame = gtk_frame_new (label);
    g_free (label);

    scales_hbox = gtk_hbox_new (FALSE, 6);

    widget = gtk_vscale_new_with_range (-24.0, 12.0, 0.5);
    gtk_scale_set_draw_value (GTK_SCALE (widget), TRUE);
    gtk_scale_set_value_pos (GTK_SCALE (widget), GTK_POS_TOP);
    gtk_range_set_value (GTK_RANGE (widget), gain);
    gtk_widget_set_size_request (widget, 25, 150);
    g_signal_connect (G_OBJECT (widget), "value-changed",
        G_CALLBACK (on_gain_changed), (gpointer) band);
    gtk_box_pack_start (GTK_BOX (scales_hbox), widget, FALSE, FALSE, 0);

    widget = gtk_vscale_new_with_range (0.0, 20000.0, 5.0);
    gtk_scale_set_draw_value (GTK_SCALE (widget), TRUE);
    gtk_scale_set_value_pos (GTK_SCALE (widget), GTK_POS_TOP);
    gtk_range_set_value (GTK_RANGE (widget), bw);
    gtk_widget_set_size_request (widget, 25, 150);
    g_signal_connect (G_OBJECT (widget), "value-changed",
        G_CALLBACK (on_bandwidth_changed), (gpointer) band);
    gtk_box_pack_start (GTK_BOX (scales_hbox), widget, TRUE, TRUE, 0);

    widget = gtk_vscale_new_with_range (20.0, 20000.0, 5.0);
//.........这里部分代码省略.........
开发者ID:roopar,项目名称:gst-plugins-good,代码行数:101,代码来源:demo.c

示例2: wxFAIL_MSG

bool wxSlider::Create(wxWindow *parent, wxWindowID id,
        int value, int minValue, int maxValue,
        const wxPoint& pos, const wxSize& size,
        long style, const wxValidator& validator, const wxString& name )
{
    m_acceptsFocus = true;
    m_needParent = true;

    if (!PreCreation( parent, pos, size ) ||
        !CreateBase( parent, id, pos, size, style, validator, name ))
    {
        wxFAIL_MSG( wxT("wxSlider creation failed") );
        return false;
    }

    m_oldPos = 0.0;

    if (style & wxSL_VERTICAL)
        m_widget = gtk_vscale_new( NULL );
    else
        m_widget = gtk_hscale_new( NULL );

    if (style & wxSL_LABELS)
    {
        gtk_scale_set_draw_value( GTK_SCALE( m_widget ), TRUE );
        gtk_scale_set_digits( GTK_SCALE( m_widget ), 0 );

        /* labels need more space and too small window will
           cause junk to appear on the dialog */
        if (style & wxSL_VERTICAL)
        {
            wxSize sz( size );
            if (sz.x < 35)
            {
                sz.x = 35;
                SetSize( sz );
            }
        }
        else
        {
            wxSize sz( size );
            if (sz.y < 35)
            {
                sz.y = 35;
                SetSize( sz );
            }
        }
    }
    else
        gtk_scale_set_draw_value( GTK_SCALE( m_widget ), FALSE );

    m_adjust = gtk_range_get_adjustment( GTK_RANGE(m_widget) );

    GtkEnableEvents();
    gtk_signal_connect( GTK_OBJECT(m_widget),
                        "button_press_event",
                        (GtkSignalFunc)gtk_slider_button_press_callback,
                        (gpointer) this );
    gtk_signal_connect( GTK_OBJECT(m_widget),
                        "button_release_event",
                        (GtkSignalFunc)gtk_slider_button_release_callback,
                        (gpointer) this );

    SetRange( minValue, maxValue );
    SetValue( value );

    m_parent->DoAddChild( this );

    PostCreation(size);

    return true;
}
开发者ID:3v1n0,项目名称:wxWidgets,代码行数:72,代码来源:slider.cpp

示例3: ctk_scale_new

GtkWidget* ctk_scale_new(GtkAdjustment *gtk_adjustment,
                         const gchar *label_text,
                         CtkConfig *ctk_config,
                         gint value_type)
{
    GObject *object;
    CtkScale *ctk_scale;
    GtkWidget *label;
    GtkWidget *frame;
    GtkWidget *hbox;

    g_return_val_if_fail(GTK_IS_ADJUSTMENT(gtk_adjustment), NULL);
    g_return_val_if_fail(label_text != NULL, NULL);

    /* create and initialize the object */

    object = g_object_new(CTK_TYPE_SCALE, NULL);

    ctk_scale = CTK_SCALE(object);

    ctk_scale->gtk_adjustment = gtk_adjustment;
    ctk_scale->label = label_text;
    ctk_scale->ctk_config = ctk_config;
    ctk_scale->value_type = value_type;

    gtk_box_set_spacing (GTK_BOX (object), 2);

    /* scale label */

    label = gtk_label_new(ctk_scale->label);
    gtk_box_pack_start(GTK_BOX (object), label, FALSE, FALSE, 0);

    gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);

    /* frame around slider and text box */

    frame = gtk_frame_new(NULL);
    gtk_box_pack_start(GTK_BOX(object), frame, TRUE, TRUE, 0);
    ctk_scale->tooltip_widget = frame;

    /* hbox to contain slider and text box */

    hbox = gtk_hbox_new(FALSE, 0);
    gtk_container_add(GTK_CONTAINER(ctk_scale->tooltip_widget), hbox);

    /* text entry */

    ctk_scale->text_entry = gtk_entry_new();
    gtk_entry_set_max_length(GTK_ENTRY(ctk_scale->text_entry), 6);
    gtk_entry_set_width_chars(GTK_ENTRY(ctk_scale->text_entry), 6);

    /* text entry container */

    ctk_scale->text_entry_container = gtk_frame_new(NULL);
    gtk_frame_set_shadow_type(GTK_FRAME(ctk_scale->text_entry_container),
                              GTK_SHADOW_NONE);
    gtk_container_set_border_width
        (GTK_CONTAINER(ctk_scale->text_entry_container), 0);


    gtk_container_add(GTK_CONTAINER(ctk_scale->text_entry_container),
                      ctk_scale->text_entry);
    ctk_scale->text_entry_packed = TRUE;
    g_object_ref(G_OBJECT(ctk_scale->text_entry));

    gtk_box_pack_start(GTK_BOX(hbox),
                       ctk_scale->text_entry_container, FALSE, FALSE, 0);

    text_entry_toggled(ctk_scale->ctk_config, (gpointer) ctk_scale);

    /* wire up the adjustment events */

    adjustment_value_changed(ctk_scale->gtk_adjustment, G_OBJECT(ctk_scale));

    g_signal_connect(G_OBJECT(ctk_scale->gtk_adjustment), "value_changed",
                     G_CALLBACK(adjustment_value_changed),
                     (gpointer) ctk_scale);

    g_signal_connect(G_OBJECT(ctk_scale->text_entry), "activate",
                     G_CALLBACK(text_entry_activate),
                     (gpointer) ctk_scale);

    g_signal_connect(G_OBJECT(ctk_config), "slider_text_entry_toggled",
                     G_CALLBACK(text_entry_toggled),
                     (gpointer) ctk_scale);

    /* the slider */

    ctk_scale->gtk_scale =
        gtk_hscale_new(GTK_ADJUSTMENT(ctk_scale->gtk_adjustment));

    gtk_scale_set_draw_value(GTK_SCALE(ctk_scale->gtk_scale), FALSE);

    gtk_scale_set_digits(GTK_SCALE(ctk_scale->gtk_scale), 0);


    gtk_box_pack_start(GTK_BOX(hbox), ctk_scale->gtk_scale, TRUE, TRUE, 3);

    g_signal_connect(ctk_scale->gtk_scale, "key_press_event",
                     G_CALLBACK(ctk_scale_key_event), G_OBJECT(ctk_scale));
//.........这里部分代码省略.........
开发者ID:scaronni,项目名称:nvidia-settings,代码行数:101,代码来源:ctkscale.c

示例4: GTKShowRolls

extern void
GTKShowRolls(const gint nDepth, evalcontext * pec, matchstate * pms)
{


    GtkWidget *vbox, *hbox, *vb2;
    GtkAdjustment *padj;
    int n;

    rollswidget *prw = (rollswidget *) g_malloc(sizeof(rollswidget));

    prw->closing = FALSE;
    prw->pDialog = GTKCreateDialog(_("Distribution of rolls"), DT_INFO, NULL, DIALOG_FLAG_MODAL, NULL, NULL);

    n = (nDepth < 1) ? 1 : nDepth;

    prw->pms = pms;
    prw->pec = pec;
    prw->nDepth = -1;           /* not yet calculated */

    /* vbox to hold tree widget and buttons */

    vbox = gtk_vbox_new(FALSE, 8);
    gtk_container_set_border_width(GTK_CONTAINER(vbox), 8);
    gtk_container_add(GTK_CONTAINER(DialogArea(prw->pDialog, DA_MAIN)), vbox);

    /* hook to free rollswidget on widget destruction */
    g_object_set_data_full(G_OBJECT(vbox), "rollswidget", prw, g_free);

    /* scrolled window to hold tree widget */

    prw->psw = gtk_scrolled_window_new(NULL, NULL);
    gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(prw->psw), GTK_SHADOW_ETCHED_IN);
    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(prw->psw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
    gtk_box_pack_start(GTK_BOX(vbox), prw->psw, TRUE, TRUE, 0);

    /* buttons */

    gtk_box_pack_start(GTK_BOX(vbox), gtk_hseparator_new(), FALSE, FALSE, 0);

    hbox = gtk_hbox_new(FALSE, 0);
    gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 4);

    gtk_box_pack_start(GTK_BOX(hbox), gtk_label_new(_("Depth")), FALSE, FALSE, 4);

    /* Set page size to 1 */
    padj = GTK_ADJUSTMENT(gtk_adjustment_new(1., 1., 5., 1., 1., 0.));
    prw->pScale = gtk_hscale_new(padj);
    gtk_widget_set_size_request(prw->pScale, 100, -1);
    gtk_box_pack_start(GTK_BOX(hbox), prw->pScale, FALSE, FALSE, 4);
    gtk_scale_set_digits(GTK_SCALE(prw->pScale), 0);
    gtk_scale_set_draw_value(GTK_SCALE(prw->pScale), TRUE);

    /* Separate vbox to make button height correct */
    vb2 = gtk_vbox_new(FALSE, 0);
    gtk_box_pack_start(GTK_BOX(hbox), vb2, FALSE, FALSE, 4);
    prw->pCancel = gtk_button_new_with_label(_("Cancel"));
    gtk_widget_set_size_request(prw->pCancel, -1, 27);
    gtk_widget_set_sensitive(prw->pCancel, FALSE);
    g_signal_connect(G_OBJECT(prw->pCancel), "clicked", G_CALLBACK(CancelRolls), NULL);
    gtk_box_pack_start(GTK_BOX(vb2), prw->pCancel, FALSE, FALSE, 4);

    g_signal_connect(G_OBJECT(prw->pScale), "button-press-event", G_CALLBACK(DepthEvent), prw);
    g_signal_connect(G_OBJECT(prw->pScale), "button-release-event", G_CALLBACK(DepthEvent), prw);
    g_signal_connect(G_OBJECT(prw->pScale), "value-changed", G_CALLBACK(DepthChanged), prw);

    /* tree  */

    if ((prw->ptv = RollsTree(n, pec, pms)) != 0) {
        gtk_container_add(GTK_CONTAINER(prw->psw), prw->ptv);
        prw->nDepth = n;
    }

    gtk_window_set_default_size(GTK_WINDOW(prw->pDialog), 560, 400);
    g_signal_connect(G_OBJECT(prw->pDialog), "delete_event", G_CALLBACK(RollsClose), prw);      /* In case closed mid calculation */

    GTKRunDialog(prw->pDialog);
}
开发者ID:mormegil-cz,项目名称:gnubg,代码行数:78,代码来源:gtkrolls.c

示例5: scale_create_widget

GtkWidget *
scale_create_widget (GtkWidget * dlg)
{
  GtkWidget *w;
  GtkAdjustment *adj;
  gint page;

  if (options.scale_data.min_value >= options.scale_data.max_value)
    {
      g_printerr (_("Maximum value must be greater than minimum value.\n"));
      return NULL;
    }

  /* check for initial value */
  if (options.scale_data.have_value)
    {
      if (options.scale_data.value < options.scale_data.min_value)
        {
          g_printerr (_("Initial value less than minimal.\n"));
          options.scale_data.value = options.scale_data.min_value;
        }
      else if (options.scale_data.value > options.scale_data.max_value)
        {
          g_printerr (_("Initial value greater than maximum.\n"));
          options.scale_data.value = options.scale_data.max_value;
        }
    }
  else
    options.scale_data.value = options.scale_data.min_value;

  page = options.scale_data.page == -1 ? options.scale_data.step * 10 : options.scale_data.page;
  /* this type conversion needs only for gtk-2.0 */
  adj = (GtkAdjustment *) gtk_adjustment_new ((double) options.scale_data.value,
                                              (double) options.scale_data.min_value,
                                              (double) options.scale_data.max_value,
                                              (double) options.scale_data.step,
                                              (double) page,
                                              0.0);
  if (options.common_data.vertical)
    {
#if GTK_CHECK_VERSION(3,0,0)
      scale = gtk_scale_new (GTK_ORIENTATION_VERTICAL, GTK_ADJUSTMENT (adj));
#else
      scale = gtk_vscale_new (GTK_ADJUSTMENT (adj));
#endif
      gtk_range_set_inverted (GTK_RANGE (scale), !options.scale_data.invert);
    }
  else
    {
#if GTK_CHECK_VERSION(3,0,0)
      scale = gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, GTK_ADJUSTMENT (adj));
#else
      scale = gtk_hscale_new (GTK_ADJUSTMENT (adj));
#endif
      gtk_range_set_inverted (GTK_RANGE (scale), options.scale_data.invert);
    }
  gtk_widget_set_name (scale, "yad-scale-widget");
  gtk_scale_set_digits (GTK_SCALE (scale), 0);

  if (options.scale_data.hide_value)
    gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);

  /* add marks */
  if (options.scale_data.marks)
    {
      GtkPositionType pos;
      GSList *m = options.scale_data.marks;

      pos = options.common_data.vertical ? GTK_POS_LEFT : GTK_POS_BOTTOM;
      for (; m; m = m->next)
        {
          YadScaleMark *mark = (YadScaleMark *) m->data;
          gtk_scale_add_mark (GTK_SCALE (scale), mark->value, pos, mark->name);
        }
    }

  /* create container */
  if (options.common_data.vertical)
    {
#if GTK_CHECK_VERSION(3,0,0)
      w = gtk_box_new (GTK_ORIENTATION_VERTICAL, 1);
#else
      w = gtk_vbox_new (FALSE, 1);
#endif
    }
  else
    {
#if GTK_CHECK_VERSION(3,0,0)
      w = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 1);
#else
      w = gtk_hbox_new (FALSE, 1);
#endif
    }

  /* create buttons */
  if (options.scale_data.buttons)
    {
      minus_btn = gtk_button_new_with_label ("-");
      gtk_button_set_relief (GTK_BUTTON (minus_btn), GTK_RELIEF_NONE);
      g_signal_connect (G_OBJECT (minus_btn), "clicked", G_CALLBACK (vb_pressed), GINT_TO_POINTER (MINUS_BTN));
//.........这里部分代码省略.........
开发者ID:svn2github,项目名称:yad-dialog,代码行数:101,代码来源:scale.c

示例6: show_mixer

gboolean show_mixer(GtkWidget *widget, GdkEvent  *event, gpointer user_data)
{

  GtkWidget *win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title(GTK_WINDOW(win), "SIDE Mixer");
  gtk_container_set_border_width(GTK_CONTAINER(win), 10);
  gtk_window_resize(GTK_WINDOW(win), 150, 300);
  GdkScreen *screen = gdk_screen_get_default();

  fwin = win;

  g_timeout_add(100, check_focus, win);

  GtkWidget *box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5);
  GtkWidget *dsc = gtk_label_new("master");

  GtkAdjustment *adj = gtk_adjustment_new(50, 0, 100, 5, 0, 0);
  g_signal_connect(G_OBJECT(adj), "value-changed", G_CALLBACK(set_volume), NULL);
  GtkWidget     *scl = gtk_scale_new(GTK_ORIENTATION_VERTICAL, adj);
  gtk_scale_set_draw_value(GTK_SCALE(scl), FALSE);

  s_mute = gtk_toggle_button_new_with_label("mute");

  g_signal_connect(G_OBJECT(s_mute), "toggled", G_CALLBACK(set_mute), (gpointer) adj);


  gtk_box_pack_end(GTK_BOX(box), s_mute, FALSE, FALSE, 0);


  gtk_container_add(GTK_CONTAINER(box), dsc);
  gtk_box_pack_end(GTK_BOX(box), scl, TRUE, TRUE, 5);


    int x, y;
    gtk_window_get_size(GTK_WINDOW(win), &x, &y);
    gtk_window_set_decorated(GTK_WINDOW(win), FALSE);
    gtk_window_move(GTK_WINDOW(win), gdk_screen_get_width(screen), gdk_screen_get_height(screen) - (y+25));



  gtk_container_add(GTK_CONTAINER(win), box);
  gtk_widget_show_all(win);


  snd_mixer_t *mix;
  snd_mixer_selem_id_t *sid;
  const char *card = "default";
  const char *selem_name = "Master";

  long val, max, min;

  snd_mixer_open(&mix, 0);
  snd_mixer_attach(mix, card);
  snd_mixer_selem_register(mix, NULL, NULL);
  snd_mixer_load(mix);

  snd_mixer_selem_id_alloca(&sid);
  snd_mixer_selem_id_set_index(sid, 0);
  snd_mixer_selem_id_set_name(sid, selem_name);
  snd_mixer_elem_t* elem = snd_mixer_find_selem(mix, sid);

  snd_mixer_selem_get_playback_volume_range(elem, &min, &max);

  snd_mixer_selem_get_playback_volume(elem, SND_MIXER_SCHN_MONO  , &val);
  gtk_adjustment_set_value(adj, 100 - (int)  100 * val / max);


  snd_mixer_close(mix);



  return FALSE;
}
开发者ID:tom2901,项目名称:desktop,代码行数:73,代码来源:volume.c

示例7: create_volume_window

GtkWidget*
create_volume_window (void)
{
	accel_group = gtk_accel_group_new ();

	volume_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
	gtk_widget_set_size_request (volume_window, 60, 240);
	gtk_container_set_border_width (GTK_CONTAINER (volume_window), 2);

	gtk_window_set_resizable (GTK_WINDOW (volume_window), FALSE);
	gtk_window_set_position (GTK_WINDOW (volume_window), GTK_WIN_POS_MOUSE);
	gtk_window_set_decorated (GTK_WINDOW (volume_window), FALSE);
	gtk_window_set_skip_taskbar_hint( GTK_WINDOW (volume_window), TRUE );

	frame = gtk_frame_new (_("Volume"));

	vbox1 = gtk_vbox_new (FALSE, 0);
	gtk_widget_show (vbox1);
	gtk_container_add (GTK_CONTAINER (frame), vbox1);
	gtk_container_add (GTK_CONTAINER (volume_window), frame);
	gtk_widget_show (frame);
	vol_adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (1, 0, 100, 1, 10, 0));

	/* get original adjustments */
	get_current_levels();

	hbox1 = gtk_hbox_new (FALSE, 0);
	gtk_widget_show (hbox1);
	gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, TRUE, 8);


	/* ajustment, climb rate, digits */
	spinbutton1 = gtk_spin_button_new (GTK_ADJUSTMENT (vol_adjustment), 1, 0);
	gtk_widget_show (spinbutton1);

	gtk_box_pack_start (GTK_BOX (hbox1), spinbutton1, TRUE, FALSE, 0);
	gtk_widget_set_size_request (spinbutton1, -1, 22);
	g_signal_connect ((gpointer) spinbutton1, "value_changed",
			  G_CALLBACK (on_spinbutton1_button_release_event),
			  NULL);
	g_object_set_data_full(G_OBJECT (volume_window), "spinbutton1", 
			       gtk_widget_ref (spinbutton1),
			       (GDestroyNotify) gtk_widget_unref);

	hbox3 = gtk_hbox_new (FALSE, 0);
	gtk_widget_show (hbox3);
	gtk_box_pack_start (GTK_BOX (vbox1), hbox3, TRUE, TRUE, 5);

	vscale1 = gtk_vscale_new (GTK_ADJUSTMENT (vol_adjustment));
	gtk_widget_show (vscale1);
	gtk_range_set_inverted (GTK_RANGE (vscale1), TRUE);
	gtk_box_pack_start (GTK_BOX (hbox3), vscale1, TRUE, TRUE, 0);
	gtk_scale_set_draw_value (GTK_SCALE (vscale1), FALSE);
	g_signal_connect ((gpointer) vscale1, "button_release_event",
			  G_CALLBACK (on_vscale1_button_release_event),
			  vol_adjustment);
	g_object_set_data_full(G_OBJECT (volume_window), "vscale1",
			       gtk_widget_ref (vscale1),
			       (GDestroyNotify) gtk_widget_unref);

	hbox4 = gtk_hbox_new (FALSE, 0);
	gtk_widget_show (hbox4);
	gtk_box_pack_start (GTK_BOX (vbox1), hbox4, FALSE, TRUE, 8);

	g_signal_connect ((gpointer) volume_window, "destroy",
			  G_CALLBACK (gtk_widget_destroy),
			  NULL);

	g_object_set_data (G_OBJECT (volume_window), "volume_window", volume_window);
	g_object_set_data_full (G_OBJECT (volume_window), "frame",
			        gtk_widget_ref (frame), 
				(GDestroyNotify) gtk_widget_unref);
	g_object_set_data_full (G_OBJECT (volume_window), "vbox1",
			        gtk_widget_ref (vbox1), 
				(GDestroyNotify) gtk_widget_unref);
	g_object_set_data_full (G_OBJECT (volume_window), "hbox1",
			        gtk_widget_ref (hbox1), 
				(GDestroyNotify) gtk_widget_unref);
	g_object_set_data_full (G_OBJECT (volume_window), "hbox3",
			        gtk_widget_ref (hbox3), 
				(GDestroyNotify) gtk_widget_unref);
	g_object_set_data_full (G_OBJECT (volume_window), "hbox4",
			        gtk_widget_ref (hbox4), 
				(GDestroyNotify) gtk_widget_unref);

	gtk_window_add_accel_group (GTK_WINDOW (volume_window), accel_group);

	vol_spin = spinbutton1;

	return volume_window;
}
开发者ID:bookwar,项目名称:lxpanel,代码行数:91,代码来源:volume-impl.c

示例8: create_dialog1

GtkWidget*
create_dialog1 (void)
{
  GtkWidget *dialog1;
  GtkWidget *dialog_vbox1;
  GtkWidget *vbox1;
  GtkWidget *hbox1;
  GtkWidget *frame1;
  GtkWidget *table2;
  GtkWidget *label4;
  GtkWidget *label5;
  GtkWidget *hscaleBrightness;
  GtkWidget *hscaleSaturation;
  GtkWidget *hscaleContrast;
  GtkWidget *label3;
  GtkWidget *label1;
  GtkWidget *frame2;
  GtkWidget *table3;
  GtkWidget *label6;
  GtkWidget *hscaleGamma;
  GtkWidget *hscaleGammaR;
  GtkWidget *label8;
  GtkWidget *hscaleGammaG;
  GtkWidget *label9;
  GtkWidget *label10;
  GtkWidget *label7;
  GtkWidget *hscaleGammaB;
  GtkWidget *hscaleGammaWeight;
  GtkWidget *label2;
  GtkWidget *hscale1;
  GtkWidget *drawingarea1;
  GtkWidget *dialog_action_area1;
  GtkWidget *cancelbutton1;
  GtkWidget *okbutton1;

  dialog1 = gtk_dialog_new ();
  gtk_container_set_border_width (GTK_CONTAINER (dialog1), 6);
  gtk_window_set_title (GTK_WINDOW (dialog1), QT_TR_NOOP("MPlayer eq2"));
  gtk_window_set_resizable (GTK_WINDOW (dialog1), FALSE);

  dialog_vbox1 = GTK_DIALOG (dialog1)->vbox;
  gtk_widget_show (dialog_vbox1);

  vbox1 = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox1);
  gtk_box_pack_start (GTK_BOX (dialog_vbox1), vbox1, TRUE, TRUE, 0);

  hbox1 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox1);
  gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);

  frame1 = gtk_frame_new (NULL);
  gtk_widget_show (frame1);
  gtk_box_pack_start (GTK_BOX (hbox1), frame1, TRUE, TRUE, 0);
  gtk_frame_set_shadow_type (GTK_FRAME (frame1), GTK_SHADOW_NONE);

  table2 = gtk_table_new (3, 2, FALSE);
  gtk_widget_show (table2);
  gtk_container_add (GTK_CONTAINER (frame1), table2);
  gtk_container_set_border_width (GTK_CONTAINER (table2), 12);
  gtk_table_set_row_spacings (GTK_TABLE (table2), 6);
  gtk_table_set_col_spacings (GTK_TABLE (table2), 12);

  label4 = gtk_label_new_with_mnemonic (QT_TR_NOOP("Brigh_tness:"));
  gtk_widget_show (label4);
  gtk_table_attach (GTK_TABLE (table2), label4, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label4), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label4), 0, 0.5);

  label5 = gtk_label_new_with_mnemonic (QT_TR_NOOP("_Saturation:"));
  gtk_widget_show (label5);
  gtk_table_attach (GTK_TABLE (table2), label5, 0, 1, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label5), GTK_JUSTIFY_LEFT);
  gtk_misc_set_alignment (GTK_MISC (label5), 0, 0.5);

  hscaleBrightness = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (0, -1, 1, 0.05, 1, 0)));
  gtk_widget_show (hscaleBrightness);
  gtk_table_attach (GTK_TABLE (table2), hscaleBrightness, 1, 2, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (GTK_FILL), 0, 0);
  gtk_widget_set_size_request (hscaleBrightness, 144, 0);
  gtk_scale_set_value_pos (GTK_SCALE (hscaleBrightness), GTK_POS_RIGHT);
  gtk_scale_set_digits (GTK_SCALE (hscaleBrightness), 2);

  hscaleSaturation = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (1, 0, 3, 0.05, 1, 0)));
  gtk_widget_show (hscaleSaturation);
  gtk_table_attach (GTK_TABLE (table2), hscaleSaturation, 1, 2, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (GTK_FILL), 0, 0);
  gtk_widget_set_size_request (hscaleSaturation, 144, 0);
  gtk_scale_set_value_pos (GTK_SCALE (hscaleSaturation), GTK_POS_RIGHT);
  gtk_scale_set_digits (GTK_SCALE (hscaleSaturation), 2);

  hscaleContrast = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (1, -2, 2, 0.05, 1, 0)));
  gtk_widget_show (hscaleContrast);
  gtk_table_attach (GTK_TABLE (table2), hscaleContrast, 1, 2, 0, 1,
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:avidemux,代码行数:101,代码来源:DIA_eq2.cpp

示例9: create_dialog1

GtkWidget*
create_dialog1 (void)
{
  GtkWidget *dialog1;
  GtkWidget *dialog_vbox1;
  GtkWidget *vbox1;
  GtkWidget *hbox1;
  GtkWidget *label1;
  GtkObject *spinbutton1_adj;
  GtkWidget *spinbutton1;
  GtkWidget *hscale1;
  GtkWidget *hbox2;
  GtkWidget *drawingarea1;
  GtkWidget *vscale1;
  GtkWidget *dialog_action_area1;
  GtkWidget *cancelbutton1;
  GtkWidget *okbutton1;

  dialog1 = gtk_dialog_new ();
  gtk_window_set_title (GTK_WINDOW (dialog1), QT_TR_NOOP("Subtitle Size and Position"));
  gtk_window_set_type_hint (GTK_WINDOW (dialog1), GDK_WINDOW_TYPE_HINT_DIALOG);

  dialog_vbox1 = GTK_DIALOG (dialog1)->vbox;
  gtk_widget_show (dialog_vbox1);

  vbox1 = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox1);
  gtk_box_pack_start (GTK_BOX (dialog_vbox1), vbox1, TRUE, TRUE, 0);

  hbox1 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox1);
  gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);

  label1 = gtk_label_new (QT_TR_NOOP("Font Size:"));
  gtk_widget_show (label1);
  gtk_box_pack_start (GTK_BOX (hbox1), label1, FALSE, FALSE, 0);

  spinbutton1_adj = gtk_adjustment_new (1, 6, 99, 1, 10, 10);
  spinbutton1 = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton1_adj), 1, 2);
  gtk_widget_show (spinbutton1);
  gtk_box_pack_start (GTK_BOX (hbox1), spinbutton1, FALSE, FALSE, 0);
  gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton1), TRUE);

  hscale1 = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, 99, 1, 1, 1)));
  gtk_widget_show (hscale1);
  gtk_box_pack_start (GTK_BOX (vbox1), hscale1, FALSE, FALSE, 0);

  hbox2 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox2);
  gtk_box_pack_start (GTK_BOX (vbox1), hbox2, TRUE, TRUE, 0);

  drawingarea1 = gtk_drawing_area_new ();
  gtk_widget_show (drawingarea1);
  gtk_box_pack_start (GTK_BOX (hbox2), drawingarea1, TRUE, TRUE, 0);

  vscale1 = gtk_vscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (0, 100, 1, 1, 1, 1)));
  gtk_widget_show (vscale1);
  gtk_box_pack_start (GTK_BOX (hbox2), vscale1, FALSE, FALSE, 0);
  gtk_scale_set_digits (GTK_SCALE (vscale1), 0);

  dialog_action_area1 = GTK_DIALOG (dialog1)->action_area;
  gtk_widget_show (dialog_action_area1);
  gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END);

  cancelbutton1 = gtk_button_new_from_stock ("gtk-cancel");
  gtk_widget_show (cancelbutton1);
  gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), cancelbutton1, GTK_RESPONSE_CANCEL);
  GTK_WIDGET_SET_FLAGS (cancelbutton1, GTK_CAN_DEFAULT);

  okbutton1 = gtk_button_new_from_stock ("gtk-ok");
  gtk_widget_show (okbutton1);
  gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), okbutton1, GTK_RESPONSE_OK);
  GTK_WIDGET_SET_FLAGS (okbutton1, GTK_CAN_DEFAULT);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog1, "dialog1");
  GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_vbox1, "dialog_vbox1");
  GLADE_HOOKUP_OBJECT (dialog1, vbox1, "vbox1");
  GLADE_HOOKUP_OBJECT (dialog1, hbox1, "hbox1");
  GLADE_HOOKUP_OBJECT (dialog1, label1, "label1");
  GLADE_HOOKUP_OBJECT (dialog1, spinbutton1, "spinbutton1");
  GLADE_HOOKUP_OBJECT (dialog1, hscale1, "hscale1");
  GLADE_HOOKUP_OBJECT (dialog1, hbox2, "hbox2");
  GLADE_HOOKUP_OBJECT (dialog1, drawingarea1, "drawingarea1");
  GLADE_HOOKUP_OBJECT (dialog1, vscale1, "vscale1");
  GLADE_HOOKUP_OBJECT_NO_REF (dialog1, dialog_action_area1, "dialog_action_area1");
  GLADE_HOOKUP_OBJECT (dialog1, cancelbutton1, "cancelbutton1");
  GLADE_HOOKUP_OBJECT (dialog1, okbutton1, "okbutton1");

  return dialog1;
}
开发者ID:BackupTheBerlios,项目名称:avidemux-svn,代码行数:91,代码来源:DIA_srt.cpp

示例10: configure


//.........这里部分代码省略.........
	gtk_widget_show(vbox3);
	gtk_container_add(GTK_CONTAINER(Downsample_Frame), vbox3);

	Sample_44 = gtk_radio_button_new_with_label(sample_group, "44 kHz");
	sample_group = gtk_radio_button_group(GTK_RADIO_BUTTON(Sample_44));
	gtk_object_set_data(GTK_OBJECT(xmp_conf_window),"Sample_44", Sample_44);
	gtk_widget_show(Sample_44);
	gtk_box_pack_start(GTK_BOX(vbox3), Sample_44, TRUE, TRUE, 0);
	if (xmp_cfg.mixing_freq == FREQ_SAMPLE_44)
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(Sample_44),TRUE);

	Sample_22 = gtk_radio_button_new_with_label(sample_group, "22 kHz");
	sample_group = gtk_radio_button_group(GTK_RADIO_BUTTON(Sample_22));
	gtk_object_set_data(GTK_OBJECT(xmp_conf_window), "Sample_22",Sample_22);
	gtk_widget_show(Sample_22);
	gtk_box_pack_start(GTK_BOX(vbox3), Sample_22, TRUE, TRUE, 0);
	if (xmp_cfg.mixing_freq == FREQ_SAMPLE_22)
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(Sample_22),TRUE);

	Sample_11 = gtk_radio_button_new_with_label(sample_group, "11 kHz");
	sample_group = gtk_radio_button_group(GTK_RADIO_BUTTON(Sample_11));
	gtk_object_set_data(GTK_OBJECT(xmp_conf_window), "Sample_11",Sample_11);
	gtk_widget_show(Sample_11);
	gtk_box_pack_start(GTK_BOX(vbox3), Sample_11, TRUE, TRUE, 0);
	if (xmp_cfg.mixing_freq == FREQ_SAMPLE_11)
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(Sample_11),TRUE);

	vbox6 = gtk_vbox_new(FALSE, 0);
	gtk_object_set_data(GTK_OBJECT(xmp_conf_window), "vbox6", vbox6);
	gtk_widget_show(vbox6);

	/* Options */

#define OPTCHECK(w,l,o) {						\
	w = gtk_check_button_new_with_label(l);				\
	gtk_object_set_data(GTK_OBJECT(xmp_conf_window), #w, w);	\
	gtk_widget_show(w);						\
	gtk_box_pack_start(GTK_BOX(vbox6), w, TRUE, TRUE, 0);		\
	if (xmp_cfg.o == 1)						\
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w), TRUE); \
}

	OPTCHECK(Convert_Check, "Convert 16 bit samples to 8 bit", convert8bit);
	OPTCHECK(Fixloops_Check, "Fix sample loops", fixloops);
	OPTCHECK(Modrange_Check, "Force 3 octave range in standard MOD files",
		modrange);
	OPTCHECK(Interp_Check, "Enable 32-bit linear interpolation",
		interpolation);
	OPTCHECK(Filter_Check, "Enable IT filters", filter);

	pansep_label = gtk_label_new("Pan amplitude (%)");
	gtk_widget_show(pansep_label);
	gtk_box_pack_start(GTK_BOX(vbox6), pansep_label, TRUE, TRUE, 0);
	pansep_adj = gtk_adjustment_new(xmp_cfg.pan_amplitude,
		0.0, 100.0, 1.0, 10.0, 1.0);
	pansep_hscale = gtk_hscale_new(GTK_ADJUSTMENT(pansep_adj));
	gtk_scale_set_digits(GTK_SCALE(pansep_hscale), 0);
	gtk_scale_set_draw_value(GTK_SCALE(pansep_hscale), TRUE);
	gtk_scale_set_value_pos(GTK_SCALE(pansep_hscale), GTK_POS_BOTTOM);
	gtk_widget_show(pansep_hscale);
	gtk_box_pack_start(GTK_BOX(vbox6), pansep_hscale, TRUE, TRUE, 0);

	Quality_Label = gtk_label_new("Quality");
	gtk_object_set_data(GTK_OBJECT(xmp_conf_window),
		"Quality_Label", Quality_Label);
	gtk_widget_show(Quality_Label);
	gtk_notebook_append_page(GTK_NOTEBOOK(notebook1), vbox1, Quality_Label);

	Options_Label = gtk_label_new("Options");
	gtk_object_set_data(GTK_OBJECT(xmp_conf_window),
		"Options_Label", Options_Label);
	gtk_widget_show(Options_Label);
	gtk_notebook_append_page(GTK_NOTEBOOK(notebook1), vbox6, Options_Label);

	bbox = gtk_hbutton_box_new();
	gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
	gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5);
	gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0);

	ok = gtk_button_new_with_label("Ok");
	gtk_signal_connect(GTK_OBJECT(ok), "clicked",
		GTK_SIGNAL_FUNC(config_ok), NULL);
	GTK_WIDGET_SET_FLAGS(ok, GTK_CAN_DEFAULT);
	gtk_box_pack_start(GTK_BOX(bbox), ok, TRUE, TRUE, 0);
	gtk_widget_show(ok);
	gtk_widget_grab_default(ok);

	cancel = gtk_button_new_with_label("Cancel");
	gtk_signal_connect_object(GTK_OBJECT(cancel), "clicked",
		GTK_SIGNAL_FUNC(gtk_widget_destroy),
		GTK_OBJECT(xmp_conf_window));
	GTK_WIDGET_SET_FLAGS(cancel, GTK_CAN_DEFAULT);
	gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 0);
	gtk_widget_show(cancel);

	gtk_widget_show(bbox);

	gtk_widget_show(vbox);
	gtk_widget_show(xmp_conf_window);
}
开发者ID:ProjectZeroSlackr,项目名称:XMP,代码行数:101,代码来源:bmp.c

示例11: create_dialog1

GtkWidget*
create_dialog1 (void)
{
  GtkWidget *dialog1;
  GtkWidget *dialog_vbox1;
  GtkWidget *vbox1;
  GtkWidget *accellabel1;
  GtkWidget *hscale1;
  GtkWidget *label1;
  GtkWidget *hscale2;
  GtkWidget *dialog_action_area1;
  GtkWidget *hbox1;
  GtkWidget *button_ok;
  GtkWidget *button_ko;
  GtkWidget *button_preview;

  dialog1 = gtk_dialog_new ();
  gtk_object_set_data (GTK_OBJECT (dialog1), "dialog1", dialog1);
  gtk_window_set_title (GTK_WINDOW (dialog1), "Clean smoother");
  gtk_window_set_policy (GTK_WINDOW (dialog1), TRUE, TRUE, FALSE);
   gtk_window_set_modal(GTK_WINDOW(dialog1), TRUE);
  dialog_vbox1 = GTK_DIALOG (dialog1)->vbox;
  gtk_object_set_data (GTK_OBJECT (dialog1), "dialog_vbox1", dialog_vbox1);

  gtk_widget_show (dialog_vbox1);

  vbox1 = gtk_vbox_new (FALSE, 0);
  gtk_widget_ref (vbox1);
  gtk_object_set_data_full (GTK_OBJECT (dialog1), "vbox1", vbox1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (vbox1);
  gtk_box_pack_start (GTK_BOX (dialog_vbox1), vbox1, TRUE, TRUE, 0);

  accellabel1 = gtk_accel_label_new ("Diameter");
  gtk_widget_ref (accellabel1);
  gtk_object_set_data_full (GTK_OBJECT (dialog1), "accellabel1", accellabel1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (accellabel1);
  gtk_box_pack_start (GTK_BOX (vbox1), accellabel1, FALSE, FALSE, 0);

  radius_adj=gtk_adjustment_new (2, 2, 10, 1, 1, 1);

  hscale1 = gtk_hscale_new (GTK_ADJUSTMENT (radius_adj));
  gtk_widget_ref (hscale1);
  gtk_object_set_data_full (GTK_OBJECT (dialog1), "hscale1", hscale1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hscale1);
  gtk_box_pack_start (GTK_BOX (vbox1), hscale1, TRUE, TRUE, 0);

  gtk_scale_set_digits(GTK_SCALE(hscale1),0);

  label1 = gtk_label_new ("Blend amount");
  gtk_widget_ref (label1);
  gtk_object_set_data_full (GTK_OBJECT (dialog1), "label1", label1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label1);
  gtk_box_pack_start (GTK_BOX (vbox1), label1, FALSE, FALSE, 0);

  blend_adj= gtk_adjustment_new (1, 1, 10, 1, 1, 1);
  hscale2 = gtk_hscale_new (GTK_ADJUSTMENT (blend_adj));
  gtk_widget_ref (hscale2);
  gtk_object_set_data_full (GTK_OBJECT (dialog1), "hscale2", hscale2,
                            (GtkDestroyNotify) gtk_widget_unref);
   gtk_scale_set_digits(GTK_SCALE(hscale2),0);

  gtk_widget_show (hscale2);
  gtk_box_pack_start (GTK_BOX (vbox1), hscale2, TRUE, TRUE, 0);

  dialog_action_area1 = GTK_DIALOG (dialog1)->action_area;
  gtk_object_set_data (GTK_OBJECT (dialog1), "dialog_action_area1", dialog_action_area1);
  gtk_widget_show (dialog_action_area1);
  gtk_container_set_border_width (GTK_CONTAINER (dialog_action_area1), 10);

  hbox1 = gtk_hbox_new (FALSE, 0);
  gtk_widget_ref (hbox1);
  gtk_object_set_data_full (GTK_OBJECT (dialog1), "hbox1", hbox1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbox1);
  gtk_box_pack_start (GTK_BOX (dialog_action_area1), hbox1, TRUE, TRUE, 0);

  button_ok = gtk_button_new_with_label ("OK");
  gtk_widget_ref (button_ok);
  gtk_object_set_data_full (GTK_OBJECT (dialog1), "button_ok", button_ok,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button_ok);
  gtk_box_pack_start (GTK_BOX (hbox1), button_ok, FALSE, FALSE, 0);

  button_ko = gtk_button_new_with_label ("Cancel");
  gtk_widget_ref (button_ko);
  gtk_object_set_data_full (GTK_OBJECT (dialog1), "button_ko", button_ko,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button_ko);
  gtk_box_pack_start (GTK_BOX (hbox1), button_ko, FALSE, FALSE, 0);

  button_preview = gtk_button_new_with_label ("Preview");
  gtk_widget_ref (button_preview);
  gtk_object_set_data_full (GTK_OBJECT (dialog1), "button_preview", button_preview,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button_preview);
  gtk_box_pack_start (GTK_BOX (hbox1), button_preview, TRUE, FALSE, 0);
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:avidemux-svn,代码行数:101,代码来源:ADM_guiClean.cpp

示例12: calloc

spin_button_ctx_t *time_scrollbar_new(void)
{
    GtkObject *adj_msec;
    GtkObject *adj_sec;
    GtkObject *adj_min;
    GtkObject *adj_scale;
    GtkWidget *scale;
    GtkWidget *spin_msec;
    GtkWidget *spin_sec;
    GtkWidget *spin_min;
    GtkWidget *hbox;
    GtkWidget *vbox;
    spin_button_ctx_t *sbctx;

    sbctx = (spin_button_ctx_t *) calloc(1, sizeof(spin_button_ctx_t));

    vbox = gtk_vbox_new(FALSE, 4);
    sbctx->time_scrollbar = vbox;

    hbox = gtk_hbox_new(FALSE, 4);
    gtk_widget_show(hbox);

    gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0);
   
    adj_msec  = gtk_adjustment_new(0.0, -1.0, 1000.0, 1.0, 1.0, 1.0);
    adj_sec   = gtk_adjustment_new(0.0, -1.0, 60.0,   1.0, 1.0, 1.0);
    adj_min   = gtk_adjustment_new(0.0, 0.0,  99.0,   1.0, 1.0, 1.0);
    adj_scale = gtk_adjustment_new(0.0, 0.0,  100.0*60*1000, 5.0, 5.0, 1.0);

    spin_min = gtk_spin_button_new(GTK_ADJUSTMENT(adj_min), 1.0, 0);
    gtk_widget_show(spin_min);

    spin_sec = gtk_spin_button_new(GTK_ADJUSTMENT(adj_sec), 1.0, 0);
    gtk_widget_show(spin_sec);

    spin_msec = gtk_spin_button_new(GTK_ADJUSTMENT(adj_msec), 1.0, 0);
    gtk_widget_show(spin_msec);
    
    scale = gtk_hscale_new_with_range(0.0, 100.0, 1.0);
    gtk_widget_show(scale);
    gtk_range_set_adjustment(GTK_RANGE(scale), GTK_ADJUSTMENT(adj_scale));
    gtk_range_set_update_policy(GTK_RANGE(scale), GTK_UPDATE_DELAYED);
    gtk_scale_set_draw_value(GTK_SCALE(scale), FALSE);

    gtk_box_pack_start(GTK_BOX(hbox), spin_min,  FALSE, TRUE, 2);
    gtk_box_pack_start(GTK_BOX(hbox), spin_sec,  FALSE, TRUE, 2);
    gtk_box_pack_start(GTK_BOX(hbox), spin_msec, FALSE, TRUE, 2);
    gtk_box_pack_start(GTK_BOX(vbox), scale,     FALSE, TRUE, 2);

    sbctx->spin_min  = GTK_SPIN_BUTTON(spin_min);
    sbctx->spin_sec  = GTK_SPIN_BUTTON(spin_sec);
    sbctx->spin_msec = GTK_SPIN_BUTTON(spin_msec);
    sbctx->scale     = GTK_SCALE(scale);
    sbctx->adj_min   = GTK_ADJUSTMENT(adj_min);
    sbctx->adj_sec   = GTK_ADJUSTMENT(adj_sec);
    sbctx->adj_msec  = GTK_ADJUSTMENT(adj_msec);
    sbctx->adj_scale = GTK_ADJUSTMENT(adj_scale);

    g_signal_connect(G_OBJECT(spin_msec), "value-changed", 
                     G_CALLBACK(cb_block_scale), sbctx);
    sbctx->hmsec = g_signal_connect(G_OBJECT(spin_msec), "value-changed", 
                     G_CALLBACK(cb_spin_msec), sbctx);
    g_signal_connect(G_OBJECT(spin_msec), "value-changed", 
                     G_CALLBACK(cb_unblock_scale), sbctx);

    g_signal_connect(G_OBJECT(spin_sec), "value-changed", 
                     G_CALLBACK(cb_block_scale), sbctx);
    sbctx->hsec = g_signal_connect(G_OBJECT(spin_sec), "value-changed", 
                     G_CALLBACK(cb_spin_sec), sbctx);
    g_signal_connect(G_OBJECT(spin_sec), "value-changed", 
                     G_CALLBACK(cb_unblock_scale), sbctx);

    g_signal_connect(G_OBJECT(spin_min), "value-changed", 
                     G_CALLBACK(cb_block_scale), sbctx);
    sbctx->hmin = g_signal_connect(G_OBJECT(spin_min), "value-changed", 
                     G_CALLBACK(cb_spin_min), sbctx);
    g_signal_connect(G_OBJECT(spin_min), "value-changed", 
                     G_CALLBACK(cb_unblock_scale), sbctx);

    g_signal_connect(G_OBJECT(scale), "value-changed", 
                     G_CALLBACK(cb_block_spinners), sbctx);
    sbctx->hscale = g_signal_connect(G_OBJECT(scale), "value-changed", 
                     G_CALLBACK(cb_scale), sbctx);
    g_signal_connect(G_OBJECT(scale), "value-changed", 
                     G_CALLBACK(cb_unblock_spinners), sbctx);
    return sbctx;
}
开发者ID:gusrc,项目名称:mpgedit,代码行数:87,代码来源:spinner2.c

示例13: create_threshold_dialog

GtkWidget*
create_threshold_dialog (void)
{
  GtkWidget *threshold_dialog;
  GtkWidget *dialogVbox;
  GtkWidget *allButButtonsVbox;
  GtkWidget *settingsOuterHbox;
  GtkWidget *settingsOuterVbox;
  GtkWidget *minValueVbox;
  GtkWidget *minValueLabel;
  GtkWidget *minValueHbox;
  GtkWidget *minValueSlider;
  GtkObject *minValueSpinner_adj;
  GtkWidget *minValueSpinner;
  GtkWidget *maxValueVbox;
  GtkWidget *maxValueLabel;
  GtkWidget *maxValueHbox;
  GtkWidget *maxValueSlider;
  GtkObject *maxValueSpinner_adj;
  GtkWidget *maxValueSpinner;
  GtkWidget *outputValuesHbox;
  GtkWidget *outputValuesLabel;
  GtkWidget *outputValuesMenu;
  GtkWidget *debugHbox;
  GtkWidget *debugLabel;
  GtkObject *debugSpinButton_adj;
  GtkWidget *debugSpinButton;
  GtkWidget *previewFrame;
  GtkWidget *previewAlignment;
  GtkWidget *previewVbox;
  GtkWidget *previewControlHbox;
  GtkWidget *previewOutputMenu;
  GtkWidget *previewSlider;
  GtkWidget *previewVideo;
  GtkWidget *previewLabel;
  GtkWidget *dialogButtonBox;
  GtkWidget *cancelButton;
  GtkWidget *okButton;

  threshold_dialog = gtk_dialog_new ();
  gtk_window_set_title (GTK_WINDOW (threshold_dialog), QT_TR_NOOP("Threshold"));
  gtk_window_set_type_hint (GTK_WINDOW (threshold_dialog), GDK_WINDOW_TYPE_HINT_DIALOG);

  dialogVbox = GTK_DIALOG (threshold_dialog)->vbox;
  gtk_widget_show (dialogVbox);

  allButButtonsVbox = gtk_vbox_new (FALSE, 12);
  gtk_widget_show (allButButtonsVbox);
  gtk_box_pack_start (GTK_BOX (dialogVbox), allButButtonsVbox, TRUE, TRUE, 0);

  settingsOuterHbox = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (settingsOuterHbox);
  gtk_box_pack_start (GTK_BOX (allButButtonsVbox), settingsOuterHbox, FALSE, TRUE, 0);

  settingsOuterVbox = gtk_vbox_new (FALSE, 12);
  gtk_widget_show (settingsOuterVbox);
  gtk_box_pack_start (GTK_BOX (settingsOuterHbox), settingsOuterVbox, TRUE, TRUE, 0);

  minValueVbox = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (minValueVbox);
  gtk_box_pack_start (GTK_BOX (settingsOuterVbox), minValueVbox, FALSE, FALSE, 0);

  minValueLabel = gtk_label_new (QT_TR_NOOP("Minimum value to be in-range:"));
  gtk_widget_show (minValueLabel);
  gtk_box_pack_start (GTK_BOX (minValueVbox), minValueLabel, FALSE, FALSE, 0);
  gtk_misc_set_alignment (GTK_MISC (minValueLabel), 0.5, 1);
  gtk_misc_set_padding (GTK_MISC (minValueLabel), 0, 8);

  minValueHbox = gtk_hbox_new (FALSE, 5);
  gtk_widget_show (minValueHbox);
  gtk_box_pack_start (GTK_BOX (minValueVbox), minValueHbox, TRUE, TRUE, 0);

#ifdef ORIGINAL_CODE_GENERATED_BY_GLADE
  minValueSlider = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, 255, 1, 1, 0)));
#else
  minValueSpinner_adj = gtk_adjustment_new (0, 0, 255, 1, 1, 0);
  minValueSlider = gtk_hscale_new (GTK_ADJUSTMENT (minValueSpinner_adj));
#endif
  gtk_widget_show (minValueSlider);
  gtk_box_pack_start (GTK_BOX (minValueHbox), minValueSlider, TRUE, TRUE, 0);
  gtk_scale_set_draw_value (GTK_SCALE (minValueSlider), FALSE);
  gtk_scale_set_value_pos (GTK_SCALE (minValueSlider), GTK_POS_LEFT);
  gtk_scale_set_digits (GTK_SCALE (minValueSlider), 0);

#ifdef ORIGINAL_CODE_GENERATED_BY_GLADE
  minValueSpinner_adj = gtk_adjustment_new (0, 0, 255, 1, 10, 10);
#endif
  minValueSpinner = gtk_spin_button_new (GTK_ADJUSTMENT (minValueSpinner_adj), 1, 0);
  gtk_widget_show (minValueSpinner);
  gtk_box_pack_start (GTK_BOX (minValueHbox), minValueSpinner, FALSE, TRUE, 0);

  maxValueVbox = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (maxValueVbox);
  gtk_box_pack_start (GTK_BOX (settingsOuterVbox), maxValueVbox, FALSE, FALSE, 0);

  maxValueLabel = gtk_label_new (QT_TR_NOOP("Maximum value to be in-range:"));
  gtk_widget_show (maxValueLabel);
  gtk_box_pack_start (GTK_BOX (maxValueVbox), maxValueLabel, FALSE, FALSE, 0);

  maxValueHbox = gtk_hbox_new (FALSE, 5);
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:avidemux-svn,代码行数:101,代码来源:DIA_threshold.cpp

示例14: gu_playdeck_add


//.........这里部分代码省略.........
                       PROP_TAG_CALLBACK_INT, gu_subscription_set_sensitivity,
                       pd->playpause,
                       PROP_TAG_COURIER, pc,
                       NULL);

    /* Next button */
    pd->next = ti = gtk_tool_button_new_from_stock(GTK_STOCK_MEDIA_NEXT);
    gtk_toolbar_insert(GTK_TOOLBAR(pd->tbar), ti, -1);
    g_signal_connect(G_OBJECT(ti), "clicked", G_CALLBACK(next_clicked), pd);

    pd->sub_canSkipForward =
        prop_subscribe(0,
                       PROP_TAG_NAME("global", "media", "current",
                                     "canSkipForward"),
                       PROP_TAG_CALLBACK_INT, gu_subscription_set_sensitivity,
                       pd->next,
                       PROP_TAG_COURIER, pc,
                       NULL);

    /* Separator */
    ti = gtk_separator_tool_item_new();
    gtk_toolbar_insert(GTK_TOOLBAR(pd->tbar), ti, -1);

    /* Subscribe to playstatus */
    pd->sub_playstatus =
        prop_subscribe(0,
                       PROP_TAG_NAME("global", "media", "current", "playstatus"),
                       PROP_TAG_CALLBACK, update_playstatus, pd,
                       PROP_TAG_COURIER, pc,
                       NULL);

    /**
     * Media position
     */
    pd->pos_adjust = gtk_adjustment_new(0, 0, 0, 0, 0, 0);

    pd->pos_slider = gtk_hscale_new(GTK_ADJUSTMENT(pd->pos_adjust));
    gtk_scale_set_value_pos (GTK_SCALE(pd->pos_slider), GTK_POS_LEFT);

    g_signal_connect(G_OBJECT(pd->pos_slider), "grab-focus",
                     G_CALLBACK(slider_grabbed), pd);

    g_signal_connect(G_OBJECT(pd->pos_slider), "change-value",
                     G_CALLBACK(slider_updated), pd);

    g_signal_connect(G_OBJECT(pd->pos_slider), "format-value",
                     G_CALLBACK(slider_value_callback), pd);

    ti = gtk_tool_item_new();
    gtk_tool_item_set_expand(ti, TRUE);
    gtk_container_add(GTK_CONTAINER(ti), pd->pos_slider);
    gtk_toolbar_insert(GTK_TOOLBAR(pd->tbar), ti, -1);

    /* Subscribe to current track position */
    pd->sub_pos =
        prop_subscribe(0,
                       PROP_TAG_NAME("global", "media", "current", "currenttime"),
                       PROP_TAG_CALLBACK_FLOAT, update_curtime, pd,
                       PROP_TAG_COURIER, pc,
                       NULL);

    /* Subscribe to current track duration */
    pd->sub_duration =
        prop_subscribe(0,
                       PROP_TAG_NAME("global", "media", "current",
                                     "metadata", "duration"),
                       PROP_TAG_CALLBACK_FLOAT, update_duration, pd,
                       PROP_TAG_COURIER, pc,
                       NULL);



    /* Separator */
    ti = gtk_separator_tool_item_new();
    gtk_toolbar_insert(GTK_TOOLBAR(pd->tbar), ti, -1);

    gtk_widget_show_all(vbox);

    /**
     * Volume control
     */
    ti = gtk_tool_item_new();
    pd->volume = gtk_volume_button_new();
    gtk_container_add(GTK_CONTAINER(ti), pd->volume);
    gtk_toolbar_insert(GTK_TOOLBAR(pd->tbar), ti, -1);

    g_signal_connect(G_OBJECT(pd->volume), "value-changed",
                     G_CALLBACK(read_mastervol), pd);

    pd->sub_volume =
        prop_subscribe(0,
                       PROP_TAG_NAME("global", "audio", "mastervolume"),
                       PROP_TAG_CALLBACK_FLOAT, update_mastervol, pd,
                       PROP_TAG_COURIER, pc,
                       NULL);
    gtk_widget_show_all(GTK_WIDGET(ti));

    g_signal_connect(playdeck, "destroy", G_CALLBACK(playdeck_dtor), pd);
    return playdeck;
}
开发者ID:copernic-us,项目名称:showtime-1,代码行数:101,代码来源:gu_playdeck.c

示例15: main

int main (int argc, char *argv[])
{
    GtkWidget *window;
    GtkWidget *box;
    GtkWidget *box1;
    GtkWidget *box2;
    GtkWidget *button;
    GtkWidget *frame;
    GtkWidget *scale;
    const gchar *labels[3] = {
        "<small>Left</small>",
        "<small>Middle</small>",
        "<small>Right</small>"
    };

    gdouble bath_marks[4] = { 0.0, 33.3, 66.6, 100.0 };
    const gchar *bath_labels[4] = {
        "<span color='blue' size='small'>Cold</span>",
        "<span size='small'>Baby bath</span>",
        "<span size='small'>Hot tub</span>",
        "<span color='Red' size='small'>Hot</span>"
    };

    gdouble pos_marks[4] = { 0.0, 33.3, 66.6, 100.0 };
    const gchar *pos_labels[4] = { "Left", "Right", "Top", "Bottom" };

    gtk_init (&argc, &argv);

    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    gtk_window_set_title (GTK_WINDOW (window), "Ranges with marks");
    box1 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
    flipbox = box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
    gtk_widget_set_hexpand (flipbox, TRUE);
    gtk_widget_set_vexpand (flipbox, TRUE);
    gtk_container_add (GTK_CONTAINER (box1), box);
    gtk_container_add (GTK_CONTAINER (window), box1);

    frame = gtk_frame_new ("No marks");
    scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, 0, 100, 1);
    scales = g_slist_prepend (scales, scale);
    gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
    gtk_container_add (GTK_CONTAINER (frame), scale);
    gtk_box_pack_start (GTK_BOX (box), frame, FALSE, FALSE, 0);

    frame = gtk_frame_new ("With fill level");
    scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, 0, 100, 1);
    scales = g_slist_prepend (scales, scale);
    gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
    gtk_range_set_show_fill_level (GTK_RANGE (scale), TRUE);
    gtk_range_set_fill_level (GTK_RANGE (scale), 50);
    gtk_container_add (GTK_CONTAINER (frame), scale);
    gtk_box_pack_start (GTK_BOX (box), frame, FALSE, FALSE, 0);

    frame = gtk_frame_new ("Simple marks");
    extra_scale = scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, 0, 100, 1);
    scales = g_slist_prepend (scales, scale);
    gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
    gtk_scale_add_mark (GTK_SCALE (scale), marks[0], GTK_POS_BOTTOM, NULL);
    gtk_scale_add_mark (GTK_SCALE (scale), marks[1], GTK_POS_BOTTOM, NULL);
    gtk_scale_add_mark (GTK_SCALE (scale), marks[2], GTK_POS_BOTTOM, NULL);
    gtk_container_add (GTK_CONTAINER (frame), scale);
    gtk_box_pack_start (GTK_BOX (box), frame, FALSE, FALSE, 0);

    frame = gtk_frame_new ("Simple marks up");
    scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, 0, 100, 1);
    scales = g_slist_prepend (scales, scale);
    gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
    gtk_scale_add_mark (GTK_SCALE (scale), marks[0], GTK_POS_TOP, NULL);
    gtk_scale_add_mark (GTK_SCALE (scale), marks[1], GTK_POS_TOP, NULL);
    gtk_scale_add_mark (GTK_SCALE (scale), marks[2], GTK_POS_TOP, NULL);
    gtk_container_add (GTK_CONTAINER (frame), scale);
    gtk_box_pack_start (GTK_BOX (box), frame, FALSE, FALSE, 0);

    frame = gtk_frame_new ("Labeled marks");
    box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);

    scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, 0, 100, 1);
    scales = g_slist_prepend (scales, scale);
    gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
    gtk_scale_add_mark (GTK_SCALE (scale), marks[0], GTK_POS_BOTTOM, labels[0]);
    gtk_scale_add_mark (GTK_SCALE (scale), marks[1], GTK_POS_BOTTOM, labels[1]);
    gtk_scale_add_mark (GTK_SCALE (scale), marks[2], GTK_POS_BOTTOM, labels[2]);
    gtk_container_add (GTK_CONTAINER (frame), scale);
    gtk_box_pack_start (GTK_BOX (box), frame, FALSE, FALSE, 0);

    frame = gtk_frame_new ("Some labels");
    scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, 0, 100, 1);
    scales = g_slist_prepend (scales, scale);
    gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
    gtk_scale_add_mark (GTK_SCALE (scale), marks[0], GTK_POS_TOP, labels[0]);
    gtk_scale_add_mark (GTK_SCALE (scale), marks[1], GTK_POS_TOP, NULL);
    gtk_scale_add_mark (GTK_SCALE (scale), marks[2], GTK_POS_TOP, labels[2]);
    gtk_container_add (GTK_CONTAINER (frame), scale);
    gtk_box_pack_start (GTK_BOX (box), frame, FALSE, FALSE, 0);

    frame = gtk_frame_new ("Above and below");
    scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, 0, 100, 1);
    scales = g_slist_prepend (scales, scale);
    gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
    gtk_scale_add_mark (GTK_SCALE (scale), bath_marks[0], GTK_POS_TOP, bath_labels[0]);
//.........这里部分代码省略.........
开发者ID:jigpu,项目名称:gtk,代码行数:101,代码来源:testscale.c


注:本文中的GTK_SCALE函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。