Ejemplo n.º 1
0
void
gs_shell_category_setup (GsShellCategory *shell_category,
			 GsShell *shell,
			 GsPluginLoader *plugin_loader,
			 GtkBuilder *builder,
			 GCancellable *cancellable)
{
	GsShellCategoryPrivate *priv = shell_category->priv;
	GtkAdjustment *adj;

	priv->plugin_loader = g_object_ref (plugin_loader);
	priv->builder = g_object_ref (builder);
	priv->shell = shell;

	g_signal_connect (priv->listbox_filter, "row-selected", G_CALLBACK (filter_selected), shell_category);

	adj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (priv->scrolledwindow_category));
	gtk_container_set_focus_vadjustment (GTK_CONTAINER (priv->category_detail_grid), adj);

	g_signal_connect (priv->listbox_filter, "key-press-event",
			  G_CALLBACK (key_event), shell_category);

	/* chain up */
	gs_page_setup (GS_PAGE (shell_category),
	               shell,
	               plugin_loader,
	               cancellable);
}
Ejemplo n.º 2
0
int
clip_GTK_CONTAINERSETFOCUSVADJUSTMENT(ClipMachine * cm)
{
	C_widget *ccon = _fetch_cw_arg(cm);
	C_widget *cwid = _fetch_cwidget(cm,_clip_spar(cm,2));
	CHECKCWID(ccon,GTK_IS_CONTAINER);
	CHECKARG2(2,MAP_t,NUMERIC_t); CHECKCWID(cwid,GTK_IS_ADJUSTMENT);
	gtk_container_set_focus_vadjustment(GTK_CONTAINER(ccon->widget),
		GTK_ADJUSTMENT(cwid->widget));
	return 0;
err:
	return 1;
}
Ejemplo n.º 3
0
static void
cc_ua_panel_init (CcUaPanel *self)
{
  CcUaPanelPrivate *priv;
  GtkWidget *panel;
  GtkWidget *content;

  priv = self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
                                                   CC_TYPE_UA_PANEL,
                                                   CcUaPanelPrivate);

  g_resources_register (cc_universal_access_get_resource ());

  priv->interface_settings = g_settings_new (INTERFACE_SETTINGS);
  priv->a11y_settings = g_settings_new (A11Y_SETTINGS);
  priv->wm_settings = g_settings_new (WM_SETTINGS);
  priv->kb_settings = g_settings_new (KEYBOARD_SETTINGS);
  priv->mouse_settings = g_settings_new (MOUSE_SETTINGS);
  priv->application_settings = g_settings_new (APPLICATION_SETTINGS);

  priv->builder = gtk_builder_new ();
  gtk_builder_add_from_resource (priv->builder,

                                 "/org/gnome/control-center/universal-access/uap.ui",
                                 NULL);

  cc_ua_panel_init_status (self);
  cc_ua_panel_init_seeing (self);
  cc_ua_panel_init_hearing (self);
  cc_ua_panel_init_keyboard (self);
  cc_ua_panel_init_mouse (self);

  panel = WID ("universal_access_panel");
  content = WID ("universal_access_content");

  g_signal_connect (content, "size-allocate",
                    G_CALLBACK (on_content_size_changed), panel);

  priv->focus_adjustment = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (panel));
  gtk_container_set_focus_vadjustment (GTK_CONTAINER (content), priv->focus_adjustment);

  gtk_widget_reparent (panel, GTK_WIDGET (self));
}
static void
setup_model (GnomeControlCenter *shell)
{
  GnomeControlCenterPrivate *priv = shell->priv;

  gtk_widget_set_margin_top (shell->priv->main_vbox, 8);
  gtk_widget_set_margin_bottom (shell->priv->main_vbox, 8);
  gtk_widget_set_margin_left (shell->priv->main_vbox, 12);
  gtk_widget_set_margin_right (shell->priv->main_vbox, 12);
  gtk_container_set_focus_vadjustment (GTK_CONTAINER (shell->priv->main_vbox),
                                       gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (shell->priv->scrolled_window)));

  priv->store = (GtkListStore *) cc_shell_model_new ();
  priv->category_views = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
  priv->menu_tree = gmenu_tree_new_for_path (MENUDIR "/gnomecc.menu", 0);

  reload_menu (shell);

  g_signal_connect (priv->menu_tree, "changed", G_CALLBACK (on_menu_changed), shell);
}
Ejemplo n.º 5
0
void
gs_shell_overview_setup (GsShellOverview *self,
			 GsShell *shell,
			 GsPluginLoader *plugin_loader,
			 GtkBuilder *builder,
			 GCancellable *cancellable)
{
	GsShellOverviewPrivate *priv = gs_shell_overview_get_instance_private (self);
	GtkAdjustment *adj;
	GtkWidget *tile;
	gint i;

	g_return_if_fail (GS_IS_SHELL_OVERVIEW (self));

	priv->plugin_loader = g_object_ref (plugin_loader);
	priv->builder = g_object_ref (builder);
	priv->cancellable = g_object_ref (cancellable);

	/* avoid a ref cycle */
	priv->shell = shell;

	adj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (priv->scrolledwindow_overview));
	gtk_container_set_focus_vadjustment (GTK_CONTAINER (priv->box_overview), adj);

	tile = gs_feature_tile_new (NULL);
	gtk_container_add (GTK_CONTAINER (priv->bin_featured), tile);

	for (i = 0; i < N_TILES; i++) {
		tile = gs_popular_tile_new (NULL);
		gtk_container_add (GTK_CONTAINER (priv->box_popular), tile);

		tile = gs_popular_tile_new (NULL);
		gtk_container_add (GTK_CONTAINER (priv->box_popular_rotating), tile);
	}

	/* chain up */
	gs_page_setup (GS_PAGE (self),
	               shell,
	               plugin_loader,
	               cancellable);
}
Ejemplo n.º 6
0
void
layer_dialog_create(void)
{
  GtkWidget *dialog;
  GtkWidget *vbox;
  GtkWidget *hbox;
  GtkWidget *label;
  GtkWidget *omenu;
  GtkWidget *menu;
  GtkWidget *list;
  GtkWidget *separator;
  GtkWidget *scrolled_win;
  GtkWidget *button_box;
  GtkWidget *button;

  layer_dialog = g_new(struct LayerDialog, 1);

  layer_dialog->diagram = NULL;
  
  layer_dialog->dialog = dialog = gtk_dialog_new ();
  gtk_window_set_title (GTK_WINDOW (dialog), _("Layers"));
  gtk_window_set_role (GTK_WINDOW (dialog), "layer_window");
  gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE);

  g_signal_connect (G_OBJECT (dialog), "delete_event",
                    G_CALLBACK(layer_dialog_delete), NULL);
  g_signal_connect (G_OBJECT (dialog), "destroy",
                    G_CALLBACK(gtk_widget_destroyed), 
		    &(layer_dialog->dialog));

  vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog));

  hbox = gtk_hbox_new(FALSE, 1);
  
  label = gtk_label_new(_("Diagram:"));
  gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2);
  gtk_widget_show (label);
  
  layer_dialog->diagram_omenu = omenu = gtk_option_menu_new();
  gtk_box_pack_start(GTK_BOX(hbox), omenu, TRUE, TRUE, 2);
  gtk_widget_show (omenu);

  menu = gtk_menu_new();
  gtk_option_menu_set_menu(GTK_OPTION_MENU(omenu), menu);

  gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2);
  gtk_widget_show (hbox);

  separator = gtk_hseparator_new();
  gtk_box_pack_start(GTK_BOX(vbox), separator, FALSE, FALSE, 2);
  gtk_widget_show (separator);

  scrolled_win = gtk_scrolled_window_new (NULL, NULL);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
				  GTK_POLICY_AUTOMATIC, 
				  GTK_POLICY_AUTOMATIC);
  gtk_box_pack_start (GTK_BOX (vbox), scrolled_win, TRUE, TRUE, 2);

  layer_dialog->layer_list = list = gtk_list_new();

  gtk_list_set_selection_mode (GTK_LIST (list), GTK_SELECTION_BROWSE);
  gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_win), list);
  gtk_container_set_focus_vadjustment (GTK_CONTAINER (list),
				       gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (scrolled_win)));
  gtk_widget_show (scrolled_win);
  gtk_widget_show (list);

  g_signal_connect (G_OBJECT (list), "event",
		    G_CALLBACK (layer_list_events), NULL);

  button_box = create_button_box(dialog, TRUE);
  
  gtk_box_pack_start (GTK_BOX (vbox), button_box, FALSE, FALSE, 2);
  gtk_widget_show (button_box);

  gtk_container_set_border_width(GTK_CONTAINER(
				 gtk_dialog_get_action_area (GTK_DIALOG(dialog))),
				 2);

  button = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
  gtk_box_pack_start (GTK_BOX (gtk_dialog_get_action_area (GTK_DIALOG(dialog))), 
		      button, TRUE, TRUE, 0);
  g_signal_connect_swapped(G_OBJECT (button), "clicked",
			   G_CALLBACK(gtk_widget_hide),
			   G_OBJECT(dialog));

  gtk_widget_show (button);

  persistence_register_window(GTK_WINDOW(dialog));

  layer_dialog_update_diagram_list();
}
Ejemplo n.º 7
0
GtkWidget * create_layer_view_widget (void)
{
  GtkWidget  *vbox;
  GtkWidget  *hbox;
  GtkWidget  *label;
  GtkWidget  *hide_button;
  GtkRcStyle *rcstyle;    /* For hide_button */   
  GtkWidget  *image;      /* For hide_button */
  GtkWidget  *list;
  GtkWidget  *separator;
  GtkWidget  *scrolled_win;
  GtkWidget  *button_box;
  
  /* if layer_dialog were renamed to layer_view_data this would make
   * more sense.
   */
  layer_dialog = g_new (struct LayerDialog, 1);

  layer_dialog->diagram = NULL;

  layer_dialog->dialog = vbox = gtk_vbox_new (FALSE, 1);
    
  hbox = gtk_hbox_new (FALSE, 1);
  
  label = gtk_label_new (_ ("Layers:"));
  gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 2);
  gtk_widget_show (label);
  
  layer_dialog->diagram_omenu = NULL;

  /* Hide Button */
  hide_button = gtk_button_new ();
  gtk_button_set_relief (GTK_BUTTON (hide_button), GTK_RELIEF_NONE);
  gtk_button_set_focus_on_click (GTK_BUTTON (hide_button), FALSE);

  /* make it as small as possible */
  rcstyle = gtk_rc_style_new ();
  rcstyle->xthickness = rcstyle->ythickness = 0;
  gtk_widget_modify_style (hide_button, rcstyle);
  g_object_unref (rcstyle);

  image = gtk_image_new_from_stock (GTK_STOCK_CLOSE,
                                    GTK_ICON_SIZE_MENU);

  gtk_container_add (GTK_CONTAINER(hide_button), image);
  g_signal_connect (G_OBJECT (hide_button), "clicked", 
                    G_CALLBACK (layer_view_hide_button_clicked), NULL);    
    
  gtk_box_pack_start (GTK_BOX (hbox), hide_button, FALSE, FALSE, 2);
    
  gtk_box_pack_start (GTK_BOX(vbox), hbox, FALSE, FALSE, 2);
  gtk_widget_show_all (hbox);

  button_box = create_button_box(vbox, FALSE);
  
  gtk_box_pack_start (GTK_BOX (vbox), button_box, FALSE, FALSE, 2);
  gtk_widget_show (button_box);
    
  separator = gtk_hseparator_new();
  gtk_box_pack_start(GTK_BOX(vbox), separator, FALSE, FALSE, 2);
  gtk_widget_show (separator);

  scrolled_win = gtk_scrolled_window_new (NULL, NULL);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
				  GTK_POLICY_AUTOMATIC, 
				  GTK_POLICY_AUTOMATIC);
  gtk_box_pack_start (GTK_BOX (vbox), scrolled_win, TRUE, TRUE, 2);

  layer_dialog->layer_list = list = gtk_list_new();

  gtk_list_set_selection_mode (GTK_LIST (list), GTK_SELECTION_BROWSE);
  gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_win), list);
  gtk_container_set_focus_vadjustment (GTK_CONTAINER (list),
				       gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (scrolled_win)));
  gtk_widget_show (scrolled_win);
  gtk_widget_show (list);

  g_signal_connect (G_OBJECT (list), "event",
		    G_CALLBACK (layer_list_events), NULL);
    
  return vbox;
}
Ejemplo n.º 8
0
bool wxListBox::Create( wxWindow *parent, wxWindowID id,
                        const wxPoint &pos, const wxSize &size,
                        int n, const wxString choices[],
                        long style, const wxValidator& validator,
                        const wxString &name )
{
    m_needParent = true;
    m_acceptsFocus = true;
    m_prevSelection = 0;  // or -1 ??
    m_blockEvent = false;

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

    m_widget = gtk_scrolled_window_new( (GtkAdjustment*) NULL, (GtkAdjustment*) NULL );
    if (style & wxLB_ALWAYS_SB)
    {
      gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(m_widget),
        GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS );
    }
    else
    {
      gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(m_widget),
        GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
    }

    m_list = GTK_LIST( gtk_list_new() );

    GtkSelectionMode mode;
    if (style & wxLB_MULTIPLE)
    {
        mode = GTK_SELECTION_MULTIPLE;
    }
    else if (style & wxLB_EXTENDED)
    {
        mode = GTK_SELECTION_EXTENDED;
    }
    else
    {
        // if style was 0 set single mode
        m_windowStyle |= wxLB_SINGLE;
        mode = GTK_SELECTION_SINGLE;
    }

    gtk_list_set_selection_mode( GTK_LIST(m_list), mode );

    gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW(m_widget), GTK_WIDGET(m_list) );

    /* make list scroll when moving the focus down using cursor keys */
    gtk_container_set_focus_vadjustment(
        GTK_CONTAINER(m_list),
        gtk_scrolled_window_get_vadjustment(
            GTK_SCROLLED_WINDOW(m_widget)));

    gtk_widget_show( GTK_WIDGET(m_list) );

    gtk_signal_connect( GTK_OBJECT(m_list), "realize",
                        GTK_SIGNAL_FUNC(gtk_listbox_realized_callback), (gpointer) this );

    if ( style & wxLB_SORT )
    {
        // this will change DoAppend() behaviour
        m_strings = new wxSortedArrayString;
    }
    else
    {
        m_strings = (wxSortedArrayString *)NULL;
    }

    for (int i = 0; i < n; i++)
    {
        // add one by one
        DoAppend(choices[i]);
    }

    m_parent->DoAddChild( this );

    PostCreation(size);
    SetInitialSize(size); // need this too because this is a wxControlWithItems

    return true;
}
Ejemplo n.º 9
0
void main (int argc, char **argv)
{
  GtkWidget *window, *entry, *hbox, *vbox, *label, *label2, *l3, *l4, *la;
  GtkWidget *scrolled_window;
  GtkWidget *table;
  int i,j;

  gtk_init (&argc, &argv);

  gtk_settings_set_string_property (gtk_settings_get_default (),
				    "gtk-theme-name", "nimbus", "gdm");


  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

  gtk_window_set_default_size (GTK_WINDOW (window), 400, 400);
  
  g_signal_connect (G_OBJECT (window),
                    "delete_event",
                    G_CALLBACK (gtk_main_quit),
                    NULL);

  entry = gtk_entry_new ();

  scrolled_window = gtk_scrolled_window_new (NULL, NULL);
  gtk_container_set_border_width (GTK_CONTAINER (scrolled_window), 10);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
				  GTK_POLICY_AUTOMATIC,
				  GTK_POLICY_AUTOMATIC);  


  table = gtk_table_new (20, 20, FALSE);
  gtk_table_set_row_spacings (GTK_TABLE (table), 10);
  gtk_table_set_col_spacings (GTK_TABLE (table), 10);
  gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_window), table);
  gtk_container_set_focus_hadjustment (GTK_CONTAINER (table),
    				   gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (scrolled_window)));
  gtk_container_set_focus_vadjustment (GTK_CONTAINER (table),
    				   gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (scrolled_window)));
  gtk_widget_show (table);

  for (i = 0; i < 20; i++)
	for (j = 0; j < 20; j++)
	  {
	    la= gtk_label_new ("     ");
	    gtk_table_attach_defaults (GTK_TABLE (table), la,
				       i, i+1, j, j+1);
	    gtk_widget_show (la);
	  }
  
  /* gtk_widget_set_sensitive (scrolled_window, FALSE);   */

  hbox = gtk_hbox_new (FALSE, 10);
  vbox = gtk_vbox_new (FALSE, 10);

  gtk_container_add (GTK_CONTAINER (window), vbox);

  label = gtk_label_new ("        ");
  label2 = gtk_label_new ("        ");
  l3 = gtk_label_new ("       ");
  l4 = gtk_label_new ("         ");
  
  gtk_container_add (GTK_CONTAINER (vbox), label);
  gtk_container_add (GTK_CONTAINER (vbox), hbox);
  gtk_container_add (GTK_CONTAINER (vbox), label2);
  
  gtk_container_add (GTK_CONTAINER (hbox), l3);
  gtk_container_add (GTK_CONTAINER (hbox), scrolled_window);
  gtk_container_add (GTK_CONTAINER (hbox), l4);

  gtk_widget_show_all (window);

  gtk_main ();
}
Ejemplo n.º 10
0
static void
gtk_combo_init (GtkCombo * combo)
{
  GtkWidget *arrow;
  GtkWidget *frame;
  GtkWidget *event_box;
  GdkCursor *cursor;

  combo->case_sensitive = 0;
  combo->value_in_list = 0;
  combo->ok_if_empty = 1;
  combo->use_arrows = 1;
  combo->use_arrows_always = 0;
  combo->entry = gtk_entry_new ();
  combo->button = gtk_button_new ();
  combo->current_button = 0;
  arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_OUT);
  gtk_widget_show (arrow);
  gtk_container_add (GTK_CONTAINER (combo->button), arrow);
  gtk_box_pack_start (GTK_BOX (combo), combo->entry, TRUE, TRUE, 0);
  gtk_box_pack_end (GTK_BOX (combo), combo->button, FALSE, FALSE, 0);
  GTK_WIDGET_UNSET_FLAGS (combo->button, GTK_CAN_FOCUS);
  gtk_widget_show (combo->entry);
  gtk_widget_show (combo->button);
  combo->entry_change_id = gtk_signal_connect (GTK_OBJECT (combo->entry), "changed",
			      (GtkSignalFunc) gtk_combo_update_list, combo);
  gtk_signal_connect (GTK_OBJECT (combo->entry), "key_press_event",
		      (GtkSignalFunc) gtk_combo_entry_key_press, combo);
  gtk_signal_connect_after (GTK_OBJECT (combo->entry), "focus_out_event",
			    (GtkSignalFunc) gtk_combo_entry_focus_out, combo);
  combo->activate_id = gtk_signal_connect (GTK_OBJECT (combo->entry), "activate",
		      (GtkSignalFunc) gtk_combo_activate, combo);
  gtk_signal_connect_after (GTK_OBJECT (combo->button), "button_press_event",
			    (GtkSignalFunc) gtk_combo_popup_button_press, combo);
  /*gtk_signal_connect_after (GTK_OBJECT (combo->button), "button_release_event",
    (GtkSignalFunc) gtk_combo_button_release, combo);*/
  gtk_signal_connect (GTK_OBJECT (combo->button), "leave_notify_event",
		      (GtkSignalFunc) gtk_combo_popup_button_leave, combo);
  /*gtk_signal_connect(GTK_OBJECT(combo->button), "clicked",
     (GtkSignalFunc)prelight_bug, combo); */

  combo->popwin = gtk_window_new (GTK_WINDOW_POPUP);
  gtk_widget_ref (combo->popwin);
  gtk_window_set_policy (GTK_WINDOW (combo->popwin), 1, 1, 0);
  
  gtk_widget_set_events (combo->popwin, GDK_KEY_PRESS_MASK);

  event_box = gtk_event_box_new ();
  gtk_container_add (GTK_CONTAINER (combo->popwin), event_box);
  gtk_widget_show (event_box);

  gtk_widget_realize (event_box);
  cursor = gdk_cursor_new (GDK_TOP_LEFT_ARROW);
  gdk_window_set_cursor (event_box->window, cursor);
  gdk_cursor_destroy (cursor);

  frame = gtk_frame_new (NULL);
  gtk_container_add (GTK_CONTAINER (event_box), frame);
  gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
  gtk_widget_show (frame);

  combo->popup = gtk_scrolled_window_new (NULL, NULL);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (combo->popup),
				  GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
  GTK_WIDGET_UNSET_FLAGS (GTK_SCROLLED_WINDOW (combo->popup)->hscrollbar, GTK_CAN_FOCUS);
  GTK_WIDGET_UNSET_FLAGS (GTK_SCROLLED_WINDOW (combo->popup)->vscrollbar, GTK_CAN_FOCUS);
  gtk_container_add (GTK_CONTAINER (frame), combo->popup);
  gtk_widget_show (combo->popup);

  combo->list = gtk_list_new ();
  /* We'll use enter notify events to figure out when to transfer
   * the grab to the list
   */
  gtk_widget_set_events (combo->list, GDK_ENTER_NOTIFY_MASK);

  gtk_list_set_selection_mode(GTK_LIST(combo->list), GTK_SELECTION_BROWSE);
  gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (combo->popup), combo->list);
  gtk_container_set_focus_vadjustment (GTK_CONTAINER (combo->list),
				       gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (combo->popup)));
  gtk_container_set_focus_hadjustment (GTK_CONTAINER (combo->list),
				       gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (combo->popup)));
  gtk_widget_show (combo->list);

  combo->list_change_id = gtk_signal_connect (GTK_OBJECT (combo->list), "selection_changed",
			     (GtkSignalFunc) gtk_combo_update_entry, combo);
  gtk_signal_connect (GTK_OBJECT (combo->popwin), "key_press_event",
		      (GtkSignalFunc) gtk_combo_list_key_press, combo);
  gtk_signal_connect (GTK_OBJECT (combo->popwin), "button_press_event",
		      GTK_SIGNAL_FUNC (gtk_combo_button_press), combo);

  gtk_signal_connect_after (GTK_OBJECT (combo->list), "button_release_event",
			    GTK_SIGNAL_FUNC (gtk_combo_button_release), combo);
  /* We connect here on the button, because we'll have a grab on it
   * when the event occurs. But we are actually interested in enters
   * for the combo->list.
   */
  gtk_signal_connect (GTK_OBJECT (combo->button), "enter_notify_event",
		      GTK_SIGNAL_FUNC (gtk_combo_list_enter), combo);
}
Ejemplo n.º 11
0
int
main (int argc, char **argv)
{
	struct {
		char *label;
		void (*func) ();
	} buttons[] =
	  {
		  { "app window", create_app_helper },
		  { "color picker", create_color_picker },
		  { "date edit", create_date_edit },
		  { "entry", create_entry },
		  { "file entry", create_file_entry },
		  { "pixmap entry", create_pixmap_entry },
		  { "icon entry", create_icon_entry },
		  { "font picker", create_font_picker },
		  { "href", create_href },
		  { "icon list", create_icon_list },
		  { "about box", create_about_box }
	  };
	int nbuttons = sizeof (buttons) / sizeof (buttons[0]);
	GnomeProgram *program;
	TestGnomeApp *app;
	GtkWidget *box1;
	GtkWidget *box2;
	GtkWidget *button;
	GtkWidget *scrolled_window;
	int i;

	program = gnome_program_init ("testGNOME", VERSION,
			    LIBGNOMEUI_MODULE,
			    argc, argv,
			    GNOME_PARAM_GOPTION_CONTEXT,
			    g_option_context_new ("test-gnome"),
			    NULL);

	app = create_newwin (FALSE, "testGNOME", "testGNOME");
	gtk_window_set_default_size (GTK_WINDOW (app->app), 200, 300);
	box1 = gtk_vbox_new (FALSE, 0);
	bonobo_window_set_contents (BONOBO_WINDOW (app->app), box1);
	gtk_widget_show (box1);
	scrolled_window = gtk_scrolled_window_new (NULL, NULL);
	gtk_container_set_border_width (GTK_CONTAINER (scrolled_window), 10);
	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
					GTK_POLICY_AUTOMATIC,
					GTK_POLICY_AUTOMATIC);
	GTK_WIDGET_UNSET_FLAGS (GTK_SCROLLED_WINDOW (scrolled_window)->vscrollbar,
				GTK_CAN_FOCUS);
	gtk_box_pack_start (GTK_BOX (box1), scrolled_window, TRUE, TRUE, 0);
	gtk_widget_show (scrolled_window);
	box2 = gtk_vbox_new (FALSE, 0);
	gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
	gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_window), box2);
	gtk_container_set_focus_vadjustment (GTK_CONTAINER (box2), gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW(scrolled_window)));
	gtk_widget_show (box2);
	for (i = 0; i < nbuttons; i++) {
		button = gtk_button_new_with_label (buttons[i].label);
		if (buttons[i].func)
			g_signal_connect (button, "clicked",
					  G_CALLBACK(buttons[i].func),
					  NULL);
		else
			gtk_widget_set_sensitive (button, FALSE);
		gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
		gtk_widget_show (button);
	}

	gtk_widget_show (app->app);

	gtk_main ();

	g_object_unref (program);

	return 0;
}