]> icculus.org git repositories - mikachu/openbox.git/blob - src/frame.hh
make shape work with the titlebar and handle
[mikachu/openbox.git] / 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 "client.hh"
13 #include "otk/strut.hh"
14 #include "otk/rect.hh"
15 #include "otk/screeninfo.hh"
16 #include "otk/style.hh"
17 #include "otk/widget.hh"
18 #include "otk/button.hh"
19 #include "otk/focuswidget.hh"
20 #include "otk/focuslabel.hh"
21
22 #include <string>
23
24 namespace ob {
25
26 //! Holds and decorates a frame around an OBClient (client window)
27 /*!
28 */
29 class OBFrame : public otk::OtkWidget {
30 private:
31   OBClient *_client;
32   const otk::ScreenInfo *_screen;
33
34   //! The style to use for size and display the decorations
35   otk::Style *_style;
36
37   //! The size of the frame on each side of the client window
38   otk::Strut _size;
39
40   //! The size of the frame on each side of the client window inside the border
41   otk::Strut _innersize;
42
43   // decoration windows
44   otk::OtkFocusWidget _plate;   // sits entirely under the client window
45   otk::OtkFocusWidget _titlebar;
46   otk::OtkButton      _button_close;
47   otk::OtkButton      _button_iconify;
48   otk::OtkButton      _button_max;
49   otk::OtkButton      _button_stick;
50   otk::OtkFocusLabel  _label;
51   otk::OtkFocusWidget _handle;
52   otk::OtkButton      _grip_left;
53   otk::OtkButton      _grip_right;
54
55   //! The decorations to display on the window.
56   /*!
57     This is by default the same value as in the OBClient::decorations, but it
58     is duplicated here so that it can be overridden per-window by the user.
59   */
60   OBClient::DecorationFlags _decorations;
61
62   //! Reparents the client window from the root window onto the frame
63   void grabClient();
64   //! Reparents the client window back to the root window
65   /*!
66     @param remap Re-map the client window when we're done reparenting?
67   */
68   void releaseClient(bool remap);
69
70 public:
71   //! Constructs an OBFrame object, and reparents the client to itself
72   /*!
73     @param client The client window which will be decorated by the new OBFrame
74     @param style The style to use to decorate the frame
75   */
76   OBFrame(OBClient *client, otk::Style *style);
77   //! Destroys the OBFrame object
78   virtual ~OBFrame();
79
80   //! Set the style to decorate the frame with
81   virtual void setStyle(otk::Style *style);
82
83   //! Update the frame to match the client
84   void adjust();
85   //! Shape the frame window to the client window
86   void adjustShape();
87
88   //! Applies gravity for the client's gravity, moving the frame to the
89   //! appropriate place
90   void applyGravity();
91
92   //! Reversely applies gravity for the client's gravity, moving the frame so
93   //! that the client is in its pre-gravity position
94   void restoreGravity();
95 };
96
97 }
98
99 #endif // __frame_hh