]> icculus.org git repositories - dana/openbox.git/blob - openbox/frame.h
prefixing and capitalization for the Frame->ObFrame struct and the Context->ObFrameCo...
[dana/openbox.git] / openbox / frame.h
1 #ifndef __frame_h
2 #define __frame_h
3
4 #include "geom.h"
5 #include "render/render.h"
6
7 typedef struct _ObFrame ObFrame;
8
9 struct _ObClient;
10
11 typedef enum {
12     OB_FRAME_CONTEXT_NONE,
13     OB_FRAME_CONTEXT_ROOT,
14     OB_FRAME_CONTEXT_CLIENT,
15     OB_FRAME_CONTEXT_TITLEBAR,
16     OB_FRAME_CONTEXT_HANDLE,
17     OB_FRAME_CONTEXT_FRAME,
18     OB_FRAME_CONTEXT_BLCORNER,
19     OB_FRAME_CONTEXT_BRCORNER,
20     OB_FRAME_CONTEXT_MAXIMIZE,
21     OB_FRAME_CONTEXT_ALLDESKTOPS,
22     OB_FRAME_CONTEXT_SHADE,
23     OB_FRAME_CONTEXT_ICONIFY,
24     OB_FRAME_CONTEXT_ICON,
25     OB_FRAME_CONTEXT_CLOSE,
26     OB_FRAME_NUM_CONTEXTS
27 } ObFrameContext;
28
29 struct _ObFrame
30 {
31     struct _ObClient *client;
32
33     Window    window;
34     Window    plate;
35
36     Strut     size;
37     Rect      area;
38     gboolean  visible;
39     guint     decorations;
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     gint      width;         /* title and handle */
66     gint      label_width;
67     gint      icon_x;        /* x-position of the window icon button */
68     gint      label_x;       /* x-position of the window title */
69     gint      iconify_x;     /* x-position of the window iconify button */
70     gint      desk_x;        /* x-position of the window all-desktops button */
71     gint      shade_x;       /* x-position of the window shade button */
72     gint      max_x;         /* x-position of the window maximize button */
73     gint      close_x;       /* x-position of the window close button */
74     gint      bwidth;        /* border width */
75     gint      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 };
85
86 void frame_startup();
87 void frame_shutdown();
88
89 ObFrame *frame_new();
90 void frame_show(ObFrame *self);
91 void frame_hide(ObFrame *self);
92 void frame_adjust_shape(ObFrame *self);
93 void frame_adjust_area(ObFrame *self, gboolean moved, gboolean resized);
94 void frame_adjust_state(ObFrame *self);
95 void frame_adjust_focus(ObFrame *self, gboolean hilite);
96 void frame_adjust_title(ObFrame *self);
97 void frame_adjust_icon(ObFrame *self);
98 void frame_grab_client(ObFrame *self, struct _ObClient *client);
99 void frame_release_client(ObFrame *self, struct _ObClient *client);
100
101 ObFrameContext frame_context_from_string(char *name);
102
103 ObFrameContext frame_context(struct _ObClient *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(ObFrame *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(ObFrame *self, int *x, int *y);
116
117
118 #endif