]> icculus.org git repositories - dana/openbox.git/blob - openbox/frame.h
add ability to set a texture to None
[dana/openbox.git] / openbox / frame.h
1 #ifndef __frame_h
2 #define __frame_h
3
4 #include "geom.h"
5 #include "client.h"
6 /*#include "render2/render.h"*/
7 #include "window.h"
8
9 typedef enum {
10     Context_None,
11     Context_Root,
12     Context_Client,
13     Context_Titlebar,
14     Context_Handle,
15     Context_Frame,
16     Context_BLCorner,
17     Context_BRCorner,
18     Context_TLCorner,
19     Context_TRCorner,
20     Context_Maximize,
21     Context_AllDesktops,
22     Context_Shade,
23     Context_Iconify,
24     Context_Icon,
25     Context_Close,
26     NUM_CONTEXTS
27 } Context;
28
29 typedef enum {
30     Decor_TopLeft,
31     Decor_Top,
32     Decor_TopRight,
33     Decor_Left,
34     Decor_Right,
35     Decor_BottomLeft,
36     Decor_Bottom,
37     Decor_BottomRight
38 } Anchor;
39
40 #define FRAME_HANDLE_Y(f) (f->innersize.top + f->client->area.height + \
41                            f->cbwidth)
42
43 struct Frame;
44
45 typedef enum {
46     Decor_Absolute,
47     Decor_Relative
48 } DecorSizeType;
49
50 typedef struct FrameDecor {
51     ObWindow obwin;
52     Window window;
53
54     Context context;
55     Anchor anchor;
56     Rect area;
57     DecorSizeType sizetypex;
58     DecorSizeType sizetypey;
59     Decoration type;
60     struct Frame *frame;
61 /*    struct RrSurface *surface;  SOOOOON!*/
62 } FrameDecor;
63
64 typedef struct Frame {
65     Client *client;
66
67     Window window;
68     Window plate;
69
70     Strut  size;
71     Rect   area;
72     gboolean visible;
73
74     int framedecors;
75     struct FrameDecor *framedecor;
76
77     int width;         /* width of client + borders */
78     int height;         /* height of client + borders */
79     int bwidth;        /* border width */
80     int cbwidth;       /* client border width */
81
82     gboolean max_press;
83     gboolean close_press;
84     gboolean desk_press;
85     gboolean shade_press;
86     gboolean iconify_press;
87
88     gboolean focused;
89 } Frame;
90
91 void frame_startup();
92 void frame_shutdown();
93
94 Frame *frame_new();
95 void frame_show(Frame *self);
96 void frame_hide(Frame *self);
97 void frame_adjust_shape(Frame *self);
98 void frame_adjust_area(Frame *self, gboolean moved, gboolean resized);
99 void frame_adjust_state(Frame *self);
100 void frame_adjust_focus(Frame *self, gboolean hilite);
101 void frame_adjust_title(Frame *self);
102 void frame_adjust_icon(Frame *self);
103 void frame_grab_client(Frame *self, Client *client);
104 void frame_release_client(Frame *self, Client *client);
105
106 Context frame_context_from_string(char *name);
107
108 Context frame_context(Client *self, Window win);
109
110 /*! Applies gravity to the client's position to find where the frame should
111   be positioned.
112   @return The proper coordinates for the frame, based on the client.
113 */
114 void frame_client_gravity(Frame *self, int *x, int *y);
115
116 /*! Reversly applies gravity to the frame's position to find where the client
117   should be positioned.
118     @return The proper coordinates for the client, based on the frame.
119 */
120 void frame_frame_gravity(Frame *self, int *x, int *y);
121
122
123 #endif