static HRESULT draw_item(header_theme_t *theme, cairo_t *cr, int state_id, int width, int height) { GtkStyleContext *context; GtkStateFlags state; GtkWidget *widget; assert(theme != NULL); widget = pgtk_tree_view_column_get_button( pgtk_tree_view_get_column((GtkTreeView *)theme->treeview, 1)); context = pgtk_widget_get_style_context(widget); pgtk_style_context_save(context); if (state_id == HIS_HOT) state = GTK_STATE_FLAG_PRELIGHT; else if (state_id == HIS_PRESSED) state = GTK_STATE_FLAG_ACTIVE; else state = GTK_STATE_FLAG_NORMAL; pgtk_style_context_set_state(context, state); pgtk_render_background(context, cr, 0, 0, width, height); pgtk_render_frame(context, cr, 0, 0, width, height); pgtk_style_context_restore(context); return S_OK; }
static HRESULT draw_button(combobox_theme_t *theme, cairo_t *cr, int part_id, int state_id, int width, int height) { GtkStateFlags state = get_dropdown_button_state_flags(state_id); GtkStyleContext *context; int arrow_x, arrow_y, arrow_width; assert(theme != NULL); context = pgtk_widget_get_style_context(theme->button); pgtk_style_context_save(context); pgtk_style_context_set_state(context, state); /* Render with another size to remove a gap */ if (part_id == CP_DROPDOWNBUTTONLEFT) { pgtk_render_background(context, cr, -2, -2, width + 2, height + 4); pgtk_render_frame(context, cr, -2, -2, width + 2, height + 4); } else { pgtk_render_background(context, cr, 0, -2, width + 2, height + 4); pgtk_render_frame(context, cr, 0, -2, width + 2, height + 4); } pgtk_style_context_restore(context); context = pgtk_widget_get_style_context(theme->arrow); pgtk_style_context_save(context); pgtk_style_context_set_state(context, state); arrow_width = theme->arrow_size * theme->arrow_scaling; arrow_x = (width - arrow_width + 3) / 2; arrow_y = (height - arrow_width) / 2; pgtk_render_arrow(context, cr, G_PI, arrow_x, arrow_y, arrow_width); pgtk_style_context_restore(context); return S_OK; }
static HRESULT draw_dialog(uxgtk_theme_t *theme, cairo_t *cr, int state_id, int width, int height) { GtkStyleContext *context; assert(theme != NULL); context = pgtk_widget_get_style_context(theme->window); pgtk_render_background(context, cr, 0, 0, width, height); return S_OK; }
static HRESULT draw_border(combobox_theme_t *theme, cairo_t *cr, int state_id, int width, int height) { GtkStateFlags state = get_border_state_flags(state_id); GtkStyleContext *context; assert(theme != NULL); context = pgtk_widget_get_style_context(theme->entry); pgtk_style_context_save(context); pgtk_style_context_set_state(context, state); pgtk_render_background(context, cr, 0, 0, width, height); pgtk_render_frame(context, cr, 0, 0, width, height); pgtk_style_context_restore(context); return S_OK; }
static HRESULT draw_button(button_theme_t *theme, cairo_t *cr, int state_id, int width, int height) { GtkStateFlags state = get_push_button_state_flags(state_id); GtkStyleContext *context; assert(theme != NULL); context = pgtk_widget_get_style_context(get_button(theme)); pgtk_style_context_save(context); pgtk_style_context_set_state(context, state); if (state_id == PBS_DEFAULTED) pgtk_style_context_add_class(context, GTK_STYLE_CLASS_DEFAULT); pgtk_render_background(context, cr, 0, 0, width, height); pgtk_render_frame(context, cr, 0, 0, width, height); pgtk_style_context_restore(context); return S_OK; }