Add new conf.c and conf.h files with config parser.
[lxde/lxpanel.git] / src / panel.h
CommitLineData
239cb032 1/**
a99ee9e1
JH
2 * Copyright (c) 2006 LxDE Developers, see the file AUTHORS for details.
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
a52c2257
HJYP
19#ifndef PANEL_H
20#define PANEL_H
21
a52c2257
HJYP
22#include <X11/Xlib.h>
23#include <gtk/gtk.h>
24#include <gdk/gdk.h>
25
26#include "config.h"
27
28#include "bg.h"
29#include "ev.h"
30
31enum { ALLIGN_NONE, ALLIGN_LEFT, ALLIGN_CENTER, ALLIGN_RIGHT };
64afc832 32enum { EDGE_NONE=0, EDGE_LEFT, EDGE_RIGHT, EDGE_TOP, EDGE_BOTTOM };
a52c2257
HJYP
33enum { WIDTH_NONE, WIDTH_REQUEST, WIDTH_PIXEL, WIDTH_PERCENT };
34enum { HEIGHT_NONE, HEIGHT_PIXEL, HEIGHT_REQUEST };
a97d06a6
HJYP
35enum {
36 ORIENT_NONE = -1,
37 ORIENT_VERT = GTK_ORIENTATION_VERTICAL,
38 ORIENT_HORIZ = GTK_ORIENTATION_HORIZONTAL
39};
a52c2257
HJYP
40enum { POS_NONE, POS_START, POS_END };
41
9dd114c4 42#define PANEL_ICON_SIZE 24 /* Default size of panel icons */
43#define PANEL_HEIGHT_DEFAULT 26 /* Default height of horizontal panel */
2918994e 44#define PANEL_WIDTH_DEFAULT 150 /* Default "height" of vertical panel */
9dd114c4 45#define PANEL_HEIGHT_MAX 200 /* Maximum height of panel */
46#define PANEL_HEIGHT_MIN 16 /* Minimum height of panel */
2918994e 47#define PANEL_ICON_HIGHLIGHT 0x202020 /* Constant to pass to icon loader */
a52c2257 48
95095259
HJYP
49/* to check if we are in LXDE */
50extern gboolean is_in_lxde;
51
2918994e 52/* Context of a panel on a given edge. */
53typedef struct _Panel {
8110399f 54 char* name;
2918994e 55 GtkWidget * topgwin; /* Main panel window */
56 Window topxwin; /* Main panel's X window */
57 GdkDisplay * display; /* Main panel's GdkDisplay */
58 GtkStyle * defstyle;
21f91705 59 GtkIconTheme* icon_theme; /*Default icon theme*/
2918994e 60
61 GtkWidget * box; /* Top level widget */
e2957bd2 62
a52c2257
HJYP
63 GtkRequisition requisition;
64 GtkWidget *(*my_box_new) (gboolean, gint);
65 GtkWidget *(*my_separator_new) ();
66
67 FbBg *bg;
68 int alpha;
69 guint32 tintcolor;
2de71c90 70 guint32 fontcolor;
a52c2257 71 GdkColor gtintcolor;
2de71c90 72 GdkColor gfontcolor;
bee4c26e 73
a52c2257
HJYP
74 int ax, ay, aw, ah; /* prefferd allocation of a panel */
75 int cx, cy, cw, ch; /* current allocation (as reported by configure event) allocation */
76 int allign, edge, margin;
77 int orientation;
78 int widthtype, width;
79 int heighttype, height;
64afc832 80 gint monitor;
d1d43629 81 gulong strut_size; /* Values for WM_STRUT_PARTIAL */
82 gulong strut_lower;
83 gulong strut_upper;
547ece89 84 int strut_edge;
a52c2257 85
930af9fd 86 guint config_changed : 1;
4b93d81e
HJYP
87 guint self_destroy : 1;
88 guint setdocktype : 1;
89 guint setstrut : 1;
90 guint round_corners : 1;
91 guint usefontcolor : 1;
1869ef90
LK
92 guint usefontsize : 1;
93 guint fontsize;
4b93d81e
HJYP
94 guint transparent : 1;
95 guint background : 1;
96 guint spacing;
bee4c26e 97
176fb687 98 guint autohide : 1;
99 guint visible : 1;
100 int height_when_hidden;
101 guint hide_timeout;
8f9e6256 102 int icon_size; /* Icon size */
176fb687 103
a52c2257
HJYP
104 int desknum;
105 int curdesk;
106 guint32 *workarea;
107 int wa_len;
108
2de71c90 109 char* background_file;
389975e0 110
2918994e 111 GList * plugins; /* List of all plugins */
112 GSList * system_menus; /* List of plugins having menus */
239cb032 113
2918994e 114 GtkWidget* plugin_pref_dialog; /* Plugin preference dialog */
115 GtkWidget* pref_dialog; /* preference dialog */
e7a42ecf 116 GtkWidget* margin_control; /* Margin control in preference dialog */
9dd114c4 117 GtkWidget* height_label; /* Label of height control */
118 GtkWidget* width_label; /* Label of width control */
2918994e 119 GtkWidget* alignment_left_label; /* Label of alignment: left control */
120 GtkWidget* alignment_right_label; /* Label of alignment: right control */
9dd114c4 121 GtkWidget* height_control; /* Height control in preference dialog */
2918994e 122 GtkWidget* width_control; /* Width control in preference dialog */
123} Panel;
a52c2257 124
2918994e 125/* Decoded value of WM_STATE property. */
bee4c26e 126typedef struct {
a52c2257
HJYP
127 unsigned int modal : 1;
128 unsigned int sticky : 1;
129 unsigned int maximized_vert : 1;
130 unsigned int maximized_horz : 1;
131 unsigned int shaded : 1;
132 unsigned int skip_taskbar : 1;
133 unsigned int skip_pager : 1;
134 unsigned int hidden : 1;
135 unsigned int fullscreen : 1;
136 unsigned int above : 1;
137 unsigned int below : 1;
22242ed4 138} NetWMState;
a52c2257 139
2918994e 140/* Decoded value of _NET_WM_WINDOW_TYPE property. */
bee4c26e 141typedef struct {
a52c2257
HJYP
142 unsigned int desktop : 1;
143 unsigned int dock : 1;
144 unsigned int toolbar : 1;
145 unsigned int menu : 1;
146 unsigned int utility : 1;
147 unsigned int splash : 1;
148 unsigned int dialog : 1;
149 unsigned int normal : 1;
22242ed4 150} NetWMWindowType;
a52c2257
HJYP
151
152typedef struct {
153 char *name;
08ea5341 154 char *disp_name;
a52c2257 155 void (*cmd)(void);
22242ed4 156} Command;
a52c2257 157
22242ed4 158extern Command commands[];
a52c2257
HJYP
159
160extern gchar *cprofile;
161
162extern Atom a_UTF8_STRING;
163extern Atom a_XROOTPMAP_ID;
164
165extern Atom a_WM_STATE;
166extern Atom a_WM_CLASS;
167extern Atom a_WM_DELETE_WINDOW;
168extern Atom a_WM_PROTOCOLS;
169extern Atom a_NET_WORKAREA;
170extern Atom a_NET_CLIENT_LIST;
171extern Atom a_NET_CLIENT_LIST_STACKING;
172extern Atom a_NET_NUMBER_OF_DESKTOPS;
173extern Atom a_NET_CURRENT_DESKTOP;
c0aed50f 174extern Atom a_NET_DESKTOP_VIEWPORT;
a52c2257
HJYP
175extern Atom a_NET_DESKTOP_NAMES;
176extern Atom a_NET_ACTIVE_WINDOW;
177extern Atom a_NET_CLOSE_WINDOW;
53b37ef2 178extern Atom a_NET_SHOWING_DESKTOP;
a52c2257
HJYP
179extern Atom a_NET_SUPPORTED;
180extern Atom a_NET_WM_STATE;
181extern Atom a_NET_WM_STATE_SKIP_TASKBAR;
182extern Atom a_NET_WM_STATE_SKIP_PAGER;
183extern Atom a_NET_WM_STATE_STICKY;
184extern Atom a_NET_WM_STATE_HIDDEN;
185extern Atom a_NET_WM_STATE_SHADED;
186
187#define a_NET_WM_STATE_REMOVE 0 /* remove/unset property */
188#define a_NET_WM_STATE_ADD 1 /* add/set property */
189#define a_NET_WM_STATE_TOGGLE 2 /* toggle property */
190
191extern Atom a_NET_WM_WINDOW_TYPE;
192extern Atom a_NET_WM_WINDOW_TYPE_DESKTOP;
193extern Atom a_NET_WM_WINDOW_TYPE_DOCK;
194extern Atom a_NET_WM_WINDOW_TYPE_TOOLBAR;
195extern Atom a_NET_WM_WINDOW_TYPE_MENU;
196extern Atom a_NET_WM_WINDOW_TYPE_UTILITY;
197extern Atom a_NET_WM_WINDOW_TYPE_SPLASH;
198extern Atom a_NET_WM_WINDOW_TYPE_DIALOG;
199extern Atom a_NET_WM_WINDOW_TYPE_NORMAL;
bee4c26e 200
a52c2257
HJYP
201extern Atom a_NET_WM_DESKTOP;
202extern Atom a_NET_WM_NAME;
203extern Atom a_NET_WM_VISIBLE_NAME;
204extern Atom a_NET_WM_STRUT;
205extern Atom a_NET_WM_STRUT_PARTIAL;
206extern Atom a_NET_WM_ICON;
207extern Atom a_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR;
208
2918994e 209extern Atom a_NET_SYSTEM_TRAY_OPCODE;
964b8b7e 210extern Atom a_NET_SYSTEM_TRAY_MESSAGE_DATA;
2918994e 211extern Atom a_NET_SYSTEM_TRAY_ORIENTATION;
212extern Atom a_MANAGER;
213
77886b88 214extern Atom a_LXPANEL_CMD; /* for private client message */
a52c2257
HJYP
215
216extern int verbose;
217
53b37ef2
HJYP
218/* if current window manager is EWMH conforming. */
219extern gboolean is_ewmh_supported;
220
a52c2257
HJYP
221extern FbEv *fbev;
222
223#define FBPANEL_WIN(win) gdk_window_lookup(win)
224
2918994e 225extern void panel_apply_icon(GtkWindow *w);
226extern void panel_destroy(Panel *p);
227extern void panel_adjust_geometry_terminology(Panel *p);
228extern void panel_determine_background_pixmap(Panel * p, GtkWidget * widget, GdkWindow * window);
3fd2186c
HG
229extern void panel_draw_label_text(Panel * p, GtkWidget * label, char * text, gboolean bold,
230 float custom_size_factor, gboolean custom_color);
2918994e 231extern void panel_establish_autohide(Panel *p);
fcb35553 232extern void panel_image_set_from_file(Panel * p, GtkWidget * image, const char * file);
c14620f2 233extern gboolean panel_image_set_icon_theme(Panel * p, GtkWidget * image, const gchar * icon);
2918994e 234extern void panel_set_wm_strut(Panel *p);
235extern void panel_set_dock_type(Panel *p);
236extern void panel_set_panel_configuration_changed(Panel *p);
237extern void panel_update_background( Panel* p );
238
239extern int panel_handle_x_error(Display * d, XErrorEvent * ev);
240extern int panel_handle_x_error_swallow_BadWindow_BadDrawable(Display * d, XErrorEvent * ev);
bee4c26e 241
cf701cb7 242extern const char* lxpanel_get_file_manager();
cf701cb7 243
a52c2257 244#endif