X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fframe.hh;h=7fa7a513fdd7c8194101df19e71e04a1e0799a3b;hb=7f561a6a7acee71d55eecc9ed2bd278147ce2536;hp=c587c112ad2e863e4758a60f0cf9e72ee9be3a23;hpb=17b0266979137ad957a701c7093a14841a8c2091;p=chaz%2Fopenbox diff --git a/src/frame.hh b/src/frame.hh index c587c112..7fa7a513 100644 --- a/src/frame.hh +++ b/src/frame.hh @@ -9,6 +9,7 @@ extern "C" { #include } +#include "client.hh" #include "python.hh" #include "otk/strut.hh" #include "otk/rect.hh" @@ -18,25 +19,30 @@ extern "C" { #include "otk/eventhandler.hh" #include +#include namespace ob { -class Client; - //! Varius geometry settings in the frame decorations struct FrameGeometry { - unsigned int width; // title and handle - unsigned int font_height; - unsigned int title_height() { return font_height + bevel*2; } - unsigned int label_width; - unsigned int label_height() { return font_height; } - unsigned int handle_height; // static, from the style + int width; // title and handle + int font_height; + int title_height() { return font_height + bevel*2; } + int label_width; + int label_height() { return font_height; } + int handle_height; // static, from the style + int icon_x; // x-position of the window icon button + int title_x; // x-position of the window title + int iconify_x; // x-position of the window iconify button + int desktop_x; // x-position of the window all-desktops button + int max_x; // x-position of the window maximize button + int close_x; // x-position of the window close button int handle_y; - unsigned int button_size; // static, from the style - unsigned grip_width() { return button_size * 2; } - unsigned bevel; // static, from the style - unsigned bwidth; // frame elements' border width - unsigned cbwidth; // client border width + int button_size; // static, from the style + int grip_width() { return button_size * 2; } + int bevel; // static, from the style + int bwidth; // frame elements' border width + int cbwidth; // client border width }; //! Holds and decorates a frame around an Client (client window) @@ -64,6 +70,9 @@ private: otk::Rect _area; bool _visible; + + //! The decorations that are being displayed in the frame. + Client::DecorationFlags _decorations; // decoration windows Window _frame; // sits under everything @@ -73,11 +82,11 @@ private: Window _handle; // bottom bar Window _lgrip; // lefthand resize grab on the handle Window _rgrip; // righthand resize grab on the handle - Window *_buttons; // all of the titlebar buttons - unsigned int _numbuttons; // number of buttons, size of _buttons array - unsigned int *_titleorder; // order of the buttons and the label (always - // holds '_numbuttons + 1' elements (for the - // label, which is coded as '-1') + Window _max; // maximize button + Window _desk; // all-desktops button + Window _iconify; // iconify button + Window _icon; // window icon button + Window _close; // close button // surfaces for each otk::Surface *_frame_sur; @@ -85,13 +94,31 @@ private: otk::Surface *_label_sur; otk::Surface *_handle_sur; otk::Surface *_grip_sur; - otk::Surface **_buttons_sur; + otk::Surface *_max_sur; + otk::Surface *_desk_sur; + otk::Surface *_iconify_sur; + otk::Surface *_icon_sur; + otk::Surface *_close_sur; + + otk::ustring _layout; // layout of the titlebar + + bool _max_press; + bool _desk_press; + bool _iconify_press; + bool _icon_press; + bool _close_press; + unsigned int _press_button; // mouse button that started the press FrameGeometry geom; void applyStyle(const otk::RenderStyle &style); void layoutTitle(); void renderLabel(); + void renderMax(); + void renderDesk(); + void renderIconify(); + void renderClose(); + void renderIcon(); public: //! Constructs an Frame object for a client @@ -124,6 +151,7 @@ public: void adjustState(); void adjustFocus(); void adjustTitle(); + void adjustIcon(); //! Applies gravity to the client's position to find where the frame should //! be positioned. @@ -150,6 +178,9 @@ public: //! Hides the frame void hide(); + void buttonPressHandler(const XButtonEvent &e); + void buttonReleaseHandler(const XButtonEvent &e); + //! Returns the MouseContext for the given window id /*! Returns '-1' if no valid mouse context exists in the frame for the given