Hi,
i am new to gtk programming an i tried to draw on the background of a button.
The draw signal is catched by my funtion, so that it should draw the lines.
Heres is my code of the drawing function.
Code:
cairo_t *cr = NULL;
cr = gdk_cairo_create(gtk_widget_get_window(m_pWidget));
cairo_set_source_rgb (cr, 0, 0, 0);
cairo_set_line_width(cr, 2);
cairo_move_to(cr, 0, 0);
cairo_line_to(cr, 100, 150);
cairo_line_to(cr, 0, 150);
cairo_line_to(cr,0,0);
cairo_fill(cr);
cairo_destroy(cr);
if i use the same code for a GtkWindow it works fine.
To create the button i use these two functions.
Code:
m_pWidget = gtk_button_new_with_label("Hello");
gtk_widget_set_app_paintable(m_pWidget, true);
Can someone pint me in the right direction to draw on the buttons background.
HeReSY