]> icculus.org git repositories - dana/openbox.git/blob - openbox/frame.h
add some more font metrics 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 "render2/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->size.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     struct RrSurface *s_frame;
42     struct RrSurface *s_title;
43     struct RrSurface *s_label;
44     struct RrSurface *s_max;
45     struct RrSurface *s_close;
46     struct RrSurface *s_desk;
47     struct RrSurface *s_shade;
48     struct RrSurface *s_iconify;
49     struct RrSurface *s_icon;
50     struct RrSurface *s_handle;
51     struct RrSurface *s_lgrip;
52     struct RrSurface *s_rgrip;
53
54     Window w_title;
55     Window w_label;
56     Window w_max;
57     Window w_close;
58     Window w_desk;
59     Window w_shade;
60     Window w_iconify;
61     Window w_icon;
62     Window w_handle;
63     Window w_lgrip;
64     Window w_rgrip;
65
66     GSList *clients;
67
68     int width;         /* title and handle */
69     int label_width;
70     int icon_x;        /* x-position of the window icon button */
71     int label_x;       /* x-position of the window title */
72     int iconify_x;     /* x-position of the window iconify button */
73     int desk_x;        /* x-position of the window all-desktops button */
74     int shade_x;       /* x-position of the window shade button */
75     int max_x;         /* x-position of the window maximize button */
76     int close_x;       /* x-position of the window close button */
77     int bwidth;        /* border width */
78     int cbwidth;       /* client border width */
79
80     gboolean max_press;
81     gboolean close_press;
82     gboolean desk_press;
83     gboolean shade_press;
84     gboolean iconify_press;
85
86     gboolean focused;
87 } Frame;
88
89 void frame_startup();
90 void frame_shutdown();
91
92 Frame *frame_new();
93 void frame_show(Frame *self);
94 void frame_hide(Frame *self);
95 void frame_adjust_shape(Frame *self);
96 void frame_adjust_area(Frame *self, gboolean moved, gboolean resized);
97 void frame_adjust_state(Frame *self);
98 void frame_adjust_focus(Frame *self, gboolean hilite);
99 void frame_adjust_title(Frame *self);
100 void frame_adjust_icon(Frame *self);
101 void frame_grab_client(Frame *self, Client *client);
102 void frame_release_client(Frame *self, Client *client);
103
104 Context frame_context_from_string(char *name);
105
106 Context frame_context(Client *self, Window win);
107
108 /*! Applies gravity to the client's position to find where the frame should
109   be positioned.
110   @return The proper coordinates for the frame, based on the client.
111 */
112 void frame_client_gravity(Frame *self, int *x, int *y);
113
114 /*! Reversly applies gravity to the frame's position to find where the client
115   should be positioned.
116     @return The proper coordinates for the client, based on the frame.
117 */
118 void frame_frame_gravity(Frame *self, int *x, int *y);
119
120
121 #endif