Example #1
0
void drawTest(Ihandle *ih, int posx)
{
  GtkWidget* widget = (GtkWidget*)IupGetAttribute(ih, "WID");
  gdk_draw_arc (widget->window,
                widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
                TRUE,
                0, 0, widget->allocation.width, widget->allocation.height,
                0, 64 * 360);
}
Example #2
0
void WinDraw_ShowSplash(void)
{

	gdk_draw_pixmap(pixmap,
	    drawarea->style->fg_gc[GTK_WIDGET_STATE(drawarea)],
	    splash_pixmap, 0, 0,
	    768 - keropi_xpm_width, 512 - keropi_xpm_height,
	    keropi_xpm_width, keropi_xpm_height);
}
Example #3
0
gboolean on_window_expose_event(GtkWidget * da, GdkEventExpose * event, gpointer user_data){
    gdk_draw_drawable(da->window,
        da->style->fg_gc[GTK_WIDGET_STATE(da)], pixmap,
        // Only copy the area that was exposed.
        event->area.x, event->area.y,
        event->area.x, event->area.y,
        event->area.width, event->area.height);
    return TRUE;
}
static void redraw_viewer(void)
{
  gdk_draw_pixbuf(drawing_area->window,
                  drawing_area->style->fg_gc[GTK_WIDGET_STATE (drawing_area)],
                  map_buffer, 0, 0, 0, 0,
                  drawing_area->allocation.width,
                  drawing_area->allocation.height,
                  GDK_RGB_DITHER_NONE, 0, 0);
}
Example #5
0
static gint
panel_expose_event(GtkWidget *widget, GdkEventExpose *ev)
	{
	gdk_draw_pixmap(widget->window,
			widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
			panel->pixmap, ev->area.x, ev->area.y, ev->area.x, ev->area.y,
			ev->area.width, ev->area.height);
	return FALSE;
	}
Example #6
0
void gpk_redraw(GdkPixmap *pixmap, GtkWidget *pixmapbox)
{
  /* redraw the entire pixmap */
  gdk_draw_pixmap(pixmapbox->window,
		  pixmapbox->style->fg_gc[GTK_WIDGET_STATE (pixmapbox)],
		  pixmap,0,0,0,0,
		  pixmapbox->allocation.width,
		  pixmapbox->allocation.height);
}
Example #7
0
/**
* @brief Callback when subrx is exposed - need to paint it from the pixmap
*
* @param widget
* @param event
*
* @return
*/
gboolean subrxFrequencyDisplayExpose(GtkWidget* widget,GdkEventExpose* event) {
    gdk_draw_drawable(widget->window,
                    widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
                    subrxPixmap,
                    event->area.x, event->area.y,
                    event->area.x, event->area.y,
                    event->area.width, event->area.height);
    return FALSE;
}
static gint
expose_event (GtkWidget *widget, GdkEventExpose *e, C2NetworkTraffic *nt)
{
	gdk_draw_pixmap (widget->window, widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
					 nt->pixmap, e->area.x, e->area.y, e->area.x, e->area.y,
					 e->area.width, e->area.height);
	
	return FALSE;
}
void ZLGtkApplicationWindow::refresh() {
	ZLApplicationWindow::refresh();

	for (std::map<std::string,GtkMenuItem*>::iterator it = myMenuItems.begin(); it != myMenuItems.end(); it++) {
		const std::string &id = it->first;
		GtkWidget *gtkItem = GTK_WIDGET(it->second);
		if (application().isActionVisible(id)) {
			gtk_widget_show(gtkItem);
		} else {
			gtk_widget_hide(gtkItem);
		}
		bool alreadyEnabled =
			(GTK_WIDGET_STATE(gtkItem) & GTK_STATE_INSENSITIVE) == 0;
		if (application().isActionEnabled(id) != alreadyEnabled) {
			gtk_widget_set_sensitive(gtkItem, !alreadyEnabled);
		}
	}
	for (std::vector<GtkMenuItem*>::reverse_iterator rit = mySubmenuItems.rbegin(); rit != mySubmenuItems.rend(); ++rit) {
		bool isVisible = false;
		bool isEnabled = false;
		GtkMenu *menu = GTK_MENU(gtk_menu_item_get_submenu(*rit));
		GList *children = gtk_container_get_children(GTK_CONTAINER(menu));
		if (children != 0) {
			for (GList *ptr =  g_list_first(children); ptr != 0; ptr = g_list_next(ptr)) {
				GtkMenuItem *item = GTK_MENU_ITEM(ptr->data);
				if (GTK_WIDGET_VISIBLE(item)) {
					isVisible = true;
					isEnabled = (GTK_WIDGET_STATE(item) & GTK_STATE_INSENSITIVE) == 0;
					if (isEnabled) {
						break;
					}
				}
			}
		}
		if (isEnabled != ((GTK_WIDGET_STATE(*rit) & GTK_STATE_INSENSITIVE) == 0)) {
			gtk_widget_set_sensitive(GTK_WIDGET(*rit), isEnabled);
		}
		if (isVisible) {
			gtk_widget_show(GTK_WIDGET(*rit));
		} else {
			gtk_widget_hide(GTK_WIDGET(*rit));
		}
	}
}
Example #10
0
void
aurora_get_parent_bg (const GtkWidget *widget, AuroraRGB *color)
{
	GtkStateType state_type;
	const GtkWidget *parent;
	GdkColor *gcolor;
	gboolean stop;
	GtkShadowType shadow = GTK_SHADOW_NONE;
	
	if (widget == NULL)
		return;
	
	parent = widget->parent;
	stop = FALSE;
	
	while (parent && !stop)
	{
		stop = FALSE;

		stop |= !GTK_WIDGET_NO_WINDOW (parent);
		stop |= GTK_IS_NOTEBOOK (parent) &&
		        gtk_notebook_get_show_tabs (GTK_NOTEBOOK (parent)) &&
		        gtk_notebook_get_show_border (GTK_NOTEBOOK (parent));

		if (GTK_IS_FRAME(parent))
		{
			shadow = gtk_frame_get_shadow_type(GTK_FRAME(parent));
			stop |= (shadow != GTK_SHADOW_NONE);
		}
		else if (GTK_IS_TOOLBAR (parent))
		{
			gtk_widget_style_get (GTK_WIDGET (parent), "shadow-type", &shadow, NULL);
			
			stop |= (shadow != GTK_SHADOW_NONE);
		}

		if (!stop)
			parent = parent->parent;
	}

	if (parent == NULL)
		return;
	
	state_type = GTK_WIDGET_STATE (parent);
	
	gcolor = &parent->style->bg[state_type];
	
	aurora_gdk_color_to_rgb (gcolor, &color->r, &color->g, &color->b);
    
    if (GTK_IS_FRAME (parent) && shadow != GTK_SHADOW_NONE) {
         if (shadow == (GTK_SHADOW_IN || GTK_SHADOW_ETCHED_IN))
         	aurora_shade (color, color, 0.97);
         else
            aurora_shade (color, color, 1.04);
    }
}
static gint     expose_event(GtkWidget *widget, GdkEventExpose *event, void *disp)
{
  gdk_draw_pixmap(widget->window,
                  widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
                  pixmap,
                  event->area.x, event->area.y,
                  event->area.x, event->area.y,
                  event->area.width, event->area.height);
  return (FALSE);
}
Example #12
0
gboolean Fenetre::expose_event(GtkWidget *widget, GdkEventExpose *event)
{ // devient visible => on réaffiche l'image mémoire à l'écran
  gdk_draw_drawable (widget->window,
		     widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
		     dessin,
		     event->area.x, event->area.y,
		     event->area.x, event->area.y,
		     event->area.width, event->area.height);
  return FALSE;
}
Example #13
0
void Fenetre::remplitRectangle(int x,int y,int large,int haut ){ // rectangle plein
    if (existe) {
      gdk_gc_set_rgb_fg_color(fenetre->style->fg_gc[GTK_STATE_NORMAL],&stylo);
      gdk_draw_rectangle (dessin,
    		      fenetre->style->fg_gc[GTK_WIDGET_STATE (fenetre)], TRUE,
    		      x, y, large, haut);
      gtk_widget_queue_draw(fenetre); // provoquer l'affichage
      traiteEvenements();
      }
}
Example #14
0
// méthodes de dessin (droite, arc)
void Fenetre::traceLigne(int ax, int ay, int bx, int by, int e) { //droite
    if (existe) {
        gdk_gc_set_rgb_fg_color(fenetre->style->fg_gc[GTK_STATE_NORMAL],&stylo);
        choixEpaisseurTrace(e); // couleur et épaisseur du tracé
        gdk_draw_line(dessin, fenetre->style->fg_gc[GTK_WIDGET_STATE (fenetre)],
                ax,ay,bx,by);
        gtk_widget_queue_draw(fenetre); // provoquer l'affichage
        traiteEvenements();
        }
}
Example #15
0
File: table.c Project: ralight/ggz
/* Draw the box around the cards */
static void draw_card_box(int p)
{
	int x, y, w, h;

	get_card_box_pos(p, &x, &y);
	get_card_box_dim(p, &w, &h);
	gdk_draw_rectangle(table_buf,
			   table_style->fg_gc[GTK_WIDGET_STATE(table)],
			   FALSE, x, y, w, h);
}
Example #16
0
File: table.c Project: ralight/ggz
void table_draw_table(GdkPixmap * pixmap, int x, int y, int w, int h)
{
	if (pixmap == NULL)
		pixmap = table_drawing_area->window;

	/* Display the buffer */
	gdk_draw_drawable(pixmap,
			  table_style->fg_gc[GTK_WIDGET_STATE(table)],
			  table_buf, x, y, x, y, w, h);
}
Example #17
0
static void
gwy_hmarker_box_draw_marker(GwyMarkerBox *mbox,
                            gint i)
{
    GtkWidget *widget;
    GtkStateType state, gcstate;
    gboolean ghost, selected;
    GdkPoint points[3];
    gint height, width;
    gdouble pos;
    gint iw, ipos;

    widget = GTK_WIDGET(mbox);
    state = GTK_WIDGET_STATE(widget);
    width = widget->allocation.width;
    height = widget->allocation.height;

    selected = (i == mbox->selected);
    ghost = selected && mbox->ghost;
    selected = selected && mbox->highlight;
    pos = g_array_index(mbox->markers, gdouble, i);

    if (ghost)
        gcstate = GTK_STATE_INSENSITIVE;
    else if (state == GTK_STATE_INSENSITIVE)
        gcstate = state;
    else
        gcstate = GTK_STATE_NORMAL;

    ipos = GWY_ROUND(pos*(width - 1));
    iw = MAX(GWY_ROUND(height/GWY_SQRT3 - 1), 1);
    points[0].x = ipos - iw;
    points[1].x = ipos + iw;
    points[2].x = ipos;
    if (mbox->flipped) {
        points[0].y = 0;
        points[1].y = 0;
        points[2].y = height-1;
    }
    else {
        points[0].y = height-1;
        points[1].y = height-1;
        points[2].y = 0;
    }
    if (selected && !ghost)
        gdk_draw_polygon(widget->window,
                         widget->style->bg_gc[GTK_STATE_SELECTED],
                         TRUE, points, G_N_ELEMENTS(points));
    else
        gdk_draw_polygon(widget->window, widget->style->text_gc[gcstate],
                         TRUE, points, G_N_ELEMENTS(points));

    gdk_draw_polygon(widget->window, widget->style->fg_gc[gcstate],
                     FALSE, points, G_N_ELEMENTS(points));
}
Example #18
0
void gpk_graph_draw(GtkWidget *widget,               /* plot on this widged */
		   int n,                           /* number of data points */
		   gdouble *xcord, gdouble *ycord,  /* data */
		   gdouble xmn,gdouble ymn,         /* coordinates of corners */
		   gdouble xmx,gdouble ymx,
                   int clear,                       /* clear old plot first */
		   char *title,                     /* add a title (only if clear=1) */
                   GdkColor *color)		    
{
  GdkPixmap **ppixmap;
  GdkPoint *points;
  int i;
  gint16 width,height;
  GdkFont *fixed_font;
  GdkGC *gc;

  gc = gdk_gc_new(widget->window);
  gdk_gc_set_foreground(gc, color);



  if ((ppixmap=findpixmap(widget))) {
    width = widget->allocation.width;
    height = widget->allocation.height;


    if (clear) {
      /* white background */
      gdk_draw_rectangle (*ppixmap,
			  widget->style->white_gc,
			  TRUE,0, 0,width,height);
      /* title */
#ifdef _WIN32
      fixed_font = gdk_font_load ("-misc-fixed-large-r-*-*-*-100-*-*-*-*-*-*");
#else
      fixed_font = gdk_font_load ("-misc-fixed-medium-r-*-*-*-100-*-*-*-*-iso8859-1");
#endif

      gdk_draw_text (*ppixmap,fixed_font,
		     widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
		     0,10,title,strlen(title));
    }
      

    points = g_malloc(n*sizeof(GdkPoint));
    for (i=0; i<n ; i++) {
      points[i].x =.5+  ((xcord[i]-xmn)*(width-1)/(xmx-xmn));
      points[i].y =.5+  ((ycord[i]-ymx)*(height-1)/(ymn-ymx));
    }
    gdk_draw_lines(*ppixmap,gc,points,n);
    g_free(points);
    gpk_redraw(*ppixmap,widget);
  }
  gdk_gc_destroy(gc);
}
Example #19
0
// Méthodes pour écrire du texte et des entiers dans une fenêtre
void Fenetre::ecrit(int x, int y, const char * texte) {
    if (existe) {
      gdk_gc_set_rgb_fg_color(fenetre->style->fg_gc[GTK_STATE_NORMAL],&stylo);
      int lb,rb,w,as,de;
      gdk_string_extents (fonte, texte, &lb, &rb, &w, &as, &de);
      gdk_draw_string (dessin, fonte,
        fenetre->style->fg_gc[GTK_WIDGET_STATE (fenetre)],x,y-de,texte); 
      gtk_widget_queue_draw(fenetre); // provoquer l'affichage
      traiteEvenements();
      }
}
Example #20
0
void Fenetre::afficheImage(Image img, int x, int y) { // image à partir d'un objet
   if (existe) {
    GdkPixbuf * image = img.getPixbub();
    if (image!=NULL) {
	    gdk_pixbuf_render_to_drawable(image, dessin, fenetre->style->fg_gc[GTK_WIDGET_STATE(fenetre)],
                        0,0,x,y,-1,-1,GDK_RGB_DITHER_MAX,0,0);
	    gtk_widget_queue_draw(fenetre);
	    traiteEvenements();
	    }
    }
}
Example #21
0
void Fenetre::traceArc(int x, int y, int large, int haut, int angle1, int angle2, int e) {
    if (existe) {
       gdk_gc_set_rgb_fg_color(fenetre->style->fg_gc[GTK_STATE_NORMAL],&stylo); // courbe
       choixEpaisseurTrace(e); // couleur et épaisseur du tracé
       gdk_draw_arc(dessin,
    		      fenetre->style->fg_gc[GTK_WIDGET_STATE (fenetre)], FALSE,
                  x,y,large,haut,angle1*64,angle2*64); 
       gtk_widget_queue_draw(fenetre); // provoquer l'affichage
       traiteEvenements();
       }
}
Example #22
0
static gboolean draw_frame(GtkWidget* widget, GdkEventExpose* event)
{
     gdk_draw_rgb_32_image(main_canvas->window,
			   main_canvas->style->fg_gc[GTK_WIDGET_STATE(main_canvas)],
			   0, 0,
			   240, 320,
			   GDK_RGB_DITHER_NONE,
			   frame_buffer,
			   240*4);
     return FALSE;
}
Example #23
0
static void gdkDrawFocusRect(Ihandle* ih, int x, int y, int w, int h)
{
  GdkWindow* window = iupgtkGetWindow(ih->handle);
  GtkStyle *style = gtk_widget_get_style(ih->handle);
#if GTK_CHECK_VERSION(2, 18, 0)
  GtkStateType state = gtk_widget_get_state(ih->handle);
#else
  GtkStateType state = GTK_WIDGET_STATE(ih->handle);
#endif
  gtk_paint_focus(style, window, state, NULL, ih->handle, NULL, x, y, w, h);
}
Example #24
0
gint
wgra_expose(GtkWidget *widget,GdkEventExpose *ee,gpointer data)
{
  gdk_draw_pixmap(widget->window,
		  widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
		  wcanvas,
		  ee->area.x, ee->area.y,
		  ee->area.x, ee->area.y,
		  ee->area.width, ee->area.height);
  return FALSE;
}
static gboolean lack_expose_event(GtkWidget *widget, GdkEventExpose *event,  
        gpointer data)  
{  
	//gdk_draw_line((widget->window), widget->style->fg_gc[GTK_WIDGET_STATE(  
           // widget)], a, a,b,b);

    gdk_draw_drawable(widget->window, widget->style->fg_gc[GTK_WIDGET_STATE(  
            widget)], lack_graph, event->area.x, event->area.y, event->area.x,  
            event->area.y, event->area.width, event->area.height);  
    return FALSE;  
}  
Example #26
0
File: snake.c Project: blygo/test
static gboolean expose_event(GtkWidget * widget, GdkEventExpose * event,
			     gpointer data)
{
      gdk_draw_drawable(widget->window,
			widget->style->fg_gc[GTK_WIDGET_STATE(widget)],
			pixmap,
			event->area.x, event->area.y,
			event->area.x, event->area.y,
			event->area.width, event->area.height);
      return TRUE;
}
Example #27
0
int
clip_GTK_WIDGETGETSTATE(ClipMachine * cm)
{
	C_widget *cwid = _fetch_cw_arg(cm);
	CHECKCWID(cwid,GTK_IS_WIDGET);
	_clip_retni(cm,GTK_WIDGET_STATE(cwid->widget));

	return 0;
err:
	return 1;
}
Example #28
0
File: mapa.c Project: Lamieur/Lac
G_MODULE_EXPORT gint expose_event( GtkWidget *widget, GdkEventExpose *event )
{
    gdk_draw_drawable( widget->window,
			widget->style->fg_gc[ GTK_WIDGET_STATE( widget ) ],
			dmapa.pixmap,
			event->area.x, event->area.y,
			event->area.x, event->area.y,
			event->area.width, event->area.height );

    return FALSE;
}
Example #29
0
EXPORT gboolean logger_display_expose_event(GtkWidget * widget, GdkEventExpose *event , gpointer data)
{
	gdk_draw_drawable(widget->window,
			widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
			ttm_data->pixmap,
			event->area.x, event->area.y,
			event->area.x, event->area.y,
			event->area.width, event->area.height);

	return TRUE;
}
Example #30
0
static void
draw_restore(struct graphics_priv *gr, struct point *p, int w, int h)
{
#if 0
	GtkWidget *widget=gr->widget;
	gdk_draw_pixmap(widget->window,
                        widget->style->fg_gc[GTK_WIDGET_STATE(widget)],
                        gr->drawable,
                        p->x, p->y, p->x, p->y, w, h);
#endif

}