mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-03 00:15:21 +00:00
96 lines
2.6 KiB
C++
96 lines
2.6 KiB
C++
/*
|
|
* Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
|
|
*
|
|
* 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/>.
|
|
*/
|
|
|
|
#ifndef MAINPANEL_H
|
|
#define MAINPANEL_H
|
|
|
|
#include "controller/dockitemcontroller.h"
|
|
#include "util/docksettings.h"
|
|
|
|
#include <QFrame>
|
|
#include <QTimer>
|
|
#include <QBoxLayout>
|
|
|
|
#include <DBlurEffectWidget>
|
|
#include <DWindowManagerHelper>
|
|
|
|
#define xstr(s) str(s)
|
|
#define str(s) #s
|
|
#define PANEL_BORDER 0
|
|
#define PANEL_PADDING 0
|
|
#define WINDOW_OVERFLOW 5
|
|
|
|
DWIDGET_USE_NAMESPACE
|
|
|
|
class MainPanel : public DBlurEffectWidget
|
|
{
|
|
Q_OBJECT
|
|
Q_PROPERTY(int displayMode READ displayMode DESIGNABLE true)
|
|
Q_PROPERTY(int position READ position DESIGNABLE true)
|
|
|
|
public:
|
|
explicit MainPanel(QWidget *parent = 0);
|
|
|
|
void updateDockPosition(const Position dockPosition);
|
|
void updateDockDisplayMode(const Dock::DisplayMode displayMode);
|
|
int displayMode() const;
|
|
int position() const;
|
|
|
|
void setEffectEnabled(const bool enabled);
|
|
|
|
signals:
|
|
void requestWindowAutoHide(const bool autoHide) const;
|
|
void requestRefershWindowVisible() const;
|
|
void geometryChanged();
|
|
|
|
private:
|
|
void moveEvent(QMoveEvent *e);
|
|
void resizeEvent(QResizeEvent *e);
|
|
void dragEnterEvent(QDragEnterEvent *e);
|
|
void dragMoveEvent(QDragMoveEvent *e);
|
|
void dragLeaveEvent(QDragLeaveEvent *e);
|
|
void dropEvent(QDropEvent *e);
|
|
|
|
void manageItem(DockItem *item);
|
|
DockItem *itemAt(const QPoint &point);
|
|
|
|
private slots:
|
|
void adjustItemSize();
|
|
void itemInserted(const int index, DockItem *item);
|
|
void itemRemoved(DockItem *item);
|
|
void itemMoved(DockItem *item, const int index);
|
|
void itemDragStarted();
|
|
void itemDropped(QObject *destnation);
|
|
|
|
private:
|
|
Position m_position;
|
|
DisplayMode m_displayMode;
|
|
QBoxLayout *m_itemLayout;
|
|
|
|
QTimer *m_itemAdjustTimer;
|
|
DockItemController *m_itemController;
|
|
|
|
static DockItem *DragingItem;
|
|
static PlaceholderItem *RequestDockItem;
|
|
};
|
|
|
|
#endif // MAINPANEL_H
|