NetSurf
compat.c
Go to the documentation of this file.
1/*
2 * Copyright 2010 Rob Kendrick <rjek@netsurf-browser.org>
3 *
4 * This file is part of NetSurf, http://www.netsurf-browser.org/
5 *
6 * NetSurf is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * NetSurf is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19/**
20 * \file
21 * Compatibility functions for older GTK versions implementation
22 */
23
24#include <stdint.h>
25
26#include "gtk/compat.h"
27
28#ifdef _SEXY_ICON_ENTRY_H_
29#include "gtk/sexy_icon_entry.c"
30
31/*
32 * exported interface documented in gtk/compat.h
33 *
34 * Only required for the lib sexy interface before 2.16
35 */
36GtkStateType nsgtk_widget_get_state(GtkWidget *widget)
37{
38#if GTK_CHECK_VERSION(2,18,0)
39 return gtk_widget_get_state(widget);
40#else
41 return GTK_WIDGET_STATE(widget);
42#endif
43}
44
45
46#endif
47
48void nsgtk_widget_set_can_focus(GtkWidget *widget, gboolean can_focus)
49{
50#if GTK_CHECK_VERSION(2,22,0)
51 gtk_widget_set_can_focus(widget, can_focus);
52#else
53 if (can_focus == TRUE)
54 GTK_WIDGET_SET_FLAGS(widget, GTK_CAN_FOCUS);
55 else
56 GTK_WIDGET_UNSET_FLAGS(widget, GTK_CAN_FOCUS);
57#endif
58}
59
60gboolean nsgtk_widget_has_focus(GtkWidget *widget)
61{
62#if GTK_CHECK_VERSION(2,20,0)
63 return gtk_widget_has_focus(widget);
64#else
65 return GTK_WIDGET_HAS_FOCUS(widget);
66#endif
67}
68
69gboolean nsgtk_widget_get_visible(GtkWidget *widget)
70{
71#if GTK_CHECK_VERSION(2,20,0)
72 return gtk_widget_get_visible(widget);
73#else
74 return GTK_WIDGET_VISIBLE(widget);
75#endif
76}
77
78gboolean nsgtk_widget_get_realized(GtkWidget *widget)
79{
80#if GTK_CHECK_VERSION(2,20,0)
81 return gtk_widget_get_realized(widget);
82#else
83 return GTK_WIDGET_REALIZED(widget);
84#endif
85}
86
87gboolean nsgtk_widget_get_mapped(GtkWidget *widget)
88{
89#if GTK_CHECK_VERSION(2,20,0)
90 return gtk_widget_get_mapped(widget);
91#else
92 return GTK_WIDGET_MAPPED(widget);
93#endif
94}
95
96gboolean nsgtk_widget_is_drawable(GtkWidget *widget)
97{
98#if GTK_CHECK_VERSION(2,18,0)
99 return gtk_widget_is_drawable(widget);
100#else
101 return GTK_WIDGET_DRAWABLE(widget);
102#endif
103}
104
105void nsgtk_dialog_set_has_separator(GtkDialog *dialog, gboolean setting)
106{
107#if GTK_CHECK_VERSION(2,21,8)
108 /* Deprecated */
109#else
110 gtk_dialog_set_has_separator(dialog, setting);
111#endif
112}
113
115{
116#if GTK_CHECK_VERSION(2,24,0)
117 return gtk_combo_box_text_new();
118#else
119 return gtk_combo_box_new_text();
120#endif
121}
122
123void nsgtk_combo_box_text_append_text(GtkWidget *combo_box, const gchar *text)
124{
125#if GTK_CHECK_VERSION(2,24,0)
126 gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo_box), text);
127#else
128 gtk_combo_box_append_text(GTK_COMBO_BOX(combo_box), text);
129#endif
130
131}
132
133gchar *nsgtk_combo_box_text_get_active_text(GtkWidget *combo_box)
134{
135#if GTK_CHECK_VERSION(2,24,0)
136 return gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(combo_box));
137#else
138 return gtk_combo_box_get_active_text(GTK_COMBO_BOX(combo_box));
139#endif
140}
141
142GtkWidget *nsgtk_entry_new(void)
143{
144#if GTK_CHECK_VERSION(2,16,0)
145 return gtk_entry_new();
146#else
147 return GTK_WIDGET(sexy_icon_entry_new());
148#endif
149}
150
152 GtkEntryIconPosition icon_pos,
153 GdkPixbuf *pixbuf)
154{
155#if GTK_CHECK_VERSION(2,16,0)
156 gtk_entry_set_icon_from_pixbuf(GTK_ENTRY(entry), icon_pos, pixbuf);
157#else
158 GtkImage *image = GTK_IMAGE(gtk_image_new_from_pixbuf(pixbuf));
159
160 if (image != NULL) {
162 (SexyIconEntryPosition)icon_pos,
163 image);
164
165 g_object_unref(image);
166 }
167
168#endif
169}
170
171
172/* exported interface documented in gtk/compat.h */
174 GtkEntryIconPosition icon_pos,
175 const gchar *id)
176{
177#ifdef NSGTK_USE_ICON_NAME
178 gtk_entry_set_icon_from_icon_name(GTK_ENTRY(entry), icon_pos, id);
179#else
180#if GTK_CHECK_VERSION(2,16,0)
181 gtk_entry_set_icon_from_icon_name(GTK_ENTRY(entry), icon_pos, id);
182#else
183 GtkImage *image;
184 image = GTK_IMAGE(gtk_image_new_from_stock(id, GTK_ICON_SIZE_LARGE_TOOLBAR));
185
186 if (image != NULL) {
188 (SexyIconEntryPosition)icon_pos,
189 image);
190 g_object_unref(image);
191 }
192#endif
193#endif
194}
195
196
197/* exported interface documented in gtk/compat.h */
198GtkWidget *nsgtk_image_new_from_stock(const gchar *id, GtkIconSize size)
199{
200#ifdef NSGTK_USE_ICON_NAME
201 return gtk_image_new_from_icon_name(id, size);
202#else
203 return gtk_image_new_from_stock(id, size);
204#endif
205}
206
207
208/* exported interface documented in gtk/compat.h */
209GtkWidget *nsgtk_button_new_from_stock(const gchar *stock_id)
210{
211#ifdef NSGTK_USE_ICON_NAME
212 return gtk_button_new_with_label(stock_id);
213#else
214 return gtk_button_new_from_stock(stock_id);
215#endif
216}
217
218/* exported interface documented in gtk/compat.h */
219void nsgtk_button_set_focus_on_click(GtkButton *button, gboolean focus_on_click)
220{
221#if GTK_CHECK_VERSION(3,20,0)
222 gtk_widget_set_focus_on_click(GTK_WIDGET(button), focus_on_click);
223#else
224 gtk_button_set_focus_on_click(button, focus_on_click);
225#endif
226}
227
228
229/* exported interface documented in gtk/compat.h */
230gboolean nsgtk_stock_lookup(const gchar *stock_id, GtkStockItem *item)
231{
232#ifdef NSGTK_USE_ICON_NAME
233 return FALSE;
234#else
235 return gtk_stock_lookup(stock_id, item);
236#endif
237}
238
239
241 GtkStateFlags state,
242 uint16_t a,
243 uint16_t r,
244 uint16_t g,
245 uint16_t b)
246{
247#if GTK_CHECK_VERSION(3,0,0)
248#if GTK_CHECK_VERSION(3,16,0)
249 /* do nothing - deprecated - must use css styling */
250 return;
251#else
252 GdkRGBA colour;
253 colour.alpha = (double)a / 0xffff;
254 colour.red = (double)r / 0xffff;
255 colour.green = (double)g / 0xffff;
256 colour.blue = (double)b / 0xffff;
257 gtk_widget_override_background_color(widget, state, &colour);
258#endif
259#else
260 GdkColor colour;
261 colour.pixel = a;
262 colour.red = r;
263 colour.green = g;
264 colour.blue = b;
265 gtk_widget_modify_bg(widget, state, &colour );
266#endif
267}
268
269GtkAdjustment *nsgtk_layout_get_vadjustment(GtkLayout *layout)
270{
271#if GTK_CHECK_VERSION(3,0,0)
272 return gtk_scrollable_get_vadjustment(GTK_SCROLLABLE(layout));
273#else
274 return gtk_layout_get_vadjustment(layout);
275#endif
276}
277
278GtkAdjustment *nsgtk_layout_get_hadjustment(GtkLayout *layout)
279{
280#if GTK_CHECK_VERSION(3,0,0)
281 return gtk_scrollable_get_hadjustment(GTK_SCROLLABLE(layout));
282#else
283 return gtk_layout_get_hadjustment(layout);
284#endif
285}
286
287static void nsgtk_layout_set_adjustment_step_increment(GtkAdjustment *adj,
288 int value)
289{
290#if GTK_CHECK_VERSION(2,14,0)
291 gtk_adjustment_set_step_increment(adj, value);
292#else
293 adj->step_increment = value;
294#endif
295}
296
297void nsgtk_layout_set_hadjustment(GtkLayout *layout, GtkAdjustment *adj)
298{
299#if GTK_CHECK_VERSION(3,0,0)
300 gtk_scrollable_set_hadjustment(GTK_SCROLLABLE(layout), adj);
301#else
302 gtk_layout_set_hadjustment(layout, adj);
303#endif
305}
306
307void nsgtk_layout_set_vadjustment(GtkLayout *layout, GtkAdjustment *adj)
308{
309#if GTK_CHECK_VERSION(3,0,0)
310 gtk_scrollable_set_vadjustment(GTK_SCROLLABLE(layout), adj);
311#else
312 gtk_layout_set_vadjustment(layout, adj);
313#endif
315}
316
317GtkWidget *nsgtk_hbox_new(gboolean homogeneous, gint spacing)
318{
319#if GTK_CHECK_VERSION(3,0,0)
320 return gtk_box_new(GTK_ORIENTATION_HORIZONTAL, spacing);
321#else
322 return gtk_hbox_new(homogeneous, spacing);
323#endif
324}
325
326GtkWidget *nsgtk_vbox_new(gboolean homogeneous, gint spacing)
327{
328#if GTK_CHECK_VERSION(3,0,0)
329 return gtk_box_new(GTK_ORIENTATION_VERTICAL, spacing);
330#else
331 return gtk_vbox_new(homogeneous, spacing);
332#endif
333}
334
336{
337#if GTK_CHECK_VERSION(3,0,0)
338 return gtk_widget_get_state_flags(widget);
339#else
340#if GTK_CHECK_VERSION(2,18,0)
341 return gtk_widget_get_state(widget);
342#else
343 return 0; /* FIXME */
344#endif
345#endif
346}
347
349{
350#if GTK_CHECK_VERSION(3,0,0)
351 return gtk_widget_get_style_context(widget);
352#else
353 return widget->style;
354#endif
355}
356
357const PangoFontDescription* nsgtk_style_context_get_font(GtkStyleContext *style,
358 GtkStateFlags state)
359{
360#if GTK_CHECK_VERSION(3,8,0)
361 const PangoFontDescription* fontdesc = NULL;
362 gtk_style_context_get(style, state, GTK_STYLE_PROPERTY_FONT, &fontdesc, NULL);
363 return fontdesc;
364#else
365#if GTK_CHECK_VERSION(3,0,0)
366 return gtk_style_context_get_font(style, state);
367#else
368 return style->font_desc;
369#endif
370#endif
371}
372
373gulong nsgtk_connect_draw_event(GtkWidget *widget,
374 GCallback callback,
375 gpointer g)
376{
377#if GTK_CHECK_VERSION(3,0,0)
378 return g_signal_connect(G_OBJECT(widget), "draw", callback, g);
379#else
380 return g_signal_connect(G_OBJECT(widget), "expose_event", callback, g);
381#endif
382}
383
384void nsgdk_cursor_unref(GdkCursor *cursor)
385{
386#if GTK_CHECK_VERSION(3,0,0)
387 g_object_unref(cursor);
388#else
389 gdk_cursor_unref(cursor);
390#endif
391}
392
393void nsgtk_widget_modify_font(GtkWidget *widget,
394 PangoFontDescription *font_desc)
395{
396#if GTK_CHECK_VERSION(3,0,0)
397/* FIXME */
398 return;
399#else
400 gtk_widget_modify_font(widget, font_desc);
401#endif
402}
403
404GdkWindow *nsgtk_widget_get_window(GtkWidget *widget)
405{
406#if GTK_CHECK_VERSION(2,14,0)
407 return gtk_widget_get_window(widget);
408#else
409 return widget->window;
410#endif
411}
412
414{
415#if GTK_CHECK_VERSION(2,14,0)
416 return gtk_dialog_get_content_area(dialog);
417#else
418 return dialog->vbox;
419#endif
420}
421
422#if GTK_CHECK_VERSION(3,22,0)
423#include "gtk/scaffolding.h"
424#endif
425
426gboolean nsgtk_show_uri(GdkScreen *screen,
427 const gchar *uri,
428 guint32 timestamp,
429 GError **error)
430{
431#if GTK_CHECK_VERSION(2,14,0)
432#if GTK_CHECK_VERSION(3,22,0)
433 GtkWindow *parent;
435 return gtk_show_uri_on_window(parent, uri, timestamp,error);
436#else
437 return gtk_show_uri(screen, uri, timestamp, error);
438#endif
439#else
440 return FALSE; /** \todo add uri opening for before gtk 2.14 */
441#endif
442}
443
444GdkWindow *nsgtk_layout_get_bin_window(GtkLayout *layout)
445{
446#if GTK_CHECK_VERSION(2,14,0)
447 return gtk_layout_get_bin_window(layout);
448#else
449 return layout->bin_window;
450#endif
451}
452
453gdouble nsgtk_adjustment_get_step_increment(GtkAdjustment *adjustment)
454{
455#if GTK_CHECK_VERSION(2,14,0)
456 return gtk_adjustment_get_step_increment(adjustment);
457#else
458 return adjustment->step_increment;
459#endif
460}
461
462gdouble nsgtk_adjustment_get_upper(GtkAdjustment *adjustment)
463{
464#if GTK_CHECK_VERSION(2,14,0)
465 return gtk_adjustment_get_upper(adjustment);
466#else
467 return adjustment->upper;
468#endif
469}
470
471gdouble nsgtk_adjustment_get_lower(GtkAdjustment *adjustment)
472{
473#if GTK_CHECK_VERSION(2,14,0)
474 return gtk_adjustment_get_lower(adjustment);
475#else
476 return adjustment->lower;
477#endif
478}
479
480gdouble nsgtk_adjustment_get_page_increment(GtkAdjustment *adjustment)
481{
482#if GTK_CHECK_VERSION(2,14,0)
483 return gtk_adjustment_get_page_increment(adjustment);
484#else
485 return adjustment->page_increment;
486#endif
487}
488
489void nsgtk_widget_get_allocation(GtkWidget *widget, GtkAllocation *allocation)
490{
491#if GTK_CHECK_VERSION(2,18,0)
492 gtk_widget_get_allocation(widget, allocation);
493#else
494 allocation->x = widget->allocation.x;
495 allocation->y = widget->allocation.y;
496 allocation->width = widget->allocation.width;
497 allocation->height = widget->allocation.height;
498#endif
499}
500
501/* exported interface documented in gtk/compat.h */
502GtkWidget *nsgtk_image_new_from_pixbuf_icon(GdkPixbuf *pixbuf, GtkIconSize size)
503{
504#if GTK_CHECK_VERSION(3,10,0)
505 return gtk_image_new_from_pixbuf(pixbuf);
506#else
507 GtkIconSet *icon_set;
508 GtkWidget *image;
509
510 icon_set = gtk_icon_set_new_from_pixbuf(pixbuf);
511
512 image = gtk_image_new_from_icon_set(icon_set, size);
513
514 gtk_icon_set_unref(icon_set);
515
516 return image;
517#endif
518}
519
520
521/* exported interface documented in gtk/compat.h */
522void nsgtk_window_set_opacity(GtkWindow *window, gdouble opacity)
523{
524#if GTK_CHECK_VERSION(3,8,0)
525 gtk_widget_set_opacity(GTK_WIDGET(window), opacity);
526#else
527 gtk_window_set_opacity(window, opacity);
528#endif
529}
530
531/* exported interface documented in gtk/compat.h */
532void nsgtk_scrolled_window_add_with_viewport(GtkScrolledWindow *window,
533 GtkWidget *child)
534{
535#if GTK_CHECK_VERSION(3,8,0)
536 gtk_container_add(GTK_CONTAINER(window), child);
537#else
538 gtk_scrolled_window_add_with_viewport(window, child);
539#endif
540}
541
542/* exported interface documented in gtk/compat.h */
543GtkWidget *nsgtk_image_menu_item_new_with_mnemonic(const gchar *label)
544{
545#if GTK_CHECK_VERSION(3,10,0)
546 return gtk_menu_item_new_with_mnemonic(label);
547#else
548 return gtk_image_menu_item_new_with_mnemonic(label);
549#endif
550}
551
552/* exported interface documented in gtk/compat.h */
553void nsgtk_image_menu_item_set_image(GtkWidget *image_menu_item, GtkWidget *image)
554{
555#if !GTK_CHECK_VERSION(3,10,0)
556 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(image_menu_item), image);
557#endif
558}
559
560/* exported interface documented in gtk/compat.h */
561void nsgtk_menu_popup_at_pointer(GtkMenu *menu, const GdkEvent *trigger_event)
562{
563#if GTK_CHECK_VERSION(3,22,0)
564 gtk_menu_popup_at_pointer(menu, trigger_event);
565#else
566 gtk_menu_popup(menu, NULL, NULL, NULL, NULL, 0,
567 gtk_get_current_event_time());
568#endif
569}
570
571/* exported interface documented in gtk/compat.h */
573 GtkIconSize size,
574 gint *width,
575 gint *height)
576{
577#if GTK_CHECK_VERSION(3,10,0)
578 return gtk_icon_size_lookup(size, width, height);
579#else
580 return gtk_icon_size_lookup_for_settings(settings, size, width, height);
581#endif
582}
583
584/* exported interface documented in gtk/compat.h */
585void nsgtk_widget_set_alignment(GtkWidget *widget, GtkAlign halign, GtkAlign valign)
586{
587#if GTK_CHECK_VERSION(3,0,0)
588 gtk_widget_set_halign(widget, halign);
589 gtk_widget_set_valign(widget, valign);
590#else
591 gfloat x, y;
592 switch(halign) {
593 case GTK_ALIGN_START:
594 x = 0.0;
595 break;
596
597 case GTK_ALIGN_END:
598 x = 1.0;
599 break;
600
601 default:
602 x = 0.5;
603 break;
604 }
605
606 switch(valign) {
607 case GTK_ALIGN_START:
608 y = 0.0;
609 break;
610
611 case GTK_ALIGN_END:
612 y = 1.0;
613 break;
614
615 default:
616 y = 0.5;
617 break;
618 }
619
620 gtk_misc_set_alignment(GTK_MISC(widget), x, y);
621#endif
622}
623
624/* exported interface documented in gtk/compat.h */
625void nsgtk_widget_set_margins(GtkWidget *widget, gint hmargin, gint vmargin)
626{
627#if GTK_CHECK_VERSION(3,0,0)
628#if GTK_CHECK_VERSION(3,12,0)
629 gtk_widget_set_margin_start(widget, hmargin);
630 gtk_widget_set_margin_end(widget, hmargin);
631#else
632 gtk_widget_set_margin_left(widget, hmargin);
633 gtk_widget_set_margin_right(widget, hmargin);
634#endif
635 gtk_widget_set_margin_top(widget, vmargin);
636 gtk_widget_set_margin_bottom(widget, vmargin);
637#else
638 if (GTK_IS_MISC(widget)) {
639 gtk_misc_set_padding(GTK_MISC(widget), hmargin, vmargin);
640 }
641#endif
642}
643
644/* exported interface documented in gtk/compat.h */
645guint
647 const gchar *resource_path,
648 GError **error)
649{
650 guint ret;
651
652#ifdef WITH_GRESOURCE
653#if GTK_CHECK_VERSION(3,4,0)
654 ret = gtk_builder_add_from_resource(builder, resource_path, error);
655#else
656 GBytes *data;
657 const gchar *buffer;
658 gsize buffer_length;
659
660 g_assert(error && *error == NULL);
661
662 data = g_resources_lookup_data(resource_path, 0, error);
663 if (data == NULL) {
664 return 0;
665 }
666
667 buffer_length = 0;
668 buffer = g_bytes_get_data(data, &buffer_length);
669 g_assert(buffer != NULL);
670
671 ret = gtk_builder_add_from_string(builder, buffer, buffer_length, error);
672
673 g_bytes_unref(data);
674#endif
675#else
676 ret = 0; /* return an error as GResource not supported before GLIB 2.32 */
677#endif
678 return ret;
679}
static osspriteop_area * buffer
The buffer characteristics.
Definition: buffer.c:55
void nsgtk_layout_set_vadjustment(GtkLayout *layout, GtkAdjustment *adj)
Definition: compat.c:307
void nsgtk_window_set_opacity(GtkWindow *window, gdouble opacity)
Definition: compat.c:522
GtkStateFlags nsgtk_widget_get_state_flags(GtkWidget *widget)
Definition: compat.c:335
void nsgtk_widget_get_allocation(GtkWidget *widget, GtkAllocation *allocation)
Definition: compat.c:489
void nsgtk_button_set_focus_on_click(GtkButton *button, gboolean focus_on_click)
Sets whether the button will grab focus when it is clicked with the mouse.
Definition: compat.c:219
void nsgtk_widget_override_background_color(GtkWidget *widget, GtkStateFlags state, uint16_t a, uint16_t r, uint16_t g, uint16_t b)
Definition: compat.c:240
gboolean nsgtk_show_uri(GdkScreen *screen, const gchar *uri, guint32 timestamp, GError **error)
Definition: compat.c:426
gboolean nsgtk_widget_is_drawable(GtkWidget *widget)
Definition: compat.c:96
gchar * nsgtk_combo_box_text_get_active_text(GtkWidget *combo_box)
Definition: compat.c:133
void nsgtk_combo_box_text_append_text(GtkWidget *combo_box, const gchar *text)
Definition: compat.c:123
void nsgtk_dialog_set_has_separator(GtkDialog *dialog, gboolean setting)
Definition: compat.c:105
GtkWidget * nsgtk_image_new_from_stock(const gchar *id, GtkIconSize size)
Creates a GtkImage displaying a stock icon.
Definition: compat.c:198
static void nsgtk_layout_set_adjustment_step_increment(GtkAdjustment *adj, int value)
Definition: compat.c:287
GtkWidget * nsgtk_image_new_from_pixbuf_icon(GdkPixbuf *pixbuf, GtkIconSize size)
creates a new image widget of an appropriate icon size from a pixbuf.
Definition: compat.c:502
void nsgtk_widget_set_margins(GtkWidget *widget, gint hmargin, gint vmargin)
Set the margins of a widget.
Definition: compat.c:625
gboolean nsgtk_stock_lookup(const gchar *stock_id, GtkStockItem *item)
Fills item with the registered values for stock_id.
Definition: compat.c:230
gboolean nsgtk_widget_get_visible(GtkWidget *widget)
Definition: compat.c:69
const PangoFontDescription * nsgtk_style_context_get_font(GtkStyleContext *style, GtkStateFlags state)
Definition: compat.c:357
void nsgtk_layout_set_hadjustment(GtkLayout *layout, GtkAdjustment *adj)
Definition: compat.c:297
GdkWindow * nsgtk_widget_get_window(GtkWidget *widget)
Definition: compat.c:404
GtkWidget * nsgtk_hbox_new(gboolean homogeneous, gint spacing)
Definition: compat.c:317
GtkStyleContext * nsgtk_widget_get_style_context(GtkWidget *widget)
Definition: compat.c:348
gulong nsgtk_connect_draw_event(GtkWidget *widget, GCallback callback, gpointer g)
Definition: compat.c:373
void nsgdk_cursor_unref(GdkCursor *cursor)
Definition: compat.c:384
gdouble nsgtk_adjustment_get_page_increment(GtkAdjustment *adjustment)
Definition: compat.c:480
void nsgtk_widget_set_can_focus(GtkWidget *widget, gboolean can_focus)
Definition: compat.c:48
guint nsgtk_builder_add_from_resource(GtkBuilder *builder, const gchar *resource_path, GError **error)
Parses a resource file containing a GtkBuilder UI definition and merges it with the current contents ...
Definition: compat.c:646
void nsgtk_entry_set_icon_from_pixbuf(GtkWidget *entry, GtkEntryIconPosition icon_pos, GdkPixbuf *pixbuf)
Definition: compat.c:151
void nsgtk_widget_set_alignment(GtkWidget *widget, GtkAlign halign, GtkAlign valign)
Set the alignment of a widget.
Definition: compat.c:585
GtkWidget * nsgtk_dialog_get_content_area(GtkDialog *dialog)
Definition: compat.c:413
void nsgtk_entry_set_icon_from_icon_name(GtkWidget *entry, GtkEntryIconPosition icon_pos, const gchar *id)
Sets the icon shown in the entry at the specified position from an icon name.
Definition: compat.c:173
GtkWidget * nsgtk_entry_new(void)
Definition: compat.c:142
gboolean nsgtk_icon_size_lookup_for_settings(GtkSettings *settings, GtkIconSize size, gint *width, gint *height)
Definition: compat.c:572
gdouble nsgtk_adjustment_get_upper(GtkAdjustment *adjustment)
Definition: compat.c:462
gboolean nsgtk_widget_has_focus(GtkWidget *widget)
Definition: compat.c:60
gdouble nsgtk_adjustment_get_lower(GtkAdjustment *adjustment)
Definition: compat.c:471
GtkWidget * nsgtk_vbox_new(gboolean homogeneous, gint spacing)
Definition: compat.c:326
GtkWidget * nsgtk_button_new_from_stock(const gchar *stock_id)
Creates a new GtkButton containing the image and text from a stock item.
Definition: compat.c:209
GtkWidget * nsgtk_image_menu_item_new_with_mnemonic(const gchar *label)
Creates a new GtkImageMenuItem containing a label.
Definition: compat.c:543
GtkAdjustment * nsgtk_layout_get_vadjustment(GtkLayout *layout)
Definition: compat.c:269
void nsgtk_image_menu_item_set_image(GtkWidget *image_menu_item, GtkWidget *image)
Sets the image of image_menu_item to the given widget.
Definition: compat.c:553
GtkWidget * nsgtk_combo_box_text_new(void)
Definition: compat.c:114
gboolean nsgtk_widget_get_mapped(GtkWidget *widget)
Definition: compat.c:87
void nsgtk_scrolled_window_add_with_viewport(GtkScrolledWindow *window, GtkWidget *child)
Definition: compat.c:532
GtkAdjustment * nsgtk_layout_get_hadjustment(GtkLayout *layout)
Definition: compat.c:278
GdkWindow * nsgtk_layout_get_bin_window(GtkLayout *layout)
Definition: compat.c:444
gdouble nsgtk_adjustment_get_step_increment(GtkAdjustment *adjustment)
Definition: compat.c:453
void nsgtk_widget_modify_font(GtkWidget *widget, PangoFontDescription *font_desc)
Definition: compat.c:393
void nsgtk_menu_popup_at_pointer(GtkMenu *menu, const GdkEvent *trigger_event)
Displays menu and makes it available for selection.
Definition: compat.c:561
gboolean nsgtk_widget_get_realized(GtkWidget *widget)
Definition: compat.c:78
Compatibility functions for older GTK versions (interface)
GtkEntryIconPosition
Definition: compat.h:139
GtkStyle GtkStyleContext
Definition: compat.h:157
GtkAlign
Definition: compat.h:71
@ GTK_ALIGN_END
Definition: compat.h:74
@ GTK_ALIGN_START
Definition: compat.h:73
GtkStateType GtkStateFlags
Definition: compat.h:156
GtkStateType nsgtk_widget_get_state(GtkWidget *widget)
wimp_w parent
Definition: dialog.c:88
wimp_w dialog
Definition: dialog.c:87
static struct print_settings * settings
Definition: print.c:50
int width
Definition: gui.c:160
int height
Definition: gui.c:161
GtkWindow * nsgtk_scaffolding_window(struct nsgtk_scaffolding *g)
Get the gtk window for a scaffolding.
Definition: scaffolding.c:1310
struct nsgtk_scaffolding * nsgtk_current_scaffolding(void)
Obtain the most recently used scaffolding element.
Definition: scaffolding.c:1473
GtkWidget * sexy_icon_entry_new(void)
void sexy_icon_entry_set_icon(SexyIconEntry *entry, SexyIconEntryPosition icon_pos, GtkImage *icon)
SexyIconEntryPosition
#define SEXY_ICON_ENTRY(obj)
uint32_t colour
Colour type: XBGR.
Definition: types.h:35
static nserror text(const struct redraw_context *ctx, const struct plot_font_style *fstyle, int x, int y, const char *text, size_t length)
Text plotting.
Definition: plot.c:978