4 * Copyright (c) Tuomo Valkonen 1999-2009.
6 * See the included file LICENSE for details.
9 #ifndef ION_IONCORE_RESIZE_H
10 #define ION_IONCORE_RESIZE_H
15 #include "rectangle.h"
17 #include <mod_tiling/split.h>
20 /* To make it easier for region_managed_rqgeom handlers, the geom
21 * parameter contain a complete requested geometry for the region that
22 * wants its geometry changed. The REGION_WEAK_* flags are used to
23 * indicate that the respective geometry value has not been changed or
24 * that the requestor doesn't really care what the result is. In any case,
25 * managers are free to give the managed object whatever geometry it wishes.
27 #define REGION_RQGEOM_WEAK_X 0x0001
28 #define REGION_RQGEOM_WEAK_Y 0x0002
29 #define REGION_RQGEOM_WEAK_W 0x0004
30 #define REGION_RQGEOM_WEAK_H 0x0008
31 #define REGION_RQGEOM_WEAK_ALL 0x000f
32 #define REGION_RQGEOM_TRYONLY 0x0010
33 #define REGION_RQGEOM_ABSOLUTE 0x0020
34 #define REGION_RQGEOM_GRAVITY 0x0040
36 #define REGION_RQGEOM_NORMAL 0
37 #define REGION_RQGEOM_VERT_ONLY (REGION_RQGEOM_WEAK_X|REGION_RQGEOM_WEAK_W)
38 #define REGION_RQGEOM_HORIZ_ONLY (REGION_RQGEOM_WEAK_Y|REGION_RQGEOM_WEAK_H)
39 #define REGION_RQGEOM_H_ONLY (REGION_RQGEOM_VERT_ONLY|REGION_RQGEOM_WEAK_Y)
40 #define REGION_RQGEOM_W_ONLY (REGION_RQGEOM_HORIZ_ONLY|REGION_RQGEOM_WEAK_X)
42 #define REGION_ORIENTATION_NONE 0
43 #define REGION_ORIENTATION_HORIZONTAL 1
44 #define REGION_ORIENTATION_VERTICAL 2
51 #define HORIZONTAL SPLIT_HORIZONTAL
52 #define VERTICAL SPLIT_VERTICAL
55 #define RQGEOMPARAMS_INIT {{0, 0, 0, 0}, 0, 0}
58 DECLSTRUCT(WRQGeomParams
){
65 typedef void WDrawRubberbandFn(WRootWin
*rw
, const WRectangle
*geom
);
68 DECLCLASS(WMoveresMode
){
71 int dx1
, dx2
, dy1
, dy2
;
75 WDrawRubberbandFn
*rubfn
;
76 int parent_rx
, parent_ry
;
77 enum {MOVERES_SIZE
, MOVERES_POS
} mode
;
78 bool resize_cumulative
;
86 extern WMoveresMode
*region_begin_resize(WRegion
*reg
,
87 WDrawRubberbandFn
*rubfn
,
90 extern WMoveresMode
*region_begin_move(WRegion
*reg
,
91 WDrawRubberbandFn
*rubfn
,
94 /* dx1/dx2/dy1/dy2: left/right/top/bottom difference to previous values.
95 * left/top negative, bottom/right positive increases size.
97 extern void moveresmode_delta_resize(WMoveresMode
*mode
,
98 int dx1
, int dx2
, int dy1
, int dy2
,
100 extern void moveresmode_delta_move(WMoveresMode
*mode
,
101 int dx
, int dy
, WRectangle
*rret
);
102 extern void moveresmode_rqgeom(WMoveresMode
*mode
, WRQGeomParams
*rq
,
104 extern bool moveresmode_do_end(WMoveresMode
*mode
, bool apply
);
105 extern WRegion
*moveresmode_target(WMoveresMode
*mode
);
107 extern WMoveresMode
*moveres_mode(WRegion
*reg
);
111 /* Note: even if REGION_RQGEOM_(X|Y|W|H) are not all specified, the
112 * geom parameter should contain a proper geometry!
114 DYNFUN
void region_managed_rqgeom(WRegion
*reg
, WRegion
*sub
,
115 const WRQGeomParams
*rqgp
,
116 WRectangle
*geomret
);
117 DYNFUN
void region_managed_rqgeom_absolute(WRegion
*reg
, WRegion
*sub
,
118 const WRQGeomParams
*rqgp
,
119 WRectangle
*geomret
);
121 extern void region_rqgeom(WRegion
*reg
, const WRQGeomParams
*rqgp
,
122 WRectangle
*geomret
);
124 /* Implementation for regions that do not allow subregions to resize
125 * themselves; default is to give the size the region wants.
127 extern void region_managed_rqgeom_unallow(WRegion
*reg
, WRegion
*sub
,
128 const WRQGeomParams
*rq
,
129 WRectangle
*geomret
);
131 extern void region_managed_rqgeom_allow(WRegion
*reg
, WRegion
*sub
,
132 const WRQGeomParams
*rq
,
133 WRectangle
*geomret
);
135 extern void region_managed_rqgeom_absolute_default(WRegion
*reg
, WRegion
*sub
,
136 const WRQGeomParams
*rq
,
137 WRectangle
*geomret
);
139 DYNFUN
bool region_managed_maximize(WRegion
*reg
, WRegion
*sub
, int dir
, int action
);
142 DYNFUN
void region_size_hints(WRegion
*reg
, WSizeHints
*hints_ret
);
143 DYNFUN
int region_orientation(WRegion
*reg
);
145 extern void region_size_hints_correct(WRegion
*reg
,
146 int *wp
, int *hp
, bool min
);
148 extern uint
region_min_h(WRegion
*reg
);
149 extern uint
region_min_w(WRegion
*reg
);
151 extern void frame_maximize_vert(WFrame
*frame
);
152 extern void frame_maximize_horiz(WFrame
*frame
);
154 extern void region_convert_root_geom(WRegion
*reg
, WRectangle
*geom
);
156 extern void region_absolute_geom_to_parent(WRegion
*reg
,
157 const WRectangle
*rgeom
,
160 extern void rqgeomparams_from_table(WRQGeomParams
*rq
,
161 const WRectangle
*origg
, ExtlTab g
);
163 #endif /* ION_IONCORE_RESIZE_H */