本文整理匯總了C++中GIMP_VIEW函數的典型用法代碼示例。如果您正苦於以下問題:C++ GIMP_VIEW函數的具體用法?C++ GIMP_VIEW怎麽用?C++ GIMP_VIEW使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了GIMP_VIEW函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: gimp_selection_editor_init
static void
gimp_selection_editor_init (GimpSelectionEditor *editor)
{
GtkWidget *frame;
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_box_pack_start (GTK_BOX (editor), frame, TRUE, TRUE, 0);
gtk_widget_show (frame);
editor->view = gimp_view_new_by_types (NULL,
GIMP_TYPE_VIEW,
GIMP_TYPE_SELECTION,
GIMP_VIEW_SIZE_HUGE,
0, TRUE);
gimp_view_renderer_set_background (GIMP_VIEW (editor->view)->renderer,
GIMP_STOCK_TEXTURE);
gtk_widget_set_size_request (editor->view,
GIMP_VIEW_SIZE_HUGE, GIMP_VIEW_SIZE_HUGE);
gimp_view_set_expand (GIMP_VIEW (editor->view), TRUE);
gtk_container_add (GTK_CONTAINER (frame), editor->view);
gtk_widget_show (editor->view);
g_signal_connect (editor->view, "button-press-event",
G_CALLBACK (gimp_selection_view_button_press),
editor);
gimp_dnd_color_dest_add (editor->view,
gimp_selection_editor_drop_color,
editor);
gtk_widget_set_sensitive (GTK_WIDGET (editor), FALSE);
}
示例2: gimp_selection_editor_set_image
static void
gimp_selection_editor_set_image (GimpImageEditor *image_editor,
GimpImage *image)
{
GimpSelectionEditor *editor = GIMP_SELECTION_EDITOR (image_editor);
if (image_editor->image)
{
g_signal_handlers_disconnect_by_func (image_editor->image,
gimp_selection_editor_mask_changed,
editor);
}
GIMP_IMAGE_EDITOR_CLASS (parent_class)->set_image (image_editor, image);
if (image)
{
g_signal_connect (image, "mask-changed",
G_CALLBACK (gimp_selection_editor_mask_changed),
editor);
gimp_view_set_viewable (GIMP_VIEW (editor->view),
GIMP_VIEWABLE (gimp_image_get_mask (image)));
}
else
{
gimp_view_set_viewable (GIMP_VIEW (editor->view), NULL);
}
}
示例3: gimp_view_new_full
GtkWidget *
gimp_view_new_full (GimpContext *context,
GimpViewable *viewable,
gint width,
gint height,
gint border_width,
gboolean is_popup,
gboolean clickable,
gboolean show_popup)
{
GtkWidget *view;
g_return_val_if_fail (context == NULL || GIMP_IS_CONTEXT (context), NULL);
g_return_val_if_fail (GIMP_IS_VIEWABLE (viewable), NULL);
view = gimp_view_new_full_by_types (context,
GIMP_TYPE_VIEW,
G_TYPE_FROM_INSTANCE (viewable),
width, height, border_width,
is_popup, clickable, show_popup);
if (view)
gimp_view_set_viewable (GIMP_VIEW (view), viewable);
gimp_view_renderer_remove_idle (GIMP_VIEW (view)->renderer);
return view;
}
示例4: gimp_palette_view_find_entry
static GimpPaletteEntry *
gimp_palette_view_find_entry (GimpPaletteView *view,
gint x,
gint y)
{
GimpPalette *palette;
GimpViewRendererPalette *renderer;
GimpPaletteEntry *entry = NULL;
gint col, row;
palette = GIMP_PALETTE (GIMP_VIEW (view)->renderer->viewable);
renderer = GIMP_VIEW_RENDERER_PALETTE (GIMP_VIEW (view)->renderer);
if (! palette)
return NULL;
col = x / renderer->cell_width;
row = y / renderer->cell_height;
if (col >= 0 && col < renderer->columns &&
row >= 0 && row < renderer->rows)
{
entry = gimp_palette_get_entry (palette,
row * renderer->columns + col);
}
return entry;
}
示例5: gimp_navigation_editor_set_shell
static void
gimp_navigation_editor_set_shell (GimpNavigationEditor *editor,
GimpDisplayShell *shell)
{
g_return_if_fail (GIMP_IS_NAVIGATION_EDITOR (editor));
g_return_if_fail (! shell || GIMP_IS_DISPLAY_SHELL (shell));
if (shell == editor->shell)
return;
if (editor->shell)
{
g_signal_handlers_disconnect_by_func (editor->shell,
gimp_navigation_editor_shell_scaled,
editor);
g_signal_handlers_disconnect_by_func (editor->shell,
gimp_navigation_editor_shell_scrolled,
editor);
g_signal_handlers_disconnect_by_func (editor->shell,
gimp_navigation_editor_shell_reconnect,
editor);
}
else if (shell)
{
gtk_widget_set_sensitive (GTK_WIDGET (editor), TRUE);
}
editor->shell = shell;
if (editor->shell)
{
GimpImage *image = gimp_display_get_image (shell->display);
gimp_view_set_viewable (GIMP_VIEW (editor->view),
GIMP_VIEWABLE (image));
g_signal_connect (editor->shell, "scaled",
G_CALLBACK (gimp_navigation_editor_shell_scaled),
editor);
g_signal_connect (editor->shell, "scrolled",
G_CALLBACK (gimp_navigation_editor_shell_scrolled),
editor);
g_signal_connect (editor->shell, "reconnect",
G_CALLBACK (gimp_navigation_editor_shell_reconnect),
editor);
gimp_navigation_editor_shell_scaled (editor->shell, editor);
}
else
{
gimp_view_set_viewable (GIMP_VIEW (editor->view), NULL);
gtk_widget_set_sensitive (GTK_WIDGET (editor), FALSE);
}
if (gimp_editor_get_ui_manager (GIMP_EDITOR (editor)))
gimp_ui_manager_update (gimp_editor_get_ui_manager (GIMP_EDITOR (editor)),
gimp_editor_get_popup_data (GIMP_EDITOR (editor)));
}
示例6: gimp_color_selector_palette_set_config
static void
gimp_color_selector_palette_set_config (GimpColorSelector *selector,
GimpColorConfig *config)
{
GimpColorSelectorPalette *select = GIMP_COLOR_SELECTOR_PALETTE (selector);
if (select->context)
{
g_signal_handlers_disconnect_by_func (select->context,
gimp_color_selector_palette_palette_changed,
select);
select->context = NULL;
}
if (config)
select->context = g_object_get_data (G_OBJECT (config), "gimp-context");
if (select->context)
{
if (! select->view)
{
GtkWidget *frame;
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_container_add (GTK_CONTAINER (select), frame);
gtk_widget_show (frame);
select->view = gimp_view_new_full_by_types (select->context,
GIMP_TYPE_PALETTE_VIEW,
GIMP_TYPE_PALETTE,
100, 100, 0,
FALSE, TRUE, FALSE);
gimp_view_set_expand (GIMP_VIEW (select->view), TRUE);
gimp_view_renderer_palette_set_cell_size
(GIMP_VIEW_RENDERER_PALETTE (GIMP_VIEW (select->view)->renderer),
-1);
gimp_view_renderer_palette_set_draw_grid
(GIMP_VIEW_RENDERER_PALETTE (GIMP_VIEW (select->view)->renderer),
TRUE);
gtk_container_add (GTK_CONTAINER (frame), select->view);
gtk_widget_show (select->view);
g_signal_connect (select->view, "entry-clicked",
G_CALLBACK (gimp_color_selector_palette_entry_clicked),
select);
}
g_signal_connect_object (select->context, "palette-changed",
G_CALLBACK (gimp_color_selector_palette_palette_changed),
select, 0);
gimp_color_selector_palette_palette_changed (select->context,
gimp_context_get_palette (select->context),
select);
}
}
示例7: gimp_view_drag_viewable
static GimpViewable *
gimp_view_drag_viewable (GtkWidget *widget,
GimpContext **context,
gpointer data)
{
if (context)
*context = GIMP_VIEW (widget)->renderer->context;
return GIMP_VIEW (widget)->viewable;
}
示例8: gimp_container_grid_view_item_activated
static void
gimp_container_grid_view_item_activated (GtkWidget *widget,
gpointer data)
{
gimp_container_view_item_activated (GIMP_CONTAINER_VIEW (data),
GIMP_VIEW (widget)->viewable);
}
示例9: gimp_color_selector_palette_palette_changed
static void
gimp_color_selector_palette_palette_changed (GimpContext *context,
GimpPalette *palette,
GimpColorSelectorPalette *select)
{
gimp_view_set_viewable (GIMP_VIEW (select->view), GIMP_VIEWABLE (palette));
}
示例10: 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;
}
示例11: gimp_view_button_release_event
static gboolean
gimp_view_button_release_event (GtkWidget *widget,
GdkEventButton *bevent)
{
GimpView *view = GIMP_VIEW (widget);
if (! view->clickable &&
! view->show_popup)
return FALSE;
if (bevent->button == 1)
{
gtk_grab_remove (widget);
view->has_grab = FALSE;
if (view->clickable && view->in_button)
{
g_signal_emit (widget, view_signals[CLICKED], 0, view->press_state);
}
}
else
{
return FALSE;
}
return view->eat_button_events ? TRUE : FALSE;
}
示例12: gimp_viewable_dialog_get_property
static void
gimp_viewable_dialog_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
GimpViewableDialog *dialog = GIMP_VIEWABLE_DIALOG (object);
switch (property_id)
{
case PROP_VIEWABLE:
g_value_set_object (value,
dialog->view ?
GIMP_VIEW (dialog->view)->viewable : NULL);
break;
case PROP_CONTEXT:
g_value_set_object (value, dialog->context);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
示例13: gimp_view_realize
static void
gimp_view_realize (GtkWidget *widget)
{
GimpView *view = GIMP_VIEW (widget);
GtkAllocation allocation;
GdkWindowAttr attributes;
gint attributes_mask;
GTK_WIDGET_CLASS (parent_class)->realize (widget);
gtk_widget_get_allocation (widget, &allocation);
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_mask = GDK_WA_X | GDK_WA_Y;
view->event_window = gdk_window_new (gtk_widget_get_window (widget),
&attributes, attributes_mask);
gdk_window_set_user_data (view->event_window, view);
}
示例14: gimp_navigation_editor_set_context
static void
gimp_navigation_editor_set_context (GimpDocked *docked,
GimpContext *context)
{
GimpNavigationEditor *editor = GIMP_NAVIGATION_EDITOR (docked);
GimpDisplay *display = NULL;
if (editor->context)
{
g_signal_handlers_disconnect_by_func (editor->context,
gimp_navigation_editor_display_changed,
editor);
}
editor->context = context;
if (editor->context)
{
g_signal_connect (context, "display-changed",
G_CALLBACK (gimp_navigation_editor_display_changed),
editor);
display = gimp_context_get_display (context);
}
gimp_view_renderer_set_context (GIMP_VIEW (editor->view)->renderer,
context);
gimp_navigation_editor_display_changed (editor->context,
display,
editor);
}
示例15: gimp_palette_view_draw_selected
static void
gimp_palette_view_draw_selected (GimpPaletteView *pal_view,
GdkRectangle *area)
{
GimpView *view = GIMP_VIEW (pal_view);
if (view->renderer->viewable && pal_view->selected)
{
GtkWidget *widget = GTK_WIDGET (view);
GimpViewRendererPalette *renderer;
gint row, col;
renderer = GIMP_VIEW_RENDERER_PALETTE (view->renderer);
row = pal_view->selected->position / renderer->columns;
col = pal_view->selected->position % renderer->columns;
if (area)
gdk_gc_set_clip_rectangle (pal_view->gc, area);
gdk_draw_rectangle (widget->window, pal_view->gc,
FALSE,
widget->allocation.x + col * renderer->cell_width,
widget->allocation.y + row * renderer->cell_height,
renderer->cell_width,
renderer->cell_height);
if (area)
gdk_gc_set_clip_rectangle (pal_view->gc, NULL);
}
}