]> git.decadent.org.uk Git - ion3.git/blob - ioncore/resize.h
Update cfg_kludge_flash for Flash 10
[ion3.git] / ioncore / resize.h
1 /*
2  * ion/ioncore/resize.h
3  *
4  * Copyright (c) Tuomo Valkonen 1999-2009. 
5  *
6  * See the included file LICENSE for details.
7  */
8
9 #ifndef ION_IONCORE_RESIZE_H
10 #define ION_IONCORE_RESIZE_H
11
12 #include "common.h"
13 #include "frame.h"
14 #include "infowin.h"
15 #include "rectangle.h"
16 #include "sizehint.h"
17
18
19 /* To make it easier for region_managed_rqgeom handlers, the geom
20  * parameter contain a complete requested geometry for the region that
21  * wants its geometry changed. The REGION_WEAK_* flags are used to
22  * indicate that the respective geometry value has not been changed or
23  * that the requestor doesn't really care what the result is. In any case,
24  * managers are free to give the managed object whatever geometry it wishes.
25  */
26 #define REGION_RQGEOM_WEAK_X    0x0001
27 #define REGION_RQGEOM_WEAK_Y    0x0002
28 #define REGION_RQGEOM_WEAK_W    0x0004
29 #define REGION_RQGEOM_WEAK_H    0x0008
30 #define REGION_RQGEOM_WEAK_ALL  0x000f
31 #define REGION_RQGEOM_TRYONLY   0x0010
32 #define REGION_RQGEOM_ABSOLUTE  0x0020
33 #define REGION_RQGEOM_GRAVITY   0x0040
34
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)
40
41 #define REGION_ORIENTATION_NONE 0
42 #define REGION_ORIENTATION_HORIZONTAL 1
43 #define REGION_ORIENTATION_VERTICAL 2
44
45
46 #define RQGEOMPARAMS_INIT {{0, 0, 0, 0}, 0, 0}
47
48
49 DECLSTRUCT(WRQGeomParams){
50     WRectangle geom;
51     int flags;
52     int gravity;
53 };
54
55
56 typedef void WDrawRubberbandFn(WRootWin *rw, const WRectangle *geom);
57
58
59 DECLCLASS(WMoveresMode){
60     Obj obj;
61     WSizeHints hints;
62     int dx1, dx2, dy1, dy2;
63     WRectangle origgeom;
64     WRectangle geom;
65     WRegion *reg;
66     WDrawRubberbandFn *rubfn;
67     int parent_rx, parent_ry;
68     enum {MOVERES_SIZE, MOVERES_POS} mode;
69     bool resize_cumulative;
70     bool snap_enabled;
71     WRectangle snapgeom;
72     int rqflags;
73     WInfoWin *infowin;
74 };
75
76
77 extern WMoveresMode *region_begin_resize(WRegion *reg, 
78                                          WDrawRubberbandFn *rubfn,
79                                          bool cumulative);
80
81 extern WMoveresMode *region_begin_move(WRegion *reg,
82                                        WDrawRubberbandFn *rubfn,
83                                        bool cumulative);
84
85 /* dx1/dx2/dy1/dy2: left/right/top/bottom difference to previous values. 
86  * left/top negative, bottom/right positive increases size.
87  */
88 extern void moveresmode_delta_resize(WMoveresMode *mode, 
89                                      int dx1, int dx2, int dy1, int dy2,
90                                      WRectangle *rret);
91 extern void moveresmode_delta_move(WMoveresMode *mode, 
92                                    int dx, int dy, WRectangle *rret);
93 extern void moveresmode_rqgeom(WMoveresMode *mode, WRQGeomParams *rq, 
94                                WRectangle *rret);
95 extern bool moveresmode_do_end(WMoveresMode *mode, bool apply);
96 extern WRegion *moveresmode_target(WMoveresMode *mode);
97
98 extern WMoveresMode *moveres_mode(WRegion *reg);
99
100
101
102 /* Note: even if REGION_RQGEOM_(X|Y|W|H) are not all specified, the
103  * geom parameter should contain a proper geometry!
104  */
105 DYNFUN void region_managed_rqgeom(WRegion *reg, WRegion *sub, 
106                                   const WRQGeomParams *rqgp,
107                                   WRectangle *geomret);
108 DYNFUN void region_managed_rqgeom_absolute(WRegion *reg, WRegion *sub, 
109                                            const WRQGeomParams *rqgp,
110                                            WRectangle *geomret);
111
112 extern void region_rqgeom(WRegion *reg, const WRQGeomParams *rqgp,
113                           WRectangle *geomret);
114
115 /* Implementation for regions that do not allow subregions to resize
116  * themselves; default is to give the size the region wants.
117  */
118 extern void region_managed_rqgeom_unallow(WRegion *reg, WRegion *sub,
119                                           const WRQGeomParams *rq,
120                                           WRectangle *geomret);
121 /* default */
122 extern void region_managed_rqgeom_allow(WRegion *reg, WRegion *sub,
123                                         const WRQGeomParams *rq,
124                                         WRectangle *geomret);
125
126 extern void region_managed_rqgeom_absolute_default(WRegion *reg, WRegion *sub,
127                                                    const WRQGeomParams *rq,
128                                                    WRectangle *geomret);
129
130
131 DYNFUN void region_size_hints(WRegion *reg, WSizeHints *hints_ret);
132 DYNFUN int region_orientation(WRegion *reg);
133
134 extern void region_size_hints_correct(WRegion *reg, 
135                                       int *wp, int *hp, bool min);
136
137 extern uint region_min_h(WRegion *reg);
138 extern uint region_min_w(WRegion *reg);
139
140 extern void frame_maximize_vert(WFrame *frame);
141 extern void frame_maximize_horiz(WFrame *frame);
142
143 extern void region_convert_root_geom(WRegion *reg, WRectangle *geom);
144
145 extern void region_absolute_geom_to_parent(WRegion *reg, 
146                                            const WRectangle *rgeom,
147                                            WRectangle *pgeom);
148
149 extern void rqgeomparams_from_table(WRQGeomParams *rq, 
150                                     const WRectangle *origg, ExtlTab g);
151
152 #endif /* ION_IONCORE_RESIZE_H */