Releasing debian version 0.10.0-2.
[debian/lxpanel.git] / src / panel.h
1 /*
2 * Copyright (C) 2006-2010 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
3 * 2006-2008 Jim Huang <jserv.tw@gmail.com>
4 * 2008 Fred Chien <fred@lxde.org>
5 * 2009-2010 Marty Jack <martyj19@comcast.net>
6 * 2010 Lajos Kamocsay <lajos@panka.com>
7 * 2012 Piotr Sipika <Piotr.Sipika@gmail.com>
8 * 2012 Michael Rawson <michaelrawson76@gmail.com>
9 * 2013 Henry Gebhardt <hsggebhardt@gmail.com>
10 * 2013 Rouslan <rouslan-k@users.sourceforge.net>
11 * 2014 Andriy Grytsenko <andrej@rep.kiev.ua>
12 * 2018 Mamoru TASAKA <mtasaka@fedoraproject.org>
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software Foundation,
26 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 */
28
29 #ifndef __PANEL_H__
30 #define __PANEL_H__ 1
31
32 #include <X11/Xlib.h>
33 #include <gtk/gtk.h>
34
35 G_BEGIN_DECLS
36
37 /**
38 * LXPANEL_CHECK_VERSION
39 *
40 * A simple macro for plugins to check features.
41 *
42 * Since: 0.8.0
43 */
44 #define LXPANEL_CHECK_VERSION(_a,_b,_c) \
45 (0 > _a || \
46 (0 == _a && 10 > _b) || \
47 (0 == _a && 10 == _b && 0 >= _c))
48
49
50 #define LX_TYPE_PANEL (lxpanel_get_type())
51 #define LXPANEL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \
52 LX_TYPE_PANEL, LXPanel))
53 #define LXPANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), \
54 LX_TYPE_PANEL, LXPanelClass))
55 #define LX_IS_PANEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
56 LX_TYPE_PANEL))
57
58 extern GType lxpanel_get_type (void) G_GNUC_CONST;
59
60 /* A little trick to be compatible with some themes which rely on the
61 PanelToplevel class, so we use LXPanel as alias for PanelToplevel */
62 typedef struct _LXPanel LXPanel;
63 typedef struct _LXPanel PanelToplevel;
64 typedef struct _LXPanelClass PanelToplevelClass;
65
66 typedef struct _Panel Panel;
67
68 struct _LXPanel
69 {
70 GtkWindow window;
71 Panel *priv;
72 };
73
74 /**
75 * LXPanelClass:
76 * @parent_class: The parent class.
77 * @icon_size_changed: callback for "icon-size-changed" signal, emitted when
78 * icons size for panel is changed in the configuration dialog.
79 * @panel_font_changed: callback for "panel-font-changed" signal, emitted when
80 * custom font enabled, disabled or its metrics or color changed
81 * in the panel configuration dialog.
82 */
83 struct _LXPanelClass
84 {
85 GtkWindowClass parent_class;
86 void (*icon_size_changed)(LXPanel *panel);
87 void (*panel_font_changed)(LXPanel *panel);
88 };
89
90 /**
91 * panel_apply_icon
92 * @w: a window to apply
93 *
94 * Sets appropriate icon as the window icon for @w.
95 */
96 extern void panel_apply_icon(GtkWindow *w);
97
98 /**
99 * lxpanel_draw_label_text
100 * @p: a panel instance
101 * @label: a label widget
102 * @text: (allow-none): text for the label
103 * @bold: %TRUE if text should be bold
104 * @custom_size_factor: scale factor for font size
105 * @custom_color: %TRUE to use font color from panel settings
106 *
107 * Changes @label to contain @text with appropriate attributes using the
108 * panel @p settings.
109 */
110 extern void lxpanel_draw_label_text(LXPanel * p, GtkWidget * label, const char * text,
111 gboolean bold, float custom_size_factor,
112 gboolean custom_color);
113
114 /**
115 * lxpanel_draw_label_text_with_color
116 * @p: a panel instance
117 * @label: a label widget
118 * @text: (allow-none): text for the label
119 * @bold: %TRUE if text should be bold
120 * @custom_size_factor: scale factor for font size
121 * @color: GdkColor for drawing text
122 *
123 * Changes @label to contain @text with appropriate attributes using the
124 * panel @p settings.
125 */
126 extern void lxpanel_draw_label_text_with_color(LXPanel * p, GtkWidget * label, const char * text,
127 gboolean bold, float custom_size_factor,
128 GdkColor *color);
129
130 /**
131 * lxpanel_config_save
132 * @p: a panel instance
133 *
134 * Immediately saves current configuration for panel @p.
135 */
136 void lxpanel_config_save(LXPanel *p); /* defined in configurator.c */
137
138 /* Accessors APIs for Panel* */
139 extern GtkOrientation panel_get_orientation(LXPanel *panel);
140 extern gint panel_get_icon_size(LXPanel *panel);
141 extern gint panel_get_height(LXPanel *panel);
142 extern Window panel_get_xwindow(LXPanel *panel);
143 extern gint panel_get_monitor(LXPanel *panel);
144 extern GtkStyle *panel_get_defstyle(LXPanel *panel);
145 extern GtkIconTheme *panel_get_icon_theme(LXPanel *panel);
146 extern gboolean panel_is_at_bottom(LXPanel *panel);
147 extern gboolean panel_is_dynamic(LXPanel *panel);
148 extern GtkWidget *panel_box_new(LXPanel *panel, gboolean homogeneous, gint spacing);
149 extern GtkWidget *panel_separator_new(LXPanel *panel);
150
151 G_END_DECLS
152
153 #endif