4 * Copyright (c) Tuomo Valkonen 1999-2005.
6 * Ion is free software; you can redistribute it and/or modify it under
7 * the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation; either version 2.1 of the License, or
9 * (at your option) any later version.
12 #ifndef ION_IONCORE_RESIZE_H
13 #define ION_IONCORE_RESIZE_H
18 #include "rectangle.h"
21 /* To make it easier for region_managed_rqgeom handlers, the geom
22 * parameter contain a complete requested geometry for the region that
23 * wants its geometry changed. The REGION_WEAK_* flags are used to
24 * indicate that the respective geometry value has not been changed or
25 * that the requestor doesn't really care what the result is. In any case,
26 * managers are free to give the managed object whatever geometry it wishes.
28 #define REGION_RQGEOM_WEAK_X 0x0001
29 #define REGION_RQGEOM_WEAK_Y 0x0002
30 #define REGION_RQGEOM_WEAK_W 0x0004
31 #define REGION_RQGEOM_WEAK_H 0x0008
32 #define REGION_RQGEOM_WEAK_ALL 0x000f
33 #define REGION_RQGEOM_TRYONLY 0x0010
35 #define REGION_RQGEOM_NORMAL 0
36 #define REGION_RQGEOM_VERT_ONLY (REGION_RQGEOM_WEAK_X|REGION_RQGEOM_WEAK_W)
37 #define REGION_RQGEOM_HORIZ_ONLY (REGION_RQGEOM_WEAK_Y|REGION_RQGEOM_WEAK_H)
38 #define REGION_RQGEOM_H_ONLY (REGION_RQGEOM_VERT_ONLY|REGION_RQGEOM_WEAK_Y)
39 #define REGION_RQGEOM_W_ONLY (REGION_RQGEOM_HORIZ_ONLY|REGION_RQGEOM_WEAK_X)
41 #define REGION_ORIENTATION_NONE 0
42 #define REGION_ORIENTATION_HORIZONTAL 1
43 #define REGION_ORIENTATION_VERTICAL 2
45 typedef void WDrawRubberbandFn(WRootWin
*rw
, const WRectangle
*geom
);
48 DECLCLASS(WMoveresMode
){
51 int dx1
, dx2
, dy1
, dy2
;
55 WDrawRubberbandFn
*rubfn
;
56 int parent_rx
, parent_ry
;
57 enum {MOVERES_SIZE
, MOVERES_POS
} mode
;
58 bool resize_cumulative
;
65 extern WMoveresMode
*region_begin_resize(WRegion
*reg
,
66 WDrawRubberbandFn
*rubfn
,
69 extern WMoveresMode
*region_begin_move(WRegion
*reg
,
70 WDrawRubberbandFn
*rubfn
,
73 /* dx1/dx2/dy1/dy2: left/right/top/bottom difference to previous values.
74 * left/top negative, bottom/right positive increases size.
76 extern void moveresmode_delta_resize(WMoveresMode
*mode
,
77 int dx1
, int dx2
, int dy1
, int dy2
,
79 extern void moveresmode_delta_move(WMoveresMode
*mode
,
80 int dx
, int dy
, WRectangle
*rret
);
81 extern bool moveresmode_do_end(WMoveresMode
*mode
, bool apply
);
82 extern WRegion
*moveresmode_target(WMoveresMode
*mode
);
84 extern WMoveresMode
*moveres_mode(WRegion
*reg
);
88 /* Note: even if REGION_RQGEOM_(X|Y|W|H) are not all specified, the
89 * geom parameter should contain a proper geometry!
91 DYNFUN
void region_managed_rqgeom(WRegion
*reg
, WRegion
*sub
, int flags
,
92 const WRectangle
*geom
,
95 extern void region_rqgeom(WRegion
*reg
, int flags
,
96 const WRectangle
*geom
,
99 /* Implementation for regions that do not allow subregions to resize
100 * themselves; default is to give the size the region wants.
102 extern void region_managed_rqgeom_unallow(WRegion
*reg
, WRegion
*sub
,
104 const WRectangle
*geom
,
105 WRectangle
*geomret
);
107 extern void region_managed_rqgeom_allow(WRegion
*reg
, WRegion
*sub
,
109 const WRectangle
*geom
,
110 WRectangle
*geomret
);
112 /* This function expects a root-relative geometry and the client expects
113 * the gravity size hint be taken into account.
115 DYNFUN
void region_rqgeom_clientwin(WRegion
*reg
, WClientWin
*cwin
,
116 int flags
, const WRectangle
*geom
);
118 DYNFUN
void region_size_hints(WRegion
*reg
, XSizeHints
*hints_ret
);
119 DYNFUN
int region_orientation(WRegion
*reg
);
121 extern uint
region_min_h(WRegion
*reg
);
122 extern uint
region_min_w(WRegion
*reg
);
124 extern void frame_maximize_vert(WFrame
*frame
);
125 extern void frame_maximize_horiz(WFrame
*frame
);
127 extern void region_convert_root_geom(WRegion
*reg
, WRectangle
*geom
);
129 #endif /* ION_IONCORE_RESIZE_H */