Qt-Advanced-Docking-System/AdvancedDockingSystem/include/ads/SectionTitleWidget.h

79 lines
2.2 KiB
C
Raw Normal View History

2015-12-09 19:21:38 +08:00
#ifndef SECTION_TITLE_WIDGET_H
#define SECTION_TITLE_WIDGET_H
2017-02-20 17:06:55 +08:00
/*******************************************************************************
** QtAdcancedDockingSystem
** Copyright (C) 2017 Uwe Kindler
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
#include <QPointer>
2015-12-09 19:21:38 +08:00
#include <QPoint>
#include <QFrame>
#include "ads/API.h"
#include "ads/SectionContent.h"
2015-12-09 19:21:38 +08:00
2017-02-08 06:51:29 +08:00
class QPushButton;
2015-12-09 19:21:38 +08:00
ADS_NAMESPACE_BEGIN
class MainContainerWidget;
2015-12-09 19:21:38 +08:00
class SectionWidget;
class FloatingWidget;
class SectionTitleWidget : public QFrame
{
Q_OBJECT
Q_PROPERTY(bool activeTab READ isActiveTab WRITE setActiveTab NOTIFY activeTabChanged)
2015-12-09 19:21:38 +08:00
friend class MainContainerWidget;
2015-12-09 19:21:38 +08:00
friend class SectionWidget;
friend class CContainerWidget;
2015-12-09 19:21:38 +08:00
SectionContent::RefPtr m_Content;
// Drag & Drop (Floating)
QPoint m_DragStartMousePosition;
QPoint m_DragStartGlobalMousePosition;
QPoint m_DragStartPosition;
2015-12-09 19:21:38 +08:00
// Drag & Drop (Title/Tabs)
bool m_TabMoving;
// Property values
bool m_IsActiveTab;
2015-12-09 19:21:38 +08:00
public:
SectionTitleWidget(SectionContent::RefPtr content, QWidget* parent);
virtual ~SectionTitleWidget();
2015-12-09 19:21:38 +08:00
bool isActiveTab() const;
void setActiveTab(bool active);
protected:
virtual void mousePressEvent(QMouseEvent* ev);
virtual void mouseReleaseEvent(QMouseEvent* ev);
virtual void mouseMoveEvent(QMouseEvent* ev);
private:
void startFloating(QMouseEvent* ev, MainContainerWidget* cw, SectionWidget* sectionwidget);
void moveTab(QMouseEvent* ev);
2015-12-09 19:21:38 +08:00
signals:
void activeTabChanged();
void clicked();
};
ADS_NAMESPACE_END
2016-02-12 14:15:10 +08:00
#endif