Re: regarding gtk and x11 componenets

2010-03-19 Thread Tor Lillqvist
> I am trying to build gtk-directfb on phoneme ….

Why do you assume people would know what "phoneme" is?

>  how to replace these with similar functions of gtk ……

By asking for help on the Interwebs? Or by doing the research and
coding required yourself? Which approach would you be more proud of?

--tml
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

RE: how to draw something on GtkDrawingArea when I click a button?

2010-03-19 Thread Shawn Bakhtiar


As a matter of fact. I would suggest using Cairo. Which will allow you to then 
draw in any context (IE Printer, PDF, etc...)


/* Local Variables */
cairo_t *cr;/* Rendering context derived from widget */

/* Get the context to which we need to draw */
cr = gdk_cairo_create(widget->window);
/* Printer context would be: 
  cr = gtk_print_context_get_cairo_context(context) 
   where context is a GtkPrinterContext* */

/* If we have a valid context draw valid object */
if (cr != NULL){

   /* Boarder rectangle */
   cairo_rectangle(cr,  0.00, 0.00, 20.0 , 40.0 ); 

   cairo_stroke(cr);

   cairo_set_line_width(cr,line_width / 60);

   /* Virtical Seporation lines */
   cairo_move_to(cr, 20.0 , 40.0 ); 
   cairo_line_to(cr, 40.0, 40.0); 

   cairo_stroke(cr);

  /* Distroy the context we created */ 
  cairo_destroy(cr);

   }

 







 EMAILING FOR THE GREATER GOOD
Join me

> Subject: Re: how to draw something on GtkDrawingArea when I click a button?
> From: csaave...@gnome.org
> To: gtk-app-devel-list@gnome.org
> Date: Fri, 19 Mar 2010 08:46:33 +0200
> 
> El vie, 19-03-2010 a las 13:34 +0800, Tolic Ma escribió:
> > Hi,everyone!
> > 
> > I want to draw something on GtkDrawingArea when I click a GtkButton,but I
> > don't know how to do this...
> > 
> > this is my code(it doesn't work...):
> > 
> > *void click_button(void){
> > 
> > 
> > gdk_draw_line(drawing_area,drawing_area->style->white_gc,x,y,width+x,height+y);
> > 
> > }
> 
> You shouldn't draw directly in your callback for the button. Instead,
> you should call gtk_widget_queue_draw() to tell GTK+ to schedule a paint
> of the widget.
> 
> How will the widget be painted? GTK+ will tell your code that the widget
> needs to be painted by emitting the GtkWidget::expose-event signal.
> Then, you should connect to that signal and paint in your callback.
> 
> Last but no least, don't forget to paint to the GdkWindow of the drawing
> area, since that's the drawable.
> 
> More or less (untested code, just for clarity):
> 
> *void
> click_button(GtkButton *button, gpointer data)
> {
>button_clicked = TRUE;
>gtk_widget_queue_draw (drawing_area);
>...
> }
> 
> gboolean
> expose_drawing_area (GtkWidget *area, 
>  GdkExposureEvent *event,
>  gpointer data)
> {
>...
>if (button_clicked) {
>   gdk_draw_line(drawing_area->window,
> drawing_area->style->white_gc,x,y,width+x,height+y);
>}
>...
> }
> 
> int main(int argc,char *argv[]){
>...
>g_signal_connect(button,"clicked",G_CALLBACK(click_button),NULL);
>
> g_signal_connect(drawing_area,"expose-event",G_CALLBACK(expose_drawing_area),NULL);
>...
> }
> 
> 
> Claudio
> 
> -- 
> Claudio Saavedra 
> 
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
  
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: how to draw something on GtkDrawingArea when I click a button?

2010-03-19 Thread Tolic Ma
On Fri, Mar 19, 2010 at 2:46 PM, Claudio Saavedra wrote:

> El vie, 19-03-2010 a las 13:34 +0800, Tolic Ma escribió:
> > Hi,everyone!
> >
> > I want to draw something on GtkDrawingArea when I click a GtkButton,but I
> > don't know how to do this...
> >
> > this is my code(it doesn't work...):
> >
> > *void click_button(void){
> >
> >
> >
> gdk_draw_line(drawing_area,drawing_area->style->white_gc,x,y,width+x,height+y);
> >
> > }
>
> You shouldn't draw directly in your callback for the button. Instead,
> you should call gtk_widget_queue_draw() to tell GTK+ to schedule a paint
> of the widget.
>
> How will the widget be painted? GTK+ will tell your code that the widget
> needs to be painted by emitting the GtkWidget::expose-event signal.
> Then, you should connect to that signal and paint in your callback.
>
> Last but no least, don't forget to paint to the GdkWindow of the drawing
> area, since that's the drawable.
>
> More or less (untested code, just for clarity):
>
> *void
> click_button(GtkButton *button, gpointer data)
> {
>   button_clicked = TRUE;
>   gtk_widget_queue_draw (drawing_area);
>   ...
> }
>
> gboolean
> expose_drawing_area (GtkWidget *area,
> GdkExposureEvent *event,
> gpointer data)
> {
>   ...
>   if (button_clicked) {
>  gdk_draw_line(drawing_area->window,
> drawing_area->style->white_gc,x,y,width+x,height+y);
>   }
>   ...
> }
>
> int main(int argc,char *argv[]){
>   ...
>   g_signal_connect(button,"clicked",G_CALLBACK(click_button),NULL);
>
> g_signal_connect(drawing_area,"expose-event",G_CALLBACK(expose_drawing_area),NULL);
>   ...
> }
>
>
> Claudio
>
> --
> Claudio Saavedra 
>
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>



Thank you!

I solved my problem by following your instruction.

Thank you very much!!!
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Ho to use PangoContext returned by pango_xft_get_context()?

2010-03-19 Thread Vitaly V. Ch
Hi All!

If I try to use PangoContext returned by pango_xft_get_context() my
application SegFault via uninitialized some internal pointer in
PangoContext.
But if I use  gtk_widget_get_pango_context() - all work success.

Any ideas or examples?

\\wbr Vitaly Chernookiy
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list