本文整理汇总了C++中gtk_widget_is_drawable函数的典型用法代码示例。如果您正苦于以下问题:C++ gtk_widget_is_drawable函数的具体用法?C++ gtk_widget_is_drawable怎么用?C++ gtk_widget_is_drawable使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了gtk_widget_is_drawable函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: gimp_histogram_editor_frozen_update
static void
gimp_histogram_editor_frozen_update (GimpHistogramEditor *editor,
const GParamSpec *pspec)
{
GimpHistogramView *view = GIMP_HISTOGRAM_BOX (editor->box)->view;
if (gimp_viewable_preview_is_frozen (GIMP_VIEWABLE (editor->drawable)))
{
/* Only do the background histogram if the histogram is visible.
* This is a workaround for the fact that recalculating the
* histogram is expensive and that it is only validated when it
* is shown. So don't slow down painting by doing something that
* is not even seen by the user.
*/
if (! editor->bg_histogram &&
gtk_widget_is_drawable (GTK_WIDGET (editor)))
{
if (gimp_histogram_editor_validate (editor))
editor->bg_histogram = gimp_histogram_duplicate (editor->histogram);
gimp_histogram_view_set_background (view, editor->bg_histogram);
}
}
else if (editor->bg_histogram)
{
g_object_unref (editor->bg_histogram);
editor->bg_histogram = NULL;
gimp_histogram_view_set_background (view, NULL);
}
}
示例2: ppg_ruler_size_allocate
/**
* ppg_ruler_size_allocate:
* @ruler: (in): A #PpgRuler.
*
* Handle the "size-allocate" for the #GtkWidget. The pixmap for the
* background is created and drawn if necessary.
*
* Returns: None.
* Side effects: None.
*/
static void
ppg_ruler_size_allocate (GtkWidget *widget,
GtkAllocation *alloc)
{
PpgRuler *ruler = (PpgRuler *)widget;
PpgRulerPrivate *priv;
GdkWindow *window;
g_return_if_fail(PPG_IS_RULER(ruler));
priv = ruler->priv;
GTK_WIDGET_CLASS(ppg_ruler_parent_class)->size_allocate(widget, alloc);
if (priv->ruler) {
cairo_surface_destroy(priv->ruler);
}
if (gtk_widget_is_drawable(widget)) {
window = gtk_widget_get_window(widget);
priv->ruler = gdk_window_create_similar_surface(window,
CAIRO_CONTENT_COLOR_ALPHA,
alloc->width,
alloc->height);
ppg_ruler_draw_ruler(ruler);
}
}
示例3: sp_gradient_image_update
static void
sp_gradient_image_update (SPGradientImage *image)
{
if (gtk_widget_is_drawable (GTK_WIDGET(image))) {
gtk_widget_queue_draw (GTK_WIDGET (image));
}
}
示例4: gimp_ruler_expose
static gboolean
gimp_ruler_expose (GtkWidget *widget,
GdkEventExpose *event)
{
if (gtk_widget_is_drawable (widget))
{
GimpRuler *ruler = GIMP_RULER (widget);
GimpRulerPrivate *priv = GIMP_RULER_GET_PRIVATE (ruler);
GtkAllocation allocation;
cairo_t *cr;
gimp_ruler_draw_ticks (ruler);
cr = gdk_cairo_create (gtk_widget_get_window (widget));
gdk_cairo_region (cr, event->region);
cairo_clip (cr);
gtk_widget_get_allocation (widget, &allocation);
cairo_translate (cr, allocation.x, allocation.y);
cairo_set_source_surface (cr, priv->backing_store, 0, 0);
cairo_paint (cr);
gimp_ruler_draw_pos (ruler);
cairo_destroy (cr);
}
return FALSE;
}
示例5: cdisplay_lcms_get_screen
static GdkScreen *
cdisplay_lcms_get_screen (CdisplayLcms *lcms,
gint *monitor)
{
GimpColorManaged *managed;
GdkScreen *screen;
managed = gimp_color_display_get_managed (GIMP_COLOR_DISPLAY (lcms));
if (GTK_IS_WIDGET (managed))
screen = gtk_widget_get_screen (GTK_WIDGET (managed));
else
screen = gdk_screen_get_default ();
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
if (GTK_IS_WIDGET (managed) && gtk_widget_is_drawable (GTK_WIDGET (managed)))
{
GtkWidget *widget = GTK_WIDGET (managed);
*monitor = gdk_screen_get_monitor_at_window (screen,
gtk_widget_get_window (widget));
}
else
{
*monitor = 0;
}
return screen;
}
示例6: check_buttonbox_child_position
static void
check_buttonbox_child_position (GtkWidget *child,
ThemeMatchData *match_data)
{
GList *children = NULL;
GList *l;
GtkWidget *bbox;
gboolean secondary;
g_assert (GTK_IS_BUTTON_BOX (child->parent));
bbox = child->parent;
secondary = gtk_button_box_get_child_secondary (GTK_BUTTON_BOX (bbox), child);
for (l = GTK_BOX (bbox)->children; l != NULL; l = l->next)
{
GtkBoxChild *child_info = l->data;
GtkWidget *widget = child_info->widget;
if (child_info->is_secondary == secondary && gtk_widget_is_drawable (widget))
children = g_list_prepend (children, widget);
}
check_child_position (child, children, match_data);
g_list_free (children);
}
示例7: gimp_view_expose_event
static gboolean
gimp_view_expose_event (GtkWidget *widget,
GdkEventExpose *event)
{
if (gtk_widget_is_drawable (widget))
{
GtkAllocation allocation;
cairo_t *cr;
gtk_widget_get_allocation (widget, &allocation);
cr = gdk_cairo_create (event->window);
gdk_cairo_region (cr, event->region);
cairo_clip (cr);
cairo_translate (cr, allocation.x, allocation.y);
gimp_view_renderer_draw (GIMP_VIEW (widget)->renderer,
widget, cr,
allocation.width,
allocation.height);
cairo_destroy (cr);
}
return FALSE;
}
示例8: panel_frame_expose
static gboolean panel_frame_expose(GtkWidget* widget, GdkEventExpose* event)
#endif
{
PanelFrame *frame = (PanelFrame *) widget;
gboolean retval = FALSE;
if (!gtk_widget_is_drawable (widget))
return retval;
#if GTK_CHECK_VERSION (3, 0, 0)
if (GTK_WIDGET_CLASS (panel_frame_parent_class)->draw)
retval = GTK_WIDGET_CLASS (panel_frame_parent_class)->draw (widget, cr);
#else
if (GTK_WIDGET_CLASS (panel_frame_parent_class)->expose_event)
retval = GTK_WIDGET_CLASS (panel_frame_parent_class)->expose_event (widget, event);
#endif
#if GTK_CHECK_VERSION (3, 0, 0)
panel_frame_draw (widget, cr, frame->edges);
#else
panel_frame_draw (widget, frame->edges);
#endif
return retval;
}
示例9: panel_icon_grid_expose
static gboolean panel_icon_grid_expose(GtkWidget *widget, GdkEventExpose *event)
#endif
{
if (gtk_widget_is_drawable(widget))
{
if (gtk_widget_get_has_window(widget) &&
!gtk_widget_get_app_paintable(widget))
#if GTK_CHECK_VERSION(3, 0, 0)
gtk_render_background(gtk_widget_get_style_context(widget), cr, 0, 0,
gtk_widget_get_allocated_width(widget),
gtk_widget_get_allocated_height(widget));
#else
gtk_paint_flat_box(gtk_widget_get_style(widget),
gtk_widget_get_window(widget),
gtk_widget_get_state(widget), GTK_SHADOW_NONE,
&event->area, widget, "panelicongrid",
0, 0, -1, -1);
#endif
#if GTK_CHECK_VERSION(3, 0, 0)
GTK_WIDGET_CLASS(panel_icon_grid_parent_class)->draw(widget, cr);
#else
GTK_WIDGET_CLASS(panel_icon_grid_parent_class)->expose_event(widget, event);
#endif
}
return FALSE;
}
示例10: update_animation_info
/* update the animation information for each widget. This will also queue a redraw
* and stop the animation if it is done. */
static gboolean
update_animation_info (gpointer key, gpointer value, gpointer user_data)
{
AnimationInfo *animation_info = value;
GtkWidget *widget = key;
g_assert ((widget != NULL) && (animation_info != NULL));
/* remove the widget from the hash table if it is not drawable */
if (!gtk_widget_is_drawable (widget))
{
return TRUE;
}
if (GE_IS_PROGRESS_BAR (widget))
{
gfloat fraction = gtk_progress_bar_get_fraction (GTK_PROGRESS_BAR (widget));
/* stop animation for filled/not filled progress bars */
if (fraction <= 0.0 || fraction >= 1.0)
return TRUE;
}
force_widget_redraw (widget);
/* stop at stop_time */
if (animation_info->stop_time != 0 &&
g_timer_elapsed (animation_info->timer, NULL) > animation_info->stop_time)
return TRUE;
return FALSE;
}
示例11: gb_progress_bar_draw
static gboolean
gb_progress_bar_draw (GtkWidget *widget,
cairo_t *cr)
{
GbProgressBarPrivate *priv;
GtkStyleContext *context;
GbProgressBar *bar = (GbProgressBar *)widget;
GtkAllocation allocation;
GtkStateType state;
GdkRGBA color = { 0 };
g_return_val_if_fail(GB_IS_PROGRESS_BAR(bar), FALSE);
priv = bar->priv;
if (gtk_widget_is_drawable(widget)) {
gtk_widget_get_allocation(widget, &allocation);
state = gtk_widget_get_state(widget);
context = gtk_widget_get_style_context(widget);
gtk_style_context_get_color(context, state, &color);
cairo_save(cr);
cairo_rectangle(cr,
0,
0,
priv->fraction * allocation.width,
allocation.height);
gdk_cairo_set_source_rgba(cr, &color);
cairo_fill(cr);
cairo_restore(cr);
}
return FALSE;
}
示例12: xfce_arrow_button_draw
static gboolean
xfce_arrow_button_draw (GtkWidget *widget,
cairo_t *cr)
{
gint x, y, w;
GtkStyleContext *context;
xfce_arrow_button_thickness thickness;
GtkAllocation allocation;
if (G_LIKELY (gtk_widget_is_drawable (widget)))
{
context = gtk_widget_get_style_context (widget);
xfce_arrow_button_get_thickness (context, &thickness);
gtk_widget_get_allocation (widget, &allocation);
w = MIN (allocation.height - 2 * thickness.y,
allocation.width - 2 * thickness.x);
w = MIN (w, ARROW_WIDTH);
x = (allocation.width - w) / 2;
y = (allocation.height - w) / 2;
GTK_WIDGET_CLASS (parent_class)->draw (widget, cr);
gtk_style_context_save (context);
gtk_style_context_set_state (context, gtk_widget_get_state_flags (widget));
gtk_render_arrow (context, cr, G_PI, x, y, w);
gtk_style_context_restore (context);
}
return TRUE;
}
示例13: nruler_make_pixmap
static void
nruler_make_pixmap(Nruler *ruler, GtkWidget *widget, GtkWidget *parent)
{
gint width;
gint height;
GtkAllocation allocation, parent_allocation;
if (! gtk_widget_is_drawable(widget)) {
return;
}
gtk_widget_get_allocation(widget, &allocation);
gtk_widget_get_allocation(parent, &parent_allocation);
if (ruler->orientation == GTK_ORIENTATION_HORIZONTAL) {
ruler->length = parent_allocation.width;
ruler->size = allocation.height;
ruler->ofst = (parent_allocation.width - allocation.width) / 2;
} else {
ruler->length = parent_allocation.height;
ruler->size = allocation.width;
ruler->ofst = (parent_allocation.height - allocation.height) / 2;
}
if (ruler->backing_store) {
#if GTK_CHECK_VERSION(3, 0, 0)
width = cairo_image_surface_get_width(ruler->backing_store);
height = cairo_image_surface_get_height(ruler->backing_store);
#elif GTK_CHECK_VERSION(2, 24, 0)
gdk_pixmap_get_size(ruler->backing_store, &width, &height);
#else
gdk_drawable_get_size(ruler->backing_store, &width, &height);
#endif
if ((width == allocation.width) &&
(height == allocation.height)) {
return;
}
#if GTK_CHECK_VERSION(3, 0, 0)
cairo_surface_destroy(ruler->backing_store);
#else
g_object_unref(ruler->backing_store);
#endif
}
#if GTK_CHECK_VERSION(3, 0, 0)
ruler->backing_store = cairo_image_surface_create(CAIRO_FORMAT_RGB24,
allocation.width,
allocation.height);
#else
ruler->backing_store = gdk_pixmap_new(gtk_widget_get_window(widget),
allocation.width,
allocation.height,
-1);
#endif
ruler->save_l = 0;
ruler->save_u = 0;
}
示例14: nsgtk_widget_is_drawable
gboolean nsgtk_widget_is_drawable(GtkWidget *widget)
{
#if GTK_CHECK_VERSION(2,18,0)
return gtk_widget_is_drawable(widget);
#else
return GTK_WIDGET_DRAWABLE(widget);
#endif
}
示例15: selectcolor_set_circle
void selectcolor_set_circle(GtkWidget * sc, gboolean circle) {
g_return_if_fail(sc != NULL);
g_return_if_fail(IS_SELECT_COLOR(sc));
SELECT_COLOR(sc)->circle = circle;
if (gtk_widget_is_drawable(GTK_WIDGET(sc))) {
selectcolor_paint(sc);
}
}