Place embedded windows with panel orientation, used on startup
[window-docker.git] / panel.h
blobcef4c7b04e28cad1d121a2f73feabb431443adde
1 /*
2 * Window Docker
4 * Copyright (C) 2011 Nikita Zlobin <cook60020tmp@mail.ru>
6 **************************************************************************
7 * This file contains desktop panel API, used in Window Docker
8 **************************************************************************
10 * Window Docker is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 3 of the License, or
13 * (at your option) any later version.
15 * Window Docker is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with Window Docker. If not, see <http://www.gnu.org/licenses/>
22 * or write to the Free Software Foundation, Inc.,
23 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
26 #ifndef __PANEL_H__
27 #define __PANEL_H__
29 #include <gtk/gtk.h>
31 /* Types */
33 typedef
34 struct { int h, w; } scr_t;
36 typedef
37 enum {
38 SIDE_NONE,
40 SIDE_TOP,
41 SIDE_RIGHT,
42 SIDE_BOTTOM,
43 SIDE_LEFT,
45 /* TODO:
46 * Non-standard orientation - tilted sides (e.g. in frames with non-square geometry) */
47 SIDE_OTHER
48 } side_t;
50 typedef
51 struct {
52 scr_t scr;
54 GtkWidget * win;
55 GtkWidget * container;
57 struct {
58 GdkWindow * parent;
59 gint x, y;
60 } orig;
62 struct {
63 guint w, h;
64 gboolean request;
65 } size;
67 struct {
68 int x, y;
69 struct {
70 int x, y;
71 } hidden;
72 } pos;
74 struct {
75 side_t side;
76 double pos;
77 int border;
78 gboolean autohiding;
79 struct {
80 int show, hide;
81 guint id;
82 } timeout;
83 gboolean visible;
84 } docking;
86 guint enter_cb_id, leave_cb_id;
87 } PanelWindow;
89 #define PANEL_WINDOW( w ) ((PanelWindow *) w)
91 /**
92 * PanelWindowRequest - request form for panel initialization.
95 /* Init staff */
96 extern PanelWindow * panelWindow_Alloc (void);
97 extern void panelWindow_Init (PanelWindow * panel);
99 /* Features */
100 extern void panelWindow_AH_Toggle (PanelWindow * panel, gboolean autohide);
101 static inline gboolean panelWindow_AH_Used (PanelWindow * panel) { return panel->docking.autohiding; }
103 /* Parameters */
104 extern void panelWindow_Side_Set (PanelWindow * panel, side_t side);
105 extern void panelWindow_Pos_Set (PanelWindow * panel, double pos);
106 extern void panelWindow_AH_ShowDuration_Set (PanelWindow * panel, double sec);
107 extern void panelWindow_AH_HideDuration_Set (PanelWindow * panel, double sec);
108 extern void panelWindow_AH_Border_Set (PanelWindow * panel, guint thickness);
110 static inline side_t panelWindow_Side (PanelWindow * panel) { return panel->docking.side; }
111 static inline double panelWindow_Pos (PanelWindow * panel) { return panel->docking.pos; }
112 static inline double panelWindow_AH_ShowDuration (PanelWindow * panel) { return panel->docking.timeout.show; }
113 static inline double panelWindow_AH_HideDuration (PanelWindow * panel) { return panel->docking.timeout.hide; }
114 static inline guint panelWindow_AH_Border (PanelWindow * panel) { return panel->docking.border; }
116 /* Get internal objects */
117 static inline GtkWidget * panelWindow_Container (PanelWindow * panel) { return panel->win; }
119 #endif /*__PANEL_H__ */