Merging upstream version 0.8.0 (Closes: #639729, #761971).
[debian/lxpanel.git] / src / panel.h
CommitLineData
6cc5e1a6 1/**
00916e98 2 * Copyright (c) 2006-2014 LxDE Developers, see the file AUTHORS for details.
6cc5e1a6
DB
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
00916e98
AG
19#ifndef __PANEL_H__
20#define __PANEL_H__ 1
6cc5e1a6
DB
21
22#include <X11/Xlib.h>
23#include <gtk/gtk.h>
6cc5e1a6 24
00916e98 25G_BEGIN_DECLS
6cc5e1a6 26
89173f95
AG
27/**
28 * LXPANEL_CHECK_VERSION
29 *
30 * A simple macro for plugins to check features.
31 *
32 * Since: 0.8.0
33 */
34#define LXPANEL_CHECK_VERSION(_a,_b,_c) \
35 (0 > _a || \
36 (0 == _a && 8 > _b) || \
37 (0 == _a && 8 == _b && 0 >= _c))
38
39
00916e98
AG
40#define LX_TYPE_PANEL (lxpanel_get_type())
41#define LXPANEL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \
42 LX_TYPE_PANEL, LXPanel))
43#define LXPANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), \
44 LX_TYPE_PANEL, LXPanelClass))
45#define LX_IS_PANEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
46 LX_TYPE_PANEL))
6cc5e1a6 47
00916e98
AG
48extern GType lxpanel_get_type (void) G_GNUC_CONST;
49
50/* A little trick to be compatible with some themes which rely on the
51 PanelToplevel class, so we use LXPanel as alias for PanelToplevel */
52typedef struct _LXPanel LXPanel;
53typedef struct _LXPanel PanelToplevel;
54typedef struct _LXPanelClass PanelToplevelClass;
55
56typedef struct _Panel Panel;
57
58struct _LXPanel
59{
60 GtkWindow window;
61 Panel *priv;
6cc5e1a6 62};
6cc5e1a6 63
00916e98
AG
64struct _LXPanelClass
65{
66 GtkWindowClass parent_class;
89173f95
AG
67 void (*icon_size_changed)(LXPanel *panel);
68 void (*panel_font_changed)(LXPanel *panel);
00916e98
AG
69};
70
71/**
72 * panel_apply_icon
73 * @w: a window to apply
74 *
75 * Sets appropriate icon as the window icon for @w.
76 */
1ea75322 77extern void panel_apply_icon(GtkWindow *w);
00916e98
AG
78
79/**
80 * lxpanel_draw_label_text
81 * @p: a panel instance
82 * @label: a label widget
83 * @text: (allow-none): text for the label
84 * @bold: %TRUE if text should be bold
85 * @custom_size_factor: scale factor for font size
86 * @custom_color: %TRUE to use font color from panel settings
87 *
88 * Changes @label to contain @text with appropriate attributes using the
89 * panel @p settings.
90 */
91extern void lxpanel_draw_label_text(LXPanel * p, GtkWidget * label, const char * text,
92 gboolean bold, float custom_size_factor,
93 gboolean custom_color);
94
95/**
00916e98
AG
96 * lxpanel_config_save
97 * @p: a panel instance
98 *
99 * Immediately saves current configuration for panel @p.
100 */
101void lxpanel_config_save(LXPanel *p); /* defined in configurator.c */
102
103/* Accessors APIs for Panel* */
104extern GtkOrientation panel_get_orientation(LXPanel *panel);
105extern gint panel_get_icon_size(LXPanel *panel);
106extern gint panel_get_height(LXPanel *panel);
107extern Window panel_get_xwindow(LXPanel *panel);
108extern gint panel_get_monitor(LXPanel *panel);
109extern GtkStyle *panel_get_defstyle(LXPanel *panel);
110extern GtkIconTheme *panel_get_icon_theme(LXPanel *panel);
111extern gboolean panel_is_at_bottom(LXPanel *panel);
112extern gboolean panel_is_dynamic(LXPanel *panel);
113extern GtkWidget *panel_box_new(LXPanel *panel, gboolean homogeneous, gint spacing);
114extern GtkWidget *panel_separator_new(LXPanel *panel);
115
116G_END_DECLS
6cc5e1a6
DB
117
118#endif