UBLibWidget.h 2.78 KB
Newer Older
1 2 3
/*
 * 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
Claudio Valerio's avatar
Claudio Valerio committed
4
 * the Free Software Foundation, either version 2 of the License, or
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
 * (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/>.
 */
#ifndef UBLIBWIDGET_H
#define UBLIBWIDGET_H

#include <QWidget>
#include <QVBoxLayout>
#include <QStackedWidget>
#include <QDragEnterEvent>
#include <QDropEvent>
#include <QDragMoveEvent>
#include <QMimeData>
#include <QMouseEvent>
#include <QResizeEvent>
#include <QLabel>

#include "UBDockPaletteWidget.h"
#include "UBLibNavigatorWidget.h"
#include "UBLibItemProperties.h"
#include "UBLibActionBar.h"
33 34
#include "UBLibWebView.h"
#include "UBLibPathViewer.h"
35 36 37

#define ID_NAVIGATOR    0
#define ID_PROPERTIES   1
38
#define ID_WEBVIEW      2
39 40 41 42 43 44 45 46 47

class UBLibWidget : public UBDockPaletteWidget
{
    Q_OBJECT
public:
    UBLibWidget(QWidget* parent=0, const char* name="UBLibWidget");
    ~UBLibWidget();

    UBLibActionBar* actionBar(){return mActionBar;}
48 49
    UBLibNavigatorWidget* libNavigator() {return mNavigator;}
    UBLibPathViewer* pathViewer() {return mpPathViewer;}
50

51 52 53 54 55 56
    bool visibleInMode(eUBDockPaletteWidgetMode mode)
    {
        return mode == eUBDockPaletteWidget_BOARD
            || mode == eUBDockPaletteWidget_DESKTOP;
    }

57 58
signals:
    void resized();
59 60
    void showLibElemProperties();
    void showLibSearchEngine();
61 62 63 64 65 66 67 68 69

protected:
    void dragEnterEvent(QDragEnterEvent* pEvent);
    void dropEvent(QDropEvent *pEvent);
    void dragMoveEvent(QDragMoveEvent* pEvent);
    void dragLeaveEvent(QDragLeaveEvent* pEvent);

private slots:
    void showProperties(UBLibElement* elem);
70
    void showSearchEngine(UBLibElement* elem);
71
    void showFolder();
72
    void onUpdateNavigBar(UBChainedLibElement* elem);
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90

private:
    void processMimeData(const QMimeData* pData);
    int customMargin();
    int border();

    /** The layout */
    QVBoxLayout* mLayout;
    /** The stacked layout */
    QStackedWidget* mStackedWidget;
    /** The Navigator widget */
    UBLibNavigatorWidget* mNavigator;
    /** The Properties widget */
    UBLibItemProperties* mProperties;
    /** UBLibActionBar */
    UBLibActionBar* mActionBar;
    /** The current stack widget index*/
    int miCrntStackWidget;
91 92 93 94
    /** The webview used to display the search engines */
    UBLibWebView* mpWebView;
    /** The path navigation widget */
    UBLibPathViewer* mpPathViewer;
95 96 97
};

#endif // UBLIBWIDGET_H