]> git.decadent.org.uk Git - ion3.git/blob - ioncore/frame.h
[svn-inject] Installing original source of ion3
[ion3.git] / ioncore / frame.h
1 /*
2  * ion/ioncore/frame.h
3  *
4  * Copyright (c) Tuomo Valkonen 1999-2006. 
5  *
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.
10  */
11
12 #ifndef ION_IONCORE_FRAME_H
13 #define ION_IONCORE_FRAME_H
14
15 #include <libtu/stringstore.h>
16 #include <libtu/setparam.h>
17 #include <libextl/extl.h>
18
19 #include "common.h"
20 #include "window.h"
21 #include "attach.h"
22 #include "mplex.h"
23 #include "gr.h"
24 #include "rectangle.h"
25 #include "sizehint.h"
26
27 #define FRAME_SAVED_VERT  0x0008
28 #define FRAME_SAVED_HORIZ 0x0010
29 #define FRAME_SHADED      0x0020
30 #define FRAME_SHADED_TOGGLE 0x0040
31 /*#define FRAME_DEST_EMPTY  0x0100*/
32 #define FRAME_MAXED_VERT  0x0200
33 #define FRAME_MAXED_HORIZ 0x0400
34 #define FRAME_MIN_HORIZ   0x0800
35
36 /*#define FRAME_SZH_USEMINMAX 0x1000 */
37 /*#define FRAME_FWD_CWIN_RQGEOM 0x2000 */
38
39 #define FRAME_SHOW_NUMBERS 0x4000
40
41 typedef enum{
42     FRAME_MODE_UNKNOWN,
43     FRAME_MODE_TILED,
44     FRAME_MODE_TILED_ALT,
45     FRAME_MODE_FLOATING,
46     FRAME_MODE_TRANSIENT
47 } WFrameMode;
48
49 typedef enum{
50     FRAME_BAR_INSIDE,
51     FRAME_BAR_OUTSIDE,
52     FRAME_BAR_SHAPED,
53     FRAME_BAR_NONE
54 } WFrameBarMode;
55         
56
57
58 DECLCLASS(WFrame){
59     WMPlex mplex;
60     
61     int flags;
62     WFrameMode mode;
63     int saved_w, saved_h;
64     int saved_x, saved_y;
65     
66     int tab_dragged_idx;
67     
68     GrBrush *brush;
69     GrBrush *bar_brush;
70     GrTransparency tr_mode;
71     GrTextElem *titles;
72     int titles_n;
73     
74     /* Bar stuff */
75     WFrameBarMode barmode;
76     int bar_w, bar_h;
77     double bar_max_width_q;
78     int tab_min_w;
79 };
80
81
82 /* Create/destroy */
83 extern WFrame *create_frame(WWindow *parent, const WFitParams *fp,
84                             WFrameMode mode);
85 extern bool frame_init(WFrame *frame, WWindow *parent, const WFitParams *fp,
86                        WFrameMode mode);
87 extern void frame_deinit(WFrame *frame);
88 extern bool frame_rqclose(WFrame *frame);
89
90 /* Mode */
91
92 extern void frame_set_mode(WFrame *frame, WFrameMode mode);
93 extern WFrameMode frame_mode(WFrame *frame);
94
95 /* Resize and reparent */
96 extern bool frame_fitrep(WFrame *frame, WWindow *par, const WFitParams *fp);
97 extern void frame_size_hints(WFrame *frame, WSizeHints *hints_ret);
98
99 /* Focus */
100 extern void frame_activated(WFrame *frame);
101 extern void frame_inactivated(WFrame *frame);
102
103 /* Tabs */
104 extern int frame_nth_tab_w(WFrame *frame, int n);
105 extern int frame_nth_tab_iw(WFrame *frame, int n);
106 extern int frame_nth_tab_x(WFrame *frame, int n);
107 extern int frame_tab_at_x(WFrame *frame, int x);
108 extern void frame_update_attr_nth(WFrame *frame, int i);
109
110 extern bool frame_set_shaded(WFrame *frame, int sp);
111 extern bool frame_is_shaded(WFrame *frame);
112 extern bool frame_set_numbers(WFrame *frame, int sp);
113 extern bool frame_is_numbers(WFrame *frame);
114
115 extern int frame_default_index(WFrame *frame);
116
117 /* Misc */
118 extern void frame_managed_notify(WFrame *frame, WRegion *sub, const char *how);
119 extern void frame_managed_remove(WFrame *frame, WRegion *reg);
120
121 /* Save/load */
122 extern ExtlTab frame_get_configuration(WFrame *frame);
123 extern WRegion *frame_load(WWindow *par, const WFitParams *fp, ExtlTab tab);
124 extern void frame_do_load(WFrame *frame, ExtlTab tab);
125
126 extern WHook *frame_managed_changed_hook;
127
128 #endif /* ION_IONCORE_FRAME_H */