Adding upstream version 0.9.0.
[debian/lxpanel.git] / src / panel.h
CommitLineData
0688b017
AG
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>
6cc5e1a6
DB
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software Foundation,
25 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 */
27
6b775dbb
AG
28#ifndef __PANEL_H__
29#define __PANEL_H__ 1
6cc5e1a6
DB
30
31#include <X11/Xlib.h>
32#include <gtk/gtk.h>
6cc5e1a6 33
6b775dbb 34G_BEGIN_DECLS
6cc5e1a6 35
f7ecd6ce
AG
36/**
37 * LXPANEL_CHECK_VERSION
38 *
39 * A simple macro for plugins to check features.
40 *
41 * Since: 0.8.0
42 */
43#define LXPANEL_CHECK_VERSION(_a,_b,_c) \
44 (0 > _a || \
7a1c5048
AG
45 (0 == _a && 9 > _b) || \
46 (0 == _a && 9 == _b && 0 >= _c))
f7ecd6ce
AG
47
48
6b775dbb
AG
49#define LX_TYPE_PANEL (lxpanel_get_type())
50#define LXPANEL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \
51 LX_TYPE_PANEL, LXPanel))
52#define LXPANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), \
53 LX_TYPE_PANEL, LXPanelClass))
54#define LX_IS_PANEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
55 LX_TYPE_PANEL))
6cc5e1a6 56
6b775dbb
AG
57extern GType lxpanel_get_type (void) G_GNUC_CONST;
58
59/* A little trick to be compatible with some themes which rely on the
60 PanelToplevel class, so we use LXPanel as alias for PanelToplevel */
61typedef struct _LXPanel LXPanel;
62typedef struct _LXPanel PanelToplevel;
63typedef struct _LXPanelClass PanelToplevelClass;
64
65typedef struct _Panel Panel;
66
67struct _LXPanel
68{
69 GtkWindow window;
70 Panel *priv;
6cc5e1a6 71};
6cc5e1a6 72
8713e384
AG
73/**
74 * LXPanelClass:
75 * @parent_class: The parent class.
76 * @icon_size_changed: callback for "icon-size-changed" signal, emitted when
77 * icons size for panel is changed in the configuration dialog.
78 * @panel_font_changed: callback for "panel-font-changed" signal, emitted when
79 * custom font enabled, disabled or its metrics or color changed
80 * in the panel configuration dialog.
81 */
6b775dbb
AG
82struct _LXPanelClass
83{
84 GtkWindowClass parent_class;
f7ecd6ce
AG
85 void (*icon_size_changed)(LXPanel *panel);
86 void (*panel_font_changed)(LXPanel *panel);
6b775dbb
AG
87};
88
89/**
90 * panel_apply_icon
91 * @w: a window to apply
92 *
93 * Sets appropriate icon as the window icon for @w.
94 */
2ba86315 95extern void panel_apply_icon(GtkWindow *w);
6b775dbb
AG
96
97/**
98 * lxpanel_draw_label_text
99 * @p: a panel instance
100 * @label: a label widget
101 * @text: (allow-none): text for the label
102 * @bold: %TRUE if text should be bold
103 * @custom_size_factor: scale factor for font size
104 * @custom_color: %TRUE to use font color from panel settings
105 *
106 * Changes @label to contain @text with appropriate attributes using the
107 * panel @p settings.
108 */
109extern void lxpanel_draw_label_text(LXPanel * p, GtkWidget * label, const char * text,
110 gboolean bold, float custom_size_factor,
111 gboolean custom_color);
112
113/**
6b775dbb
AG
114 * lxpanel_config_save
115 * @p: a panel instance
116 *
117 * Immediately saves current configuration for panel @p.
118 */
119void lxpanel_config_save(LXPanel *p); /* defined in configurator.c */
120
121/* Accessors APIs for Panel* */
122extern GtkOrientation panel_get_orientation(LXPanel *panel);
123extern gint panel_get_icon_size(LXPanel *panel);
124extern gint panel_get_height(LXPanel *panel);
125extern Window panel_get_xwindow(LXPanel *panel);
126extern gint panel_get_monitor(LXPanel *panel);
127extern GtkStyle *panel_get_defstyle(LXPanel *panel);
128extern GtkIconTheme *panel_get_icon_theme(LXPanel *panel);
129extern gboolean panel_is_at_bottom(LXPanel *panel);
130extern gboolean panel_is_dynamic(LXPanel *panel);
131extern GtkWidget *panel_box_new(LXPanel *panel, gboolean homogeneous, gint spacing);
132extern GtkWidget *panel_separator_new(LXPanel *panel);
133
134G_END_DECLS
6cc5e1a6
DB
135
136#endif