File indexing completed on 2024-05-05 05:35:17

0001 #ifndef oxygensizegrip_h
0002 #define oxygensizegrip_h
0003 /*
0004     SPDX-FileCopyrightText: 2014 Hugo Pereira Da Costa <hugo.pereira@free.fr>
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006  */
0007 
0008 #include "config-oxygen.h"
0009 #include "oxygendecoration.h"
0010 
0011 #include <QMouseEvent>
0012 #include <QPaintEvent>
0013 #include <QPointer>
0014 #include <QWidget>
0015 
0016 #if OXYGEN_HAVE_X11
0017 #include <xcb/xcb.h>
0018 #endif
0019 
0020 namespace Oxygen
0021 {
0022 //* implements size grip for all widgets
0023 class SizeGrip : public QWidget
0024 {
0025     Q_OBJECT
0026 
0027 public:
0028     //* constructor
0029     explicit SizeGrip(Decoration *);
0030 
0031 protected:
0032     //*@name event handlers
0033     //@{
0034 
0035     //* paint
0036     void paintEvent(QPaintEvent *) override;
0037 
0038     //* mouse press
0039     void mousePressEvent(QMouseEvent *) override;
0040 
0041     //@}
0042 
0043 private Q_SLOTS:
0044 
0045     //* update background color
0046     void updateActiveState(void);
0047 
0048     //* update position
0049     void updatePosition(void);
0050 
0051     //* embed into parent widget
0052     void embed(void);
0053 
0054 private:
0055     //* send resize event
0056     void sendMoveResizeEvent(QPoint);
0057 
0058     //* grip size
0059     enum { Offset = 0, GripSize = 14 };
0060 
0061     //* decoration
0062     QPointer<Decoration> m_decoration;
0063 
0064 //* move/resize atom
0065 #if OXYGEN_HAVE_X11
0066     xcb_atom_t m_moveResizeAtom = 0;
0067 #endif
0068 };
0069 }
0070 
0071 #endif