1 /*
2  * ROX-Filer, filer for the ROX desktop project
3  * By Thomas Leonard, <tal197@users.sourceforge.net>.
4  */
5 
6 #ifndef _GUI_SUPPORT_H
7 #define _GUI_SUPPORT_H
8 
9 #include <gtk/gtk.h>
10 
11 #define WIN_STATE_STICKY          (1<<0) /* Fixed relative to screen */
12 #define WIN_STATE_HIDDEN          (1<<4) /* Not on taskbar but window visible */
13 #define WIN_STATE_FIXED_POSITION  (1<<8) /* Window is fixed in position even */
14 #define WIN_STATE_ARRANGE_IGNORE  (1<<9) /* Ignore for auto arranging */
15 
16 #define WIN_HINTS_SKIP_FOCUS      (1<<0) /* Do not focus */
17 #define WIN_HINTS_SKIP_WINLIST    (1<<1) /* Not in win list */
18 #define WIN_HINTS_SKIP_TASKBAR    (1<<2) /* Not on taskbar */
19 
20 typedef struct _Radios Radios;
21 
22 extern GdkFont	   	*fixed_font;
23 extern gint		screen_width, screen_height;
24 
25 /* Useful atoms (set by gui_support_init()) */
26 extern GdkAtom xa__NET_WORKAREA;
27 extern GdkAtom xa__NET_WM_DESKTOP;
28 extern GdkAtom xa__NET_CURRENT_DESKTOP;
29 extern GdkAtom xa__NET_NUMBER_OF_DESKTOPS;
30 
31 /* For Xinerama */
32 extern gint		n_monitors;
33 extern GdkRectangle	*monitor_geom;
34 /* Smallest monitor - use for sizing windows */
35 extern gint		monitor_width, monitor_height;
36 typedef struct {
37 	gboolean left, right, top, bottom;
38 } MonitorAdjacent;
39 extern MonitorAdjacent *monitor_adjacent;
40 
41 typedef void (*HelpFunc)(gpointer data);
42 typedef const char *ParseFunc(gchar *line);
43 
44 void gui_store_screen_geometry(GdkScreen *screen);
45 
46 void gui_support_init(void);
47 int get_choice(const char *title,
48 	       const char *message,
49 	       int number_of_buttons, ...);
50 void report_error(const char *message, ...);
51 void info_message(const char *message, ...);
52 void set_cardinal_property(GdkWindow *window, GdkAtom prop, gulong value);
53 gboolean get_cardinal_property(GdkWindow *window, GdkAtom prop, gulong length,
54                                gulong *data, gint *actual_length);
55 int get_current_desktop(void);
56 int get_number_of_desktops(void);
57 void get_work_area(int *x, int *y, int *width, int *height);
58 void make_panel_window(GtkWidget *widget);
59 void delayed_error(const char *error, ...);
60 gboolean load_file(const char *pathname, char **data_out, long *length_out);
61 GtkWidget *new_help_button(HelpFunc show_help, gpointer data);
62 void parse_file(const char *path, ParseFunc *parse_line);
63 gboolean get_pointer_xy(int *x, int *y);
64 int get_monitor_under_pointer(void);
65 void centre_window(GdkWindow *window, int x, int y);
66 void wink_widget(GtkWidget *widget);
67 void destroy_on_idle(GtkWidget *widget);
68 gint rox_spawn(const gchar *dir, const gchar **argv);
69 GtkWidget *button_new_mixed(const char *stock, const char *message);
70 GtkWidget *button_new_image_text(GtkWidget *image, const char *message);
71 void entry_set_error(GtkWidget *entry, gboolean error);
72 void window_put_just_above(GdkWindow *higher, GdkWindow *lower);
73 void fixed_move_fast(GtkFixed *fixed, GtkWidget *widget, int x, int y);
74 void tooltip_show(guchar *text);
75 void tooltip_prime(GtkFunction callback, GObject *object);
76 void widget_modify_font(GtkWidget *widget, PangoFontDescription *font_desc);
77 gboolean confirm(const gchar *message, const gchar *stock, const gchar *action);
78 
79 Radios *radios_new(void (*changed)(Radios *, gpointer data), gpointer data);
80 void radios_add(Radios *radios, const gchar *tip, gint value,
81 		const gchar *label, ...);
82 void radios_pack(Radios *radios, GtkBox *box);
83 void radios_set_value(Radios *radios, gint value);
84 gint radios_get_value(Radios *radios);
85 GList *uri_list_to_glist(const char *uri_list);
86 GtkWidget *simple_image_new(GdkPixbuf *pixbuf);
87 void render_pixbuf(GdkPixbuf *pixbuf, GdkDrawable *target, GdkGC *gc,
88 		   int x, int y, int width, int height);
89 /* gdk_window_set_keep_below() only exists in GTK >= 2.4 and is broken until
90  * 2.4.6 */
91 void keep_below(GdkWindow *window, gboolean setting);
92 GdkPixbuf * rox_pixbuf_new_from_file_at_scale (const char *filename,
93 					       int       width,
94 					       int       height,
95 					       gboolean  preserve_aspect_ratio,
96 					       GError    **error);
97 void make_heading(GtkWidget *label, double scale_factor);
98 void launch_uri(GObject *button, const char *uri);
99 void allow_right_click(GtkWidget *button);
100 gint current_event_button(void);
101 GdkPixbuf *create_spotlight_pixbuf(GdkPixbuf *src, GdkColor *color);
102 GtkBuilder *get_gtk_builder(gchar **ids);
103 void add_stock_to_menu_item(GtkWidget *item, const char *stock);
104 
105 #endif /* _GUI_SUPPORT_H */
106