28#ifdef _SEXY_ICON_ENTRY_H_
38#if GTK_CHECK_VERSION(2,18,0)
39 return gtk_widget_get_state(widget);
41 return GTK_WIDGET_STATE(widget);
50#if GTK_CHECK_VERSION(2,22,0)
51 gtk_widget_set_can_focus(widget, can_focus);
53 if (can_focus == TRUE)
54 GTK_WIDGET_SET_FLAGS(widget, GTK_CAN_FOCUS);
56 GTK_WIDGET_UNSET_FLAGS(widget, GTK_CAN_FOCUS);
62#if GTK_CHECK_VERSION(2,20,0)
63 return gtk_widget_has_focus(widget);
65 return GTK_WIDGET_HAS_FOCUS(widget);
71#if GTK_CHECK_VERSION(2,20,0)
72 return gtk_widget_get_visible(widget);
74 return GTK_WIDGET_VISIBLE(widget);
80#if GTK_CHECK_VERSION(2,20,0)
81 return gtk_widget_get_realized(widget);
83 return GTK_WIDGET_REALIZED(widget);
89#if GTK_CHECK_VERSION(2,20,0)
90 return gtk_widget_get_mapped(widget);
92 return GTK_WIDGET_MAPPED(widget);
98#if GTK_CHECK_VERSION(2,18,0)
99 return gtk_widget_is_drawable(widget);
101 return GTK_WIDGET_DRAWABLE(widget);
107#if GTK_CHECK_VERSION(2,21,8)
110 gtk_dialog_set_has_separator(
dialog, setting);
116#if GTK_CHECK_VERSION(2,24,0)
117 return gtk_combo_box_text_new();
119 return gtk_combo_box_new_text();
125#if GTK_CHECK_VERSION(2,24,0)
126 gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo_box),
text);
128 gtk_combo_box_append_text(GTK_COMBO_BOX(combo_box),
text);
135#if GTK_CHECK_VERSION(2,24,0)
136 return gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(combo_box));
138 return gtk_combo_box_get_active_text(GTK_COMBO_BOX(combo_box));
144#if GTK_CHECK_VERSION(2,16,0)
145 return gtk_entry_new();
155#if GTK_CHECK_VERSION(2,16,0)
156 gtk_entry_set_icon_from_pixbuf(GTK_ENTRY(entry), icon_pos, pixbuf);
158 GtkImage *image = GTK_IMAGE(gtk_image_new_from_pixbuf(pixbuf));
165 g_object_unref(image);
177#ifdef NSGTK_USE_ICON_NAME
178 gtk_entry_set_icon_from_icon_name(GTK_ENTRY(entry), icon_pos,
id);
180#if GTK_CHECK_VERSION(2,16,0)
181 gtk_entry_set_icon_from_icon_name(GTK_ENTRY(entry), icon_pos,
id);
184 image = GTK_IMAGE(gtk_image_new_from_stock(
id, GTK_ICON_SIZE_LARGE_TOOLBAR));
190 g_object_unref(image);
200#ifdef NSGTK_USE_ICON_NAME
201 return gtk_image_new_from_icon_name(
id, size);
203 return gtk_image_new_from_stock(
id, size);
211#ifdef NSGTK_USE_ICON_NAME
212 return gtk_button_new_with_label(stock_id);
214 return gtk_button_new_from_stock(stock_id);
221#if GTK_CHECK_VERSION(3,20,0)
222 gtk_widget_set_focus_on_click(GTK_WIDGET(button), focus_on_click);
224 gtk_button_set_focus_on_click(button, focus_on_click);
232#ifdef NSGTK_USE_ICON_NAME
235 return gtk_stock_lookup(stock_id, item);
247#if GTK_CHECK_VERSION(3,0,0)
248#if GTK_CHECK_VERSION(3,16,0)
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);
265 gtk_widget_modify_bg(widget, state, &
colour );
271#if GTK_CHECK_VERSION(3,0,0)
272 return gtk_scrollable_get_vadjustment(GTK_SCROLLABLE(layout));
274 return gtk_layout_get_vadjustment(layout);
280#if GTK_CHECK_VERSION(3,0,0)
281 return gtk_scrollable_get_hadjustment(GTK_SCROLLABLE(layout));
283 return gtk_layout_get_hadjustment(layout);
290#if GTK_CHECK_VERSION(2,14,0)
291 gtk_adjustment_set_step_increment(adj, value);
293 adj->step_increment = value;
299#if GTK_CHECK_VERSION(3,0,0)
300 gtk_scrollable_set_hadjustment(GTK_SCROLLABLE(layout), adj);
302 gtk_layout_set_hadjustment(layout, adj);
309#if GTK_CHECK_VERSION(3,0,0)
310 gtk_scrollable_set_vadjustment(GTK_SCROLLABLE(layout), adj);
312 gtk_layout_set_vadjustment(layout, adj);
319#if GTK_CHECK_VERSION(3,0,0)
320 return gtk_box_new(GTK_ORIENTATION_HORIZONTAL, spacing);
322 return gtk_hbox_new(homogeneous, spacing);
328#if GTK_CHECK_VERSION(3,0,0)
329 return gtk_box_new(GTK_ORIENTATION_VERTICAL, spacing);
331 return gtk_vbox_new(homogeneous, spacing);
337#if GTK_CHECK_VERSION(3,0,0)
338 return gtk_widget_get_state_flags(widget);
340#if GTK_CHECK_VERSION(2,18,0)
341 return gtk_widget_get_state(widget);
350#if GTK_CHECK_VERSION(3,0,0)
351 return gtk_widget_get_style_context(widget);
353 return widget->style;
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);
365#if GTK_CHECK_VERSION(3,0,0)
366 return gtk_style_context_get_font(style, state);
368 return style->font_desc;
377#if GTK_CHECK_VERSION(3,0,0)
378 return g_signal_connect(G_OBJECT(widget),
"draw", callback, g);
380 return g_signal_connect(G_OBJECT(widget),
"expose_event", callback, g);
386#if GTK_CHECK_VERSION(3,0,0)
387 g_object_unref(cursor);
389 gdk_cursor_unref(cursor);
396#if GTK_CHECK_VERSION(3,0,0)
400 gtk_widget_modify_font(widget,
font_desc);
406#if GTK_CHECK_VERSION(2,14,0)
407 return gtk_widget_get_window(widget);
409 return widget->window;
415#if GTK_CHECK_VERSION(2,14,0)
416 return gtk_dialog_get_content_area(
dialog);
422#if GTK_CHECK_VERSION(3,22,0)
431#if GTK_CHECK_VERSION(2,14,0)
432#if GTK_CHECK_VERSION(3,22,0)
435 return gtk_show_uri_on_window(
parent, uri, timestamp,error);
437 return gtk_show_uri(screen, uri, timestamp, error);
446#if GTK_CHECK_VERSION(2,14,0)
447 return gtk_layout_get_bin_window(layout);
449 return layout->bin_window;
455#if GTK_CHECK_VERSION(2,14,0)
456 return gtk_adjustment_get_step_increment(adjustment);
458 return adjustment->step_increment;
464#if GTK_CHECK_VERSION(2,14,0)
465 return gtk_adjustment_get_upper(adjustment);
467 return adjustment->upper;
473#if GTK_CHECK_VERSION(2,14,0)
474 return gtk_adjustment_get_lower(adjustment);
476 return adjustment->lower;
482#if GTK_CHECK_VERSION(2,14,0)
483 return gtk_adjustment_get_page_increment(adjustment);
485 return adjustment->page_increment;
491#if GTK_CHECK_VERSION(2,18,0)
492 gtk_widget_get_allocation(widget, allocation);
494 allocation->x = widget->allocation.x;
495 allocation->y = widget->allocation.y;
496 allocation->width = widget->allocation.width;
497 allocation->height = widget->allocation.height;
504#if GTK_CHECK_VERSION(3,10,0)
505 return gtk_image_new_from_pixbuf(pixbuf);
507 GtkIconSet *icon_set;
510 icon_set = gtk_icon_set_new_from_pixbuf(pixbuf);
512 image = gtk_image_new_from_icon_set(icon_set, size);
514 gtk_icon_set_unref(icon_set);
524#if GTK_CHECK_VERSION(3,8,0)
525 gtk_widget_set_opacity(GTK_WIDGET(window), opacity);
527 gtk_window_set_opacity(window, opacity);
535#if GTK_CHECK_VERSION(3,8,0)
536 gtk_container_add(GTK_CONTAINER(window), child);
538 gtk_scrolled_window_add_with_viewport(window, child);
545#if GTK_CHECK_VERSION(3,10,0)
546 return gtk_menu_item_new_with_mnemonic(label);
548 return gtk_image_menu_item_new_with_mnemonic(label);
555#if !GTK_CHECK_VERSION(3,10,0)
556 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(image_menu_item), image);
563#if GTK_CHECK_VERSION(3,22,0)
564 gtk_menu_popup_at_pointer(menu, trigger_event);
566 gtk_menu_popup(menu, NULL, NULL, NULL, NULL, 0,
567 gtk_get_current_event_time());
577#if GTK_CHECK_VERSION(3,10,0)
587#if GTK_CHECK_VERSION(3,0,0)
588 gtk_widget_set_halign(widget, halign);
589 gtk_widget_set_valign(widget, valign);
620 gtk_misc_set_alignment(GTK_MISC(widget), x, y);
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);
632 gtk_widget_set_margin_left(widget, hmargin);
633 gtk_widget_set_margin_right(widget, hmargin);
635 gtk_widget_set_margin_top(widget, vmargin);
636 gtk_widget_set_margin_bottom(widget, vmargin);
638 if (GTK_IS_MISC(widget)) {
639 gtk_misc_set_padding(GTK_MISC(widget), hmargin, vmargin);
647 const gchar *resource_path,
653#if GTK_CHECK_VERSION(3,4,0)
654 ret = gtk_builder_add_from_resource(builder, resource_path, error);
660 g_assert(error && *error == NULL);
662 data = g_resources_lookup_data(resource_path, 0, error);
668 buffer = g_bytes_get_data(data, &buffer_length);
671 ret = gtk_builder_add_from_string(builder,
buffer, buffer_length, error);
static osspriteop_area * buffer
The buffer characteristics.
void nsgtk_layout_set_vadjustment(GtkLayout *layout, GtkAdjustment *adj)
void nsgtk_window_set_opacity(GtkWindow *window, gdouble opacity)
GtkStateFlags nsgtk_widget_get_state_flags(GtkWidget *widget)
void nsgtk_widget_get_allocation(GtkWidget *widget, GtkAllocation *allocation)
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.
void nsgtk_widget_override_background_color(GtkWidget *widget, GtkStateFlags state, uint16_t a, uint16_t r, uint16_t g, uint16_t b)
gboolean nsgtk_show_uri(GdkScreen *screen, const gchar *uri, guint32 timestamp, GError **error)
gboolean nsgtk_widget_is_drawable(GtkWidget *widget)
gchar * nsgtk_combo_box_text_get_active_text(GtkWidget *combo_box)
void nsgtk_combo_box_text_append_text(GtkWidget *combo_box, const gchar *text)
void nsgtk_dialog_set_has_separator(GtkDialog *dialog, gboolean setting)
GtkWidget * nsgtk_image_new_from_stock(const gchar *id, GtkIconSize size)
Creates a GtkImage displaying a stock icon.
static void nsgtk_layout_set_adjustment_step_increment(GtkAdjustment *adj, int value)
GtkWidget * nsgtk_image_new_from_pixbuf_icon(GdkPixbuf *pixbuf, GtkIconSize size)
creates a new image widget of an appropriate icon size from a pixbuf.
void nsgtk_widget_set_margins(GtkWidget *widget, gint hmargin, gint vmargin)
Set the margins of a widget.
gboolean nsgtk_stock_lookup(const gchar *stock_id, GtkStockItem *item)
Fills item with the registered values for stock_id.
gboolean nsgtk_widget_get_visible(GtkWidget *widget)
const PangoFontDescription * nsgtk_style_context_get_font(GtkStyleContext *style, GtkStateFlags state)
void nsgtk_layout_set_hadjustment(GtkLayout *layout, GtkAdjustment *adj)
GdkWindow * nsgtk_widget_get_window(GtkWidget *widget)
GtkWidget * nsgtk_hbox_new(gboolean homogeneous, gint spacing)
GtkStyleContext * nsgtk_widget_get_style_context(GtkWidget *widget)
gulong nsgtk_connect_draw_event(GtkWidget *widget, GCallback callback, gpointer g)
void nsgdk_cursor_unref(GdkCursor *cursor)
gdouble nsgtk_adjustment_get_page_increment(GtkAdjustment *adjustment)
void nsgtk_widget_set_can_focus(GtkWidget *widget, gboolean can_focus)
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 ...
void nsgtk_entry_set_icon_from_pixbuf(GtkWidget *entry, GtkEntryIconPosition icon_pos, GdkPixbuf *pixbuf)
void nsgtk_widget_set_alignment(GtkWidget *widget, GtkAlign halign, GtkAlign valign)
Set the alignment of a widget.
GtkWidget * nsgtk_dialog_get_content_area(GtkDialog *dialog)
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.
GtkWidget * nsgtk_entry_new(void)
gboolean nsgtk_icon_size_lookup_for_settings(GtkSettings *settings, GtkIconSize size, gint *width, gint *height)
gdouble nsgtk_adjustment_get_upper(GtkAdjustment *adjustment)
gboolean nsgtk_widget_has_focus(GtkWidget *widget)
gdouble nsgtk_adjustment_get_lower(GtkAdjustment *adjustment)
GtkWidget * nsgtk_vbox_new(gboolean homogeneous, gint spacing)
GtkWidget * nsgtk_button_new_from_stock(const gchar *stock_id)
Creates a new GtkButton containing the image and text from a stock item.
GtkWidget * nsgtk_image_menu_item_new_with_mnemonic(const gchar *label)
Creates a new GtkImageMenuItem containing a label.
GtkAdjustment * nsgtk_layout_get_vadjustment(GtkLayout *layout)
void nsgtk_image_menu_item_set_image(GtkWidget *image_menu_item, GtkWidget *image)
Sets the image of image_menu_item to the given widget.
GtkWidget * nsgtk_combo_box_text_new(void)
gboolean nsgtk_widget_get_mapped(GtkWidget *widget)
void nsgtk_scrolled_window_add_with_viewport(GtkScrolledWindow *window, GtkWidget *child)
GtkAdjustment * nsgtk_layout_get_hadjustment(GtkLayout *layout)
GdkWindow * nsgtk_layout_get_bin_window(GtkLayout *layout)
gdouble nsgtk_adjustment_get_step_increment(GtkAdjustment *adjustment)
void nsgtk_widget_modify_font(GtkWidget *widget, PangoFontDescription *font_desc)
void nsgtk_menu_popup_at_pointer(GtkMenu *menu, const GdkEvent *trigger_event)
Displays menu and makes it available for selection.
gboolean nsgtk_widget_get_realized(GtkWidget *widget)
Compatibility functions for older GTK versions (interface)
GtkStateType GtkStateFlags
GtkStateType nsgtk_widget_get_state(GtkWidget *widget)
static struct print_settings * settings
GtkWindow * nsgtk_scaffolding_window(struct nsgtk_scaffolding *g)
Get the gtk window for a scaffolding.
struct nsgtk_scaffolding * nsgtk_current_scaffolding(void)
Obtain the most recently used scaffolding element.
GtkWidget * sexy_icon_entry_new(void)
void sexy_icon_entry_set_icon(SexyIconEntry *entry, SexyIconEntryPosition icon_pos, GtkImage *icon)
#define SEXY_ICON_ENTRY(obj)
uint32_t colour
Colour type: XBGR.
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.