]>
Dogcows Code - chaz/openbox/blob - src/frame.hh
c75194c44cd136333a2bb10728ae070646bb419c
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
13 #include "otk/strut.hh"
14 #include "otk/rect.hh"
15 #include "otk/renderstyle.hh"
16 #include "otk/ustring.hh"
17 #include "otk/surface.hh"
18 #include "otk/eventhandler.hh"
27 //! Varius geometry settings in the frame decorations
28 struct FrameGeometry
{
29 int width
; // title and handle
31 int title_height() { return font_height
+ bevel
*2; }
33 int label_height() { return font_height
; }
34 int handle_height
; // static, from the style
35 int icon_x
; // x-position of the window icon button
37 int button_size
; // static, from the style
38 int grip_width() { return button_size
* 2; }
39 int bevel
; // static, from the style
40 int bwidth
; // frame elements' border width
41 int cbwidth
; // client border width
44 //! Holds and decorates a frame around an Client (client window)
46 The frame is responsible for calling XSelectInput on the client window's new
47 parent with the SubstructureRedirectMask so that structure events for the
48 client are sent to the window manager.
50 class Frame
: public otk::StyleNotify
, public otk::EventHandler
{
53 //! The event mask to grab on frame windows
54 static const long event_mask
= EnterWindowMask
| LeaveWindowMask
;
59 //! The size of the frame on each side of the client window
62 //! The size of the frame on each side of the client window inside the border
63 otk::Strut _innersize
;
65 //! The position and size of the entire frame (including borders)
71 Window _frame
; // sits under everything
72 Window _plate
; // sits entirely under the client window
73 Window _title
; // the titlebar
74 Window _label
; // the section of the titlebar which shows the window name
75 Window _handle
; // bottom bar
76 Window _lgrip
; // lefthand resize grab on the handle
77 Window _rgrip
; // righthand resize grab on the handle
78 Window _max
; // maximize button
79 Window _desk
; // all-desktops button
80 Window _iconify
; // iconify button
81 Window _icon
; // window icon button
82 Window _close
; // close button
85 otk::Surface
*_frame_sur
;
86 otk::Surface
*_title_sur
;
87 otk::Surface
*_label_sur
;
88 otk::Surface
*_handle_sur
;
89 otk::Surface
*_grip_sur
;
90 otk::Surface
*_max_sur
;
91 otk::Surface
*_desk_sur
;
92 otk::Surface
*_iconify_sur
;
93 otk::Surface
*_icon_sur
;
94 otk::Surface
*_close_sur
;
96 std::string _layout
; // layout of the titlebar
105 void applyStyle(const otk::RenderStyle
&style
);
110 void renderIconify();
115 //! Constructs an Frame object for a client
117 @param client The client which will be decorated by the new Frame
119 Frame(Client
*client
);
120 //! Destroys the Frame object
123 //! Returns the size of the frame on each side of the client
124 const otk::Strut
& size() const { return _size
; }
126 //! Set the style to decorate the frame with
127 virtual void styleChanged(const otk::RenderStyle
&style
);
129 //! Reparents the client window from the root window onto the frame
131 //! Reparents the client window back to the root window
132 void releaseClient();
134 //! Update the frame's size to match the client
136 //! Update the frame's position to match the client
137 void adjustPosition();
138 //! Shape the frame window to the client window
140 //! Update the frame to match the client's new state (for things like toggle
141 //! buttons, focus, and the title) XXX break this up
146 //! Applies gravity to the client's position to find where the frame should
149 @return The proper coordinates for the frame, based on the client.
151 void clientGravity(int &x
, int &y
);
153 //! Reversly applies gravity to the frame's position to find where the client
154 //! should be positioned.
156 @return The proper coordinates for the client, based on the frame.
158 void frameGravity(int &x
, int &y
);
160 //! The position and size of the frame window
161 inline const otk::Rect
& area() const { return _area
; }
163 //! Returns if the frame is visible
164 inline bool visible() const { return _visible
; }
171 //! Returns the MouseContext for the given window id
173 Returns '-1' if no valid mouse context exists in the frame for the given
176 ob::MouseContext::MC
mouseContext(Window win
) const;
178 //! Gets the window id of the frame's base top-level parent
179 inline Window
window() const { return _frame
; }
180 //! Gets the window id of the client's parent window
181 inline Window
plate() const { return _plate
; }
183 //! Returns a null terminated array of the window ids that make up the
184 //! frame's decorations.
185 Window
*allWindows() const;
This page took 0.042679 seconds and 3 git commands to generate.