1 /* dock.h- built-in Dock module for WindowMaker
2  *
3  *  Window Maker window manager
4  *
5  *  Copyright (c) 1997-2003 Alfredo K. Kojima
6  *  Copyright (c) 1998-2003 Dan Pascu
7  *
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.
12  *
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.
17  *
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.
21  */
22 
23 #ifndef WMDOCK_H_
24 #define WMDOCK_H_
25 
26 #include "appicon.h"
27 
28 typedef struct WDock {
29     WScreen *screen_ptr;
30     int x_pos, y_pos;		       /* position of the first icon */
31 
32     WAppIcon **icon_array;	       /* array of docked icons */
33     int max_icons;
34 
35     int icon_count;
36 
37 #define WM_DOCK        0
38 #define WM_CLIP        1
39 #define WM_DRAWER      2
40     int type;
41 
42     WMagicNumber auto_expand_magic;
43     WMagicNumber auto_collapse_magic;
44     WMagicNumber auto_raise_magic;
45     WMagicNumber auto_lower_magic;
46     unsigned int auto_collapse:1;      /* if clip auto-collapse itself */
47     unsigned int auto_raise_lower:1;   /* if clip should raise/lower when
48                                         * entered/leaved */
49     unsigned int on_right_side:1;
50     unsigned int collapsed:1;
51     unsigned int mapped:1;
52     unsigned int lowered:1;
53     unsigned int attract_icons:1;      /* If clip should attract app-icons */
54 
55     unsigned int lclip_button_pushed:1;
56     unsigned int rclip_button_pushed:1;
57 
58     struct WMenu *menu;
59 
60     struct WDDomain *defaults;
61 } WDock;
62 
63 
64 
65 
66 
67 WDock *wDockCreate(WScreen *scr, int type, const char *name);
68 WDock *wDockRestoreState(WScreen *scr, WMPropList *dock_state, int type);
69 
70 void wDockDestroy(WDock *dock);
71 void wDockHideIcons(WDock *dock);
72 void wDockShowIcons(WDock *dock);
73 void wDockLower(WDock *dock);
74 void wDockRaise(WDock *dock);
75 void wDockRaiseLower(WDock *dock);
76 void wDockSaveState(WScreen *scr, WMPropList *old_state);
77 
78 Bool wDockAttachIcon(WDock *dock, WAppIcon *icon, int x, int y, Bool update_icon);
79 Bool wDockSnapIcon(WDock *dock, WAppIcon *icon, int req_x, int req_y,
80                    int *ret_x, int *ret_y, int redocking);
81 Bool wDockFindFreeSlot(WDock *dock, int *req_x, int *req_y);
82 void wDockDetach(WDock *dock, WAppIcon *icon);
83 Bool wDockMoveIconBetweenDocks(WDock *src, WDock *dest, WAppIcon *icon, int x, int y);
84 void wDockReattachIcon(WDock *dock, WAppIcon *icon, int x, int y);
85 
86 void wSlideAppicons(WAppIcon **appicons, int n, int to_the_left);
87 void wDrawerFillTheGap(WDock *drawer, WAppIcon *aicon, Bool redocking);
88 
89 void wDockFinishLaunch(WAppIcon *icon);
90 void wDockTrackWindowLaunch(WDock *dock, Window window);
91 WAppIcon *wDockFindIconForWindow(WDock *dock, Window window);
92 void wDockDoAutoLaunch(WDock *dock, int workspace);
93 void wDockLaunchWithState(WAppIcon *btn, WSavedState *state);
94 
95 #ifdef USE_DOCK_XDND
96 int wDockReceiveDNDDrop(WScreen *scr, XEvent *event);
97 #endif
98 
99 void wClipIconPaint(WAppIcon *aicon);
100 void wClipSaveState(WScreen *scr);
101 WMPropList *wClipSaveWorkspaceState(WScreen *scr, int workspace);
102 WAppIcon *wClipRestoreState(WScreen *scr, WMPropList *clip_state);
103 
104 void wDrawerIconPaint(WAppIcon *dicon);
105 void wDrawersSaveState(WScreen *scr);
106 void wDrawersRestoreState(WScreen *scr);
107 int wIsADrawer(WAppIcon *aicon);
108 
109 void wClipUpdateForWorkspaceChange(WScreen *scr, int workspace);
110 
111 RImage *wClipMakeTile(RImage *normalTile);
112 RImage* wDrawerMakeTile(WScreen *scr, RImage *normalTile);
113 
114 #define WO_FAILED          0
115 #define WO_NOT_APPLICABLE  1
116 #define WO_SUCCESS         2
117 
118 typedef enum
119 {
120 	P_NORMAL = 0,
121 	P_AUTO_RAISE_LOWER,
122 	P_KEEP_ON_TOP,
123 } dockPosition;
124 
125 int wClipMakeIconOmnipresent(WAppIcon *aicon, int omnipresent);
126 
127 #endif
128