Prevent crash when switchpanel is not initialised.
[wmaker-crm.git] / src / dock.h
blob2c6c4bc4913f46aaeac40fa4842f7a04fe98bbc2
1 /* dock.h- built-in Dock module for WindowMaker
3 * Window Maker window manager
5 * Copyright (c) 1997-2003 Alfredo K. Kojima
6 * Copyright (c) 1998-2003 Dan Pascu
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #ifndef WMDOCK_H_
24 #define WMDOCK_H_
27 #include "appicon.h"
28 #include "funcs.h"
31 typedef struct WDock {
32 WScreen *screen_ptr;
33 int x_pos, y_pos; /* position of the first icon */
35 WAppIcon **icon_array; /* array of docked icons */
36 int max_icons;
38 int icon_count;
40 #define WM_DOCK 0
41 #define WM_CLIP 1
42 #define WM_DRAWER 2
43 int type;
45 WMagicNumber auto_expand_magic;
46 WMagicNumber auto_collapse_magic;
47 WMagicNumber auto_raise_magic;
48 WMagicNumber auto_lower_magic;
49 unsigned int auto_collapse:1; /* if clip auto-collapse itself */
50 unsigned int auto_raise_lower:1; /* if clip should raise/lower when
51 * entered/leaved */
52 unsigned int on_right_side:1;
53 unsigned int collapsed:1;
54 unsigned int mapped:1;
55 unsigned int lowered:1;
56 unsigned int attract_icons:1; /* If clip should attract app-icons */
58 unsigned int lclip_button_pushed:1;
59 unsigned int rclip_button_pushed:1;
61 struct WMenu *menu;
63 struct WDDomain *defaults;
64 } WDock;
70 WDock *wDockCreate(WScreen *scr, int type, char *name);
71 WDock *wDockRestoreState(WScreen *scr, WMPropList *dock_state, int type);
73 void wDockDestroy(WDock *dock);
74 void wDockHideIcons(WDock *dock);
75 void wDockShowIcons(WDock *dock);
76 void wDockLower(WDock *dock);
77 void wDockRaise(WDock *dock);
78 void wDockRaiseLower(WDock *dock);
79 void wDockSaveState(WScreen *scr, WMPropList *old_state);
81 Bool wDockAttachIcon(WDock *dock, WAppIcon *icon, int x, int y, Bool update_icon);
82 Bool wDockSnapIcon(WDock *dock, WAppIcon *icon, int req_x, int req_y,
83 int *ret_x, int *ret_y, int redocking);
84 Bool wDockFindFreeSlot(WDock *dock, int *req_x, int *req_y);
85 void wDockDetach(WDock *dock, WAppIcon *icon);
86 Bool wDockMoveIconBetweenDocks(WDock *src, WDock *dest, WAppIcon *icon, int x, int y);
87 void wDockReattachIcon(WDock *dock, WAppIcon *icon, int x, int y);
89 void wSlideAppicons(WAppIcon **appicons, int n, int to_the_left);
90 void wDrawerFillTheGap(WDock *drawer, WAppIcon *aicon, Bool redocking);
92 void wDockFinishLaunch(WDock *dock, WAppIcon *icon);
93 void wDockTrackWindowLaunch(WDock *dock, Window window);
94 WAppIcon *wDockFindIconForWindow(WDock *dock, Window window);
95 void wDockDoAutoLaunch(WDock *dock, int workspace);
96 void wDockLaunchWithState(WDock *dock, WAppIcon *btn, WSavedState *state);
98 #ifdef XDND
99 int wDockReceiveDNDDrop(WScreen *scr, XEvent *event);
100 #endif
102 void wClipIconPaint(WAppIcon *aicon);
103 void wClipSaveState(WScreen *scr);
104 WMPropList *wClipSaveWorkspaceState(WScreen *scr, int workspace);
105 WAppIcon *wClipRestoreState(WScreen *scr, WMPropList *clip_state);
107 void wDrawerIconPaint(WAppIcon *dicon);
108 void wDrawersSaveState(WScreen *scr);
109 void wDrawersRestoreState(WScreen *scr);
110 int wIsADrawer(WScreen *scr, WAppIcon *aicon);
112 void wClipUpdateForWorkspaceChange(WScreen *scr, int workspace);
114 RImage *wClipMakeTile(WScreen *scr, RImage *normalTile);
115 RImage* wDrawerMakeTile(WScreen *scr, RImage *normalTile);
117 #define WO_FAILED 0
118 #define WO_NOT_APPLICABLE 1
119 #define WO_SUCCESS 2
121 typedef enum
123 P_NORMAL = 0,
124 P_AUTO_RAISE_LOWER,
125 P_KEEP_ON_TOP,
126 } dockPosition;
128 int wClipMakeIconOmnipresent(WAppIcon *aicon, int omnipresent);
130 #endif