ui/gtk/image.c

changeset 88
e27526429d85
parent 81
42f66ebb9881
equal deleted inserted replaced
87:5360027fb282 88:e27526429d85
27 */ 27 */
28 28
29 #include "image.h" 29 #include "image.h"
30 30
31 #include "container.h" 31 #include "container.h"
32 #include "menu.h"
32 #include "../common/context.h" 33 #include "../common/context.h"
33 #include "../common/object.h" 34 #include "../common/object.h"
34 35
35 36
36 UIWIDGET ui_imageviewer_create(UiObject *obj, UiImageViewerArgs args) { 37 UIWIDGET ui_imageviewer_create(UiObject *obj, UiImageViewerArgs args) {
49 GtkWidget *eventbox = gtk_event_box_new(); 50 GtkWidget *eventbox = gtk_event_box_new();
50 SCROLLEDWINDOW_SET_CHILD(scrolledwindow, eventbox); 51 SCROLLEDWINDOW_SET_CHILD(scrolledwindow, eventbox);
51 gtk_container_add(GTK_CONTAINER(eventbox), image); 52 gtk_container_add(GTK_CONTAINER(eventbox), image);
52 #else 53 #else
53 SCROLLEDWINDOW_SET_CHILD(scrolledwindow, image); 54 SCROLLEDWINDOW_SET_CHILD(scrolledwindow, image);
55 GtkWidget *eventbox = image;
54 #endif 56 #endif
55 57
56 UI_APPLY_LAYOUT1(current, args); 58 UI_APPLY_LAYOUT1(current, args);
57 current->container->add(current->container, scrolledwindow, TRUE); 59 current->container->add(current->container, scrolledwindow, TRUE);
58 60
66 if(value->value && value->type && !strcmp(value->type, UI_IMAGE_OBJECT_TYPE)) { 68 if(value->value && value->type && !strcmp(value->type, UI_IMAGE_OBJECT_TYPE)) {
67 GdkPixbuf *pixbuf = value->value; 69 GdkPixbuf *pixbuf = value->value;
68 value->value = NULL; 70 value->value = NULL;
69 ui_imageviewer_set(value, pixbuf, UI_IMAGE_OBJECT_TYPE); 71 ui_imageviewer_set(value, pixbuf, UI_IMAGE_OBJECT_TYPE);
70 } 72 }
73 }
74
75 if(args.contextmenu) {
76 UIMENU menu = ui_contextmenu_create(args.contextmenu, obj, eventbox);
77 ui_widget_set_contextmenu(eventbox, menu);
71 } 78 }
72 79
73 return scrolledwindow; 80 return scrolledwindow;
74 } 81 }
75 82

mercurial