static gboolean draw_cb (GtkWidget *widget, cairo_t *cr) { gint width, height; width = gtk_widget_get_allocated_width (widget); height = gtk_widget_get_allocated_height (widget); cairo_rectangle (cr, 0, 0, width, height); cairo_set_source_rgb (cr, 0, 0, 0); cairo_fill (cr); draw_horizontal_scrollbar (widget, cr, 10, 10, width - 20, 10, 30, GTK_STATE_FLAG_NORMAL); draw_horizontal_scrollbar (widget, cr, 10, 30, width - 20, 10, 40, GTK_STATE_FLAG_PRELIGHT); draw_horizontal_scrollbar (widget, cr, 10, 50, width - 20, 10, 50, GTK_STATE_FLAG_ACTIVE|GTK_STATE_FLAG_PRELIGHT); draw_text (widget, cr, 10, 70, width - 20, 20, "Not selected", GTK_STATE_FLAG_NORMAL); draw_text (widget, cr, 10, 100, width - 20, 20, "Selected", GTK_STATE_FLAG_SELECTED); draw_check (widget, cr, 10, 130, GTK_STATE_FLAG_NORMAL); draw_check (widget, cr, 40, 130, GTK_STATE_FLAG_CHECKED); draw_radio (widget, cr, 70, 130, GTK_STATE_FLAG_NORMAL); draw_radio (widget, cr, 100, 130, GTK_STATE_FLAG_CHECKED); return FALSE; }
static HRESULT draw_background(uxgtk_theme_t *theme, cairo_t *cr, int part_id, int state_id, int width, int height) { button_theme_t *button_theme = impl_from_uxgtk_theme_t(theme); switch (part_id) { case BP_PUSHBUTTON: return draw_button(button_theme, cr, state_id, width, height); case BP_RADIOBUTTON: return draw_radio(button_theme, cr, state_id); case BP_CHECKBOX: return draw_checkbox(button_theme, cr, state_id); case BP_GROUPBOX: /* GNOME applications don't draw a group box. Return some error code * to avoid useless painting operations. */ return E_ABORT; } FIXME("Unsupported button part %d.\n", part_id); return E_NOTIMPL; }
static void draw_func (GtkDrawingArea *da, cairo_t *cr, int width, int height, gpointer data) { GtkWidget *widget = GTK_WIDGET (da); gint panewidth; gint x, y; panewidth = width / 2; cairo_rectangle (cr, 0, 0, width, height); cairo_set_source_rgb (cr, 0.9, 0.9, 0.9); cairo_fill (cr); x = y = 10; draw_horizontal_scrollbar (widget, cr, x, y, panewidth - 20, 30, GTK_STATE_FLAG_NORMAL, &height); y += height + 8; draw_horizontal_scrollbar (widget, cr, x, y, panewidth - 20, 40, GTK_STATE_FLAG_PRELIGHT, &height); y += height + 8; draw_horizontal_scrollbar (widget, cr, x, y, panewidth - 20, 50, GTK_STATE_FLAG_ACTIVE|GTK_STATE_FLAG_PRELIGHT, &height); y += height + 8; draw_text (widget, cr, x, y, panewidth - 20, 20, "Not selected", GTK_STATE_FLAG_NORMAL); y += 20 + 10; draw_text (widget, cr, x, y, panewidth - 20, 20, "Selected", GTK_STATE_FLAG_SELECTED); x = 10; y += 20 + 10; draw_check (widget, cr, x, y, GTK_STATE_FLAG_NORMAL, &width, &height); x += width + 10; draw_check (widget, cr, x, y, GTK_STATE_FLAG_CHECKED, &width, &height); x += width + 10; draw_radio (widget, cr, x, y, GTK_STATE_FLAG_NORMAL, &width, &height); x += width + 10; draw_radio (widget, cr, x, y, GTK_STATE_FLAG_CHECKED, &width, &height); x = 10; y += height + 10; draw_progress (widget, cr, x, y, panewidth - 20, 50, &height); y += height + 10; draw_scale (widget, cr, x, y, panewidth - 20, 75, &height); y += height + 20; draw_notebook (widget, cr, x, y, panewidth - 20, 160); /* Second column */ x += panewidth; y = 10; draw_menu (widget, cr, x, y, panewidth - 20, &height); y += height + 10; draw_menubar (widget, cr, x, y, panewidth - 20, &height); y += height + 20; draw_spinbutton (widget, cr, x, y, panewidth - 20, &height); y += height + 30; draw_combobox (widget, cr, x, y, panewidth - 20, FALSE, &height); y += height + 10; draw_combobox (widget, cr, 10 + panewidth, y, panewidth - 20, TRUE, &height); }