]> Dogcows Code - chaz/openbox/blob - src/frame.hh
more layout fixes for the decoration elements
[chaz/openbox] / src / frame.hh
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2 #ifndef __frame_hh
3 #define __frame_hh
4
5 /*! @file frame.hh
6 */
7
8 extern "C" {
9 #include <X11/Xlib.h>
10 }
11
12 #include <string>
13
14 #include "client.hh"
15 #include "otk/strut.hh"
16 #include "otk/rect.hh"
17 #include "otk/screeninfo.hh"
18 #include "otk/style.hh"
19
20 namespace ob {
21
22 //! Holds and decorates a frame around an OBClient (client window)
23 /*!
24 */
25 class OBFrame {
26 private:
27 const OBClient *_client;
28 const otk::ScreenInfo *_screen;
29
30 //! The style to use for size and display the decorations
31 const otk::Style *_style;
32
33 //! The window id of the base frame window
34 Window _window;
35 //! The size of the frame on each side of the client window
36 otk::Strut _size;
37
38 // decoration windows
39 Window _titlebar;
40 otk::Rect _titlebar_area;
41
42 Window _button_close;
43 otk::Rect _button_close_area;
44
45 Window _button_iconify;
46 otk::Rect _button_iconify_area;
47
48 Window _button_max;
49 otk::Rect _button_max_area;
50
51 Window _button_stick;
52 otk::Rect _button_stick_area;
53
54 Window _label;
55 otk::Rect _label_area;
56
57 Window _handle;
58 otk::Rect _handle_area;
59
60 Window _grip_left;
61 otk::Rect _grip_left_area;
62
63 Window _grip_right;
64 otk::Rect _grip_right_area;
65
66 //! The decorations to display on the window.
67 /*!
68 This is by default the same value as in the OBClient::decorations, but it
69 is duplicated here so that it can be overridden per-window by the user.
70 */
71 OBClient::DecorationFlags _decorations;
72
73 //! Creates the base frame window
74 Window createFrame();
75 //! Creates a child frame decoration element window
76 Window createChild(Window parent, Cursor cursor);
77
78 //! Reparents the client window from the root window onto the frame
79 void grabClient();
80 //! Reparents the client window back to the root window
81 /*!
82 @param remap Re-map the client window when we're done reparenting?
83 */
84 void releaseClient(bool remap);
85
86 public:
87 //! Constructs an OBFrame object, and reparents the client to itself
88 /*!
89 @param client The client window which will be decorated by the new OBFrame
90 @param style The style to use to decorate the frame
91 */
92 OBFrame(const OBClient *client, const otk::Style *style);
93 //! Destroys the OBFrame object
94 virtual ~OBFrame();
95
96 //! Load a style to decorate the frame with
97 void loadStyle(const otk::Style *style);
98
99 //! Update the frame to match the client
100 void update();
101 //! Shape the frame window to the client window
102 void updateShape();
103
104 //! Returns the frame's most-parent window, which is a child of the root
105 //! window
106 inline Window window() const { return _window; }
107
108 inline Window titlebar() const { return _titlebar; }
109 inline Window label() const { return _label; }
110 inline Window buttonIconify() const { return _button_iconify; }
111 inline Window buttonMax() const { return _button_max; }
112 inline Window buttonStick() const { return _button_stick; }
113 inline Window buttonClose() const { return _button_close; }
114 inline Window handle() const { return _handle; }
115 inline Window gripLeft() const { return _grip_left; }
116 inline Window gripRight() const { return _grip_right; }
117 };
118
119 }
120
121 #endif // __frame_hh
This page took 0.040777 seconds and 4 git commands to generate.