]> icculus.org git repositories - dana/openbox.git/blob - openbox/frame.h
fixed to accomodate the changes to the render/ API.
[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 "render/render.h"
7
8 typedef enum {
9     Context_None,
10     Context_Root,
11     Context_Client,
12     Context_Titlebar,
13     Context_Handle,
14     Context_Frame,
15     Context_BLCorner,
16     Context_BRCorner,
17     Context_TLCorner,
18     Context_TRCorner,
19     Context_Maximize,
20     Context_AllDesktops,
21     Context_Shade,
22     Context_Iconify,
23     Context_Icon,
24     Context_Close,
25     NUM_CONTEXTS
26 } Context;
27
28 #define FRAME_HANDLE_Y(f) (f->innersize.top + f->client->area.height + \
29                            f->cbwidth)
30
31 typedef struct Frame {
32     Client *client;
33
34     Window window;
35     Window plate;
36
37     Strut  size;
38     Rect   area;
39     gboolean visible;
40
41     Window title;
42     Window label;
43     Window max;
44     Window close;
45     Window desk;
46     Window shade;
47     Window icon;
48     Window iconify;
49     Window handle;
50     Window lgrip;
51     Window rgrip;
52
53     RrAppearance *a_unfocused_title;
54     RrAppearance *a_focused_title;
55     RrAppearance *a_unfocused_label;
56     RrAppearance *a_focused_label;
57     RrAppearance *a_icon;
58     RrAppearance *a_unfocused_handle;
59     RrAppearance *a_focused_handle;
60
61     Strut  innersize;
62
63     GSList *clients;
64
65     int width;         /* title and handle */
66     int label_width;
67     int icon_x;        /* x-position of the window icon button */
68     int label_x;       /* x-position of the window title */
69     int iconify_x;     /* x-position of the window iconify button */
70     int desk_x;        /* x-position of the window all-desktops button */
71     int shade_x;       /* x-position of the window shade button */
72     int max_x;         /* x-position of the window maximize button */
73     int close_x;       /* x-position of the window close button */
74     int bwidth;        /* border width */
75     int cbwidth;       /* client border width */
76
77     gboolean max_press;
78     gboolean close_press;
79     gboolean desk_press;
80     gboolean shade_press;
81     gboolean iconify_press;
82
83     gboolean focused;
84 } Frame;
85
86 void frame_startup();
87 void frame_shutdown();
88
89 Frame *frame_new();
90 void frame_show(Frame *self);
91 void frame_hide(Frame *self);
92 void frame_adjust_shape(Frame *self);
93 void frame_adjust_area(Frame *self, gboolean moved, gboolean resized);
94 void frame_adjust_state(Frame *self);
95 void frame_adjust_focus(Frame *self, gboolean hilite);
96 void frame_adjust_title(Frame *self);
97 void frame_adjust_icon(Frame *self);
98 void frame_grab_client(Frame *self, Client *client);
99 void frame_release_client(Frame *self, Client *client);
100
101 Context frame_context_from_string(char *name);
102
103 Context frame_context(Client *self, Window win);
104
105 /*! Applies gravity to the client's position to find where the frame should
106   be positioned.
107   @return The proper coordinates for the frame, based on the client.
108 */
109 void frame_client_gravity(Frame *self, int *x, int *y);
110
111 /*! Reversly applies gravity to the frame's position to find where the client
112   should be positioned.
113     @return The proper coordinates for the client, based on the frame.
114 */
115 void frame_frame_gravity(Frame *self, int *x, int *y);
116
117
118 #endif