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


C++ GTK_CONTAINER函数代码示例

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


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

示例1: create_lshw

GtkWidget*
create_lshw (void)
{
  GtkWidget *lshw;
  GtkWidget *vbox1;
  GtkWidget *menu;
  GtkWidget *menuitem4;
  GtkWidget *menuitem4_menu;
  GtkWidget *save;
  GtkWidget *quit1;
  GtkWidget *menuitem6;
  GtkWidget *menuitem6_menu;
  GtkWidget *refresh1;
  GtkWidget *menuitem7;
  GtkWidget *menuitem7_menu;
  GtkWidget *about1;
  GtkWidget *toolbar1;
  GtkIconSize tmp_toolbar_icon_size;
  GtkWidget *upbutton;
  GtkWidget *refreshbutton;
  GtkWidget *savebutton;
  GtkWidget *quitbutton;
  GtkWidget *scrolledwindow1;
  GtkWidget *viewport2;
  GtkWidget *hbox1;
  GtkWidget *hpaned1;
  GtkWidget *hbox3;
  GtkWidget *scrolledwindow10;
  GtkWidget *treeview1;
  GtkWidget *scrolledwindow11;
  GtkWidget *treeview2;
  GtkWidget *scrolledwindow12;
  GtkWidget *treeview3;
  GtkWidget *vbox2;
  GtkWidget *scrolledwindow13;
  GtkWidget *viewport3;
  GtkWidget *scrolledwindow14;
  GtkWidget *description;
  GtkWidget *statusbar;
  GtkAccelGroup *accel_group;
  GtkTooltips *tooltips;

  tooltips = gtk_tooltips_new ();

  accel_group = gtk_accel_group_new ();

  lshw = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title (GTK_WINDOW (lshw), "lshw");
  gtk_window_set_default_size (GTK_WINDOW (lshw), 700, 480);

  vbox1 = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox1);
  gtk_container_add (GTK_CONTAINER (lshw), vbox1);

  menu = gtk_menu_bar_new ();
  gtk_widget_show (menu);
  gtk_box_pack_start (GTK_BOX (vbox1), menu, FALSE, FALSE, 0);

  menuitem4 = gtk_menu_item_new_with_mnemonic ("_File");
  gtk_widget_show (menuitem4);
  gtk_container_add (GTK_CONTAINER (menu), menuitem4);

  menuitem4_menu = gtk_menu_new ();
  gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem4), menuitem4_menu);

  save = gtk_image_menu_item_new_from_stock ("gtk-save", accel_group);
  gtk_widget_show (save);
  gtk_container_add (GTK_CONTAINER (menuitem4_menu), save);
  gtk_widget_set_sensitive (save, FALSE);

  quit1 = gtk_image_menu_item_new_from_stock ("gtk-quit", accel_group);
  gtk_widget_show (quit1);
  gtk_container_add (GTK_CONTAINER (menuitem4_menu), quit1);

  menuitem6 = gtk_menu_item_new_with_mnemonic ("_View");
  gtk_widget_show (menuitem6);
  gtk_container_add (GTK_CONTAINER (menu), menuitem6);

  menuitem6_menu = gtk_menu_new ();
  gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem6), menuitem6_menu);

  refresh1 = gtk_image_menu_item_new_from_stock ("gtk-refresh", accel_group);
  gtk_widget_show (refresh1);
  gtk_container_add (GTK_CONTAINER (menuitem6_menu), refresh1);
  gtk_widget_add_accelerator (refresh1, "activate", accel_group,
                              GDK_F5, (GdkModifierType) 0,
                              GTK_ACCEL_VISIBLE);

  menuitem7 = gtk_menu_item_new_with_mnemonic ("_Help");
  gtk_widget_show (menuitem7);
  gtk_container_add (GTK_CONTAINER (menu), menuitem7);

  menuitem7_menu = gtk_menu_new ();
  gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem7), menuitem7_menu);

  about1 = gtk_menu_item_new_with_mnemonic ("_About");
  gtk_widget_show (about1);
  gtk_container_add (GTK_CONTAINER (menuitem7_menu), about1);

  toolbar1 = gtk_toolbar_new ();
//.........这里部分代码省略.........
开发者ID:kaseya,项目名称:lshw,代码行数:101,代码来源:interface.c

示例2: eel_wrap_table_size_request

/* GtkWidgetClass methods */
static void
eel_wrap_table_size_request (GtkWidget *widget,
                             GtkRequisition *requisition)
{
    EelWrapTable *wrap_table;
    EelDimensions content_dimensions;

    g_assert (EEL_IS_WRAP_TABLE (widget));
    g_assert (requisition != NULL);

    wrap_table = EEL_WRAP_TABLE (widget);

    content_dimensions = wrap_table_get_content_dimensions (wrap_table);

    /* The -1 tells Satan to use as much space as is available */
    requisition->width = -1;
    requisition->height = content_dimensions.height + gtk_container_get_border_width (GTK_CONTAINER (widget)) * 2;
}
开发者ID:fatman2021,项目名称:caja,代码行数:19,代码来源:eel-wrap-table.c

示例3: main

int main(int argc, char *argv[]) {
  gtk_init(&argc, &argv);

  if ( ! parse_commandline(argc, argv) )
    return(EXIT_FAILURE);

  sterm::common::set_debugging(opt_debug);

  if ( opt_config_file != NULL )
    config_file = opt_config_file;

  configuration = new sterm::config(config_file);

  gtk_window_set_default_icon_name("utilities-terminal");

  main_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title(GTK_WINDOW(main_window), "STerm");
  gtk_container_set_border_width(GTK_CONTAINER(main_window), 0);

  terminal = new sterm::terminal(configuration);

  std::string child_command;
  if ( opt_command != NULL )
    child_command = opt_command;

  terminal->attach_to_container(GTK_CONTAINER(main_window));

  terminal->spawn_child(child_command);

  terminal->connect_callback("child-exited", G_CALLBACK(main_exit_with_status_cb), NULL);
  terminal->connect_callback("bell", G_CALLBACK(main_bell_cb), NULL);

  terminal->link_property_to_terminal("window-title", G_OBJECT(main_window), "title");

  g_signal_connect(G_OBJECT(main_window), "destroy", G_CALLBACK(main_exit_cb), &main_window);

  functions = new sterm::function_handler(configuration, terminal);

  gtk_widget_show_all(main_window);
  gtk_main();

  if ( terminal != NULL ) {
    delete(terminal);
    terminal = NULL;
  }

  if ( functions != NULL ) {
    delete(functions);
    functions = NULL;
  }

  if ( configuration != NULL ) {
    delete(configuration);
    configuration = NULL;
  }

  if ( main_window != NULL ) {
    gtk_widget_destroy(main_window);
    main_window = NULL;
  }

  return ret;
}
开发者ID:flocke,项目名称:sterm,代码行数:63,代码来源:main.cpp

示例4: settings_window_create

void settings_window_create (void) {

	if(win_set_main != NULL) {
		gtk_widget_hide(win_set_main);
		gtk_widget_show(win_set_main);
		return;
	}

	GtkWidget *vbox_set_m, *hbox_set_m, *but_set_close, *but_set_save, *but_set_reset;
	GtkWidget *nb_set_m, *lab_e, *vbox_nb_up, *vbox_nb_um, *vbox_nb_uq;
	GtkWidget *hbox_um_s, *grid_uq, *grid_up, *grid_um;

	win_set_main = gtk_window_new (GTK_WINDOW_TOPLEVEL);
	gtk_window_set_title(GTK_WINDOW(win_set_main), "Pomf it! - Settings");
	g_signal_connect(win_set_main, "destroy", G_CALLBACK(settings_window_destroy), NULL);
	gtk_container_set_border_width(GTK_CONTAINER(win_set_main), 10);
	gtk_window_resize(GTK_WINDOW(win_set_main), 320, 200);
	gtk_window_set_position(GTK_WINDOW(win_set_main), GTK_WIN_POS_CENTER);

	vbox_set_m = gtk_box_new(GTK_ORIENTATION_VERTICAL , 0);
	gtk_container_add(GTK_CONTAINER(win_set_main), vbox_set_m);

	nb_set_m = gtk_notebook_new();
	gtk_container_add(GTK_CONTAINER(vbox_set_m),nb_set_m);

	vbox_nb_up = gtk_box_new(GTK_ORIENTATION_VERTICAL , 0);
	gtk_container_add(GTK_CONTAINER(nb_set_m), vbox_nb_up);
	lab_e = gtk_label_new("Uploader");
	g_object_set(G_OBJECT(lab_e), "can-focus", FALSE, NULL);
	gtk_notebook_set_tab_label(GTK_NOTEBOOK(nb_set_m),
		gtk_notebook_get_nth_page(GTK_NOTEBOOK(nb_set_m), 0),lab_e);

	vbox_nb_um = gtk_box_new(GTK_ORIENTATION_VERTICAL , 0);
	gtk_container_add(GTK_CONTAINER(nb_set_m), vbox_nb_um);
	lab_e = gtk_label_new("Manager");
	g_object_set(G_OBJECT(lab_e), "can-focus", FALSE, NULL);
	gtk_notebook_set_tab_label(GTK_NOTEBOOK(nb_set_m),
		gtk_notebook_get_nth_page(GTK_NOTEBOOK(nb_set_m), 1),lab_e);

	vbox_nb_uq = gtk_box_new(GTK_ORIENTATION_VERTICAL , 0);
	gtk_container_add(GTK_CONTAINER(nb_set_m), vbox_nb_uq);
	lab_e = gtk_label_new("Queue");
	g_object_set(G_OBJECT(lab_e), "can-focus", FALSE, NULL);
	gtk_notebook_set_tab_label(GTK_NOTEBOOK(nb_set_m),
		gtk_notebook_get_nth_page(GTK_NOTEBOOK(nb_set_m), 2),lab_e);

	grid_up = gtk_grid_new ();
	gtk_box_pack_start(GTK_BOX(vbox_nb_up), grid_up , FALSE, FALSE, 0);

	lab_e = gtk_label_new("Profiles:	");
	gtk_grid_attach (GTK_GRID (grid_up),lab_e, 0, 0, 2,  1);

	com_upm_pl = gtk_combo_box_text_new();
	gtk_grid_attach (GTK_GRID (grid_up),com_upm_pl, 2, 0, 2,  1);
	profiles_combo_fill();

	hbox_um_s = gtk_box_new(GTK_ORIENTATION_HORIZONTAL , 0);
	gtk_grid_attach (GTK_GRID (grid_up),hbox_um_s, 4, 0, 4,  1);

	GtkWidget *but_up_act = gtk_button_new_with_label("Activate");
	g_signal_connect(but_up_act,"clicked",G_CALLBACK(profiles_profile_activate), NULL);
	gtk_box_pack_start(GTK_BOX(hbox_um_s),GTK_WIDGET(but_up_act),TRUE,TRUE,0);

	GtkWidget *but_up_edit = gtk_button_new_with_label("Edit");
	g_signal_connect(but_up_edit,"clicked",G_CALLBACK(profiles_profile_edit), NULL);
	gtk_box_pack_start(GTK_BOX(hbox_um_s),GTK_WIDGET(but_up_edit),TRUE,TRUE,0);

	hbox_um_s = gtk_box_new(GTK_ORIENTATION_HORIZONTAL , 0);
	gtk_grid_attach (GTK_GRID (grid_up),hbox_um_s, 8, 0, 4,  1);

	GtkWidget *but_up_add = gtk_button_new_with_label("Add New");
	g_signal_connect(but_up_add,"clicked",G_CALLBACK(profiles_window_create), NULL);
	gtk_box_pack_end(GTK_BOX(hbox_um_s),GTK_WIDGET(but_up_add),TRUE,FALSE,0);

	GtkWidget *but_up_del = gtk_button_new_with_label("Delete");
	g_signal_connect(but_up_del,"clicked",G_CALLBACK(profiles_profile_delete), NULL);
	gtk_box_pack_start(GTK_BOX(hbox_um_s),GTK_WIDGET(but_up_del),TRUE,FALSE,0);

	lab_e = gtk_label_new("Active Profile:");
	gtk_grid_attach (GTK_GRID (grid_up),lab_e, 0, 1, 2,  1);

	lab_profile = gtk_label_new("none");
	gtk_grid_attach (GTK_GRID (grid_up),lab_profile, 2, 1, 2,  1);

	lab_e = gtk_label_new("Keep SS:");
	gtk_grid_attach (GTK_GRID (grid_up),lab_e, 4, 1, 2,  1);

	sw_up_kss = gtk_switch_new();
	gtk_grid_attach (GTK_GRID (grid_up),sw_up_kss, 6, 1, 2,  1);

    grid_um = gtk_grid_new ();
	gtk_box_pack_start(GTK_BOX(vbox_nb_um), grid_um , FALSE, FALSE, 0);

	lab_e = gtk_label_new("Picture Preview:");
	gtk_grid_attach (GTK_GRID (grid_um),lab_e, 0, 0, 2,  1);

	sw_um_pp = gtk_switch_new();
	gtk_grid_attach (GTK_GRID (grid_um),sw_um_pp, 2, 0, 2,  1);

	lab_e = gtk_label_new("Window Size:");
//.........这里部分代码省略.........
开发者ID:BucketPW,项目名称:pomfit,代码行数:101,代码来源:settings.c

示例5: pgd_forms_create_widget


//.........这里部分代码省略.........
			  (gpointer)demo);
	gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 0);
	gtk_widget_show (button);

	gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
	gtk_widget_show (hbox);

	demo->timer_label = gtk_label_new (NULL);
	gtk_label_set_markup (GTK_LABEL (demo->timer_label), "<i>No form fields found</i>");
	g_object_set (G_OBJECT (demo->timer_label), "xalign", 1.0, NULL);
	gtk_box_pack_start (GTK_BOX (vbox), demo->timer_label, FALSE, TRUE, 0);
	gtk_widget_show (demo->timer_label);

	hpaned = gtk_hpaned_new ();

	demo->field_view = pgd_form_field_view_new ();

	swindow = gtk_scrolled_window_new (NULL, NULL);
	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow),
					GTK_POLICY_AUTOMATIC,
					GTK_POLICY_AUTOMATIC);
	
	demo->model = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING,
					  G_TYPE_INT, G_TYPE_BOOLEAN,
					  G_TYPE_STRING,
					  G_TYPE_STRING, G_TYPE_STRING,
					  G_TYPE_STRING, G_TYPE_OBJECT);
	treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (demo->model));

	renderer = gtk_cell_renderer_text_new ();
	gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),
						     0, "Form Field Type",
						     renderer,
						     "text", FORMS_FIELD_TYPE_COLUMN,
						     NULL);
	
	renderer = gtk_cell_renderer_text_new ();
	gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),
						     1, "Form Field Id",
						     renderer,
						     "text", FORMS_ID_COLUMN,
						     NULL);
	
	renderer = gtk_cell_renderer_toggle_new ();
	gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),
						     2, "Read Only",
						     renderer,
						     "active", FORMS_READ_ONLY_COLUMN,
						     NULL);

	renderer = gtk_cell_renderer_text_new ();
	gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),
						     3, "X1",
						     renderer,
						     "text", FORMS_X1_COLUMN,
						     NULL);
	renderer = gtk_cell_renderer_text_new ();
	gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),
						     4, "Y1",
						     renderer,
						     "text", FORMS_Y1_COLUMN,
						     NULL);
	renderer = gtk_cell_renderer_text_new ();
	gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),
						     5, "X2",
						     renderer,
						     "text", FORMS_X2_COLUMN,
						     NULL);
	renderer = gtk_cell_renderer_text_new ();
	gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),
						     6, "Y2",
						     renderer,
						     "text", FORMS_Y2_COLUMN,
						     NULL);
	
	selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview));
	g_signal_connect (G_OBJECT (selection), "changed",
			  G_CALLBACK (pgd_forms_selection_changed),
			  (gpointer)demo);

	gtk_container_add (GTK_CONTAINER (swindow), treeview);
	gtk_widget_show (treeview);

	gtk_paned_add1 (GTK_PANED (hpaned), swindow);
	gtk_widget_show (swindow);

	gtk_paned_add2 (GTK_PANED (hpaned), demo->field_view);
	gtk_widget_show (demo->field_view);

	gtk_paned_set_position (GTK_PANED (hpaned), 300);

	gtk_box_pack_start (GTK_BOX (vbox), hpaned, TRUE, TRUE, 0);
	gtk_widget_show (hpaned);

	g_object_weak_ref (G_OBJECT (vbox),
			   (GWeakNotify)pgd_forms_free,
			   demo);
	
	return vbox;
}
开发者ID:13609594236,项目名称:CrossApp,代码行数:101,代码来源:forms.c

示例6: main

int main( int   argc, 
          char *argv[] )
{
  GtkWidget *window;
  GtkWidget *drawing_area;
  GtkWidget *vbox;
  GtkWidget *v1box;
  GtkWidget *hbox;
  GtkWidget *button;
  
  gtk_init (&argc, &argv);
  printf("Helo\n");
  int i,j;
	for(i=0;i<1000;i++)
	{
		for(j=0;j<1000;j++)
		{
			pixels[i][j]=0;
			visited[i][j]=0;
		}
	}
	

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
  gtk_window_set_title(GTK_WINDOW(window), "pencil_project");

  vbox = gtk_vbox_new (FALSE, 0);
  gtk_container_add (GTK_CONTAINER (window), vbox);
  gtk_widget_show (vbox);

  g_signal_connect (GTK_WINDOW(window), "destroy",
                    G_CALLBACK (quit), NULL);

  hbox = gtk_hbox_new (FALSE, 0);
  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
  gtk_widget_show (hbox);
  v1box = newVerticalbox ( FALSE, 0, TRUE, TRUE, 0 );
  gtk_box_pack_start (GTK_BOX (hbox), v1box, FALSE, FALSE, 0);
  gtk_widget_show (v1box);
  
    /* Create the drawing area */
    
  drawing_area = gtk_drawing_area_new ();
  gtk_widget_set_size_request (GTK_WIDGET (drawing_area), breadth, height);//breadth,height global variables in buttons.h
  //cr = gdk_cairo_create(drawing_area->window);
  gtk_box_pack_start (GTK_BOX (hbox), drawing_area, TRUE, TRUE, 0);

  gtk_widget_show (drawing_area);

  g_signal_connect (drawing_area, "expose_event",
		    G_CALLBACK (expose_event),NULL);
 /* g_signal_connect (drawing_area, "configure_event",
		    G_CALLBACK (configure_event), NULL);

  /* Event signals */

  g_signal_connect (drawing_area, "motion_notify_event",
		    G_CALLBACK (motion_notify_event), NULL);//made them null as it don't have significance.
  handler_id = g_signal_connect (drawing_area, "button_press_event",
		    G_CALLBACK (button_press_event), NULL);

  gtk_widget_set_events (drawing_area, GDK_EXPOSURE_MASK
			 |GDK_LEAVE_NOTIFY_MASK
			 | GDK_BUTTON_PRESS_MASK
			 |GDK_POINTER_MOTION_MASK
			 | GDK_POINTER_MOTION_HINT_MASK);
  button = horizontal_box ( FALSE, 0, TRUE, TRUE, 0, TRUE );
  gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
  button = horizontal_box ( FALSE, 0, TRUE, TRUE, 0, FALSE );
  gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);   
  
   button = gtk_button_new_with_label ("Fill");
  gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
  g_signal_connect_swapped (button, "clicked", G_CALLBACK (button_press_event_fill), drawing_area);
 
                           
  gtk_widget_show_all (window);

  gtk_main ();

  return 0;
}
开发者ID:mdilip,项目名称:Programming-lab-assignment,代码行数:83,代码来源:pro_circle.c

示例7: word_list_window_init

static void
word_list_window_init (WordListWindow *window)
{
  GtkWidget *word_list, *vbox, *statusbar;
  GtkUIManager *ui;
  GtkActionGroup *actions;

  gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
  gtk_window_set_default_size(GTK_WINDOW(window), 600, 450);
  gtk_window_set_title(GTK_WINDOW(window), _("Edit the dictionary"));

#if GTK_CHECK_VERSION(3, 2, 0)
  vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
#else
  vbox = gtk_vbox_new(FALSE, 0);
#endif
  gtk_container_add(GTK_CONTAINER(window), vbox);
  gtk_widget_show(vbox);

  window->action_group = actions = gtk_action_group_new("Actions");
#if ENABLE_NLS
  gtk_action_group_set_translate_func(window->action_group,
				      translate_func, NULL, NULL);
#endif
  gtk_action_group_add_actions(actions, menu_action_entries,
			       n_menu_action_entries, window);

  gtk_action_group_add_radio_actions(actions, dictionary_entries,
				     n_dictionary_entries,
				     DICT_ENUM_DICTIONARY_TYPE_ANTHY,
				     G_CALLBACK(activate_radio_action),
				     window);

  window->ui_manager = ui = gtk_ui_manager_new();
  gtk_ui_manager_insert_action_group(ui, actions, 0);
  g_signal_connect(ui, "add_widget",
		   G_CALLBACK(add_widget_cb),
		   vbox);
  gtk_window_add_accel_group(GTK_WINDOW(window),
			     gtk_ui_manager_get_accel_group(ui));

  gtk_ui_manager_add_ui_from_file(ui,
				  UIM_DATADIR "/helperdata/uim-dict-ui.xml",
				  NULL);
  gtk_ui_manager_ensure_update(ui);

  window->word_list = word_list = word_list_view_new();
  word_list_view_set_visible_cclass_code_column(WORD_LIST_VIEW(word_list), TRUE);
  word_list_view_set_visible_freq_column(WORD_LIST_VIEW(word_list), TRUE);
  gtk_widget_show(word_list);
  gtk_box_pack_start(GTK_BOX(vbox), word_list, TRUE, TRUE, 0);

  g_signal_connect(G_OBJECT(gtk_bin_get_child(GTK_BIN(window->word_list))),
		   "button-press-event",
		   G_CALLBACK(word_list_button_press_cb), window);
  g_signal_connect(G_OBJECT(gtk_bin_get_child(GTK_BIN(window->word_list))),
		   "row-activated",
		   G_CALLBACK(word_list_row_activated_cb), window);
  g_signal_connect(G_OBJECT(gtk_bin_get_child(GTK_BIN(window->word_list))),
		   "key-press-event",
		   G_CALLBACK(word_list_key_press_cb), window);
  g_signal_connect(G_OBJECT(WORD_LIST_VIEW(window->word_list)->selection),
		   "changed",
		   G_CALLBACK(word_list_selection_changed_cb), window);

  window->statusbar = statusbar = gtk_statusbar_new();
  gtk_box_pack_start(GTK_BOX(vbox), statusbar, FALSE, FALSE, 0);
  gtk_widget_show(statusbar);

  word_list_window_set_sensitive(window);
}
开发者ID:doughdemon,项目名称:uim,代码行数:71,代码来源:word-list-win-gtk.c

示例8: help_about_action_cb

static void
help_about_action_cb(GtkAction *action, WordListWindow *window)
{
  const gchar *name = N_("uim-dict");
#if GTK_CHECK_VERSION(2, 6, 0)
  GdkPixbuf *pixbuf, *transparent;
  const gchar *filename = UIM_PIXMAPSDIR "/uim-dict.png";
  const gchar *authors[] = {
    "Masahito Omote <[email protected]>",
    "Takuro Ashie",
    "Etsushi Kato",
    NULL
  };
  const gchar *copyright = N_(
    "Copyright (C) 2003-2004 Masahito Omote\n"
    "Copyright (C) 2004-2013 uim Project\n"
    "All rights reserved.");

  transparent = NULL;
  pixbuf = gdk_pixbuf_new_from_file(filename, NULL);
  if (pixbuf) {
    transparent = gdk_pixbuf_add_alpha(pixbuf, TRUE, 0xff, 0xff, 0xff);
    g_object_unref(pixbuf);
  }
  
#if !GTK_CHECK_VERSION(2, 18, 0)
  gtk_about_dialog_set_url_hook (activate_url, NULL, NULL);
#endif
  gtk_show_about_dialog (GTK_WINDOW(window),
			 "name", name,
			 "version", VERSION,
			 "copyright", copyright,
			 "website", "https://github.com/uim/uim",
			 "authors", authors,
			 "logo", transparent,
			 NULL);
  g_object_unref(transparent);
#else
  GtkWidget *about_dialog, *label1;
  const gchar *copyright = N_(
    "Copyright 2003-2004 Masahito Omote &lt;[email protected]&gt;\n"
    "Copyright 2004-2013 uim Project https://github.com/uim/uim\n"
    "All rights reserved.");
  gchar *about_name =
    g_strdup_printf("<span size=\"20000\">%s %s </span>\n\n<span size=\"14000\">%s </span>\n", _(name), VERSION, _(copyright));

  about_dialog = gtk_dialog_new_with_buttons(_("About uim-dict"), NULL,
					     GTK_DIALOG_MODAL,
					     GTK_STOCK_OK,
					     GTK_RESPONSE_ACCEPT, NULL);
  gtk_container_set_border_width(GTK_CONTAINER(about_dialog), 8);

  label1 = gtk_label_new(NULL);
  gtk_widget_show(label1);
  gtk_label_set_markup(GTK_LABEL(label1), about_name);
  g_free(about_name);
  gtk_box_pack_start(
      GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(about_dialog))),
      label1, FALSE, FALSE, 0);

  gtk_window_set_transient_for(GTK_WINDOW(about_dialog),
			       GTK_WINDOW(window));
  gtk_window_set_position(GTK_WINDOW(about_dialog),
			  GTK_WIN_POS_CENTER_ON_PARENT);
  gtk_dialog_run(GTK_DIALOG(about_dialog));

  gtk_widget_destroy(about_dialog);
#endif
}
开发者ID:doughdemon,项目名称:uim,代码行数:69,代码来源:word-list-win-gtk.c

示例9: gtk_window_set_transient_for

bool wxMiniFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
      const wxPoint &pos, const wxSize &size,
      long style, const wxString &name )
{
    style = style | wxCAPTION;

    if ((style & wxCAPTION) || (style & wxTINY_CAPTION_HORIZ) || (style & wxTINY_CAPTION_VERT))
        m_miniTitle = 13;

    m_miniEdge = 3;
    m_isDragging = FALSE;
    m_oldX = -1;
    m_oldY = -1;
    m_diffX = 0;
    m_diffY = 0;

    wxFrame::Create( parent, id, title, pos, size, style, name );

    if (m_parent && (GTK_IS_WINDOW(m_parent->m_widget)))
    {
        gtk_window_set_transient_for( GTK_WINDOW(m_widget), GTK_WINDOW(m_parent->m_widget) );
    }
    
    if ((style & wxSYSTEM_MENU) &&
        ((style & wxCAPTION) || (style & wxTINY_CAPTION_HORIZ) || (style & wxTINY_CAPTION_VERT)))
    {
        GdkBitmap *mask = (GdkBitmap*) NULL;
        GdkPixmap *pixmap = gdk_pixmap_create_from_xpm_d
                            (
                                wxGetRootWindow()->window,
                                &mask,
                                NULL,
                                (char **)cross_xpm
                            );

        GtkWidget *pw = gtk_pixmap_new( pixmap, mask );
        gdk_bitmap_unref( mask );
        gdk_pixmap_unref( pixmap );
        gtk_widget_show( pw );

        GtkWidget *close_button = gtk_button_new();
        gtk_container_add( GTK_CONTAINER(close_button), pw );

        gtk_pizza_put( GTK_PIZZA(m_mainWidget),
                         close_button,
                         size.x-16, 4, 11, 11 );

        gtk_widget_show( close_button );

        gtk_signal_connect( GTK_OBJECT(close_button), "clicked",
          GTK_SIGNAL_FUNC(gtk_button_clicked_callback), (gpointer*)this );
    }

    /* these are called when the borders are drawn */
    gtk_signal_connect( GTK_OBJECT(m_mainWidget), "expose_event",
        GTK_SIGNAL_FUNC(gtk_window_own_expose_callback), (gpointer)this );

#ifndef __WXGTK20__
    gtk_signal_connect( GTK_OBJECT(m_mainWidget), "draw",
       GTK_SIGNAL_FUNC(gtk_window_own_draw_callback), (gpointer)this );
#endif

    /* these are required for dragging the mini frame around */
    gtk_signal_connect( GTK_OBJECT(m_mainWidget), "button_press_event",
      GTK_SIGNAL_FUNC(gtk_window_button_press_callback), (gpointer)this );

    gtk_signal_connect( GTK_OBJECT(m_mainWidget), "button_release_event",
      GTK_SIGNAL_FUNC(gtk_window_button_release_callback), (gpointer)this );

    gtk_signal_connect( GTK_OBJECT(m_mainWidget), "motion_notify_event",
      GTK_SIGNAL_FUNC(gtk_window_motion_notify_callback), (gpointer)this );

    return TRUE;
}
开发者ID:gitrider,项目名称:wxsj2,代码行数:74,代码来源:minifram.cpp

示例10: x264_gtk_encode_status_window

GtkWidget *
x264_gtk_encode_status_window (X264_Thread_Data *thread_data)
{
  GtkWidget *win_status;
  GtkWidget *table;
  GtkWidget *label;

  if (!thread_data) return NULL;

  win_status = thread_data->dialog = gtk_dialog_new ();
  gtk_window_set_title  (GTK_WINDOW (win_status), _("Encoding status"));
  thread_data->button = gtk_dialog_add_button (GTK_DIALOG (win_status),
                                               GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
  thread_data->end_button = gtk_dialog_add_button (GTK_DIALOG (thread_data->dialog),
                                                   GTK_STOCK_CLOSE, GTK_RESPONSE_CANCEL);
  gtk_widget_set_sensitive (thread_data->end_button, FALSE);

  g_signal_connect (G_OBJECT (win_status),
                    "delete-event",
                    G_CALLBACK (_delete_window_cb),
                    thread_data);
  g_signal_connect (G_OBJECT (win_status),
                    "response",
                    G_CALLBACK (_response_window_cb),
                    thread_data);

  table = gtk_table_new (5, 2, FALSE);
  gtk_table_set_row_spacings (GTK_TABLE (table), 6);
  gtk_table_set_col_spacings (GTK_TABLE (table), 6);
  gtk_container_set_border_width (GTK_CONTAINER (table), 6);
  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (win_status)->vbox), table,
                      FALSE, FALSE, 0);
  gtk_widget_show (table);

  label = gtk_label_new (_("Current video frame:"));
  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
  gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 0, 1);
  gtk_widget_show (label);

  thread_data->current_video_frame = gtk_entry_new ();
  gtk_editable_set_editable (GTK_EDITABLE (thread_data->current_video_frame), FALSE);
  gtk_table_attach_defaults (GTK_TABLE (table),
                             thread_data->current_video_frame,
                             1, 2, 0, 1);
  gtk_widget_show (thread_data->current_video_frame);

  label = gtk_label_new (_("Video data:"));
  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
  gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 1, 2);
  gtk_widget_show (label);

  thread_data->video_data = gtk_entry_new ();
  gtk_entry_set_text (GTK_ENTRY (thread_data->video_data), _("0KB"));
  gtk_editable_set_editable (GTK_EDITABLE (thread_data->video_data), FALSE);
  gtk_table_attach_defaults (GTK_TABLE (table), thread_data->video_data,
                             1, 2, 1, 2);
  gtk_widget_show (thread_data->video_data);

  label = gtk_label_new (_("Video rendering rate:"));
  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
  gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 2, 3);
  gtk_widget_show (label);

  thread_data->video_rendering_rate = gtk_entry_new ();
  gtk_editable_set_editable (GTK_EDITABLE (thread_data->video_rendering_rate), FALSE);
  gtk_table_attach_defaults (GTK_TABLE (table),
                             thread_data->video_rendering_rate,
                             1, 2, 2, 3);
  gtk_widget_show (thread_data->video_rendering_rate);

  label = gtk_label_new (_("Time elapsed:"));
  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
  gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 3, 4);
  gtk_widget_show (label);

  thread_data->time_elapsed = gtk_entry_new ();
  gtk_editable_set_editable (GTK_EDITABLE (thread_data->time_elapsed), FALSE);
  gtk_table_attach_defaults (GTK_TABLE (table), thread_data->time_elapsed,
                             1, 2, 3, 4);
  gtk_widget_show (thread_data->time_elapsed);

  label = gtk_label_new (_("Time remaining (estimated):"));
  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
  gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 4, 5);
  gtk_widget_show (label);

  thread_data->time_remaining = gtk_entry_new ();
  gtk_editable_set_editable (GTK_EDITABLE (thread_data->time_remaining), FALSE);
  gtk_table_attach_defaults (GTK_TABLE (table), thread_data->time_remaining,
                             1, 2, 4, 5);
  gtk_widget_show (thread_data->time_remaining);

  table = gtk_table_new (1, 2, FALSE);
  gtk_table_set_row_spacings (GTK_TABLE (table), 6);
  gtk_table_set_col_spacings (GTK_TABLE (table), 6);
  gtk_container_set_border_width (GTK_CONTAINER (table), 6);
  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (win_status)->vbox), table,
                      FALSE, FALSE, 0);
  gtk_widget_show (table);

//.........这里部分代码省略.........
开发者ID:275958081,项目名称:netfox,代码行数:101,代码来源:x264_gtk_encode_status_window.c

示例11: zar_sprav_m

int zar_sprav_m(class zar_sprav_rek *rek,GtkWidget *wpredok)
{

class zar_sprav_m_data data;
char strsql[512];
iceb_u_str kikz;
data.rk=rek;
 
data.window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_position( GTK_WINDOW(data.window),ICEB_POS_CENTER);
gtk_window_set_modal(GTK_WINDOW(data.window),TRUE);

GtkWidget *label=NULL;

sprintf(strsql,"%s %s",name_system,gettext("Распечатать справку о зарплате"));

if(data.rk->metka_vr == 1)
 label=gtk_label_new(gettext("Распечатать справку о доходах"));
if(data.rk->metka_vr == 2)
 label=gtk_label_new(gettext("Распечатать расчёт средней зарплаты для начисления больничного"));
if(data.rk->metka_vr == 3)
 label=gtk_label_new(gettext("Распечатать расчёт средней зарплаты для социальной помощи"));
if(data.rk->metka_vr == 4)
 label=gtk_label_new(gettext("Распечатать справку о доходах в счёт месяцев начисления"));
if(data.rk->metka_vr == 6)
 label=gtk_label_new(gettext("Распечатать расчёт отпускных"));

gtk_window_set_title(GTK_WINDOW(data.window),strsql);
gtk_signal_connect(GTK_OBJECT(data.window),"delete_event",GTK_SIGNAL_FUNC(gtk_widget_destroy),NULL);
gtk_signal_connect(GTK_OBJECT(data.window),"destroy",GTK_SIGNAL_FUNC(gtk_main_quit),NULL);
gtk_signal_connect_after(GTK_OBJECT(data.window),"key_press_event",GTK_SIGNAL_FUNC(zar_sprav_m_key_press),&data);

if(wpredok != NULL)
 {
  gdk_window_set_cursor(wpredok->window,gdk_cursor_new(ICEB_CURSOR_GDITE));
  //Удерживать окно над породившем его окном всегда
  gtk_window_set_transient_for(GTK_WINDOW(data.window),GTK_WINDOW(wpredok));
  //Закрыть окно если окно предок удалено
  gtk_window_set_destroy_with_parent(GTK_WINDOW(data.window),TRUE);
 }

GtkWidget *vbox = gtk_vbox_new (FALSE, 0);
GtkWidget *hbox[KOLENTER];
for(int i=0; i < KOLENTER; i++)
 hbox[i] = gtk_hbox_new (FALSE, 0);
GtkWidget *hboxknop = gtk_hbox_new (FALSE, 0);

gtk_container_add (GTK_CONTAINER (data.window), vbox);
gtk_container_add (GTK_CONTAINER (vbox), label);

data.label_fio=gtk_label_new(data.rk->fio.ravno_toutf());
gtk_container_add (GTK_CONTAINER (vbox), data.label_fio);

for(int i=0; i < KOLENTER; i++)
 gtk_container_add (GTK_CONTAINER (vbox), hbox[i]);



gtk_container_add (GTK_CONTAINER (vbox), hboxknop);

GtkTooltips *tooltips_enter[KOLENTER];

sprintf(strsql,"%s",gettext("Табельный номер"));
data.knopka_enter[E_TABNOM]=gtk_button_new_with_label(iceb_u_toutf(strsql));
gtk_box_pack_start (GTK_BOX (hbox[E_TABNOM]), data.knopka_enter[E_TABNOM], FALSE, FALSE, 0);
gtk_signal_connect(GTK_OBJECT(data.knopka_enter[E_TABNOM]),"clicked",GTK_SIGNAL_FUNC(zar_sprav_m_e_knopka),&data);
gtk_object_set_user_data(GTK_OBJECT(data.knopka_enter[E_TABNOM]),(gpointer)E_TABNOM);
tooltips_enter[E_TABNOM]=gtk_tooltips_new();
gtk_tooltips_set_tip(tooltips_enter[E_TABNOM],data.knopka_enter[E_TABNOM],gettext("Выбор табельного номера"),NULL);

data.entry[E_TABNOM] = gtk_entry_new();
gtk_box_pack_start (GTK_BOX (hbox[E_TABNOM]), data.entry[E_TABNOM], FALSE, FALSE, 0);
gtk_signal_connect(GTK_OBJECT (data.entry[E_TABNOM]), "activate",GTK_SIGNAL_FUNC(zar_sprav_m_vvod),&data);
gtk_entry_set_text(GTK_ENTRY(data.entry[E_TABNOM]),data.rk->tabnom.ravno_toutf());
gtk_object_set_user_data(GTK_OBJECT(data.entry[E_TABNOM]),(gpointer)E_TABNOM);



sprintf(strsql,"%s %s",gettext("Дата начала"),gettext("(м.г)"));
data.knopka_enter[E_DATAN]=gtk_button_new_with_label(iceb_u_toutf(strsql));
gtk_box_pack_start (GTK_BOX (hbox[E_DATAN]), data.knopka_enter[E_DATAN], FALSE, FALSE, 0);
gtk_signal_connect(GTK_OBJECT(data.knopka_enter[E_DATAN]),"clicked",GTK_SIGNAL_FUNC(zar_sprav_m_e_knopka),&data);
gtk_object_set_user_data(GTK_OBJECT(data.knopka_enter[E_DATAN]),(gpointer)E_DATAN);
tooltips_enter[E_DATAN]=gtk_tooltips_new();
gtk_tooltips_set_tip(tooltips_enter[E_DATAN],data.knopka_enter[E_DATAN],gettext("Выбор даты"),NULL);

data.entry[E_DATAN] = gtk_entry_new_with_max_length (7);
gtk_box_pack_start (GTK_BOX (hbox[E_DATAN]), data.entry[E_DATAN], FALSE, FALSE, 0);
gtk_signal_connect(GTK_OBJECT (data.entry[E_DATAN]), "activate",GTK_SIGNAL_FUNC(zar_sprav_m_vvod),&data);
gtk_entry_set_text(GTK_ENTRY(data.entry[E_DATAN]),data.rk->datan.ravno_toutf());
gtk_object_set_user_data(GTK_OBJECT(data.entry[E_DATAN]),(gpointer)E_DATAN);


sprintf(strsql,"%s %s",gettext("Дата конца"),gettext("(м.г)"));
data.knopka_enter[E_DATAK]=gtk_button_new_with_label(iceb_u_toutf(strsql));
gtk_box_pack_start (GTK_BOX (hbox[E_DATAK]), data.knopka_enter[E_DATAK], FALSE, FALSE, 0);
gtk_signal_connect(GTK_OBJECT(data.knopka_enter[E_DATAK]),"clicked",GTK_SIGNAL_FUNC(zar_sprav_m_e_knopka),&data);
gtk_object_set_user_data(GTK_OBJECT(data.knopka_enter[E_DATAK]),(gpointer)E_DATAK);
tooltips_enter[E_DATAK]=gtk_tooltips_new();
gtk_tooltips_set_tip(tooltips_enter[E_DATAK],data.knopka_enter[E_DATAK],gettext("Выбор даты"),NULL);
//.........这里部分代码省略.........
开发者ID:zaharchuktv,项目名称:linuxbuh,代码行数:101,代码来源:zar_sprav_m.c

示例12: gtk_ellipsis_size_allocate

static void
gtk_ellipsis_size_allocate (GtkWidget     *widget,
			    GtkAllocation *allocation)
{
  GtkEllipsis *ellipsis;
  GtkBin *bin;
  GtkEllipsisPrivate *priv;
  GtkRequisition child_requisition;
  gint border_width;
  gint focus_width;
  gint focus_pad;

  ellipsis = GTK_ELLIPSIS (widget);
  bin = GTK_BIN (widget);
  priv = ellipsis->priv;

  border_width = GTK_CONTAINER (widget)->border_width;

  gtk_widget_style_get (widget,
			"focus-line-width", &focus_width,
			"focus-padding", &focus_pad,
			NULL);

  child_requisition.width = 0;
  child_requisition.height = 0;
  if (bin->child && priv->expanded)
    gtk_widget_get_child_requisition (bin->child, &child_requisition);

  widget->allocation = *allocation;

  if (priv->label && GTK_WIDGET_VISIBLE (priv->label) && !priv->expanded)
    {
      GtkAllocation label_allocation;
      GtkAllocation ellipsis_allocation;
      GtkRequisition ellipsis_requisition;
      PangoLayout *layout;
      gboolean ltr;

      label_allocation.y = (widget->allocation.y + border_width
			    + focus_width + focus_pad);
      label_allocation.width = MAX (1,
				    allocation->width - 2 * border_width -
				    GTK_ELLIPSIS_SPACING -
				    2 * focus_width - 2 * focus_pad);

      label_allocation.height = get_label_line_height (priv->label);
      label_allocation.height = MIN (label_allocation.height,
				     allocation->height - 2 * border_width -
				     2 * focus_width - 2 * focus_pad);
      label_allocation.height = MAX (label_allocation.height, 1);

      ltr = gtk_widget_get_direction (widget) != GTK_TEXT_DIR_RTL;

      if (priv->ellipsis_label && GTK_WIDGET_VISIBLE (priv->label))
        {
          gtk_widget_get_child_requisition (priv->ellipsis_label,
					    &ellipsis_requisition);

          if (ltr)
            ellipsis_allocation.x = widget->allocation.x
				    + widget->allocation.width - border_width
			            - GTK_ELLIPSIS_OUT_SPACING
			            - ellipsis_requisition.width;
          else
            ellipsis_allocation.x = widget->allocation.x
				    + border_width
            			    + GTK_ELLIPSIS_OUT_SPACING;

          ellipsis_allocation.y = label_allocation.y;
          ellipsis_allocation.width = ellipsis_requisition.width;
          ellipsis_allocation.height = ellipsis_requisition.height;

	  gtk_widget_size_allocate (priv->ellipsis_label,
				    &ellipsis_allocation);

          label_allocation.width = MAX (1, label_allocation.width -
				        ellipsis_allocation.width);
        }

      if (ltr)
	label_allocation.x = (widget->allocation.x +
                              border_width + focus_width + focus_pad);
      else
        label_allocation.x = (widget->allocation.x + widget->allocation.width -
                              (label_allocation.width +
                               border_width + focus_width + focus_pad));

      /* HACK!  We know that GtkLabel only sets the PangoLayout's width
	 in its size_request method, so we are free to do that here.
	 Together with setting the X alignment to 0.0, this truncates
	 the label to whatever fits in the first line.  */
      layout = gtk_label_get_layout (GTK_LABEL (priv->label));
      pango_layout_set_width (layout, label_allocation.width * PANGO_SCALE);
      gtk_widget_size_allocate (priv->label, &label_allocation);

      if (GTK_WIDGET_REALIZED (widget))
        gdk_window_move_resize (priv->event_window,
			        allocation->x + border_width, 
			        allocation->y + border_width, 
			        MAX (allocation->width - 2 * border_width, 1), 
//.........这里部分代码省略.........
开发者ID:JamesLinus,项目名称:gtk-widgets,代码行数:101,代码来源:gtkellipsis.c

示例13: gtk_ellipsis_realize

static void
gtk_ellipsis_realize (GtkWidget *widget)
{
  GtkEllipsis *ellipsis;
  GtkEllipsisPrivate *priv;
  GdkWindowAttr attributes;
  gint attributes_mask;
  gint border_width;
  gint label_height;

  ellipsis = GTK_ELLIPSIS (widget);
  priv = ellipsis->priv;
  GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);

  border_width = GTK_CONTAINER (widget)->border_width;

  if (priv->label && GTK_WIDGET_VISIBLE (priv->label))
    {
      gint focus_width, focus_pad;

      gtk_widget_style_get (widget,
			    "focus-line-width", &focus_width,
			    "focus-padding", &focus_pad,
			    NULL);

      label_height = get_label_line_height (priv->label);
      label_height = MIN (label_height,
                          widget->allocation.height - 2 * border_width -
                          2 * focus_width - 2 * focus_pad);
    }
  else
    label_height = 0;

  attributes.window_type = GDK_WINDOW_CHILD;
  attributes.x = widget->allocation.x + border_width;
  attributes.y = widget->allocation.y + border_width;
  attributes.width = MAX (widget->allocation.width - 2 * border_width, 1);
  attributes.height = MAX (label_height, 1);
  attributes.wclass = GDK_INPUT_ONLY;
  attributes.event_mask = gtk_widget_get_events (widget)     |
				GDK_BUTTON_PRESS_MASK        |
				GDK_BUTTON_RELEASE_MASK      |
				GDK_ENTER_NOTIFY_MASK        |
				GDK_LEAVE_NOTIFY_MASK;

  attributes_mask = GDK_WA_X | GDK_WA_Y;
  if (GTK_WIDGET_IS_SENSITIVE (widget))
    {
      attributes.cursor = gdk_cursor_new_for_display (gtk_widget_get_display (widget),
                                                      GTK_ELLIPSIS_CURSOR);
      attributes_mask |= GDK_WA_CURSOR;
    }

  widget->window = gtk_widget_get_parent_window (widget);
  g_object_ref (widget->window);

  priv->event_window = gdk_window_new (gtk_widget_get_parent_window (widget),
				       &attributes, attributes_mask);
  gdk_window_set_user_data (priv->event_window, widget);
  if (attributes_mask & GDK_WA_CURSOR)
    gdk_cursor_unref (attributes.cursor);

  widget->style = gtk_style_attach (widget->style, widget->window);

  if (priv->label && GTK_WIDGET_VISIBLE (priv->label) && !priv->expanded)
    gdk_window_show (priv->event_window);
}
开发者ID:JamesLinus,项目名称:gtk-widgets,代码行数:67,代码来源:gtkellipsis.c

示例14: cast_GtkContainer

GtkContainer* cast_GtkContainer(GtkWidget* widget) {
    return GTK_CONTAINER(widget);
}
开发者ID:claywagnerio,项目名称:gtk,代码行数:3,代码来源:gtk_glue.c

示例15: prefs_common_page

GtkWidget *
prefs_common_page (void)
{
    GtkWidget *main_vbox;
    GtkWidget *vbox1;
    GtkWidget *frame1;
    GtkWidget *button1;
    GtkWidget *button2;
    GSList *vbox1_group = NULL;
    GtkWidget *frame2;
    GtkWidget *vbox2;
    GtkWidget *radiobutton1;
    GtkWidget *radiobutton2;
    GtkWidget *radiobutton3;
    GtkWidget *checkbutton1;
    GtkWidget *checkbutton2;

    main_vbox = gtk_vbox_new (FALSE, 0);
    gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 10);

    frame1 = gtk_frame_new (_(" Startup Directory "));
    gtk_box_pack_start (GTK_BOX (main_vbox), frame1, FALSE, FALSE, 0);

    vbox1 = gtk_vbox_new (FALSE, 0);
    gtk_container_set_border_width (GTK_CONTAINER (vbox1), 10);
    gtk_container_add (GTK_CONTAINER (frame1), vbox1);

    radiobutton1 =
	gtk_radio_button_new_with_label (vbox1_group, _("Home directory"));
    vbox1_group = gtk_radio_button_group (GTK_RADIO_BUTTON (radiobutton1));
    gtk_box_pack_start (GTK_BOX (vbox1), radiobutton1, FALSE, FALSE, 0);

    radiobutton2 =
	gtk_radio_button_new_with_label (vbox1_group,
					 _("Go to last visited location"));
    vbox1_group = gtk_radio_button_group (GTK_RADIO_BUTTON (radiobutton2));
    gtk_box_pack_start (GTK_BOX (vbox1), radiobutton2, FALSE, FALSE, 0);

    radiobutton3 =
	gtk_radio_button_new_with_label (vbox1_group,
					 _("Go to this directory:"));
    vbox1_group = gtk_radio_button_group (GTK_RADIO_BUTTON (radiobutton3));
    gtk_box_pack_start (GTK_BOX (vbox1), radiobutton3, FALSE, FALSE, 0);

    prefs_win.startup_dir_table = gtk_table_new (2, 2, FALSE);
    gtk_box_pack_start (GTK_BOX (vbox1), prefs_win.startup_dir_table, TRUE,
			TRUE, 0);

    prefs_win.startup_dir_entry = gtk_entry_new ();
    gtk_table_attach (GTK_TABLE (prefs_win.startup_dir_table),
		      prefs_win.startup_dir_entry, 0, 1, 0, 1,
		      (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
		      (GtkAttachOptions) (0), 0, 0);

    button1 = gtk_button_new_with_label (_("Browse..."));
    gtk_table_attach (GTK_TABLE (prefs_win.startup_dir_table), button1, 1, 2,
		      0, 1, (GtkAttachOptions) (GTK_FILL),
		      (GtkAttachOptions) (0), 0, 0);

    button2 = gtk_button_new_with_label (_("Current"));
    gtk_table_attach (GTK_TABLE (prefs_win.startup_dir_table), button2, 1, 2,
		      1, 2, (GtkAttachOptions) (GTK_FILL),
		      (GtkAttachOptions) (0), 0, 0);
    gtk_widget_set_usize (button2, 90, -2);
    gtk_widget_show_all (frame1);

    frame2 = gtk_frame_new (_(" Main Window "));
    gtk_box_pack_start (GTK_BOX (main_vbox), frame2, FALSE, FALSE, 10);

    vbox2 = gtk_vbox_new (FALSE, 0);
    gtk_container_set_border_width (GTK_CONTAINER (vbox2), 10);
    gtk_container_add (GTK_CONTAINER (frame2), vbox2);

    checkbutton1 =
	gtk_check_button_new_with_label (_("Remember window size"));
    gtk_box_pack_start (GTK_BOX (vbox2), checkbutton1, FALSE, FALSE, 0);

    checkbutton2 = gtk_check_button_new_with_label (_("Enable/Disable dock"));
    gtk_box_pack_start (GTK_BOX (vbox2), checkbutton2, FALSE, FALSE, 0);
    gtk_widget_show_all (frame2);

    gtk_widget_set_sensitive (GTK_WIDGET (prefs_win.startup_dir_table),
			      FALSE);

    if (conf.startup_dir_mode == 0)
	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radiobutton1), TRUE);
    else if (conf.startup_dir_mode == 1)
	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radiobutton2), TRUE);
    else
    {
	gtk_entry_set_text (GTK_ENTRY (prefs_win.startup_dir_entry),
			    conf.startup_dir);

	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radiobutton3), TRUE);
	gtk_widget_set_sensitive (GTK_WIDGET (prefs_win.startup_dir_table),
				  TRUE);
    }

    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbutton1),
				  conf.save_win_state);
//.........这里部分代码省略.........
开发者ID:gentoo,项目名称:pornview,代码行数:101,代码来源:prefs_ui_common.c


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