本文整理汇总了C++中GTK_COLOR_SWATCH函数的典型用法代码示例。如果您正苦于以下问题:C++ GTK_COLOR_SWATCH函数的具体用法?C++ GTK_COLOR_SWATCH怎么用?C++ GTK_COLOR_SWATCH使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GTK_COLOR_SWATCH函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: gtk_color_swatch_measure
static void
gtk_color_swatch_measure (GtkCssGadget *gadget,
GtkOrientation orientation,
int for_size,
int *minimum,
int *natural,
int *minimum_baseline,
int *natural_baseline,
gpointer unused)
{
GtkWidget *widget;
GtkColorSwatch *swatch;
gint w, h, min;
widget = gtk_css_gadget_get_owner (gadget);
swatch = GTK_COLOR_SWATCH (widget);
gtk_css_gadget_get_preferred_size (swatch->priv->overlay_gadget,
orientation,
-1,
minimum, natural,
NULL, NULL);
gtk_widget_get_size_request (widget, &w, &h);
if (orientation == GTK_ORIENTATION_HORIZONTAL)
min = w < 0 ? 48 : w;
else
min = h < 0 ? 32 : h;
*minimum = MAX (*minimum, min);
*natural = MAX (*natural, min);
}
开发者ID:grubersjoe,项目名称:adwaita,代码行数:32,代码来源:gtkcolorswatch.c
示例2: swatch_button_press
static gboolean
swatch_button_press (GtkWidget *widget,
GdkEventButton *event)
{
GtkColorSwatch *swatch = GTK_COLOR_SWATCH (widget);
gtk_widget_grab_focus (widget);
if (gdk_event_triggers_context_menu ((GdkEvent *) event) &&
swatch->priv->has_color)
{
do_popup (widget, event);
return TRUE;
}
else if (event->type == GDK_2BUTTON_PRESS &&
event->button == GDK_BUTTON_PRIMARY)
{
g_signal_emit (swatch, signals[ACTIVATE], 0);
return TRUE;
}
else if (event->button == GDK_BUTTON_PRIMARY)
{
return TRUE;
}
return FALSE;
}
开发者ID:aswinas,项目名称:gtk-,代码行数:27,代码来源:gtkcolorswatch.c
示例3: swatch_realize
static void
swatch_realize (GtkWidget *widget)
{
GtkColorSwatch *swatch = GTK_COLOR_SWATCH (widget);
GtkAllocation allocation;
GdkWindow *window;
GdkWindowAttr attributes;
gint attributes_mask;
gtk_widget_get_allocation (widget, &allocation);
gtk_widget_set_realized (widget, TRUE);
attributes.window_type = GDK_WINDOW_CHILD;
attributes.x = allocation.x;
attributes.y = allocation.y;
attributes.width = allocation.width;
attributes.height = allocation.height;
attributes.wclass = GDK_INPUT_ONLY;
attributes.event_mask = gtk_widget_get_events (widget);
attributes.event_mask |= GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK
| GDK_ENTER_NOTIFY_MASK
| GDK_LEAVE_NOTIFY_MASK
| GDK_TOUCH_MASK;
attributes_mask = GDK_WA_X | GDK_WA_Y;
window = gtk_widget_get_parent_window (widget);
gtk_widget_set_window (widget, window);
g_object_ref (window);
swatch->priv->event_window = gdk_window_new (window, &attributes, attributes_mask);
gtk_widget_register_window (widget, swatch->priv->event_window);
}
开发者ID:grubersjoe,项目名称:adwaita,代码行数:34,代码来源:gtkcolorswatch.c
示例4: swatch_key_press
static gboolean
swatch_key_press (GtkWidget *widget,
GdkEventKey *event)
{
GtkColorSwatch *swatch = GTK_COLOR_SWATCH (widget);
if (event->keyval == GDK_KEY_space ||
event->keyval == GDK_KEY_Return ||
event->keyval == GDK_KEY_ISO_Enter||
event->keyval == GDK_KEY_KP_Enter ||
event->keyval == GDK_KEY_KP_Space)
{
if (swatch->priv->has_color &&
swatch->priv->selectable &&
(gtk_widget_get_state_flags (widget) & GTK_STATE_FLAG_SELECTED) == 0)
gtk_widget_set_state_flags (widget, GTK_STATE_FLAG_SELECTED, FALSE);
else
g_signal_emit (swatch, signals[ACTIVATE], 0);
return TRUE;
}
if (GTK_WIDGET_CLASS (gtk_color_swatch_parent_class)->key_press_event (widget, event))
return TRUE;
return FALSE;
}
开发者ID:grubersjoe,项目名称:adwaita,代码行数:26,代码来源:gtkcolorswatch.c
示例5: gtk_color_swatch_allocate
static void
gtk_color_swatch_allocate (GtkCssGadget *gadget,
const GtkAllocation *allocation,
int baseline,
GtkAllocation *out_clip,
gpointer unused)
{
GtkColorSwatch *swatch;
GtkAllocation overlay_alloc;
gint overlay_width, overlay_height;
swatch = GTK_COLOR_SWATCH (gtk_css_gadget_get_owner (gadget));
gtk_css_gadget_get_preferred_size (swatch->priv->overlay_gadget,
GTK_ORIENTATION_HORIZONTAL,
-1,
&overlay_width, NULL,
NULL, NULL);
gtk_css_gadget_get_preferred_size (swatch->priv->overlay_gadget,
GTK_ORIENTATION_VERTICAL,
-1,
&overlay_height, NULL,
NULL, NULL);
overlay_alloc.x = allocation->x + (allocation->width - overlay_width) / 2;
overlay_alloc.y = allocation->y + (allocation->height - overlay_height) / 2;
overlay_alloc.width = overlay_width;
overlay_alloc.height = overlay_height;
gtk_css_gadget_allocate (swatch->priv->overlay_gadget, &overlay_alloc, baseline, out_clip);
}
开发者ID:grubersjoe,项目名称:adwaita,代码行数:31,代码来源:gtkcolorswatch.c
示例6: swatch_touch
static gboolean
swatch_touch (GtkWidget *widget,
GdkEventTouch *event)
{
GtkColorSwatch *swatch = GTK_COLOR_SWATCH (widget);
if (!swatch->priv->press_and_hold)
{
gint drag_threshold;
g_object_get (gtk_widget_get_settings (widget),
"gtk-dnd-drag-threshold", &drag_threshold,
NULL);
swatch->priv->press_and_hold = gtk_press_and_hold_new ();
g_object_set (swatch->priv->press_and_hold,
"drag-threshold", drag_threshold,
"hold-time", 1000,
NULL);
g_signal_connect (swatch->priv->press_and_hold, "hold",
G_CALLBACK (hold_action), swatch);
g_signal_connect (swatch->priv->press_and_hold, "tap",
G_CALLBACK (tap_action), swatch);
}
gtk_press_and_hold_process_event (swatch->priv->press_and_hold, (GdkEvent *)event);
return TRUE;
}
开发者ID:aswinas,项目名称:gtk-,代码行数:31,代码来源:gtkcolorswatch.c
示例7: swatch_get_property
static void
swatch_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
GtkColorSwatch *swatch = GTK_COLOR_SWATCH (object);
GdkRGBA color;
switch (prop_id)
{
case PROP_RGBA:
gtk_color_swatch_get_rgba (swatch, &color);
g_value_set_boxed (value, &color);
break;
case PROP_SELECTABLE:
g_value_set_boolean (value, gtk_color_swatch_get_selectable (swatch));
break;
case PROP_HAS_MENU:
g_value_set_boolean (value, swatch->priv->has_menu);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
开发者ID:grubersjoe,项目名称:adwaita,代码行数:26,代码来源:gtkcolorswatch.c
示例8: swatch_state_flags_changed
static void
swatch_state_flags_changed (GtkWidget *widget,
GtkStateFlags previous_state)
{
GtkColorSwatch *swatch = GTK_COLOR_SWATCH (widget);
gtk_css_node_set_state (swatch->priv->overlay_node, gtk_widget_get_state_flags (widget));
}
开发者ID:danysan2000,项目名称:gtk,代码行数:8,代码来源:gtkcolorswatch.c
示例9: swatch_draw
static gboolean
swatch_draw (GtkWidget *widget,
cairo_t *cr)
{
gtk_css_gadget_draw (GTK_COLOR_SWATCH (widget)->priv->gadget, cr);
return FALSE;
}
开发者ID:grubersjoe,项目名称:adwaita,代码行数:8,代码来源:gtkcolorswatch.c
示例10: swatch_finalize
static void
swatch_finalize (GObject *object)
{
GtkColorSwatch *swatch = GTK_COLOR_SWATCH (object);
g_free (swatch->priv->icon);
G_OBJECT_CLASS (gtk_color_swatch_parent_class)->finalize (object);
}
开发者ID:danysan2000,项目名称:gtk,代码行数:9,代码来源:gtkcolorswatch.c
示例11: swatch_drag_begin
static void
swatch_drag_begin (GtkWidget *widget,
GdkDragContext *context)
{
GtkColorSwatch *swatch = GTK_COLOR_SWATCH (widget);
GdkRGBA color;
gtk_color_swatch_get_rgba (swatch, &color);
drag_set_color_icon (context, &color);
}
开发者ID:grubersjoe,项目名称:adwaita,代码行数:10,代码来源:gtkcolorswatch.c
示例12: swatch_unmap
static void
swatch_unmap (GtkWidget *widget)
{
GtkColorSwatch *swatch = GTK_COLOR_SWATCH (widget);
if (swatch->priv->event_window)
gdk_window_hide (swatch->priv->event_window);
GTK_WIDGET_CLASS (gtk_color_swatch_parent_class)->unmap (widget);
}
开发者ID:grubersjoe,项目名称:adwaita,代码行数:10,代码来源:gtkcolorswatch.c
示例13: swatch_leave_notify
static gboolean
swatch_leave_notify (GtkWidget *widget,
GdkEventCrossing *event)
{
GtkColorSwatch *swatch = GTK_COLOR_SWATCH (widget);
swatch->priv->contains_pointer = FALSE;
gtk_widget_unset_state_flags (widget, GTK_STATE_FLAG_PRELIGHT);
return FALSE;
}
开发者ID:aswinas,项目名称:gtk-,代码行数:10,代码来源:gtkcolorswatch.c
示例14: swatch_get_preferred_height
static void
swatch_get_preferred_height (GtkWidget *widget,
gint *minimum,
gint *natural)
{
gtk_css_gadget_get_preferred_size (GTK_COLOR_SWATCH (widget)->priv->gadget,
GTK_ORIENTATION_VERTICAL,
-1,
minimum, natural,
NULL, NULL);
}
开发者ID:grubersjoe,项目名称:adwaita,代码行数:11,代码来源:gtkcolorswatch.c
示例15: gtk_color_editor_set_use_alpha
static void
gtk_color_editor_set_use_alpha (GtkColorEditor *editor,
gboolean use_alpha)
{
if (editor->priv->use_alpha != use_alpha)
{
editor->priv->use_alpha = use_alpha;
gtk_widget_set_visible (editor->priv->a_slider, use_alpha);
gtk_color_swatch_set_use_alpha (GTK_COLOR_SWATCH (editor->priv->swatch), use_alpha);
}
}
开发者ID:RavetcoFX,项目名称:gnome-apps,代码行数:11,代码来源:gtkcoloreditor.c
示例16: swatch_state_flags_changed
static void
swatch_state_flags_changed (GtkWidget *widget,
GtkStateFlags previous_state)
{
GtkColorSwatch *swatch = GTK_COLOR_SWATCH (widget);
gtk_css_node_set_state (gtk_css_gadget_get_node (swatch->priv->gadget), gtk_widget_get_state_flags (widget));
gtk_css_node_set_state (gtk_css_gadget_get_node (swatch->priv->overlay_gadget), gtk_widget_get_state_flags (widget));
GTK_WIDGET_CLASS (gtk_color_swatch_parent_class)->state_flags_changed (widget, previous_state);
}
开发者ID:grubersjoe,项目名称:adwaita,代码行数:11,代码来源:gtkcolorswatch.c
示例17: swatch_finalize
static void
swatch_finalize (GObject *object)
{
GtkColorSwatch *swatch = GTK_COLOR_SWATCH (object);
g_free (swatch->priv->icon);
g_object_unref (swatch->priv->long_press_gesture);
g_object_unref (swatch->priv->multipress_gesture);
G_OBJECT_CLASS (gtk_color_swatch_parent_class)->finalize (object);
}
开发者ID:Distrotech,项目名称:gtk,代码行数:12,代码来源:gtkcolorswatch.c
示例18: swatch_button_release
static gboolean
swatch_button_release (GtkWidget *widget,
GdkEventButton *event)
{
GtkColorSwatch *swatch = GTK_COLOR_SWATCH (widget);
if (event->button == GDK_BUTTON_PRIMARY &&
swatch->priv->contains_pointer)
return swatch_primary_action (swatch);
return FALSE;
}
开发者ID:aswinas,项目名称:gtk-,代码行数:12,代码来源:gtkcolorswatch.c
示例19: swatch_unrealize
static void
swatch_unrealize (GtkWidget *widget)
{
GtkColorSwatch *swatch = GTK_COLOR_SWATCH (widget);
if (swatch->priv->event_window)
{
gtk_widget_unregister_window (widget, swatch->priv->event_window);
gdk_window_destroy (swatch->priv->event_window);
swatch->priv->event_window = NULL;
}
GTK_WIDGET_CLASS (gtk_color_swatch_parent_class)->unrealize (widget);
}
开发者ID:grubersjoe,项目名称:adwaita,代码行数:14,代码来源:gtkcolorswatch.c
示例20: swatch_size_allocate
static void
swatch_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
GtkColorSwatch *swatch = GTK_COLOR_SWATCH (widget);
gtk_widget_set_allocation (widget, allocation);
if (gtk_widget_get_realized (widget))
gdk_window_move_resize (swatch->priv->event_window,
allocation->x,
allocation->y,
allocation->width,
allocation->height);
}
开发者ID:aswinas,项目名称:gtk-,代码行数:15,代码来源:gtkcolorswatch.c
注:本文中的GTK_COLOR_SWATCH函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论