2017-09-18 14:33:44 +08:00
|
|
|
/*
|
2018-02-07 11:52:47 +08:00
|
|
|
* Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
|
2017-09-18 14:33:44 +08:00
|
|
|
*
|
|
|
|
* Author: sbw <sbw@sbw.so>
|
|
|
|
*
|
|
|
|
* Maintainer: sbw <sbw@sbw.so>
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
2016-06-02 15:43:57 +08:00
|
|
|
#ifndef MAINPANEL_H
|
|
|
|
#define MAINPANEL_H
|
|
|
|
|
2016-06-03 16:06:11 +08:00
|
|
|
#include "controller/dockitemcontroller.h"
|
2016-06-06 10:59:29 +08:00
|
|
|
#include "util/docksettings.h"
|
2016-06-03 16:06:11 +08:00
|
|
|
|
2016-06-02 15:43:57 +08:00
|
|
|
#include <QFrame>
|
2016-06-22 15:07:53 +08:00
|
|
|
#include <QTimer>
|
2016-06-06 10:59:29 +08:00
|
|
|
#include <QBoxLayout>
|
2016-06-02 15:43:57 +08:00
|
|
|
|
2017-02-16 11:33:30 +08:00
|
|
|
#include <DBlurEffectWidget>
|
2017-05-11 10:10:32 +08:00
|
|
|
#include <DWindowManagerHelper>
|
2017-02-16 11:33:30 +08:00
|
|
|
|
2016-07-12 16:08:46 +08:00
|
|
|
#define xstr(s) str(s)
|
|
|
|
#define str(s) #s
|
2016-08-19 11:39:16 +08:00
|
|
|
#define PANEL_BORDER 0
|
2018-01-09 17:03:12 +08:00
|
|
|
#define PANEL_PADDING 0
|
2017-12-26 11:54:31 +08:00
|
|
|
#define WINDOW_OVERFLOW 5
|
2016-07-12 15:59:45 +08:00
|
|
|
|
2017-02-16 11:33:30 +08:00
|
|
|
DWIDGET_USE_NAMESPACE
|
|
|
|
|
2018-01-04 16:36:25 +08:00
|
|
|
class MainPanel : public DBlurEffectWidget
|
2016-06-02 15:43:57 +08:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
2016-07-08 14:29:54 +08:00
|
|
|
Q_PROPERTY(int displayMode READ displayMode DESIGNABLE true)
|
|
|
|
Q_PROPERTY(int position READ position DESIGNABLE true)
|
2016-06-02 15:43:57 +08:00
|
|
|
|
|
|
|
public:
|
|
|
|
explicit MainPanel(QWidget *parent = 0);
|
2016-06-03 16:06:11 +08:00
|
|
|
|
2016-06-21 17:24:03 +08:00
|
|
|
void updateDockPosition(const Position dockPosition);
|
2016-06-22 16:41:36 +08:00
|
|
|
void updateDockDisplayMode(const Dock::DisplayMode displayMode);
|
2016-10-14 15:47:43 +08:00
|
|
|
int displayMode() const;
|
|
|
|
int position() const;
|
2016-06-06 10:59:29 +08:00
|
|
|
|
2018-01-12 14:32:57 +08:00
|
|
|
void setEffectEnabled(const bool enabled);
|
|
|
|
|
2016-06-30 15:32:18 +08:00
|
|
|
signals:
|
2016-07-18 09:32:01 +08:00
|
|
|
void requestWindowAutoHide(const bool autoHide) const;
|
2016-06-30 15:32:18 +08:00
|
|
|
void requestRefershWindowVisible() const;
|
2016-10-14 15:47:43 +08:00
|
|
|
void geometryChanged();
|
2016-06-30 15:32:18 +08:00
|
|
|
|
2016-06-06 11:37:09 +08:00
|
|
|
private:
|
2016-10-14 15:47:43 +08:00
|
|
|
void moveEvent(QMoveEvent *e);
|
2016-06-06 11:37:09 +08:00
|
|
|
void resizeEvent(QResizeEvent *e);
|
2016-06-07 16:01:37 +08:00
|
|
|
void dragEnterEvent(QDragEnterEvent *e);
|
|
|
|
void dragMoveEvent(QDragMoveEvent *e);
|
2016-06-20 14:28:25 +08:00
|
|
|
void dragLeaveEvent(QDragLeaveEvent *e);
|
2016-06-07 16:01:37 +08:00
|
|
|
void dropEvent(QDropEvent *e);
|
|
|
|
|
2016-08-15 14:11:19 +08:00
|
|
|
void manageItem(DockItem *item);
|
2016-06-20 15:28:40 +08:00
|
|
|
DockItem *itemAt(const QPoint &point);
|
2016-06-20 14:28:25 +08:00
|
|
|
|
|
|
|
private slots:
|
2016-06-06 11:37:09 +08:00
|
|
|
void adjustItemSize();
|
2016-06-14 11:22:19 +08:00
|
|
|
void itemInserted(const int index, DockItem *item);
|
|
|
|
void itemRemoved(DockItem *item);
|
2016-06-22 10:28:47 +08:00
|
|
|
void itemMoved(DockItem *item, const int index);
|
2016-06-20 14:28:25 +08:00
|
|
|
void itemDragStarted();
|
2016-08-10 14:59:55 +08:00
|
|
|
void itemDropped(QObject *destnation);
|
2016-06-06 11:37:09 +08:00
|
|
|
|
2016-06-03 16:06:11 +08:00
|
|
|
private:
|
2016-06-21 17:24:03 +08:00
|
|
|
Position m_position;
|
2016-06-23 10:24:51 +08:00
|
|
|
DisplayMode m_displayMode;
|
2016-06-06 10:59:29 +08:00
|
|
|
QBoxLayout *m_itemLayout;
|
|
|
|
|
2016-06-22 15:07:53 +08:00
|
|
|
QTimer *m_itemAdjustTimer;
|
2016-06-03 16:06:11 +08:00
|
|
|
DockItemController *m_itemController;
|
2016-06-20 14:28:25 +08:00
|
|
|
|
|
|
|
static DockItem *DragingItem;
|
2016-07-18 17:10:15 +08:00
|
|
|
static PlaceholderItem *RequestDockItem;
|
2016-06-02 15:43:57 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // MAINPANEL_H
|