Adding upstream version 0.9.0.
[debian/lxpanel.git] / plugins / task-button.h
1 /**
2 * Copyright (C) 2014-2016 Andriy Grytsenko <andrej@rep.kiev.ua>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18
19 #ifndef __TASK_BUTTON_H__
20 #define __TASK_BUTTON_H__ 1
21
22 #include "plugin.h"
23
24 #include <gtk/gtk.h>
25
26 G_BEGIN_DECLS
27
28 typedef struct /* bitwise rendering options for taskbar */
29 {
30 gboolean show_all_desks : 1; /* show windows from all desktops */
31 gboolean tooltips : 1; /* show tooltips */
32 gboolean icons_only : 1; /* show icons only, omit name */
33 gboolean use_mouse_wheel : 1; /* scroll wheel does iconify and raise */
34 gboolean use_urgency_hint : 1; /* windows with urgency will flash */
35 gboolean flat_button : 1; /* taskbar buttons have visible background */
36 gboolean same_monitor_only : 1; /* only show windows that are in the same monitor as the taskbar */
37 gboolean disable_taskbar_upscale : 1; /* don't upscale taskbar icons */
38 gboolean use_net_active : 1; /* NET_WM_ACTIVE_WINDOW is supported by the window manager */
39 gboolean use_smaller_icons : 1; /* use icons 4 pixels less than panel default */
40 } TaskShowFlags;
41
42 #define PANEL_TYPE_TASK_BUTTON (task_button_get_type())
43 #define PANEL_TASK_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \
44 PANEL_TYPE_TASK_BUTTON, TaskButton))
45 #define PANEL_TASK_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), \
46 PANEL_TYPE_TASK_BUTTON, TaskButtonClass))
47 #define PANEL_IS_TASK_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
48 PANEL_TYPE_TASK_BUTTON))
49 #define PANEL_IS_TASK_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
50 PANEL_TYPE_TASK_BUTTON))
51
52 extern GType task_button_get_type (void) G_GNUC_CONST;
53
54 typedef struct _TaskButton TaskButton;
55 typedef struct _TaskButtonClass TaskButtonClass;
56
57 struct _TaskButtonClass
58 {
59 GtkToggleButtonClass parent_class;
60 void (*menu_built)(TaskButton *button, GtkMenu *menu); /* "menu-built" signal */
61 void (*menu_target_set)(TaskButton *button, gulong win); /* "menu-target-set" signal */
62 };
63
64 /* creates new button and sets rendering options */
65 TaskButton *task_button_new(Window win, gint desk, gint desks, LXPanel *panel,
66 const char *cl, TaskShowFlags flags);
67
68 gboolean task_button_has_window(TaskButton *button, Window win);
69 /* removes windows from button, that are missing in list */
70 void task_button_update_windows_list(TaskButton *button, Window *list, gint n);
71 /* returns TRUE if found and updated */
72 gboolean task_button_window_xprop_changed(TaskButton *button, Window win, Atom atom);
73 gboolean task_button_window_focus_changed(TaskButton *button, Window *win);
74 gboolean task_button_window_reconfigured(TaskButton *button, Window win);
75 /* updates rendering options */
76 void task_button_update(TaskButton *button, gint desk, gint desks,
77 gint mon, guint icon_size, TaskShowFlags flags);
78 void task_button_set_flash_state(TaskButton *button, gboolean state);
79 /* adds task only if it's the same class */
80 gboolean task_button_add_window(TaskButton *button, Window win, const char *cl);
81 gboolean task_button_drop_window(TaskButton *button, Window win, gboolean leave_last);
82 /* leaves only last task in button and returns rest if not empty */
83 TaskButton *task_button_split(TaskButton *button);
84 /* merges buttons if they are the same class */
85 gboolean task_button_merge(TaskButton *button, TaskButton *sibling);
86 /* single-instance-menu management, should be called on button parent widget */
87 void task_button_reset_menu(GtkWidget *parent);
88
89 G_END_DECLS
90
91 #endif /* __TASK_BUTTON_H__ */