]> icculus.org git repositories - mikachu/openbox.git/blob - src/frame.hh
<shrug>
[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   // decoration windows
41   otk::OtkFocusWidget _titlebar;
42   otk::OtkButton      _button_close;
43   otk::OtkButton      _button_iconify;
44   otk::OtkButton      _button_max;
45   otk::OtkButton      _button_stick;
46   otk::OtkFocusLabel  _label;
47   otk::OtkFocusWidget _handle;
48   otk::OtkButton      _grip_left;
49   otk::OtkButton      _grip_right;
50
51   //! The decorations to display on the window.
52   /*!
53     This is by default the same value as in the OBClient::decorations, but it
54     is duplicated here so that it can be overridden per-window by the user.
55   */
56   OBClient::DecorationFlags _decorations;
57
58   //! Creates the base frame window
59   Window createFrame();
60   //! Creates a child frame decoration element window
61   Window createChild(Window parent, Cursor cursor);
62
63   //! Reparents the client window from the root window onto the frame
64   void grabClient();
65   //! Reparents the client window back to the root window
66   /*!
67     @param remap Re-map the client window when we're done reparenting?
68   */
69   void releaseClient(bool remap);
70
71 public:
72   //! Constructs an OBFrame object, and reparents the client to itself
73   /*!
74     @param client The client window which will be decorated by the new OBFrame
75     @param style The style to use to decorate the frame
76   */
77   OBFrame(OBClient *client, otk::Style *style);
78   //! Destroys the OBFrame object
79   virtual ~OBFrame();
80
81   //! Set the style to decorate the frame with
82   virtual void setStyle(otk::Style *style);
83
84   //! Update the frame to match the client
85   void adjust();
86   //! Shape the frame window to the client window
87   void adjustShape(); 
88 };
89
90 }
91
92 #endif // __frame_hh