ui/gtk/range.c

changeset 431
bb7da585debc
parent 299
48763a9d19a7
equal deleted inserted replaced
169:fe49cff3c571 431:bb7da585debc
29 #include <stdio.h> 29 #include <stdio.h>
30 #include <stdlib.h> 30 #include <stdlib.h>
31 31
32 #include "range.h" 32 #include "range.h"
33 #include "container.h" 33 #include "container.h"
34 #include <ucx/mempool.h>
35 #include "../common/context.h" 34 #include "../common/context.h"
36 #include "../common/object.h" 35 #include "../common/object.h"
37 36
38 37
39 static UIWIDGET ui_scrollbar(UiObject *obj, UiOrientation orientation, UiRange *range, ui_callback f, void *userdata) { 38 static UIWIDGET ui_scrollbar(UiObject *obj, UiOrientation orientation, UiRange *range, ui_callback f, void *userdata) {
40 #ifdef UI_GTK3 39 #if GTK_MAJOR_VERSION >= 3
41 GtkWidget *scrollbar = gtk_scrollbar_new(orientation == UI_HORIZONTAL ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL, NULL); 40 GtkWidget *scrollbar = gtk_scrollbar_new(orientation == UI_HORIZONTAL ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL, NULL);
42 #else 41 #else
43 GtkWidget *scrollbar; 42 GtkWidget *scrollbar;
44 if(orientation == UI_HORIZONTAL) { 43 if(orientation == UI_HORIZONTAL) {
45 scrollbar = gtk_hscrollbar_new(NULL); 44 scrollbar = gtk_hscrollbar_new(NULL);
60 UiEventData *event = malloc(sizeof(UiEventData)); 59 UiEventData *event = malloc(sizeof(UiEventData));
61 event->obj = obj; 60 event->obj = obj;
62 event->userdata = userdata; 61 event->userdata = userdata;
63 event->callback = f; 62 event->callback = f;
64 event->value = 0; 63 event->value = 0;
64 event->customdata = NULL;
65 65
66 g_signal_connect( 66 g_signal_connect(
67 G_OBJECT(scrollbar), 67 G_OBJECT(scrollbar),
68 "value-changed", 68 "value-changed",
69 G_CALLBACK(ui_scrollbar_value_changed), 69 G_CALLBACK(ui_scrollbar_value_changed),
122 #ifdef UI_GTK2LEGACY 122 #ifdef UI_GTK2LEGACY
123 a->page_size = extent; 123 a->page_size = extent;
124 #else 124 #else
125 gtk_adjustment_set_page_size(a, extent); 125 gtk_adjustment_set_page_size(a, extent);
126 #endif 126 #endif
127 #if !(GTK_MAJOR_VERSION >= 3 && GTK_MINOR_VERSION >= 18) 127 #if GTK_MAJOR_VERSION * 100 + GTK_MIMOR_VERSION < 318
128 gtk_adjustment_changed(a); 128 gtk_adjustment_changed(a);
129 #endif 129 #endif
130 range->extent = extent; 130 range->extent = extent;
131 } 131 }

mercurial