Пример #1
0
static void set_trayicon_pixmap(TrayIconType icontype)
{
	GdkPixmap *pixmap = NULL;
	GdkBitmap *bitmap = NULL;

	switch(icontype) {
	case TRAYICON_NEW:
		pixmap = newmail_pixmap;
		bitmap = newmail_bitmap;
		break;
	case TRAYICON_NEWMARKED:
		pixmap = newmarkedmail_pixmap;
		bitmap = newmarkedmail_bitmap;
		break;
	case TRAYICON_UNREAD:
		pixmap = unreadmail_pixmap;
		bitmap = unreadmail_bitmap;
		break;
	case TRAYICON_UNREADMARKED:
		pixmap = unreadmarkedmail_pixmap;
		bitmap = unreadmarkedmail_bitmap;
		break;
	default:
		pixmap = nomail_pixmap;
		bitmap = nomail_bitmap;
		break;
	}

	gtk_pixmap_set(GTK_PIXMAP(image), pixmap, bitmap);
	gtk_widget_shape_combine_mask(GTK_WIDGET(trayicon), bitmap, GTK_WIDGET(image)->allocation.x, GTK_WIDGET(image)->allocation.y);
}
Пример #2
0
 void SetPixmap(const wxBitmap& bitmap)
 {
     if (bitmap.Ok())
     {
         GdkBitmap *mask = bitmap.GetMask() ? bitmap.GetMask()->GetBitmap()
                                            : (GdkBitmap *)NULL;
         gtk_pixmap_set( GTK_PIXMAP(m_pixmap), bitmap.GetPixmap(), mask );
     }
 }
Пример #3
0
void noticeview_set_icon(NoticeView *noticeview, StockPixmap icon)
{
	GdkPixmap *pixmap;
	GdkBitmap *bitmap;
	
	if (stock_pixmap_gdk(noticeview->window, icon, &pixmap, &bitmap) < 0)
		return;
	
	gtk_pixmap_set(GTK_PIXMAP(noticeview->icon), pixmap, bitmap);
}
Пример #4
0
void wxStaticBitmap::SetBitmap( const wxBitmap &bitmap )
{
    m_bitmap = bitmap;

    if (m_bitmap.Ok())
    {
        GdkBitmap *mask = NULL;
        if (m_bitmap.GetMask())
            mask = m_bitmap.GetMask()->GetBitmap();

        gtk_pixmap_set(GTK_PIXMAP(m_widget), m_bitmap.GetPixmap(), mask);

        InvalidateBestSize();
        SetSize(GetBestSize());
    }
}
Пример #5
0
void wxToggleBitmapButton::OnSetBitmap()
{
    if (!m_bitmap.IsOk()) return;

    GdkBitmap *mask = NULL;
    if (m_bitmap.GetMask()) mask = m_bitmap.GetMask()->GetBitmap();

    GtkWidget *child = BUTTON_CHILD(m_widget);
    if (child == NULL)
    {
        // initial bitmap
        GtkWidget *pixmap = gtk_pixmap_new(m_bitmap.GetPixmap(), mask);
        gtk_widget_show(pixmap);
        gtk_container_add(GTK_CONTAINER(m_widget), pixmap);
    }
    else
    {   // subsequent bitmaps
        GtkPixmap *g_pixmap = GTK_PIXMAP(child);
        gtk_pixmap_set(g_pixmap, m_bitmap.GetPixmap(), mask);
    }
}
Пример #6
0
void wxBitmapButton::OnSetBitmap()
{
    wxCHECK_RET( m_widget != NULL, wxT("invalid bitmap button") );

    InvalidateBestSize();

    wxBitmap the_one;
    if (!IsThisEnabled())
        the_one = GetBitmapDisabled();
   else if (m_isSelected)
     the_one = GetBitmapPressed();
   else if (HasFocus())
     the_one = GetBitmapFocus();

   if (!the_one.IsOk())
     {
         the_one = GetBitmapLabel();
         if (!the_one.IsOk())
             return;
     }

    GdkBitmap *mask = NULL;
    if (the_one.GetMask()) mask = the_one.GetMask()->GetBitmap();

    GtkWidget *child = BUTTON_CHILD(m_widget);
    if (child == NULL)
    {
        // initial bitmap
        GtkWidget *pixmap;
        pixmap = gtk_pixmap_new(the_one.GetPixmap(), mask);
        gtk_widget_show(pixmap);
        gtk_container_add(GTK_CONTAINER(m_widget), pixmap);
    }
    else
    {   // subsequent bitmaps
        GtkPixmap *pixmap = GTK_PIXMAP(child);
        gtk_pixmap_set(pixmap, the_one.GetPixmap(), mask);
    }
}
Пример #7
0
gint display_about_dbox()
{
  GtkWidget *dbox;
  gpointer user_data;
  FILE *fd;
  gchar buffer[MAXCHARS];
  GdkFont *fixed_font;
  GtkWidget *text;
  gchar tempstr[MAXCHARS];

  dbox = create_about_dbox();
  
  /* Set text */
  user_data = gtk_object_get_data(GTK_OBJECT(dbox), "text1");
  text = GTK_WIDGET(user_data);
  gtk_text_freeze(GTK_TEXT (text));
  gtk_editable_delete_text(GTK_EDITABLE(text), 0, -1);

  strcpy(buffer, inst_paths.base_dir);  // retrieve base path
  strcat(buffer, SHARE_DIR);          //
  strcat(buffer, DIR_SEPARATOR);
#if defined(__LINUX__)
  strcat(buffer, "COPYING");
#elif defined(__WIN32__)
  strcat(buffer, "Copying.txt");
#endif

  if(access(buffer, F_OK) == 0 )
    {
#if defined(__LINUX__)
      fixed_font = gdk_font_load ("-misc-clean-medium-r-*-*-*-140-*-*-*-*-*-*");
#elif defined(__WIN32__)
      fixed_font = gdk_font_load ("-adobe-courier-medium-r-normal--12-120-75-75-p-70-iso8859-1");
#endif
      if( (fd=fopen (buffer, "r")) != NULL)
	{
	  memset (buffer, 0, sizeof(buffer));
	  while(fread (buffer, 1, sizeof(buffer)-1, fd))
            {
	      process_buffer(buffer);
              gtk_text_insert (GTK_TEXT (text), fixed_font, NULL, NULL, buffer, strlen (buffer));
              memset (buffer, 0, sizeof(buffer));
            }
	  fclose (fd);
	}
    }
  gtk_text_thaw(GTK_TEXT (text));

  /* Set label */
  user_data = gtk_object_get_data(GTK_OBJECT(dbox), "label5");
#ifdef HAVE_LIBTIFFEP
  g_snprintf(tempstr, sizeof(tempstr), 
	     "* TILP version %s (cable=%s, tiffep=%s)", 
	     GTKTIEMU_VERSION,
	     ticable_get_version(),
	     tiffep_get_version());
#else
  g_snprintf(tempstr, sizeof(tempstr),
	     "* TILP version %s (%s %s)", 
	     GTKTIEMU_VERSION,
	     ticable_get_version(),
	     "NA");
#endif
  gtk_label_set_text(GTK_LABEL(user_data), tempstr);

  /* Set pixmap */
  user_data = gtk_object_get_data(GTK_OBJECT(dbox), "pixmap2");
  #if 0
  /* buggy code -- avoid segfault ... */
  GtkWidget *tmp_pixmapwid = GTK_WIDGET(user_data);
  GdkPixmap *pixmap;
  GdkBitmap *mask;
  GtkStyle *style;
  FILE *f;
  gchar buffer[MAXCHARS];

  return;

  /* Create the base filename */
  strcpy(buffer, inst_paths.base_dir);  // retrieve base path
  strcat(buffer, SHARE_DIR);          //
  strcat(buffer, DIR_SEPARATOR);
#if defined(__LINUX__)
  strcat(buffer, "logo.jpg");
#elif defined(__WIN32__)
  strcat(buffer, "logo.jpg");
#endif
  DISPLAY("logo: <%s>\n", buffer);
  /* Try to access the file */
  if(access(buffer, F_OK) == 0 )
    {
      /* Open and load file */
      f = fopen(buffer, "rb");
      if(f == NULL)
	g_error("Unable to open the logo (logo.jpg).\n");
      img.depth = 3; // > 2 colors
      read_jpg_format(f, &img);
      fclose(f);

      convert_bytemap_to_pixmap(&img);

      style = gtk_widget_get_style(widget);
      pixmap = gdk_pixmap_create_from_xpm_d(widget->window, &mask,
					    &style->bg[GTK_STATE_NORMAL],
					    (gchar **)(img.pixmap));
      gtk_pixmap_set(GTK_PIXMAP(tmp_pixmapwid), pixmap, mask);      
    }
  else 
    g_warning("Unable to open the logo (logo.jpg).\n");
#endif

  gtk_widget_show_all(dbox);
  return 0;
}
Пример #8
0
bool wxNotebook::SetPageImage( size_t page, int image )
{
    /* HvdH 28-12-98: now it works, but it's a bit of a kludge */

    wxGtkNotebookPage* nb_page = GetNotebookPage(page);

    if (!nb_page) return FALSE;

    /* Optimization posibility: return immediately if image unchanged.
     * Not enabled because it may break existing (stupid) code that
     * manipulates the imagelist to cycle images */

    /* if (image == nb_page->m_image) return true; */

    /* For different cases:
       1) no image -> no image
       2) image -> no image
       3) no image -> image
       4) image -> image */

    if (image == -1 && nb_page->m_image == -1)
        return true; /* Case 1): Nothing to do. */

    GtkWidget *pixmapwid = NULL;

    if (nb_page->m_image != -1)
    {
        /* Case 2) or 4). There is already an image in the gtkhbox. Let's find it */

        GList *child = gtk_container_children(GTK_CONTAINER(nb_page->m_box));
        while (child)
        {
            if (GTK_IS_PIXMAP(child->data))
            {
                pixmapwid = GTK_WIDGET(child->data);
                break;
            }
            child = child->next;
        }

        /* We should have the pixmap widget now */
        wxASSERT(pixmapwid != NULL);

        if (image == -1)
        {
            /* If there's no new widget, just remove the old from the box */
            gtk_container_remove(GTK_CONTAINER(nb_page->m_box), pixmapwid);
            nb_page->m_image = -1;

            return true; /* Case 2) */
        }
    }

    /* Only cases 3) and 4) left */
    wxASSERT( m_imageList != NULL ); /* Just in case */

    /* Construct the new pixmap */
    const wxBitmap *bmp = m_imageList->GetBitmapPtr(image);
    GdkPixmap *pixmap = bmp->GetPixmap();
    GdkBitmap *mask = NULL;
    if ( bmp->GetMask() )
    {
        mask = bmp->GetMask()->GetBitmap();
    }

    if (pixmapwid == NULL)
    {
        /* Case 3) No old pixmap. Create a new one and prepend it to the hbox */
        pixmapwid = gtk_pixmap_new (pixmap, mask );

        /* CHECKME: Are these pack flags okay? */
        gtk_box_pack_start(GTK_BOX(nb_page->m_box), pixmapwid, FALSE, FALSE, m_padding);
        gtk_widget_show(pixmapwid);
    }
    else
    {
        /* Case 4) Simply replace the pixmap */
        gtk_pixmap_set(GTK_PIXMAP(pixmapwid), pixmap, mask);
    }

    nb_page->m_image = image;

    return true;
}
Пример #9
0
void malicrecog_gui_setup(MalicRecogGui* gui, MalibObject* handler){
  GtkWidget * malicrecog_main_fixed, * malicrecog_main_viewport,
            * malicrecog_statusbar,  * malicrecog_scrolledwindow,
            * alpha_progressbar,     * toggle_running,
            * malib_drawingarea;
  
  gtk_signal_connect(GTK_OBJECT (gui->window), "delete_event",
		     GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
		     //GTK_SIGNAL_FUNC (gtk_wrap_malic_cv_gtkdisplay_delete), gui->display);

  /* main viewport (drawingarea) */
  malicrecog_main_viewport= lookup_widget(gui->window, "malicrecog_main_viewport");
  gtk_widget_set_usize(malicrecog_main_viewport,
		       BTTV_DEFAULT_WIDTH, BTTV_DEFAULT_HEIGHT);
  malib_drawingarea=
    GTK_WIDGET (malib_gtkdisplay_get_drawarea(gui->display));
  gtk_container_add(GTK_CONTAINER (malicrecog_main_viewport), malib_drawingarea);
  gtk_widget_ref(malib_drawingarea);

  /* toggle running button */
  toggle_running= lookup_widget(gui->window, "toggle_running_button");
  gtk_signal_connect(GTK_OBJECT (toggle_running), "clicked",
		     GTK_SIGNAL_FUNC (malicrecog_toggle_running_clicked),
		     gui);

  /* create indicator's gdk_pixmap */
  {
    GtkPixmap* tmp_gtk_pixmap;

    tmp_gtk_pixmap= (GtkPixmap*) create_pixmap
                                 (gui->window, MALICRECOG_FACE_DETECT_PIXMAP);
    gui->face_detect_indicator_malic_pixmap.gdk_pixmap = tmp_gtk_pixmap->pixmap;
    gui->face_detect_indicator_malic_pixmap.pixmap_mask= tmp_gtk_pixmap->mask;

    tmp_gtk_pixmap= (GtkPixmap*) create_pixmap
                                 (gui->window, MALICRECOG_NAME_DETECT_PIXMAP);
    gui->name_detect_indicator_malic_pixmap.gdk_pixmap = tmp_gtk_pixmap->pixmap;
    gui->name_detect_indicator_malic_pixmap.pixmap_mask= tmp_gtk_pixmap->mask;

    tmp_gtk_pixmap= (GtkPixmap*) create_pixmap
                                 (gui->window, MALICRECOG_DUMMY_20_PIXMAP);
    gui->dummy_20_malic_pixmap.gdk_pixmap = tmp_gtk_pixmap->pixmap;
    gui->dummy_20_malic_pixmap.pixmap_mask= tmp_gtk_pixmap->mask;
  }

  /* face detect and name detect indicator setup */
  {
    gui->face_detect_indicator_malic_pixmap.pixmap=
      lookup_widget(gui->window, "face_detect_indicator_pix");
    gtk_pixmap_set((GtkPixmap*)gui->face_detect_indicator_malic_pixmap.pixmap,
		   gui->dummy_20_malic_pixmap.gdk_pixmap,
		   gui->dummy_20_malic_pixmap.pixmap_mask);

    gui->name_detect_indicator_malic_pixmap.pixmap=
      lookup_widget(gui->window, "name_detect_indicator_pix");
    gtk_pixmap_set((GtkPixmap*)gui->name_detect_indicator_malic_pixmap.pixmap,
		   gui->dummy_20_malic_pixmap.gdk_pixmap,
		   gui->dummy_20_malic_pixmap.pixmap_mask);
  }
  /* face detect and name detect indicator setup end */

  /* labels setup */
  {
    gui->last_name_label            = lookup_widget(gui->window, "last_name_label");
    gui->current_name_label         = lookup_widget(gui->window, "current_name_label");
    gui->current_similar_value_label= lookup_widget(gui->window, "current_similar_value_label");
    gui->current_sim_jet_value_label= lookup_widget(gui->window, "current_sim_jet_value_label");
    gui->current_sim_geo_value_label= lookup_widget(gui->window, "current_sim_geo_value_label");
  }
  /* labels setup end */

  /* name detect threshold slider setup */
  {
    GtkAdjustment * adj;
    GtkWidget * h_scale;
    MalicFaceGraphMeasure * filter;

    filter= gui->fg_measure_filter;
    
    if(filter){
      h_scale= lookup_widget(gui->window, "name_threshold_h_scale");
      gtk_range_set_adjustment( GTK_RANGE(h_scale),
				GTK_ADJUSTMENT (gtk_adjustment_new (filter->face_detect_threshold, 0, 1, 0, 0, 0)));
      adj= gtk_range_get_adjustment ( GTK_RANGE(h_scale) );

      gtk_signal_connect( GTK_OBJECT(adj), "value_changed",
			  on_malic_ftype_h_scale_value_change,
			  &filter->face_detect_threshold );
    }
  }
  /* name detect threshold slider setup end */
  
  /* color slider setup */
  {
    GtkAdjustment* adj;
    GtkWidget * color_hscale;
    MalicColorConfig * filter;
    filter= (MalicColorConfig*)gui->c_conf_filter;
    if(filter){
      color_hscale= lookup_widget (gui->window, "hscale_red");
      adj= gtk_range_get_adjustment (GTK_RANGE(color_hscale));
      gtk_signal_connect(GTK_OBJECT(adj), "value_changed",
			 on_color_hscale_button_value_change,
			 &filter->red);
      color_hscale= lookup_widget (gui->window, "hscale_green");
      adj= gtk_range_get_adjustment (GTK_RANGE(color_hscale));
      gtk_signal_connect(GTK_OBJECT(adj), "value_changed",
			 on_color_hscale_button_value_change,
			 &filter->green);
      color_hscale= lookup_widget (gui->window, "hscale_blue");
      adj= gtk_range_get_adjustment (GTK_RANGE(color_hscale));
      gtk_signal_connect(GTK_OBJECT(adj), "value_changed",
			 on_color_hscale_button_value_change,
			 &filter->blue);
    }
  }
  return;
}