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