예제 #1
0
static GObject * dock_manager_preferences_bin_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
	GObject * obj;
	GObjectClass * parent_class;
	DockManagerPreferencesBin * self;
	GtkHBox* _tmp0_ = NULL;
	GtkHBox* hbox;
	GtkComboBox* _tmp1_ = NULL;
	DockManagerSearchEntry* _tmp2_ = NULL;
	GtkScrolledWindow* _tmp4_ = NULL;
	DockManagerTileView* _tmp5_ = NULL;
	parent_class = G_OBJECT_CLASS (dock_manager_preferences_bin_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = DOCK_MANAGER_PREFERENCES_BIN (obj);
	__g_list_free__dock_manager_helper_info_free0_0 (self->priv->all_helpers);
	self->priv->all_helpers = NULL;
	_tmp0_ = (GtkHBox*) gtk_hbox_new (FALSE, 6);
	hbox = g_object_ref_sink (_tmp0_);
	_tmp1_ = (GtkComboBox*) gtk_combo_box_new_text ();
	_g_object_unref0 (self->priv->combobox);
	self->priv->combobox = g_object_ref_sink (_tmp1_);
	gtk_combo_box_append_text (self->priv->combobox, "Usable");
	gtk_combo_box_append_text (self->priv->combobox, "Enabled");
	gtk_combo_box_append_text (self->priv->combobox, "Disabled");
	gtk_combo_box_append_text (self->priv->combobox, "All");
	gtk_combo_box_set_active (self->priv->combobox, 0);
	g_signal_connect_object (self->priv->combobox, "changed", (GCallback) _dock_manager_preferences_bin_update_helpers_gtk_combo_box_changed, self, 0);
	gtk_box_pack_start ((GtkBox*) hbox, (GtkWidget*) self->priv->combobox, FALSE, TRUE, (guint) 0);
	gtk_box_pack_start ((GtkBox*) self, (GtkWidget*) hbox, FALSE, TRUE, (guint) 0);
	_tmp2_ = dock_manager_search_entry_new ();
	_g_object_unref0 (self->priv->search_entry);
	self->priv->search_entry = g_object_ref_sink (_tmp2_);
	dock_manager_search_entry_set_search_timeout (self->priv->search_entry, 100);
	g_signal_connect_object (self->priv->search_entry, "search", (GCallback) __lambda5__dock_manager_search_entry_search, self, 0);
	g_signal_connect_object (self->priv->search_entry, "clear", (GCallback) __lambda6__dock_manager_search_entry_clear, self, 0);
	gtk_box_pack_start ((GtkBox*) hbox, (GtkWidget*) self->priv->search_entry, TRUE, TRUE, (guint) 0);
	if (dock_manager_NO_INSTALL == FALSE) {
		GtkButton* _tmp3_ = NULL;
		GtkButton* button;
		_tmp3_ = (GtkButton*) gtk_button_new_with_label ("Install");
		button = g_object_ref_sink (_tmp3_);
		gtk_widget_set_sensitive ((GtkWidget*) button, FALSE);
		gtk_box_pack_start ((GtkBox*) hbox, (GtkWidget*) button, FALSE, TRUE, (guint) 0);
		_g_object_unref0 (button);
	}
	gtk_widget_show_all ((GtkWidget*) hbox);
	_tmp4_ = (GtkScrolledWindow*) gtk_scrolled_window_new (NULL, NULL);
	_g_object_unref0 (self->priv->scroll);
	self->priv->scroll = g_object_ref_sink (_tmp4_);
	gtk_scrolled_window_set_policy (self->priv->scroll, GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
	_tmp5_ = dock_manager_tile_view_new ();
	_g_object_unref0 (self->priv->tile_view);
	self->priv->tile_view = g_object_ref_sink (_tmp5_);
	gtk_widget_show ((GtkWidget*) self->priv->tile_view);
	gtk_scrolled_window_add_with_viewport (self->priv->scroll, (GtkWidget*) self->priv->tile_view);
	gtk_widget_show ((GtkWidget*) self->priv->scroll);
	gtk_box_pack_start ((GtkBox*) self, (GtkWidget*) self->priv->scroll, TRUE, TRUE, (guint) 0);
	dock_manager_preferences_bin_run (self);
	_g_object_unref0 (hbox);
	return obj;
}
예제 #2
0
파일: dialog.cpp 프로젝트: chrisglass/ufoai
void Dialog::addCombo (GtkWidget* vbox, const std::string& name, const std::string& registryKey,
		const ComboBoxValueList& valueList)
{
	GtkWidget* alignment = gtk_alignment_new(0.0, 0.5, 0.0, 0.0);
	gtk_widget_show(alignment);

	{
		// Create a new combo box
		GtkWidget* combo = gtk_combo_box_new_text();

		// Add all the string values to the combo box
		for (ComboBoxValueList::const_iterator i = valueList.begin(); i != valueList.end(); i++) {
			// Add the current string value to the combo box
			gtk_combo_box_append_text(GTK_COMBO_BOX(combo), i->c_str());
		}

		// Connect the registry key to the newly created combo box
		_registryConnector.connectGtkObject(GTK_OBJECT(combo), registryKey);

		// Add it to the container and make it visible
		gtk_widget_show(combo);
		gtk_container_add(GTK_CONTAINER(alignment), combo);
	}

	// Add the widget to the dialog row
	GtkTable* row = DialogRow_new(name, alignment);
	DialogVBox_packRow(GTK_VBOX(vbox), GTK_WIDGET(row));
}
예제 #3
0
void KeyOptionView::_createItem() {
	myKeyEntry = GTK_ENTRY(gtk_entry_new());
	gtk_signal_connect(GTK_OBJECT(myKeyEntry), "focus_in_event", G_CALLBACK(key_view_focus_in_event), 0);
	gtk_signal_connect(GTK_OBJECT(myKeyEntry), "focus_out_event", G_CALLBACK(key_view_focus_out_event), 0);
	gtk_signal_connect(GTK_OBJECT(myKeyEntry), "key_press_event", G_CALLBACK(key_view_key_press_event), this);
	key_view_focus_out_event(GTK_WIDGET(myKeyEntry), 0, 0);

	myLabel = GTK_LABEL(gtkLabel(ZLResource::resource("keyOptionView")["actionFor"].value()));

	myComboBox = GTK_COMBO_BOX(gtk_combo_box_new_text());
	const std::vector<std::string> &actions = ((ZLKeyOptionEntry&)*myOption).actionNames();
	for (std::vector<std::string>::const_iterator it = actions.begin(); it != actions.end(); ++it) {
		gtk_combo_box_append_text(myComboBox, it->c_str());
	}

	myTable = GTK_TABLE(gtk_table_new(2, 2, false));
	gtk_table_set_col_spacings(myTable, 5);
	gtk_table_set_row_spacings(myTable, 5);
	gtk_table_attach_defaults(myTable, GTK_WIDGET(myLabel), 0, 1, 0, 1);
	gtk_table_attach_defaults(myTable, GTK_WIDGET(myKeyEntry), 1, 2, 0, 1);
	gtk_table_attach_defaults(myTable, GTK_WIDGET(myComboBox), 0, 2, 1, 2);
	g_signal_connect(GTK_WIDGET(myComboBox), "changed", G_CALLBACK(_onValueChanged), this);

	myTab->addItem(GTK_WIDGET(myTable), myRow, myFromColumn, myToColumn);
}
예제 #4
0
static WIDGET *
enumprop_get_widget(EnumProperty *prop, PropDialog *dialog) 
{ 
  GtkWidget *ret;

  if (prop->common.descr->extra_data) {
    PropEnumData *enumdata = prop->common.descr->extra_data;
    guint i;

#if GTK_CHECK_VERSION(2,24,0)
    ret = gtk_combo_box_text_new ();
#else
    ret = gtk_combo_box_new_text ();
#endif
    for (i = 0; enumdata[i].name != NULL; i++)
#if GTK_CHECK_VERSION(2,24,0)
      gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (ret), _(enumdata[i].name)); 
#else
      gtk_combo_box_append_text (GTK_COMBO_BOX (ret), _(enumdata[i].name)); 
#endif
    prophandler_connect(&prop->common, G_OBJECT (ret), "changed");
  } else {
    ret = gtk_entry_new(); /* should use spin button/option menu */
  }  
  return ret;
}
예제 #5
0
static void yui_resolution_init(YuiResolution * yr) {
	GtkWidget * label_w;
	GtkWidget * label_h;

	gtk_container_set_border_width (GTK_CONTAINER (yr), 10);

	label_w = gtk_label_new ("Width");
	gtk_box_pack_start(GTK_BOX(yr), label_w, TRUE, TRUE, 0);

	yr->entry_w = gtk_entry_new ();
	gtk_entry_set_width_chars(GTK_ENTRY(yr->entry_w), 8);
	gtk_box_pack_start(GTK_BOX(yr), yr->entry_w, TRUE, TRUE, 0);

	label_h = gtk_label_new ("Height");
	gtk_box_pack_start(GTK_BOX(yr), label_h, TRUE, TRUE, 0);

	yr->entry_h = gtk_entry_new ();
	gtk_entry_set_width_chars(GTK_ENTRY(yr->entry_h), 8);
	gtk_box_pack_start(GTK_BOX(yr), yr->entry_h, TRUE, TRUE, 0);

	yr->options = gtk_combo_box_new_text();
	gtk_combo_box_append_text(GTK_COMBO_BOX(yr->options), "Window");
	gtk_combo_box_append_text(GTK_COMBO_BOX(yr->options), "Fullscreen");
	gtk_combo_box_append_text(GTK_COMBO_BOX(yr->options), "Keep ratio");
	gtk_box_pack_start(GTK_BOX(yr), yr->options, TRUE, TRUE, 0);

	g_signal_connect(yr->entry_w, "changed", G_CALLBACK(yui_resolution_width_changed), yr);
	g_signal_connect(yr->entry_h, "changed", G_CALLBACK(yui_resolution_height_changed), yr);
	g_signal_connect(yr->options, "changed", G_CALLBACK(yui_resolution_options_changed), yr);
}
예제 #6
0
파일: gconf.c 프로젝트: g7/fbpanel
GtkWidget *
gconf_edit_enum(gconf_block *b, xconf *xc, xconf_enum *e)
{
    gint i = 0;
    GtkWidget *w;

    xconf_get_enum(xc, &i, e);
    xconf_set_enum(xc, i, e);
    w = gtk_combo_box_new_text();
    g_object_set_data(G_OBJECT(w), "enum", e);
    while (e && e->str)
    {
        gtk_combo_box_insert_text(GTK_COMBO_BOX(w), e->num,
            e->desc ? _(e->desc) : _(e->str));
        e++;
    }
    gtk_combo_box_set_active(GTK_COMBO_BOX(w), i);
    g_signal_connect(G_OBJECT(w), "changed",
        G_CALLBACK(gconf_edit_enum_cb), xc);
    if (b && b->cb)
    {
        g_signal_connect_swapped(G_OBJECT(w), "changed",
            G_CALLBACK(b->cb), b);
    }

    return w;
}
예제 #7
0
파일: filedlg.c 프로젝트: AmiGanguli/dia
/**
 * Create a new "option menu" for the export options
 */
static GtkWidget *
create_export_menu(void)
{
  GtkWidget *menu;
  GList *tmp;

#if GTK_CHECK_VERSION(2,24,0)
  menu = gtk_combo_box_text_new ();
#else
  menu = gtk_combo_box_new_text ();
#endif
#if GTK_CHECK_VERSION(2,24,0)
  gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(menu), _("By extension"));
#else
  gtk_combo_box_append_text(GTK_COMBO_BOX(menu), _("By extension"));
#endif
  
  for (tmp = filter_get_export_filters(); tmp != NULL; tmp = tmp->next) {
    DiaExportFilter *ef = tmp->data;
    gchar *filter_label;

    if (!ef)
      continue;
    filter_label = filter_get_export_filter_label(ef);
#if GTK_CHECK_VERSION(2,24,0)
    gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(menu), filter_label);
#else
    gtk_combo_box_append_text (GTK_COMBO_BOX(menu), filter_label);
#endif
    g_free(filter_label);
  }
  g_signal_connect(G_OBJECT(menu), "changed",
	           G_CALLBACK(export_adapt_extension_callback), NULL);
  return menu;
}
/**
 * create the page 3 of the assistant
 * this page permit to choose a name for the archive
 * and choose the format to export
 *
 * \param assistant the GtkWidget assistant
 *
 * \return a GtkWidget containing the page
 * */
static GtkWidget *gsb_assistant_archive_export_page_name ( GtkWidget *assistant )
{
    GtkWidget * vbox, * hbox;

    vbox = gtk_vbox_new ( FALSE, 6 );
    gtk_container_set_border_width ( GTK_CONTAINER(vbox), 12 );

    archive_export_label = gtk_label_new ( NULL );
    gtk_misc_set_alignment ( GTK_MISC ( archive_export_label ), 0, 0.5);
    gtk_label_set_justify ( GTK_LABEL ( archive_export_label ), GTK_JUSTIFY_LEFT );
    gtk_box_pack_start ( GTK_BOX ( vbox ), archive_export_label, FALSE, FALSE, 0 );

    /* Layout */
    hbox = gtk_hbox_new ( FALSE, 6 );
    gtk_box_pack_start ( GTK_BOX ( hbox ),
			 gtk_label_new ( _("Export format: ") ),
			 FALSE, FALSE, 0 );

    /* Combo box */
    archive_export_combobox = gtk_combo_box_new_text();
    gtk_combo_box_append_text ( GTK_COMBO_BOX(archive_export_combobox), _("Grisbi (GSB) format" ) );
    gtk_combo_box_append_text ( GTK_COMBO_BOX(archive_export_combobox), _("QIF format" ) );
    gtk_combo_box_append_text ( GTK_COMBO_BOX(archive_export_combobox), _("CSV format" ) );
    gtk_box_pack_start ( GTK_BOX ( hbox ), archive_export_combobox, TRUE, TRUE, 0 );

    archive_export_filechooser = gtk_file_chooser_widget_new ( GTK_FILE_CHOOSER_ACTION_SAVE );
    gtk_file_chooser_set_extra_widget ( GTK_FILE_CHOOSER(archive_export_filechooser), hbox );
    gtk_box_pack_start ( GTK_BOX ( vbox ), archive_export_filechooser, TRUE, TRUE, 0 );

    gtk_combo_box_set_active ( GTK_COMBO_BOX(archive_export_combobox), 0 );

    return vbox;
}
예제 #9
0
static GtkWidget *create_auto_select_by_phrase_opts(GtkWidget **out, int val)
{
  *out = gtk_combo_box_new_text ();
#if !GTK_CHECK_VERSION(2,4,0)
  GtkWidget *menu_auto_select_by_phrase = gtk_menu_new ();
#endif

  int i, current_idx=0;

  for(i=0; auto_select_by_phrase_opts[i].str; i++) {
#if !GTK_CHECK_VERSION(2,4,0)
    GtkWidget *item = gtk_menu_item_new_with_label (_(auto_select_by_phrase_opts[i].str));
#endif

    if (auto_select_by_phrase_opts[i].num == val)
      current_idx = i;

#if GTK_CHECK_VERSION(2,4,0)
    gtk_combo_box_append_text (GTK_COMBO_BOX_TEXT (*out), _(auto_select_by_phrase_opts[i].str));
#else
    gtk_menu_shell_append (GTK_MENU_SHELL (menu_auto_select_by_phrase), item);
#endif
  }

#if !GTK_CHECK_VERSION(2,4,0)
  gtk_option_menu_set_menu (GTK_OPTION_MENU (*out), menu_auto_select_by_phrase);
#endif
  gtk_combo_box_set_active (GTK_COMBO_BOX (*out), current_idx);

  return *out;
}
예제 #10
0
/* TODO - when ready - will replace the old gui_pulldown_new() function */
gpointer gui_pd_new(GSList *list, gint active, gpointer callback, gpointer argument)
{
GSList *item;
GtkTreeModel *treemodel;
GtkTreePath *treepath;
GtkTreeIter iter;
GtkWidget *w = NULL;

#if GTK_MAJOR_VERSION >= 2 && GTK_MINOR_VERSION >= 4
/* build the widget and associated drop down list */
w = gtk_combo_box_new_text();
for (item=list ; item ; item=g_slist_next(item))
  gtk_combo_box_append_text(GTK_COMBO_BOX(w), item->data);

/* set the currently active item */
treemodel = gtk_combo_box_get_model(GTK_COMBO_BOX(w));
treepath = gtk_tree_path_new_from_indices(active, -1);
gtk_tree_model_get_iter(treemodel, &iter, treepath);
gtk_combo_box_set_active_iter(GTK_COMBO_BOX(w), &iter);

/* attach callback (if any) */
if (callback)
  g_signal_connect(GTK_OBJECT(w), "changed", GTK_SIGNAL_FUNC(callback), argument);
#endif

return(w);
}
예제 #11
0
파일: zseq-gui.c 프로젝트: wareya/gzrt
/* Create window */
static void
create_window ( void )
{
    window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
    vbox = gtk_vbox_new( FALSE, 8 );
    hbox1 = gtk_hbox_new( TRUE, 8 );
    open_seq = gtk_button_new_with_label( "Open seq file" );
    open_rom = gtk_button_new_with_label( "Open ROM file" );
    go = gtk_button_new_with_label( "Go!" );
    hbox2 = gtk_hbox_new( FALSE, 8 );
    combo = gtk_combo_box_new_text( );
    check = gtk_check_button_new_with_label( "Replace all sequences" );
    
    gtk_container_add( GTK_CONTAINER(window), vbox );
    gtk_box_pack_start( GTK_BOX(vbox), hbox1, TRUE, TRUE, 0 );
    gtk_box_pack_start( GTK_BOX(vbox), hbox2, TRUE, TRUE, 0 );
    gtk_box_pack_start( GTK_BOX(hbox1), open_seq, FALSE, TRUE, 0 );
    gtk_box_pack_start( GTK_BOX(hbox1), open_rom, FALSE, TRUE, 0 );
    gtk_box_pack_start( GTK_BOX(hbox1), go, FALSE, TRUE, 0 );
    gtk_box_pack_start( GTK_BOX(hbox2), combo, TRUE, TRUE, 0 );
    gtk_box_pack_start( GTK_BOX(hbox2), check, FALSE, TRUE, 0 );
    
    gtk_container_set_border_width( GTK_CONTAINER(window), 8 );
    gtk_window_set_title( GTK_WINDOW(window), "ZSEQ" );
    
    gtk_widget_show_all( window );
    
    g_signal_connect( G_OBJECT(go), "clicked", G_CALLBACK(run), NULL );
    g_signal_connect( G_OBJECT(open_seq), "clicked", G_CALLBACK(load_seq), NULL );
    g_signal_connect( G_OBJECT(open_rom), "clicked", G_CALLBACK(load_rom), NULL );
    g_signal_connect( G_OBJECT(check), "toggled", G_CALLBACK(check_handler), NULL );
    g_signal_connect_swapped( G_OBJECT(window), "destroy", G_CALLBACK(exit), (void*)-1 );
}
예제 #12
0
/*
 * Create the combo with the color styles
 * --------------------------------------
 */
static void
display_color_style_selector(GooCanvasItem *boardRootItem, double y)
{
  int i = 0;

  gtk_combo_colors = gtk_combo_box_new_text();

  while (i < NUMBER_OF_COLOR_STYLE)
    gtk_combo_box_append_text(GTK_COMBO_BOX(gtk_combo_colors),
			      gettext(color_style_list[i++][0]));

  goo_canvas_widget_new (boardRootItem,
			 GTK_WIDGET(gtk_combo_colors),
			 combo_style_x1,
			 y,
			 combo_style_width,
			 35.0,
			 "anchor", GTK_ANCHOR_NW,
			 NULL);

  gtk_widget_show(GTK_WIDGET(gtk_combo_colors));
  gtk_combo_box_set_active(GTK_COMBO_BOX(gtk_combo_colors), 0);

  g_signal_connect(G_OBJECT(gtk_combo_colors),
		   "changed",
		   G_CALLBACK(item_event_color_style_selection),
		   NULL);
}
예제 #13
0
파일: window.c 프로젝트: risujin/cellwriter
static GtkWidget *create_blocks_combo(void)
{
        GtkWidget *event_box;
        UnicodeBlock *block;

        if (blocks_combo)
                gtk_widget_destroy(blocks_combo);
        blocks_combo = gtk_combo_box_new_text();
        block = unicode_blocks;
        while (block->name) {
                if (block->enabled)
                        gtk_combo_box_append_text(GTK_COMBO_BOX(blocks_combo),
                                                  block->name);
                block++;
        }
        gtk_combo_box_set_active(GTK_COMBO_BOX(blocks_combo),
                                 block_unicode_to_combo(training_block));
        gtk_combo_box_set_focus_on_click(GTK_COMBO_BOX(blocks_combo), FALSE);
        g_signal_connect(G_OBJECT(blocks_combo), "changed",
                         G_CALLBACK(blocks_combo_changed), NULL);

        /* Wrap ComboBox in an EventBox for tooltips */
        event_box = gtk_event_box_new();
        gtk_tooltips_set_tip(tooltips, event_box,
                             "Select Unicode block to train", NULL);
        gtk_container_add(GTK_CONTAINER(event_box), blocks_combo);

        return event_box;
}
예제 #14
0
bool wxChoice::Create( wxWindow *parent, wxWindowID id,
                       const wxPoint &pos, const wxSize &size,
                       int n, const wxString choices[],
                       long style, const wxValidator& validator,
                       const wxString &name )
{
    if (!PreCreation( parent, pos, size ) ||
            !CreateBase( parent, id, pos, size, style, validator, name ))
    {
        wxFAIL_MSG( wxT("wxChoice creation failed") );
        return false;
    }

    if ( IsSorted() )
    {
        // if our m_strings != NULL, Append() will check for it and insert
        // items in the correct order
        m_strings = new wxSortedArrayString;
    }

    m_widget = gtk_combo_box_new_text();
    g_object_ref(m_widget);

    Append(n, choices);

    m_parent->DoAddChild( this );

    PostCreation(size);

    g_signal_connect_after (m_widget, "changed",
                            G_CALLBACK (gtk_choice_changed_callback), this);

    return true;
}
예제 #15
0
static void nsgtk_options_theme_combo(void) {
/* populate theme combo from themelist file */
	GtkBox *box = GTK_BOX(glade_xml_get_widget(gladeFile, "themehbox"));
	char buf[50];
	combotheme = gtk_combo_box_new_text();
	size_t len = SLEN("themelist") + strlen(res_dir_location) + 1;
	char themefile[len];
	if ((combotheme == NULL) || (box == NULL)) {
		warn_user(messages_get("NoMemory"), 0);
		return;
	}
	snprintf(themefile, len, "%sthemelist", res_dir_location);
	FILE *fp = fopen((const char *)themefile, "r");
	if (fp == NULL) {
		LOG(("Failed opening themes file"));
		warn_user("FileError", (const char *) themefile);
		return;
	}
	while (fgets(buf, sizeof(buf), fp) != NULL) {
		/* Ignore blank lines */
		if (buf[0] == '\0')
			continue;
		
		/* Remove trailing \n */
		buf[strlen(buf) - 1] = '\0';
		
		gtk_combo_box_append_text(GTK_COMBO_BOX(combotheme), buf);
	}
	fclose(fp);
	gtk_combo_box_set_active(GTK_COMBO_BOX(combotheme), 
			option_current_theme);
	gtk_box_pack_start(box, combotheme, FALSE, TRUE, 0);
	gtk_widget_show(combotheme);		
}
예제 #16
0
GtkWidget* bimp_changeformat_gui_new(changeformat_settings settings, GtkWidget* parent)
{
    GtkWidget *gui;
    
    parentwin = parent;
    gui = gtk_vbox_new(FALSE, 5);
    
    combo_format = gtk_combo_box_new_text();
    gtk_widget_set_size_request (combo_format, COMBO_FORMAT_W, COMBO_H);
    int i;
    for(i = 0; i < FORMAT_END; i++) {
        gtk_combo_box_append_text(GTK_COMBO_BOX(combo_format), format_type_string[i][1]);
    }
    gtk_combo_box_set_active(GTK_COMBO_BOX(combo_format), settings->format);
    
    frame_params = gtk_frame_new(_("Format settings"));
    gtk_widget_set_size_request (frame_params, FRAME_PARAMS_W, FRAME_PARAMS_H);
    
    gtk_box_pack_start(GTK_BOX(gui), combo_format, FALSE, FALSE, 0);
    gtk_box_pack_start(GTK_BOX(gui), frame_params, FALSE, FALSE, 0);
    
    update_frame_params(GTK_COMBO_BOX(combo_format), settings);    
    
    g_signal_connect(G_OBJECT(combo_format), "changed", G_CALLBACK(update_frame_params), settings);
    
    return gui;
}
예제 #17
0
파일: entry.c 프로젝트: kroody/codesnippet
int main (int argc, char *argv[])
{
    GtkWidget       *window = NULL;
    GtkWidget       *combo = NULL;
   
    gtk_init (&argc, &argv);

    /* setup GtkWindow */
    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    gtk_widget_set_size_request (window, 150, 30);
    g_signal_connect (G_OBJECT (window), "destroy",
            G_CALLBACK (destroy), NULL);
 
    /* setup a test GtkComboBox */
    combo = gtk_combo_box_new_text ();
    gtk_combo_box_append_text (GTK_COMBO_BOX(combo), "test 1");
    gtk_combo_box_append_text (GTK_COMBO_BOX(combo), "test 2");
    g_signal_connect (G_OBJECT (combo), "key-press-event",
            G_CALLBACK (on_combo_key_press), NULL);
               
    gtk_container_add (GTK_CONTAINER (window), combo);
 
    /* show window */
    gtk_widget_show_all (window);
    gtk_main ();
   
    return 0;
}
예제 #18
0
static GtkWidget *create_int_opts()
{

  GtkWidget *hbox = gtk_hbox_new (FALSE, 1);

  opt_int_opts = gtk_combo_box_new_text ();
#if !GTK_CHECK_VERSION(2,4,0)
  GtkWidget *menu_int_opts = gtk_menu_new ();
#endif
  gtk_box_pack_start (GTK_BOX (hbox), opt_int_opts, FALSE, FALSE, 0);

  int i;
  for(i=0; i < int_selN; i++) {
#if GTK_CHECK_VERSION(2,4,0)
    gtk_combo_box_append_text (GTK_COMBO_BOX_TEXT (opt_int_opts), int_sel[i].name);
#else
    GtkWidget *item = gtk_menu_item_new_with_label (int_sel[i].name);
    gtk_menu_shell_append (GTK_MENU_SHELL (menu_int_opts), item);
#endif
  }

#if !GTK_CHECK_VERSION(2,4,0)
  gtk_option_menu_set_menu (GTK_OPTION_MENU (opt_int_opts), menu_int_opts);
#endif
  gtk_combo_box_set_active (GTK_COMBO_BOX (opt_int_opts), current_intcode);
  g_signal_connect (G_OBJECT (opt_int_opts), "changed", G_CALLBACK (cb_select), NULL);

  return hbox;
}
예제 #19
0
static GtkWidget *create_eng_ch_opts()
{

  GtkWidget *hbox = gtk_hbox_new (FALSE, 1);

  opt_eng_ch_opts = gtk_combo_box_new_text ();
#if !GTK_CHECK_VERSION(2,4,0)
  GtkWidget *menu_eng_ch_opts = gtk_menu_new ();
#endif
  gtk_box_pack_start (GTK_BOX (hbox), opt_eng_ch_opts, FALSE, FALSE, 0);

  int i;
  int current_idx = get_currnet_eng_ch_sw_idx();

  for(i=0; i < tsin_eng_ch_swN; i++) {
#if GTK_CHECK_VERSION(2,4,0)
    gtk_combo_box_append_text (GTK_COMBO_BOX_TEXT (opt_eng_ch_opts), _(tsin_eng_ch_sw[i].name));
#else
    GtkWidget *item = gtk_menu_item_new_with_label (_(tsin_eng_ch_sw[i].name));
    gtk_menu_shell_append (GTK_MENU_SHELL (menu_eng_ch_opts), item);
#endif
  }

  dbg("current_idx:%d\n", current_idx);

#if !GTK_CHECK_VERSION(2,4,0)
  gtk_option_menu_set_menu (GTK_OPTION_MENU (opt_eng_ch_opts), menu_eng_ch_opts);
#endif
  gtk_combo_box_set_active (GTK_COMBO_BOX (opt_eng_ch_opts), current_idx);

  return hbox;
}
예제 #20
0
gint
panel_dialogs_choose_panel (PanelApplication *application)
{
  GtkWidget *dialog;
  GtkWidget *vbox;
  GtkWidget *label;
  GtkWidget *combo;
  guint      i;
  gint       response = -1;
  gchar     *name;

  panel_return_val_if_fail (PANEL_IS_APPLICATION (application), -1);

  /* setup the dialog */
  dialog = gtk_dialog_new_with_buttons (_("Add New Item"), NULL,
                                        GTK_DIALOG_NO_SEPARATOR,
                                        GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
                                        GTK_STOCK_ADD, GTK_RESPONSE_OK, NULL);
  gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
  gtk_window_set_icon_name (GTK_WINDOW (dialog), GTK_STOCK_ADD);
  gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);

  /* create widgets */
  vbox = gtk_vbox_new (FALSE, 6);
  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), vbox, FALSE, FALSE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
  gtk_widget_show (vbox);

  label = gtk_label_new (_("Please choose a panel for the new plugin:"));
  gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
  gtk_widget_show (label);

  combo = gtk_combo_box_new_text ();
  gtk_box_pack_start (GTK_BOX (vbox), combo, FALSE, FALSE, 0);
  gtk_widget_show (combo);

  /* insert the panels */
  for (i = 0; i < panel_application_get_n_windows (application); i++)
    {
      name = g_strdup_printf (_("Panel %d"), i + 1);
      gtk_combo_box_append_text (GTK_COMBO_BOX (combo), name);
      g_free (name);
    }

  /* select first panel (changed will start marching ants) */
  g_signal_connect (G_OBJECT (combo), "changed",
       G_CALLBACK (panel_dialogs_choose_panel_combo_changed), application);
  gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0);

  /* run the dialog */
  if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK)
    response = gtk_combo_box_get_active (GTK_COMBO_BOX (combo));
  gtk_widget_destroy (dialog);

  /* unset panel selections */
  panel_application_window_select (application, NULL);

  return response;
}
예제 #21
0
파일: toolbar.c 프로젝트: gsmcmullin/sigrok
GtkWidget *toolbar_init(GtkWindow *parent)
{
	GtkWidget *vbox = gtk_vbox_new(FALSE, 0);
	GtkToolbar *toolbar;
	GtkActionGroup *ag = gtk_action_group_new("Actions");
	gtk_action_group_add_actions(ag, action_items,
					G_N_ELEMENTS(action_items), parent);
	gtk_action_group_add_toggle_actions(ag, toggle_items,
					G_N_ELEMENTS(toggle_items), parent);

	GtkUIManager *ui = gtk_ui_manager_new();
	g_object_set_data(G_OBJECT(parent), "ui_manager", ui);
	gtk_ui_manager_insert_action_group(ui, ag, 0);
	GtkAccelGroup *accel = gtk_ui_manager_get_accel_group(ui);
	gtk_window_add_accel_group(parent, accel);

	GError *error = NULL;
        if (!gtk_ui_manager_add_ui_from_string (ui, ui_xml, -1, &error)) {
                g_message ("building menus failed: %s", error->message);
                g_error_free (error);
                exit (-1);
        }

	GtkWidget *menubar = gtk_ui_manager_get_widget(ui, "/menubar");
	gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(menubar), FALSE, TRUE, 0);
	toolbar = GTK_TOOLBAR(gtk_ui_manager_get_widget(ui, "/toolbar"));
	gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(toolbar), FALSE, TRUE, 0);

	/* Device selection GtkComboBox */
	GtkToolItem *toolitem = gtk_tool_item_new();
	GtkWidget *dev = dev_select_combo_box_new(parent);

	gtk_container_add(GTK_CONTAINER(toolitem), dev);
	gtk_toolbar_insert(toolbar, toolitem, 0);

	/* Time/Samples entry */
	toolitem = gtk_tool_item_new();
	GtkWidget *timesamples = gtk_entry_new();
	gtk_entry_set_text(GTK_ENTRY(timesamples), "100");
	gtk_entry_set_alignment(GTK_ENTRY(timesamples), 1.0);
	gtk_widget_set_size_request(timesamples, 100, -1);
	gtk_container_add(GTK_CONTAINER(toolitem), timesamples);
	gtk_toolbar_insert(toolbar, toolitem, 7);

	/* Time unit combo box */
	toolitem = gtk_tool_item_new();
	GtkWidget *timeunit = gtk_combo_box_new_text();
	gtk_combo_box_append_text(GTK_COMBO_BOX(timeunit), "samples");
	gtk_combo_box_append_text(GTK_COMBO_BOX(timeunit), "ms");
	gtk_combo_box_append_text(GTK_COMBO_BOX(timeunit), "s");
	gtk_combo_box_set_active(GTK_COMBO_BOX(timeunit), 0);
	gtk_container_add(GTK_CONTAINER(toolitem), timeunit);
	gtk_toolbar_insert(toolbar, toolitem, 8);

	g_object_set_data(G_OBJECT(parent), "timesamples", timesamples);
	g_object_set_data(G_OBJECT(parent), "timeunit", timeunit);

	return GTK_WIDGET(vbox);
}
예제 #22
0
파일: lamixer.c 프로젝트: metsger/lamixer
void InitScreen(void)
{
	GtkWidget *notebook;
	GtkWidget *playbacklabel;
	GtkWidget *capturelabel;

	window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
	gtk_window_set_title (GTK_WINDOW(window), "Lightweight Alsa Mixer");
	//gtk_container_set_border_width (GTK_CONTAINER (window), 1);
	gtk_signal_connect (GTK_OBJECT(window), "destroy", GTK_SIGNAL_FUNC(gtk_main_quit), NULL);
	
	windowbox = gtk_vbox_new(FALSE,1);
	
	InitMenu();
	gtk_box_pack_start(GTK_BOX(windowbox), menu_bar, FALSE, TRUE, 0);
	
	lamixer_enum_cards();
	lamixer_mixer_init(card_id);
	mixerbox = gtk_table_new(mRows, 1, FALSE);
	capturebox = gtk_table_new(mRows, 1, FALSE);

	InitMixer(card_id);
	
	playbackscrollwin = gtk_scrolled_window_new (NULL, NULL);
	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (playbackscrollwin),GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER);
	gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW (playbackscrollwin), mixerbox);

	capturescrollwin = gtk_scrolled_window_new (NULL, NULL);
	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (capturescrollwin),GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER);
	gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW (capturescrollwin), capturebox);

	playbacklabel =  gtk_label_new("Playback");
	capturelabel =  gtk_label_new("Capture");
	
	notebook = gtk_notebook_new ();
	gtk_notebook_set_tab_pos (GTK_NOTEBOOK (notebook), GTK_POS_TOP);
	gtk_notebook_append_page (GTK_NOTEBOOK (notebook), playbackscrollwin, playbacklabel);
	gtk_notebook_append_page (GTK_NOTEBOOK (notebook), capturescrollwin, capturelabel);
	
	switchmixer = gtk_combo_box_new_text();
	
	GList *card_name = g_list_first(SoundCards);	
	while(card_name) {
		gtk_combo_box_append_text (GTK_COMBO_BOX (switchmixer), card_name->data);
		card_name = g_list_next(card_name);
	}
	
	gtk_combo_box_set_active(GTK_COMBO_BOX (switchmixer), 0);
	g_signal_connect(G_OBJECT(switchmixer), "changed", G_CALLBACK(lamixer_mixer_switch), NULL);
	
	gtk_notebook_set_action_widget (GTK_NOTEBOOK (notebook), switchmixer, GTK_PACK_END);
	gtk_widget_show(switchmixer);

	gtk_box_pack_start(GTK_BOX(windowbox), notebook, TRUE, TRUE, 0);
	gtk_container_add (GTK_CONTAINER(window), windowbox);	
	lamixer_window_resize();
	
    gtk_widget_show_all (window);
}
// Create new game dialog
void new_game_dialog_init(void)
{
        GtkWidget *vbox, *hbox, *w;

        vbox = gtk_vbox_new(FALSE, 4);

        /* Stock games */
        ngd_combo = gtk_combo_box_new_text();
        gtk_combo_box_append_text(GTK_COMBO_BOX(ngd_combo), "Tic Tac Toe");
        gtk_combo_box_append_text(GTK_COMBO_BOX(ngd_combo), "Go Moku");
        gtk_combo_box_append_text(GTK_COMBO_BOX(ngd_combo), "Connect 6");
        gtk_combo_box_append_text(GTK_COMBO_BOX(ngd_combo), "Custom");
        gtk_combo_box_set_active(GTK_COMBO_BOX(ngd_combo), 2);
        gtk_box_pack_start(GTK_BOX(vbox), ngd_combo, FALSE, FALSE, 0);
        g_signal_connect(ngd_combo, "changed", G_CALLBACK(new_game_set_combo),
                         NULL);

        // Parameters
        hbox = labeled_spin_new("Board size:", 2., MAX_BOARD_SIZE, 19.,
                                &ngd_board_size, new_game_set_custom);
        gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
        hbox = labeled_spin_new("Connect to win:", 2., MAX_CONNECT_K, 6.,
                                &ngd_connect_k, new_game_set_custom);
        gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
        hbox = labeled_spin_new("Moves per turn:", 1., MAX_PLACE_P, 2.,
                                &ngd_place_p, new_game_set_custom);
        gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
        hbox = labeled_spin_new("Starting moves:", 1., MAX_START_Q, 1.,
                                &ngd_start_q, new_game_set_custom);
        gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);

        /* Separator */
        w = gtk_vbox_new(FALSE, 0);
        gtk_box_pack_start(GTK_BOX(vbox), w, FALSE, FALSE, 4);

        /* Cancel/Ok buttons */
        hbox = gtk_hbox_new(TRUE, 4);
        w = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
        g_signal_connect(G_OBJECT(w), "clicked",
                         G_CALLBACK(new_game_dialog_cancel), NULL);
        gtk_box_pack_start(GTK_BOX(hbox), w, TRUE, TRUE, 0);
        w = gtk_button_new_from_stock(GTK_STOCK_OK);
        g_signal_connect(G_OBJECT(w), "clicked",
                         G_CALLBACK(new_game_dialog_ok), NULL);
        gtk_box_pack_end(GTK_BOX(hbox), w, TRUE, TRUE, 0);
        gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);

        // Create dialog window
        new_game_dialog = gtk_window_new(GTK_WINDOW_TOPLEVEL);
        g_signal_connect(G_OBJECT(new_game_dialog), "delete-event",
                         G_CALLBACK(gtk_widget_hide_on_delete), NULL);
        gtk_window_set_title(GTK_WINDOW(new_game_dialog), "New game...");
        gtk_window_set_transient_for(GTK_WINDOW(new_game_dialog),
                                     GTK_WINDOW(window));
        gtk_window_set_modal(GTK_WINDOW(new_game_dialog), TRUE);
        gtk_window_set_resizable(GTK_WINDOW(new_game_dialog), FALSE);
        gtk_container_add(GTK_CONTAINER(new_game_dialog), vbox);
        gtk_container_border_width(GTK_CONTAINER(new_game_dialog), 12);
}
예제 #24
0
파일: compat.c 프로젝트: pcwalton/NetSurf
GtkWidget *nsgtk_combo_box_text_new(void)
{
  #if GTK_CHECK_VERSION(2,24,0)
	return gtk_combo_box_text_new(); 
  #else
	return gtk_combo_box_new_text();
  #endif
}
예제 #25
0
파일: combo.c 프로젝트: theojulienne/Claro
void cgraphics_combo_widget_create( widget_t *widget )
{
	widget->native = gtk_combo_box_new_text( );
	
	cgraphics_widget_create( widget );
	
	g_signal_connect( G_OBJECT(widget->native), "changed", G_CALLBACK(cgraphics_combo_changed_handler), widget );
}
예제 #26
0
void detect_popup_cb( GtkWidget *widget, AnypaperWindow *window )
{
	if (!g_file_test (wallpapersetterfile, G_FILE_TEST_EXISTS)) anypaper_wallpapersetter_file(wallpapersetterfile);
	anypaper_wallpapersetter_detect (window->wallpapersetter, wallpapersetterfile);

	if (window->wallpapersetter->wallpapersetter)
	{
		GtkWidget *dialog, *label, *content_area, *box, *halign, *combo;
		GList *atual=NULL, *atual_com=NULL;

		dialog = gtk_dialog_new_with_buttons ("Detected wallpapersetters", GTK_WINDOW(window->priv->window), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, NULL);
		content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));

		box = gtk_vbox_new (FALSE, 0);
		gtk_container_add (GTK_CONTAINER (content_area), box);

		label = gtk_label_new ("Are listed below the wallpapersetter found,\nplease select one:");
		gtk_box_pack_start (GTK_BOX(box), label, FALSE, TRUE, 2);

		halign = gtk_alignment_new(0, 1, 0, 0);
		combo = gtk_combo_box_new_text ();
		gtk_container_add(GTK_CONTAINER(halign), combo);

		atual = g_list_first (window->wallpapersetter->wallpapersetter);
		atual_com = g_list_first (window->wallpapersetter->command);

		while (atual)
		{
			gtk_combo_box_append_text (GTK_COMBO_BOX (combo), atual->data);
			atual = g_list_next(atual);
		}

		gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0);
		gtk_box_pack_start (GTK_BOX(box), halign, FALSE, TRUE, 2);
		gtk_widget_show_all (dialog);

		if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
		{
			gchar *command;
			atual = g_list_nth (window->wallpapersetter->wallpapersetter, gtk_combo_box_get_active (GTK_COMBO_BOX (combo)));
			atual_com = g_list_nth (window->wallpapersetter->command, gtk_combo_box_get_active (GTK_COMBO_BOX (combo)));
			command = g_strdup_printf("%s %s", (gchar *) atual->data, (gchar *) atual_com->data);
			gtk_entry_set_text (GTK_ENTRY (window->priv->com_entry), command);
			g_free(command);
		}

		gtk_widget_destroy (dialog);
	}
	else
	{
		GtkWidget *dialog;
		dialog = gtk_message_dialog_new (GTK_WINDOW(window->priv->window), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_CLOSE, "No wallpapersetter found. A list of known wallpapersetter can be found in %s. You can install a wallpapersetter from that list, manually add a command to it or use directly a command of your preference", wallpapersetterfile);
		gtk_window_set_title (GTK_WINDOW(dialog), "Warning");
		gtk_dialog_run (GTK_DIALOG (dialog));
		gtk_widget_destroy (dialog);
	}
}
예제 #27
0
GtkWidget *create_dialog1 (void)
{
  GtkWidget *dialog1;
  GtkWidget *dialog_vbox1;
  GtkWidget *hbox1;
  GtkWidget *combobox1;
  GtkWidget *buttonConf;
  GtkWidget *dialog_action_area1;
  GtkWidget *cancelbutton1;
  GtkWidget *okbutton1;

  dialog1 = gtk_dialog_new ();
  gtk_window_set_title (GTK_WINDOW (dialog1), QT_TR_NOOP("Video encoder"));
  gtk_window_set_type_hint (GTK_WINDOW (dialog1), GDK_WINDOW_TYPE_HINT_DIALOG);

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

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

  combobox1 = gtk_combo_box_new_text ();
  gtk_widget_show (combobox1);
  gtk_box_pack_start (GTK_BOX (hbox1), combobox1, TRUE, TRUE, 0);

  buttonConf = gtk_button_new_with_mnemonic (QT_TR_NOOP("Configure"));
  gtk_widget_show (buttonConf);
  gtk_box_pack_start (GTK_BOX (hbox1), buttonConf, FALSE, FALSE, 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, hbox1, "hbox1");
  GLADE_HOOKUP_OBJECT (dialog1, combobox1, "combobox1");
  GLADE_HOOKUP_OBJECT (dialog1, buttonConf, "buttonConf");
  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;
}
예제 #28
0
파일: lowpass.c 프로젝트: jmarca/darktable
void gui_init(struct dt_iop_module_t *self)
{
  self->gui_data = malloc(sizeof(dt_iop_lowpass_gui_data_t));
  dt_iop_lowpass_gui_data_t *g = (dt_iop_lowpass_gui_data_t *)self->gui_data;
  dt_iop_lowpass_params_t *p = (dt_iop_lowpass_params_t *)self->params;

  self->widget = gtk_vbox_new(TRUE, DT_BAUHAUS_SPACE);

#if 0 // gaussian is order not user selectable here, as it does not make much sense for a lowpass filter
  GtkBox *hbox  = GTK_BOX(gtk_hbox_new(FALSE, 5));
  gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(hbox), FALSE, FALSE, 0);
  GtkWidget *label = dtgtk_reset_label_new(_("filter order"), self, &p->order, sizeof(float));
  gtk_box_pack_start(hbox, label, FALSE, FALSE, 0);
  g->order = GTK_COMBO_BOX(gtk_combo_box_new_text());
  gtk_combo_box_append_text(g->order, _("0th order"));
  gtk_combo_box_append_text(g->order, _("1st order"));
  gtk_combo_box_append_text(g->order, _("2nd order"));
  gtk_object_set(GTK_OBJECT(g->order), "tooltip-text", _("filter order of gaussian blur"), (char *)NULL);
  gtk_box_pack_start(hbox, GTK_WIDGET(g->order), TRUE, TRUE, 0);
#endif

  g->scale1 = dt_bauhaus_slider_new_with_range(self,0.1, 200.0, 0.1, p->radius, 2);
  g->scale2 = dt_bauhaus_slider_new_with_range(self,-3.0, 3.0, 0.01, p->contrast, 2);
  g->scale3 = dt_bauhaus_slider_new_with_range(self,-3.0, 3.0, 0.01, p->saturation, 2);

  dt_bauhaus_widget_set_label(g->scale1,_("radius"));
  dt_bauhaus_widget_set_label(g->scale2,_("contrast"));
  dt_bauhaus_widget_set_label(g->scale3,_("saturation"));

  g->bilat  = dt_bauhaus_combobox_new(self);
  dt_bauhaus_widget_set_label(g->bilat, _("soften with"));
  dt_bauhaus_combobox_add(g->bilat, _("gaussian"));
  dt_bauhaus_combobox_add(g->bilat, _("bilateral filter"));

  gtk_box_pack_start(GTK_BOX(self->widget), g->scale1, TRUE, TRUE, 0);
  gtk_box_pack_start(GTK_BOX(self->widget), g->bilat,  TRUE, TRUE, 0);
  gtk_box_pack_start(GTK_BOX(self->widget), g->scale2, TRUE, TRUE, 0);
  gtk_box_pack_start(GTK_BOX(self->widget), g->scale3, TRUE, TRUE, 0);
  gtk_object_set(GTK_OBJECT(g->scale1), "tooltip-text", _("radius of gaussian/bilateral blur"), (char *)NULL);
  gtk_object_set(GTK_OBJECT(g->scale2), "tooltip-text", _("contrast of lowpass filter"), (char *)NULL);
  gtk_object_set(GTK_OBJECT(g->scale3), "tooltip-text", _("color saturation of lowpass filter"), (char *)NULL);
  gtk_object_set(GTK_OBJECT(g->bilat),  "tooltip-text", _("which filter to use for blurring"), (char *)NULL);

  g_signal_connect (G_OBJECT (g->scale1), "value-changed",
                    G_CALLBACK (radius_callback), self);
  g_signal_connect (G_OBJECT (g->bilat), "value-changed",
                    G_CALLBACK (bilat_callback), self);
  g_signal_connect (G_OBJECT (g->scale2), "value-changed",
                    G_CALLBACK (contrast_callback), self);
  g_signal_connect (G_OBJECT (g->scale3), "value-changed",
                    G_CALLBACK (saturation_callback), self);
#if 0 // gaussian order not user selectable
  g_signal_connect (G_OBJECT (g->order), "changed",
                    G_CALLBACK (order_changed), self);
#endif
}
예제 #29
0
void pComboBox::constructor() {
  itemCounter = 0;
  gtkWidget = gtk_combo_box_new_text();
  g_signal_connect_swapped(G_OBJECT(gtkWidget), "changed", G_CALLBACK(ComboBox_change), (gpointer)&comboBox);

  locked = true;
  for(auto &text : comboBox.state.text) append(text);
  locked = false;
  setSelection(comboBox.state.selection);
}
예제 #30
0
GtkWidget *create_pho_sel_area()
{
  hbox_pho_sel = gtk_hbox_new (FALSE, 0);

  int i;

  for(i=0; i < bigphoN; i++) {
    bigpho[i].opt_menu = gtk_combo_box_new_text ();
    gtk_box_pack_start (GTK_BOX (hbox_pho_sel), bigpho[i].opt_menu, FALSE, FALSE, 0);

    int j;
    for(j=0; j < bigpho[i].phokeysN; j++) {
      char t[128];
      char *phostr;

      if (is_gtab) {
        int tlen;
        u_int64_t key64;
        if (ph_key_sz == 4) {
          u_int32_t key32;
          cp_ph_key(bigpho[i].phokeys,j, &key32);
          key64 = key32;
        } else
          cp_ph_key(bigpho[i].phokeys,j, &key64);

        gtab_key2name(pinmd, key64, t, &tlen);
//        dbg("%d,%d] %s\n", i,j, t);
        phostr = t;
      } else {
        phokey_t k;
        cp_ph_key(bigpho[i].phokeys, j, &k);
        phostr = b_pinyin?
        phokey2pinyin(k):phokey_to_str(k);
      }

      gtk_combo_box_append_text (GTK_COMBO_BOX_TEXT (bigpho[i].opt_menu), phostr);
    }

    gtk_combo_box_set_active (GTK_COMBO_BOX(bigpho[i].opt_menu), 0);
  }


  GtkWidget *button_ok = gtk_button_new_with_label("OK to add");
  gtk_box_pack_start (GTK_BOX (hbox_pho_sel), button_ok, FALSE, FALSE, 20);
  g_signal_connect (G_OBJECT (button_ok), "clicked",
     G_CALLBACK (cb_button_ok), NULL);

  GtkWidget *button_cancel = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
  gtk_box_pack_start (GTK_BOX (hbox_pho_sel), button_cancel, FALSE, FALSE, 20);
  g_signal_connect (G_OBJECT (button_cancel), "clicked",
     G_CALLBACK (cb_button_cancel), NULL);


  return hbox_pho_sel;
}