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


C++ gtk_widget_set_events函数代码示例

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


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

示例1: main

int 
main (int argc, char **argv)
{
  char *text;
  GtkWidget *window;
  GtkWidget *scrollwin;
  GtkWidget *vbox, *hbox;
  GtkWidget *frame;
  GtkWidget *checkbutton;

  gtk_init (&argc, &argv);
  
  if (argc != 2)
    {
      fprintf (stderr, "Usage: %s FILE\n", g_get_prgname ());
      exit(1);
    }

  /* Create the list of paragraphs from the supplied file
   */
  text = read_file (argv[1]);
  if (!text)
    exit(1);

  context = pango_win32_get_context ();

  paragraphs = split_paragraphs (text);

  pango_context_set_language (context, pango_language_from_string ("en_US"));
  pango_context_set_base_dir (context, PANGO_DIRECTION_LTR);

  font_description = pango_font_description_new ();
  pango_font_description_set_family(font_description, "sans");
  pango_font_description_set_size(font_description, 16 * PANGO_SCALE);
#if 0 /* default init ok? */
  font_description.style = PANGO_STYLE_NORMAL;
  font_description.variant = PANGO_VARIANT_NORMAL;
  font_description.weight = 500;
  font_description.stretch = PANGO_STRETCH_NORMAL;
#endif

  pango_context_set_font_description (context, font_description);

  /* Create the user interface
   */
  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_default_size (GTK_WINDOW (window), 400, 400);

  gtk_signal_connect (GTK_OBJECT (window), "destroy",
		      GTK_SIGNAL_FUNC (gtk_main_quit), NULL);

  vbox = gtk_vbox_new (FALSE, 4);
  gtk_container_add (GTK_CONTAINER (window), vbox);

  hbox = make_font_selector ();
  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
  
  scrollwin = gtk_scrolled_window_new (NULL, NULL);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrollwin),
				  GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
  
  gtk_box_pack_start (GTK_BOX (vbox), scrollwin, TRUE, TRUE, 0);
  
  layout = gtk_layout_new (NULL, NULL);
  gtk_widget_set_events (layout, GDK_BUTTON_PRESS_MASK);
  gtk_widget_set_app_paintable (layout, TRUE);

  gtk_signal_connect (GTK_OBJECT (layout), "size_allocate",
		      GTK_SIGNAL_FUNC (size_allocate), paragraphs);
  gtk_signal_connect (GTK_OBJECT (layout), "expose_event",
		      GTK_SIGNAL_FUNC (expose), paragraphs);
  gtk_signal_connect (GTK_OBJECT (layout), "draw",
		      GTK_SIGNAL_FUNC (draw), paragraphs);
  gtk_signal_connect (GTK_OBJECT (layout), "button_press_event",
		      GTK_SIGNAL_FUNC (button_press), paragraphs);
#if GTK_CHECK_VERSION (1,3,2)
  gtk_widget_set_double_buffered (layout, FALSE);
#endif
  gtk_container_add (GTK_CONTAINER (scrollwin), layout);

  frame = gtk_frame_new (NULL);
  gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
  gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);

  message_label = gtk_label_new ("Current char:");
  gtk_misc_set_padding (GTK_MISC (message_label), 1, 1);
  gtk_misc_set_alignment (GTK_MISC (message_label), 0.0, 0.5);
  gtk_container_add (GTK_CONTAINER (frame), message_label);

  checkbutton = gtk_check_button_new_with_label ("Use RTL global direction");
  gtk_signal_connect (GTK_OBJECT (checkbutton), "toggled",
		      GTK_SIGNAL_FUNC (checkbutton_toggled), NULL);
  gtk_box_pack_start (GTK_BOX (vbox), checkbutton, FALSE, FALSE, 0);

  gtk_widget_show_all (window);

  gtk_main ();
  
  return 0;
}
开发者ID:nihed,项目名称:magnetism,代码行数:100,代码来源:viewer-win32.c

示例2: mate_panel_applet_register

AppletInfo *
mate_panel_applet_register (GtkWidget       *applet,
		       gpointer         data,
		       GDestroyNotify   data_destroy,
		       PanelWidget     *panel,
		       gboolean         locked,
		       gint             pos,
		       gboolean         exactpos,
		       PanelObjectType  type,
		       const char      *id)
{
	AppletInfo *info;
	gchar *path;
	gchar *locked_changed;

	g_return_val_if_fail (applet != NULL && panel != NULL, NULL);

	if (gtk_widget_get_has_window (applet))
		gtk_widget_set_events (applet, (gtk_widget_get_events (applet) |
						APPLET_EVENT_MASK) &
				       ~( GDK_POINTER_MOTION_MASK |
					  GDK_POINTER_MOTION_HINT_MASK));

	info = g_new0 (AppletInfo, 1);
	info->type         = type;
	info->widget       = applet;
	info->menu         = NULL;
	info->data         = data;
	info->data_destroy = data_destroy;
	info->user_menu    = NULL;
	info->move_item    = NULL;
	info->id           = g_strdup (id);

	path = g_strdup_printf (PANEL_OBJECT_PATH "%s/", id);
	info->settings = g_settings_new_with_path (PANEL_OBJECT_SCHEMA, path);
	g_free (path);

	g_object_set_data (G_OBJECT (applet), "applet_info", info);

	if (type != PANEL_OBJECT_APPLET)
		panel_lockdown_notify_add (G_CALLBACK (mate_panel_applet_recreate_menu),
					   info);

	locked_changed = g_strdup_printf ("changed::%s", PANEL_OBJECT_LOCKED_KEY);
	g_signal_connect (info->settings,
					  locked_changed,
					  G_CALLBACK (mate_panel_applet_locked_change_notify),
					  G_OBJECT (applet));
	g_free (locked_changed);

	if (type == PANEL_OBJECT_DRAWER) {
		Drawer *drawer = data;
		PanelWidget *assoc_panel;

		assoc_panel = panel_toplevel_get_panel_widget (drawer->toplevel);

		g_object_set_data (G_OBJECT (applet),
				   MATE_PANEL_APPLET_ASSOC_PANEL_KEY, assoc_panel);
		assoc_panel->master_widget = applet;
		g_object_add_weak_pointer (
			G_OBJECT (applet), (gpointer *) &assoc_panel->master_widget);
	}

	g_object_set_data (G_OBJECT (applet),
			   MATE_PANEL_APPLET_FORBIDDEN_PANELS, NULL);

	registered_applets = g_slist_append (registered_applets, info);

	if (panel_widget_add (panel, applet, locked, pos, exactpos) == -1 &&
	    panel_widget_add (panel, applet, locked, 0, TRUE) == -1) {
		GSList *l;

		for (l = panels; l; l = l->next) {
			panel = PANEL_WIDGET (l->data);

			if (panel_widget_add (panel, applet, locked, 0, TRUE) != -1)
				break;
		}

		if (!l) {
			g_warning (_("Cannot find an empty spot"));
			panel_profile_delete_object (info);
			return NULL;
		}
	}

	if (BUTTON_IS_WIDGET (applet) ||
	    gtk_widget_get_has_window (applet)) {
		g_signal_connect (applet, "button_press_event",
				  G_CALLBACK (applet_button_press),
				  info);

		g_signal_connect (applet, "popup_menu",
				  G_CALLBACK (applet_popup_menu),
				  info);
	}

	g_signal_connect (applet, "destroy",
			  G_CALLBACK (mate_panel_applet_destroy),
			  info);
//.........这里部分代码省略.........
开发者ID:mate-desktop,项目名称:mate-panel,代码行数:101,代码来源:applet.c

示例3: init_stuff


//.........这里部分代码省略.........
    GTK_CHECK_MENU_ITEM(GET_COMPONENT("journalApplyAllPages")), ui.bg_apply_all_pages);
  gtk_check_menu_item_set_active(
    GTK_CHECK_MENU_ITEM(GET_COMPONENT("journalNewPageKeepsBG")), ui.new_page_bg_from_pdf);
  if (ui.fullscreen) {
    gtk_check_menu_item_set_active(
      GTK_CHECK_MENU_ITEM(GET_COMPONENT("viewFullscreen")), TRUE);
    gtk_toggle_tool_button_set_active(
      GTK_TOGGLE_TOOL_BUTTON(GET_COMPONENT("buttonFullscreen")), TRUE);
    gtk_window_fullscreen(GTK_WINDOW(winMain));
  }
  gtk_button_set_relief(GTK_BUTTON(GET_COMPONENT("buttonColorChooser")), GTK_RELIEF_NONE);

  allow_all_accels();
  add_scroll_bindings();

  // prevent interface items from stealing focus
  // glade doesn't properly handle can_focus, so manually set it
  gtk_combo_box_set_focus_on_click(GTK_COMBO_BOX(GET_COMPONENT("comboLayer")), FALSE);
  g_signal_connect(GET_COMPONENT("spinPageNo"), "activate",
          G_CALLBACK(handle_activate_signal), NULL);
  gtk_container_forall(GTK_CONTAINER(winMain), unset_flags, (gpointer)GTK_CAN_FOCUS);
  GTK_WIDGET_SET_FLAGS(GTK_WIDGET(canvas), GTK_CAN_FOCUS);
  GTK_WIDGET_SET_FLAGS(GTK_WIDGET(GET_COMPONENT("spinPageNo")), GTK_CAN_FOCUS);
  
  // install hooks on button/key/activation events to make the spinPageNo lose focus
  gtk_container_forall(GTK_CONTAINER(winMain), install_focus_hooks, NULL);

  // set up and initialize the canvas

  gtk_widget_show (GTK_WIDGET (canvas));
  w = GET_COMPONENT("scrolledwindowMain");
  gtk_container_add (GTK_CONTAINER (w), GTK_WIDGET (canvas));
  gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW (w), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
  gtk_widget_set_events (GTK_WIDGET (canvas), 
     GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK | GDK_BUTTON_MOTION_MASK | 
     GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | 
     GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK |
     GDK_PROXIMITY_IN_MASK | GDK_PROXIMITY_OUT_MASK);
  gnome_canvas_set_pixels_per_unit (canvas, ui.zoom);
  gnome_canvas_set_center_scroll_region (canvas, TRUE);
  gtk_layout_get_hadjustment(GTK_LAYOUT (canvas))->step_increment = ui.scrollbar_step_increment;
  gtk_layout_get_vadjustment(GTK_LAYOUT (canvas))->step_increment = ui.scrollbar_step_increment;

  // set up the page size and canvas size
  update_page_stuff();

  g_signal_connect ((gpointer) canvas, "button_press_event",
                    G_CALLBACK (on_canvas_button_press_event),
                    NULL);
  g_signal_connect ((gpointer) canvas, "button_release_event",
                    G_CALLBACK (on_canvas_button_release_event),
                    NULL);
  g_signal_connect ((gpointer) canvas, "enter_notify_event",
                    G_CALLBACK (on_canvas_enter_notify_event),
                    NULL);
  g_signal_connect ((gpointer) canvas, "leave_notify_event",
                    G_CALLBACK (on_canvas_leave_notify_event),
                    NULL);
  g_signal_connect ((gpointer) canvas, "proximity_in_event",
                    G_CALLBACK (on_canvas_proximity_event),
                    NULL);
  g_signal_connect ((gpointer) canvas, "proximity_out_event",
                    G_CALLBACK (on_canvas_proximity_event),
                    NULL);
  g_signal_connect ((gpointer) canvas, "expose_event",
                    G_CALLBACK (on_canvas_expose_event),
开发者ID:jyby,项目名称:xournal,代码行数:67,代码来源:main.c

示例4: AddReferenceImage

/*********************************************
* AddReferenceImage関数                      *
* 参考用画像の表示を追加                     *
* 引数                                       *
* reference	: 参考用画像表示ウィンドウの情報 *
* file_name	: 追加するファイル名             *
* pixels	: 画像のピクセルデータ           *
* width		: 画像の幅                       *
* height	: 画像の高さ                     *
* stride	: 画像の1行分のバイト数          *
* channel	: 画像のチャンネル数             *
*********************************************/
static void AddReferenceImage(
	REFERENCE_WINDOW* reference,
	const char* file_name,
	uint8* pixels,
	int width,
	int height,
	int stride,
	int channel
)
{
	GtkWidget *tab_label;
	GtkWidget *alignment;
	cairo_format_t format = (stride / width == 4) ? CAIRO_FORMAT_ARGB32 : CAIRO_FORMAT_RGB24;

	REFERENCE_IMAGE *image;
	image = reference->data->images[reference->data->num_image] =
		(REFERENCE_IMAGE*)MEM_ALLOC_FUNC(sizeof(**reference->data->images));
	image->pixels = pixels;
	image->width = width;
	image->height = height;
	image->stride = stride;
	image->channel = (uint8)channel;
	image->surface_p = cairo_image_surface_create_for_data(image->pixels,
		format, image->width, image->height, image->stride);
	image->zoom = image->rev_zoom = 1;
	image->app = reference->app;

	image->draw_area = gtk_drawing_area_new();
	gtk_widget_set_size_request(image->draw_area, image->width, image->height);
	gtk_widget_set_events(image->draw_area, GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK
		| GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK);
	(void)g_signal_connect(G_OBJECT(image->draw_area), "destroy",
		G_CALLBACK(OnDestroyReferenceImageDrawArea), image);
#if GTK_MAJOR_VERSION <= 2
	(void)g_signal_connect(G_OBJECT(image->draw_area), "expose_event",
		G_CALLBACK(DisplayReferenceImage), image);
#else
	(void)g_signal_connect(G_OBJECT(image->draw_area), "draw",
		G_CALLBACK(DisplayReferenceImage), image);
#endif
	(void)g_signal_connect(G_OBJECT(image->draw_area), "button_press_event",
		G_CALLBACK(ReferenceImageButtonPress), image);
	alignment = gtk_alignment_new(0.5f, 0.5f, 0.0f, 0.0f);
	gtk_container_add(GTK_CONTAINER(alignment), image->draw_area);

	image->scroll = gtk_scrolled_window_new(NULL, NULL);
	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(image->scroll),
		GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
	gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(image->scroll), alignment);

	tab_label = CreateNotebookLabel(file_name, reference->data->note_book, reference->data->num_image,
		OnCloseReferenceImage, reference);
	gtk_notebook_append_page(GTK_NOTEBOOK(reference->data->note_book), image->scroll, tab_label);

	gtk_widget_show_all(image->scroll);
	gtk_widget_set_sensitive(reference->data->scale, TRUE);
	reference->data->active_image = reference->data->num_image;
#if GTK_MAJOR_VERSION <= 2
	gtk_notebook_set_page(GTK_NOTEBOOK(reference->data->note_book), reference->data->active_image);
#else
	gtk_notebook_set_current_page(GTK_NOTEBOOK(reference->data->note_book), reference->data->active_image);
#endif

	reference->data->num_image++;
}
开发者ID:yamma-ma,项目名称:KABURAGI,代码行数:77,代码来源:reference_window.c

示例5: main


//.........这里部分代码省略.........
  gtk_widget_set_size_request (GTK_WIDGET (drawing_area),800,600);

  gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_win),drawing_area);



  gtk_widget_show (drawing_area);


  gtk_widget_show (scrolled_win);



  gtk_widget_show (hbox);



  /* Signals used to handle backing pixmap */

  g_signal_connect (G_OBJECT (drawing_area), "expose_event",
		    G_CALLBACK (expose_event), NULL);
  g_signal_connect (G_OBJECT (drawing_area),"configure_event",
		    G_CALLBACK (configure_event), NULL);

  /* Event signals */

  g_signal_connect (G_OBJECT (drawing_area), "motion_notify_event",
		    G_CALLBACK (motion_notify_event), NULL);
  g_signal_connect (G_OBJECT (drawing_area), "button_press_event",
		    G_CALLBACK (button_press_event), NULL);
  g_signal_connect (G_OBJECT (drawing_area), "button_release_event",
                    G_CALLBACK(button_release_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
                         | GDK_BUTTON_RELEASE_MASK);

   hbox = gtk_hbox_new (FALSE,0);

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

   frame=get_fgbgframe();
   

   gtk_box_pack_start(GTK_BOX (hbox),frame, FALSE, FALSE, 2);

   gtk_widget_show(frame);

   colortable=get_system_color_table();
  
   frame=gtk_frame_new("select color");

   gtk_widget_set_size_request (GTK_WIDGET (frame),400,75);

   gtk_box_pack_start(GTK_BOX (hbox),frame, TRUE, TRUE, 2);
  
   gtk_container_add(GTK_CONTAINER(frame),colortable); 


   gtk_widget_show (colortable); 

   gtk_widget_show(frame);
开发者ID:niranjan-nagaraju,项目名称:illuminati,代码行数:67,代码来源:illuminati.c

示例6: do_drawingarea

GtkWidget *
do_drawingarea (GtkWidget *do_widget)
{
  GtkWidget *frame;
  GtkWidget *vbox;
  GtkWidget *da;
  GtkWidget *label;

  if (!window)
    {
      window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
      gtk_window_set_screen (GTK_WINDOW (window),
                             gtk_widget_get_screen (do_widget));
      gtk_window_set_title (GTK_WINDOW (window), "Drawing Area");

      g_signal_connect (window, "destroy", G_CALLBACK (close_window), NULL);

      gtk_container_set_border_width (GTK_CONTAINER (window), 8);

      vbox = gtk_vbox_new (FALSE, 8);
      gtk_container_set_border_width (GTK_CONTAINER (vbox), 8);
      gtk_container_add (GTK_CONTAINER (window), vbox);

      /*
       * Create the checkerboard area
       */

      label = gtk_label_new (NULL);
      gtk_label_set_markup (GTK_LABEL (label),
                            "<u>Checkerboard pattern</u>");
      gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);

      frame = gtk_frame_new (NULL);
      gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
      gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);

      da = gtk_drawing_area_new ();
      /* set a minimum size */
      gtk_widget_set_size_request (da, 100, 100);

      gtk_container_add (GTK_CONTAINER (frame), da);

      g_signal_connect (da, "expose-event",
                        G_CALLBACK (checkerboard_expose), NULL);

      /*
       * Create the scribble area
       */

      label = gtk_label_new (NULL);
      gtk_label_set_markup (GTK_LABEL (label),
                            "<u>Scribble area</u>");
      gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);

      frame = gtk_frame_new (NULL);
      gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
      gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);

      da = gtk_drawing_area_new ();
      /* set a minimum size */
      gtk_widget_set_size_request (da, 100, 100);

      gtk_container_add (GTK_CONTAINER (frame), da);

      /* Signals used to handle backing pixmap */

      g_signal_connect (da, "expose-event",
                        G_CALLBACK (scribble_expose_event), NULL);
      g_signal_connect (da,"configure-event",
                        G_CALLBACK (scribble_configure_event), NULL);

      /* Event signals */

      g_signal_connect (da, "motion-notify-event",
                        G_CALLBACK (scribble_motion_notify_event), NULL);
      g_signal_connect (da, "button-press-event",
                        G_CALLBACK (scribble_button_press_event), NULL);


      /* Ask to receive events the drawing area doesn't normally
       * subscribe to
       */
      gtk_widget_set_events (da, gtk_widget_get_events (da)
                             | GDK_LEAVE_NOTIFY_MASK
                             | GDK_BUTTON_PRESS_MASK
                             | GDK_POINTER_MOTION_MASK
                             | GDK_POINTER_MOTION_HINT_MASK);

    }

  if (!gtk_widget_get_visible (window))
      gtk_widget_show_all (window);
  else
      gtk_widget_destroy (window);

  return window;
}
开发者ID:ChinnaSuhas,项目名称:ossbuild,代码行数:97,代码来源:drawingarea.c

示例7: gui_init

void
gui_init (dt_lib_module_t *self)
{
  dt_lib_collect_t *d = (dt_lib_collect_t *)malloc(sizeof(dt_lib_collect_t));

  self->data = (void *)d;
  self->widget = gtk_vbox_new(FALSE, 5);
  gtk_widget_set_size_request(self->widget, 100, -1);
  d->active_rule = 0;
  d->params = (dt_lib_collect_params_t*)malloc(sizeof(dt_lib_collect_params_t));

  dt_control_signal_connect(darktable.signals,
                            DT_SIGNAL_COLLECTION_CHANGED,
                            G_CALLBACK(collection_updated),
                            self);

  GtkBox *box;
  GtkWidget *w;
  GtkWidget *sw = gtk_scrolled_window_new(NULL, NULL);
  GtkTreeView *view = GTK_TREE_VIEW(gtk_tree_view_new());
  d->view = view;
  GtkListStore *liststore;

  for(int i=0; i<MAX_RULES; i++)
  {
    d->rule[i].num = i;
    box = GTK_BOX(gtk_hbox_new(FALSE, 5));
    d->rule[i].hbox = GTK_WIDGET(box);
    gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(box), TRUE, TRUE, 0);
    w = gtk_combo_box_new_text();
    d->rule[i].combo = GTK_COMBO_BOX(w);
    for(int k=0; k<dt_lib_collect_string_cnt; k++)
      gtk_combo_box_append_text(GTK_COMBO_BOX(w), _(dt_lib_collect_string[k]));
    g_signal_connect(G_OBJECT(w), "changed", G_CALLBACK(combo_changed), d->rule + i);
    gtk_box_pack_start(box, w, FALSE, FALSE, 0);
    w = gtk_entry_new();
    dt_gui_key_accel_block_on_focus(w);
    d->rule[i].text = w;
    gtk_widget_add_events(w, GDK_FOCUS_CHANGE_MASK);
    g_signal_connect(G_OBJECT(w), "focus-in-event", G_CALLBACK(entry_focus_in_callback), d->rule + i);

    /* xgettext:no-c-format */
    g_object_set(G_OBJECT(w), "tooltip-text", _("type your query, use `%' as wildcard"), (char *)NULL);
    gtk_widget_add_events(w, GDK_KEY_PRESS_MASK);
    g_signal_connect(G_OBJECT(w), "changed", G_CALLBACK(changed_callback), d->rule + i);
    g_signal_connect(G_OBJECT(w), "activate", G_CALLBACK(entry_activated), d->rule + i);
    gtk_box_pack_start(box, w, TRUE, TRUE, 0);
    w = dtgtk_button_new(dtgtk_cairo_paint_presets, CPF_STYLE_FLAT|CPF_DO_NOT_USE_BORDER);
    d->rule[i].button = w;
    gtk_widget_set_events(w, GDK_BUTTON_PRESS_MASK);
    g_signal_connect(G_OBJECT(w), "button-press-event", G_CALLBACK(popup_button_callback), d->rule + i);
    gtk_box_pack_start(box, w, FALSE, FALSE, 0);
    gtk_widget_set_size_request(w, 13, 13);
  }

  d->scrolledwindow = GTK_SCROLLED_WINDOW(sw);
  gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
  gtk_container_add(GTK_CONTAINER(sw), GTK_WIDGET(view));
  gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(sw), TRUE, TRUE, 0);
  gtk_tree_view_set_headers_visible(view, FALSE);
  liststore = gtk_list_store_new(DT_LIB_COLLECT_NUM_COLS, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_STRING);
  GtkTreeViewColumn *col = gtk_tree_view_column_new();
  gtk_tree_view_append_column(view, col);
  gtk_widget_set_size_request(GTK_WIDGET(view), -1, 300);
  GtkCellRenderer *renderer = gtk_cell_renderer_text_new();
  gtk_tree_view_column_pack_start(col, renderer, TRUE);
  gtk_tree_view_column_add_attribute(col, renderer, "text", DT_LIB_COLLECT_COL_TEXT);
  gtk_tree_selection_set_mode(gtk_tree_view_get_selection(view), GTK_SELECTION_SINGLE);
  gtk_tree_view_set_model(view, GTK_TREE_MODEL(liststore));
  g_signal_connect(G_OBJECT (view), "row-activated", G_CALLBACK (row_activated), d);

  /* setup proxy */
  darktable.view_manager->proxy.module_collect.module = self;
  darktable.view_manager->proxy.module_collect.update = _lib_collect_gui_update;

  _lib_collect_gui_update(self);
}
开发者ID:chubinou,项目名称:darktable,代码行数:77,代码来源:collect.c

示例8: create_mainwindow

void create_mainwindow (GooCanvasItem *rootitem)
{
  GtkWidget *wdrawareagrande;
  GtkWidget *wdrawareapetite;


  /* GCompris : suppression of all menus */
  g_assert(rootitem != NULL);

  wdrawareagrande = gtk_drawing_area_new ();
  gtk_widget_set_name (wdrawareagrande, "wdrawareagrande");
  //gtk_widget_set_size_request     (wdrawareagrande,
  //                               WIDTH_BIGAREA,
  //			   WIDTH_BIGAREA
  //			   );

  //gtk_container_add (GTK_CONTAINER (aspectframe1), wdrawareagrande);

  gtk_widget_set_events (wdrawareagrande, GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK);

  /* Gcompris */
  goo_canvas_widget_new ( rootitem,
			wdrawareagrande,
			X_BASE_BIGAREA,
			Y_BASE_BIGAREA,
			WIDTH_BIGAREA,
			WIDTH_BIGAREA,
			NULL
			);

  gtk_widget_show (wdrawareagrande);

  wdrawareapetite = gtk_drawing_area_new ();
  gtk_widget_set_name (wdrawareapetite, "wdrawareapetite");

  gtk_widget_set_events (wdrawareapetite, GDK_EXPOSURE_MASK | GDK_STRUCTURE_MASK);

  /* Gcompris */
  goo_canvas_widget_new ( rootitem,
			  wdrawareapetite,
			  X_BASE_SMALLAREA,
			  Y_BASE_SMALLAREA,
			  WIDTH_SMALLAREA,
			  WIDTH_SMALLAREA,
			  NULL
			  );

  gtk_widget_show (wdrawareapetite);

  g_signal_connect (GTK_OBJECT (wdrawareagrande), "expose_event",
                      GTK_SIGNAL_FUNC (on_wdrawareagrande_expose_event),
                      NULL);
  g_signal_connect (GTK_OBJECT (wdrawareagrande), "configure_event",
                      GTK_SIGNAL_FUNC (on_wdrawareagrande_configure_event),
                      NULL);
  g_signal_connect (GTK_OBJECT (wdrawareagrande), "button_press_event",
                      GTK_SIGNAL_FUNC (on_wdrawareagrande_button_press_event),
                      NULL);
  g_signal_connect (GTK_OBJECT (wdrawareagrande), "button_release_event",
                      GTK_SIGNAL_FUNC (on_wdrawareagrande_button_release_event),
                      NULL);
  g_signal_connect (GTK_OBJECT (wdrawareagrande), "motion_notify_event",
                      GTK_SIGNAL_FUNC (on_wdrawareagrande_motion_notify_event),
                      NULL);
  g_signal_connect (GTK_OBJECT (wdrawareapetite), "configure_event",
                      GTK_SIGNAL_FUNC (on_wdrawareapetite_configure_event),
                      NULL);
  g_signal_connect (GTK_OBJECT (wdrawareapetite), "expose_event",
                      GTK_SIGNAL_FUNC (on_wdrawareapetite_expose_event),
                      NULL);


  /* Gcompris */
  /* add here buttons */

  GdkPixbuf   *pixmap_show = NULL;
  GdkPixbuf   *pixmap_outline = NULL;
  GdkPixbuf   *pixmap_symetry = NULL;
  GooCanvasItem *previous_figure, *next_figure;
  GooCanvasItem *show_figure, *outline_figure, *symetry;

  previous_figure = goo_canvas_svg_new (rootitem,
					gc_skin_rsvg_get(),
					"svg-id", "#PREVIOUS",
					NULL);
  SET_ITEM_LOCATION_CENTER(previous_figure,
			   X_BASE_SMALLAREA,
			   Y_BASE_SMALLAREA + WIDTH_SMALLAREA + 30);

  next_figure = goo_canvas_svg_new (rootitem,
				    gc_skin_rsvg_get(),
				    "svg-id", "#NEXT",
				    NULL);
  SET_ITEM_LOCATION_CENTER(next_figure,
			   X_BASE_SMALLAREA + WIDTH_SMALLAREA,
			   Y_BASE_SMALLAREA + WIDTH_SMALLAREA + 30);


  g_signal_connect(previous_figure, "button_press_event",
		     (GCallback) on_arrow_clicked,
//.........这里部分代码省略.........
开发者ID:GNOME,项目名称:gcompris,代码行数:101,代码来源:gtans_interface.c

示例9: gui_init


//.........这里部分代码省略.........
		gchar *gamename;
		gamename = prefs_get_config_val (tmp = g_strdup_printf ("recent_game_%d", i));
		g_free (tmp);
		if (gamename && gamename[0] != '\0')
			menu_insert_game_item (gamename, i);
	}

	menu_set_eval_function ();
	vbox = gtk_vbox_new (FALSE, 0);
	gtk_box_pack_start (GTK_BOX(vbox), menu_main, FALSE, FALSE, 0);

	frame = gtk_frame_new (NULL);
	gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);

	{
	GtkWidget *innerframe;
	board_colbox = gtk_vbox_new (FALSE, 0);
	board_area = gtk_drawing_area_new ();
	hbox = gtk_hbox_new (FALSE, 0);
	gtk_box_pack_start (GTK_BOX (hbox), board_colbox, FALSE, FALSE, 0);
	vbox1 = gtk_vbox_new (FALSE, 0);
	board_rowbox = gtk_hbox_new (FALSE, 0);
	innerframe = gtk_frame_new (NULL);
	gtk_frame_set_shadow_type (GTK_FRAME (innerframe), GTK_SHADOW_IN);
	gtk_container_add (GTK_CONTAINER (vbox1), innerframe);
	gtk_container_add (GTK_CONTAINER (innerframe), board_area);
	gtk_container_add (GTK_CONTAINER (vbox1), board_rowbox);
	gtk_box_pack_start (GTK_BOX (hbox), vbox1, TRUE, FALSE, 0);
	gtk_container_add (GTK_CONTAINER (frame), hbox);

	gtk_signal_connect (GTK_OBJECT (board_area), "expose_event",
		GTK_SIGNAL_FUNC (board_redraw), NULL);

   	gtk_widget_set_events(board_area, 
			gtk_widget_get_events (board_area) 
			|   GDK_BUTTON_PRESS_MASK
			|   GDK_BUTTON_RELEASE_MASK
			|   GDK_POINTER_MOTION_MASK
			|   GDK_KEY_PRESS_MASK
			|	GDK_KEY_RELEASE_MASK
			|	GDK_LEAVE_NOTIFY_MASK
			);

	gtk_signal_connect (GTK_OBJECT (board_area), "leave_notify_event",
		GTK_SIGNAL_FUNC (board_signal_handler), NULL);
	gtk_signal_connect (GTK_OBJECT (board_area), "motion_notify_event",
		GTK_SIGNAL_FUNC (board_signal_handler), NULL);
	gtk_signal_connect (GTK_OBJECT (board_area), "button_release_event",
		GTK_SIGNAL_FUNC (board_signal_handler), NULL);
	gtk_signal_connect (GTK_OBJECT (board_area), "button_press_event",
		GTK_SIGNAL_FUNC (board_signal_handler), NULL);
	gtk_signal_connect (GTK_OBJECT (main_window), "key_press_event",
		GTK_SIGNAL_FUNC (board_signal_handler), NULL);
	gtk_signal_connect (GTK_OBJECT (main_window), "key_release_event",
		GTK_SIGNAL_FUNC (board_signal_handler), NULL);
	menu_info_bar = hbox = gtk_hbox_new (FALSE, 0);
	sb_game_label = gtk_label_new (opt_game ? opt_game->name : NULL);
	gtk_box_pack_start (GTK_BOX (hbox), sb_game_label, FALSE, FALSE, 3);
	sb_game_separator = gtk_vseparator_new ();
	gtk_box_pack_start (GTK_BOX (hbox), sb_game_separator, FALSE, FALSE, 0);
	sb_player_label = gtk_label_new (NULL);
	gtk_box_pack_start (GTK_BOX (hbox), sb_player_label, FALSE, FALSE, 3);
	sb_player_separator = gtk_vseparator_new ();
	gtk_box_pack_start (GTK_BOX (hbox), sb_player_separator, FALSE, FALSE, 0);
	sb_who_label = gtk_label_new (NULL);
	gtk_box_pack_start (GTK_BOX (hbox), sb_who_label, FALSE, FALSE, 3);
开发者ID:barak,项目名称:gtkboard,代码行数:67,代码来源:ui.c

示例10: gkrellm_panel_create

void
gkrellm_panel_create(GtkWidget *vbox, GkrellmMonitor *mon, GkrellmPanel *p)
	{
	GtkWidget		*hbox;
	GkrellmPiximage	piximage;
	GtkWidget   	*top_win = gkrellm_get_top_window();

	if (!vbox || !mon || !p)
		return;
	p->monitor = (gpointer) mon;
	if (!p->style)	/* gkrellm_panel_configure() may not have been called. */
		setup_panel_style(p, mon->privat->panel_style);

	if (!p->bg_piximage_override)
		{
		if (mon->privat->style_type == CHART_PANEL_TYPE)
			p->bg_piximage = gkrellm_bg_panel_piximage(mon->privat->style_id);
		else
			p->bg_piximage = gkrellm_bg_meter_piximage(mon->privat->style_id);
		}
	p->bg_piximage_override = FALSE;

	/* If not being called from rebuild or after a panel destroy, then panel
	|  still has a height that must be accounted for.
	*/
	if (p->h && p->shown)
		gkrellm_monitor_height_adjust(- p->h);
	p->h = p->h_configure;
	p->w = _GK.chart_width;

	if (p->hbox == NULL)
		{
		hbox = gtk_hbox_new(FALSE, 0);
		gtk_container_add (GTK_CONTAINER(vbox), hbox);
		p->hbox = hbox;
		p->drawing_area = gtk_drawing_area_new();
		p->layout = gtk_widget_create_pango_layout(top_win, NULL);
		gtk_widget_set_events (p->drawing_area, GDK_EXPOSURE_MASK
				| GDK_LEAVE_NOTIFY_MASK | GDK_ENTER_NOTIFY_MASK
				| GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_PRESS_MASK
				| GDK_POINTER_MOTION_MASK);
		gtk_box_pack_start(GTK_BOX(p->hbox), p->drawing_area,
				FALSE, FALSE, 0);
		gtk_widget_show(p->drawing_area);
		gtk_widget_show(hbox);
		p->shown = TRUE;
		gtk_widget_realize(hbox);
		gtk_widget_realize(p->drawing_area);
		panel_list = g_list_append(panel_list, p);
		p->y_mapped = -1;
		g_signal_connect(G_OBJECT (p->drawing_area), "size_allocate",
					G_CALLBACK(cb_panel_size_allocate), p);
		}
	gtk_widget_set_size_request(p->drawing_area, p->w, p->h);

	if (_GK.frame_left_panel_overlap > 0 || _GK.frame_right_panel_overlap > 0)
		{
		piximage.pixbuf = gdk_pixbuf_new_subpixbuf(p->bg_piximage->pixbuf,
				_GK.frame_left_panel_overlap, 0,
				gdk_pixbuf_get_width(p->bg_piximage->pixbuf)
							- _GK.frame_left_panel_overlap
							- _GK.frame_right_panel_overlap,
				gdk_pixbuf_get_height(p->bg_piximage->pixbuf));
		piximage.border = p->bg_piximage->border;
		gkrellm_border_adjust(&piximage.border,
				-_GK.frame_left_panel_overlap, -_GK.frame_right_panel_overlap,
				0, 0);
//		gkrellm_scale_piximage_to_pixmap(&piximage, &p->bg_clean_pixmap,
//				&p->bg_mask, p->w, p->h);
		gkrellm_scale_theme_background(&piximage, &p->bg_clean_pixmap,
				&p->bg_mask, p->w, p->h);
		g_object_unref(G_OBJECT(piximage.pixbuf));
		}
	else
		gkrellm_scale_theme_background(p->bg_piximage, &p->bg_clean_pixmap,
			&p->bg_mask, p->w, p->h);
//		gkrellm_scale_piximage_to_pixmap(p->bg_piximage, &p->bg_clean_pixmap,
//			&p->bg_mask, p->w, p->h);

	if (p->bg_text_layer_pixmap)
		g_object_unref(G_OBJECT(p->bg_text_layer_pixmap));
	p->bg_text_layer_pixmap = gdk_pixmap_new(top_win->window, p->w, p->h, -1);
	if (p->bg_pixmap)
		g_object_unref(G_OBJECT(p->bg_pixmap));
	p->bg_pixmap = gdk_pixmap_new(top_win->window, p->w, p->h, -1);
	if (p->pixmap)
		g_object_unref(G_OBJECT(p->pixmap));
	p->pixmap = gdk_pixmap_new(top_win->window, p->w, p->h, -1);

	if (p->shown)
		{
		gkrellm_monitor_height_adjust(p->h);
		gkrellm_pack_side_frames();
		}
	p->need_decal_overlap_check = TRUE;
	draw_panel(p, FALSE);
	gkrellm_panel_button_signals_connect(p);
	}
开发者ID:IceMupppet,项目名称:ubuntu-custom-gkrellm,代码行数:98,代码来源:panel.c

示例11: main

int  main(int argc, char *argv[])
{
	gnome_init(VERSION, VERSION, argc, argv);

	/* Set up to draw from card class */
	GtkWidget *vbox, *vbox1, *vbox2, *vbox3;
	GtkWidget *tbar;
	GtkWidget *setbutton, *nosetbutton;
	GdkColor white, black, blue;
	/* Done setting up */

	window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_window_set_title(GTK_WINDOW(window), "Set Game");
	gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, TRUE);
	gtk_container_border_width(GTK_CONTAINER(window), 0);

	vbox= gtk_vbox_new(FALSE, 0);
	vbox1 = gtk_vbox_new(FALSE, 0);
	vbox2 = gtk_vbox_new(FALSE, 0);
	vbox3 = gtk_vbox_new(FALSE, 0);

	drawing_area = gtk_drawing_area_new();
  gtk_widget_set_events(drawing_area,
    GDK_EXPOSURE_MASK|GDK_BUTTON_PRESS_MASK);
  gtk_widget_set_events(window, GDK_KEY_PRESS_MASK);
  gtk_signal_connect(GTK_OBJECT(drawing_area), "expose_event",
    GTK_SIGNAL_FUNC(expose_event), 0);
  gtk_signal_connect(GTK_OBJECT(drawing_area), "button_press_event",
    GTK_SIGNAL_FUNC(button_event), 0);
	GnomeUIInfo toolbar[ ] = {
GNOMEUIINFO_ITEM_STOCK ("New Game", "Start new Game", newgame, GNOME_STOCK_PIXMAP_NEW),
GNOMEUIINFO_ITEM_STOCK ("High Scores", "Shows High scores", gtk_main_quit, GNOME_STOCK_PIXMAP_SCORES),
GNOMEUIINFO_ITEM_STOCK ("End Game", "Ends Current Game", gtk_main_quit, GNOME_STOCK_PIXMAP_STOP),
GNOMEUIINFO_ITEM_STOCK ("Exit", "Exit the application", gtk_main_quit, GNOME_STOCK_PIXMAP_EXIT),
GNOMEUIINFO_END
};
	tbar = gtk_toolbar_new(GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_ICONS);
	gnome_app_fill_toolbar(GTK_TOOLBAR(tbar), toolbar, gtk_accel_group_new());
	gtk_box_pack_start(GTK_BOX(vbox1), tbar, TRUE, TRUE, 0);
	gtk_box_pack_start(GTK_BOX(vbox), vbox1, TRUE, TRUE, 0);
	gtk_box_pack_start(GTK_BOX(vbox), vbox2, TRUE, TRUE, 0);
	gtk_box_pack_start(GTK_BOX(vbox), vbox3, TRUE, TRUE, 0);
	gtk_box_pack_start(GTK_BOX(vbox2), drawing_area, TRUE, TRUE, 5);
	gtk_drawing_area_size(GTK_DRAWING_AREA(drawing_area), SPACE_INTER+CARD_WS*4, SPACE_INTER+CARD_HS*3);
	gtk_box_pack_start(GTK_BOX(vbox3), gtk_label_new("Player"), TRUE, TRUE, 1);
	playerscore = gtk_label_new("0");
	gtk_box_pack_start(GTK_BOX(vbox3), playerscore, TRUE, TRUE, 1);
	gtk_box_pack_start(GTK_BOX(vbox3), gtk_label_new("Computer"), TRUE, TRUE, 1);
	computerscore = gtk_label_new("0");
	gtk_box_pack_start(GTK_BOX(vbox3), computerscore, TRUE, TRUE, 1);
	gtk_box_pack_start(GTK_BOX(vbox3), gtk_label_new("Cards Remaining"), TRUE, TRUE, 1);
	cards_remain = gtk_label_new("81");
	gtk_box_pack_start(GTK_BOX(vbox3), cards_remain, TRUE, TRUE, 1);
	gtk_container_add(GTK_CONTAINER(window), vbox);
	gtk_widget_show_all(window);

	gtk_idle_add( myidle, NULL);


/************************ Start Deck Setup *************************/
unsigned char *pixmap_data[] = {
    bean_e_bits,
    bean_s_bits,
    bean_f_bits,
    blob_e_bits,
    blob_s_bits,
    blob_f_bits,
    diamond_e_bits,
    diamond_s_bits,
    diamond_f_bits
  };
  int i, j;
  GdkWindow *wn = window->window;
  GdkColor col[4];
  GdkColormap *cmap = gdk_window_get_colormap(wn);
  GdkGC *gc;
  GtkStyle *style = gtk_widget_get_style(window);
  col[0].red = 54000; col[0].green = col[0].blue = 0;
  col[1].green = 40000; col[1].red = col[1].blue = 0;
  col[2].red = col[2].blue = 32000; col[2].green = 0;
  gdk_color_white(cmap, &white);
  gdk_color_black(cmap, &black);
  blue.red = blue.green = 0; blue.blue = 48000;
  gdk_color_alloc(cmap, &blue);
  for (i=0; i<3; i++)
    gdk_color_alloc(cmap, &col[i]);
  for (i=0; i<9; i++)
    for (j=0; j<3; j++)
      card_pixmap[i*3+j] = gdk_pixmap_create_from_data(wn, (gchar*) pixmap_data[i],
        SHAPE_W, SHAPE_H, -1, &col[j], &white);
  /* free colors? !! */

  gc = gdk_gc_new(wn);

  /*** cards in normal state ***/
  card_bkg = gdk_pixmap_new(wn, CARD_WIDTH, CARD_HEIGHT, -1);
  /* clear the card */
  gdk_gc_set_foreground(gc, &style->bg[GTK_STATE_NORMAL]);
  gdk_draw_rectangle(card_bkg, gc, 1, 0, 0, CARD_WIDTH, CARD_HEIGHT);
  /* draw corner arcs */
//.........这里部分代码省略.........
开发者ID:chadaustin,项目名称:isugamedev,代码行数:101,代码来源:set.cpp

示例12: gtk_window_new

GtkWidget *ic_loading_panel_new()
{
	GtkWidget *window;
	GtkWidget *titlebar;
	GtkWidget *vbox;
	GtkWidget *cancel_button;
	GtkWidget *align;
	GtkWidget *label2;
	GtkWidget *image1, *image2, *image3;
	GdkPixbuf *pixbuf1, *pixbuf2, *new_pixbuf;
	GdkScreen *scr;
	gint pic_width, pic_height;
	gint new_width, new_height;
	gint scr_width;
	GdkScreen *screen;
	GdkVisual *visual;

	window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_window_set_decorated (GTK_WINDOW(window), FALSE);
	gtk_window_set_default_size(GTK_WINDOW(window), 280, 580);
	gtk_window_set_keep_above (GTK_WINDOW(window), TRUE);
	
	screen = gtk_widget_get_screen(window);
	visual = gdk_screen_get_rgba_visual(screen);
	gtk_widget_set_visual(window, visual);
	GdkColor color = {0, 30313, 51153, 63408};
	gtk_widget_modify_bg(window, GTK_STATE_NORMAL, &color);
	
	scr = gdk_screen_get_default();
	scr_width = gdk_screen_get_width(scr);
	gtk_window_move(GTK_WINDOW(window), scr_width-350, 50);

	vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
	titlebar = ic_titlebar_new ();
	gtk_box_pack_start (GTK_BOX(vbox), titlebar, FALSE, FALSE, 0);
	
	/*label1 = gtk_label_new("\niChat");
	PangoFontDescription *font_desc = pango_font_description_from_string("Purisa Bold 25");
	gtk_widget_modify_font(label1, font_desc);
	pango_font_description_free(font_desc);

	gtk_widget_set_size_request(label1, 100, 25);
	gtk_box_pack_start(GTK_BOX(vbox), label1, FALSE, FALSE, 0);
    */
    image3 = gtk_image_new_from_file(RESDIR"images/ichat.png");
    gtk_box_pack_start(GTK_BOX(vbox), image3, FALSE, FALSE, 0);

	pixbuf1 = gdk_pixbuf_new_from_file(RESDIR"images/loading/loading-01.png", NULL);
	image1 = gtk_image_new_from_pixbuf(pixbuf1);
	gtk_box_pack_start(GTK_BOX(vbox), image1, FALSE, FALSE, 0);

	pixbuf2 = gdk_pixbuf_new_from_file(RESDIR"images/gtk.png", NULL);
	pic_width = gdk_pixbuf_get_width(pixbuf2);
	pic_height = gdk_pixbuf_get_height(pixbuf2);
	new_width = 150;
	new_height = ((float)new_width/pic_width)*pic_height;
	
	new_pixbuf = gdk_pixbuf_scale_simple (pixbuf2, new_width, new_height, GDK_INTERP_BILINEAR);
	image2 = gtk_image_new_from_pixbuf(new_pixbuf);
	gtk_box_pack_start(GTK_BOX(vbox), image2, FALSE, FALSE, 5);

	gchar str[30];
	memset(str, 0, sizeof(str));
	strcat(str, user_name);
	strcat(str, "正在登录");
	label2 = gtk_label_new(str);
	gtk_box_pack_start(GTK_BOX(vbox), label2, FALSE, FALSE, 5);
	
	align = gtk_alignment_new(0.5, 0.5, 0, 0);
	cancel_button = gtk_button_new_with_label("  取 消  ");
	gtk_container_add(GTK_CONTAINER(align), cancel_button);
	gtk_box_pack_start(GTK_BOX(vbox), align, FALSE, FALSE, 5);

	gtk_widget_set_events(window, GDK_EXPOSURE_MASK | GDK_LEAVE_NOTIFY_MASK
			| GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK
			| GDK_POINTER_MOTION_HINT_MASK);
	g_signal_connect(G_OBJECT(window), "button_press_event",
			G_CALLBACK(on_mouse_press_event), NULL);
	g_signal_connect(G_OBJECT(window), "delete-event", G_CALLBACK(gtk_main_quit), NULL);
	g_timeout_add(100, (GSourceFunc)timer, (gpointer)image1);

	gtk_container_add(GTK_CONTAINER(window), vbox);
	return window;
}
开发者ID:yuanjq,项目名称:ichat,代码行数:84,代码来源:ic_loading_panel.c

示例13: main


//.........这里部分代码省略.........
                             (GConfClientNotifyFunc) keys_special6_changed,
			     NULL, NULL, NULL);

    gconf_client_notify_add (gconf_client, "/apps/gtetrinet/keys/special_self",
                             (GConfClientNotifyFunc) keys_special_self_changed,
                            NULL, NULL, NULL);

    gconf_client_notify_add (gconf_client, "/apps/gtetrinet/partyline/enable_timestamps",
                             (GConfClientNotifyFunc) partyline_enable_timestamps_changed,
			     NULL, NULL, NULL);
    
    gconf_client_notify_add (gconf_client, "/apps/gtetrinet/partyline/enable_channel_list",
                             (GConfClientNotifyFunc) partyline_enable_channel_list_changed,
			     NULL, NULL, NULL);

    /* load settings */
    config_loadconfig ();

    /* initialise some stuff */
    fields_init ();
    if (!g_thread_supported()) g_thread_init (NULL);

    /* first set up the display */

    /* create the main window */
    app = gnome_app_new (APPID, APPNAME);

    g_signal_connect (G_OBJECT(app), "destroy",
                        GTK_SIGNAL_FUNC(destroymain), NULL);
    keypress_signal = g_signal_connect (G_OBJECT(app), "key-press-event",
                                        GTK_SIGNAL_FUNC(keypress), NULL);
    g_signal_connect (G_OBJECT(app), "key-release-event",
                        GTK_SIGNAL_FUNC(keyrelease), NULL);
    gtk_widget_set_events (app, GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK);

    gtk_window_set_resizable (GTK_WINDOW (app), TRUE);
    
    /* create and set the window icon */
    icon_pixbuf = gdk_pixbuf_new_from_file (PIXMAPSDIR "/gtetrinet.png", NULL);
    if (icon_pixbuf)
    {
      gtk_window_set_icon (GTK_WINDOW (app), icon_pixbuf);
      gdk_pixbuf_unref (icon_pixbuf);
    }

    /* create the notebook */
    notebook = gtk_notebook_new ();
    gtk_notebook_set_tab_pos (GTK_NOTEBOOK(notebook), GTK_POS_TOP);

    /* put it in the main window */
    gnome_app_set_contents (GNOME_APP(app), notebook);

    /* make menus + toolbar */
    make_menus (GNOME_APP(app));

    /* create the pages in the notebook */
    fieldswidget = fields_page_new ();
    gtk_widget_set_sensitive (fieldswidget, TRUE);
    gtk_widget_show (fieldswidget);
    pfields = gtk_hbox_new (FALSE, 0);
    gtk_container_set_border_width (GTK_CONTAINER(pfields), 0);
    gtk_container_add (GTK_CONTAINER(pfields), fieldswidget);
    gtk_widget_show (pfields);
    g_object_set_data (G_OBJECT(fieldswidget), "title", "Playing Fields"); // FIXME
    label = pixmapdata_label (fields_xpm, _("Playing Fields"));
    gtk_widget_show (label);
开发者ID:nwf,项目名称:gtetrinet,代码行数:67,代码来源:gtetrinet.c

示例14: display_init

int display_init(GtkWindow *window)
{
  /* Retrieve widgets */
  display_window = window;
  display_label_mouse = GTK_LABEL(lookup_widget(GTK_WIDGET(window), "label_mouse"));
  gtk_label_set_use_markup(display_label_mouse, TRUE);
  display_label_pixel = GTK_LABEL(lookup_widget(GTK_WIDGET(window), "label_pixel"));
  display_label_selection = GTK_LABEL(lookup_widget(GTK_WIDGET(window), "label_selection"));
  gtk_label_set_use_markup(display_label_selection, TRUE);

  /* Display refresh management */
  display_refresh_init(window);

  /* Pattern display management */
  display_pattern_init();
  display_button_pattern = GTK_TOOL_BUTTON(lookup_widget(GTK_WIDGET(window), "button_pattern"));
  gtk_signal_connect_object(GTK_OBJECT(display_button_pattern), "clicked",
                            GTK_SIGNAL_FUNC(display_pattern_popup), NULL);

  /* Screenshot grab management */
  display_screenshot_init(window);

  /* Connect drawing area events */
  display_darea = GTK_DRAWING_AREA(lookup_widget(GTK_WIDGET(window), "drawing_area"));
  display_darea_scroll = -1;
  gtk_signal_connect(GTK_OBJECT(display_darea), "expose_event",
                     GTK_SIGNAL_FUNC(display_event_expose), NULL);
  gtk_signal_connect(GTK_OBJECT(display_darea), "enter_notify_event",
                     GTK_SIGNAL_FUNC(display_event_crossing), NULL);
  gtk_signal_connect(GTK_OBJECT(display_darea), "leave_notify_event",
                     GTK_SIGNAL_FUNC(display_event_crossing), NULL);
  gtk_signal_connect(GTK_OBJECT(display_darea), "motion_notify_event",
                     GTK_SIGNAL_FUNC(display_event_motion), NULL);
  gtk_signal_connect(GTK_OBJECT(display_darea), "button_press_event",
                     GTK_SIGNAL_FUNC(display_event_button), NULL);
  gtk_signal_connect(GTK_OBJECT(display_darea), "button_release_event",
                     GTK_SIGNAL_FUNC(display_event_button), NULL);
  gtk_signal_connect(GTK_OBJECT(display_darea), "key_press_event",
                     GTK_SIGNAL_FUNC(display_event_key), NULL);
  gtk_signal_connect(GTK_OBJECT(display_darea), "key_release_event",
                     GTK_SIGNAL_FUNC(display_event_key), NULL);
  gtk_widget_set_events(GTK_WIDGET(display_darea),
                        GDK_EXPOSURE_MASK |
			GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK |	GDK_POINTER_MOTION_MASK |
			GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
			GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK);

  /* Record/playback management */
  display_record_init(window);

  /* Setup selection box GC */
  gtk_widget_realize(GTK_WIDGET(display_darea));
  display_sel_init(display_darea);

  /* Init desktop selection */
  display_desktop_init(window);

  /* Setup mouse/keyboard input management */
  display_cursor_init(window, GTK_WIDGET(display_darea));

  display_input_enabled = 0;
  display_input_focus = 0;
  display_button_input = GTK_TOGGLE_TOOL_BUTTON(lookup_widget(GTK_WIDGET(window), "button_input"));
  gtk_signal_connect_object(GTK_OBJECT(display_button_input), "clicked",
                            GTK_SIGNAL_FUNC(display_input_clicked), NULL);
  gtk_toggle_tool_button_set_active(display_button_input, 0);
  gtk_widget_set_sensitive(GTK_WIDGET(display_button_input), 0);
  display_input_clicked();

  /* Manual command entry */
  display_command_init(window);

  return 0;
}
开发者ID:testfarm,项目名称:testfarm,代码行数:74,代码来源:display.c

示例15: gtk_widget_set_events

static GtkWidget *new_button(void){
    GtkWidget *ev=gtk_event_box_new();
    gtk_widget_set_events(ev, GDK_BUTTON_PRESS_MASK);
    gtk_widget_show_all(ev);
    return ev;
    }
开发者ID:bitursa,项目名称:maos,代码行数:6,代码来源:monitor_gui.c


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