2006-03-05 17:24:44 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
2007-04-26 03:53:02 +00:00
|
|
|
* \file IconPalette.h
|
2006-03-05 17:24:44 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
2007-04-19 22:01:28 +00:00
|
|
|
* \author Edwin Leuven
|
2006-03-05 17:24:44 +00:00
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef ICONPALETTE_H
|
|
|
|
#define ICONPALETTE_H
|
|
|
|
|
|
|
|
#include <QWidget>
|
2007-04-19 20:29:27 +00:00
|
|
|
#include <QMenu>
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-09-28 22:26:28 +00:00
|
|
|
class QGridLayout;
|
2007-06-17 17:55:36 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
namespace lyx {
|
2006-11-19 17:12:33 +00:00
|
|
|
namespace frontend {
|
2006-10-21 00:16:43 +00:00
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
/**
|
2007-06-21 09:51:50 +00:00
|
|
|
* tear-off widget
|
|
|
|
*/
|
|
|
|
class TearOff : public QWidget {
|
2007-06-17 17:55:36 +00:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2007-06-21 09:51:50 +00:00
|
|
|
TearOff(QWidget * parent);
|
|
|
|
void enterEvent(QEvent *);
|
|
|
|
void leaveEvent(QEvent *);
|
|
|
|
void mouseReleaseEvent (QMouseEvent *);
|
2007-06-17 17:55:36 +00:00
|
|
|
Q_SIGNALS:
|
2007-06-21 09:51:50 +00:00
|
|
|
void tearOff();
|
|
|
|
protected:
|
|
|
|
void paintEvent(QPaintEvent *);
|
2007-06-17 17:55:36 +00:00
|
|
|
private:
|
2007-06-21 09:51:50 +00:00
|
|
|
bool highlighted_;
|
2007-06-17 17:55:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-06-21 09:51:50 +00:00
|
|
|
/**
|
|
|
|
* For holding an arbitrary set of icons.
|
|
|
|
*/
|
2006-03-05 17:24:44 +00:00
|
|
|
class IconPalette : public QWidget {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2007-04-19 22:01:28 +00:00
|
|
|
IconPalette(QWidget * parent);
|
2007-04-19 20:29:27 +00:00
|
|
|
void addButton(QAction *);
|
|
|
|
|
|
|
|
Q_SIGNALS:
|
|
|
|
void triggered(QAction *);
|
|
|
|
void visible(bool);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void showEvent(QShowEvent * event);
|
|
|
|
void hideEvent(QHideEvent * event);
|
|
|
|
void paintEvent(QPaintEvent * event);
|
|
|
|
|
|
|
|
private Q_SLOTS:
|
2007-06-21 09:51:50 +00:00
|
|
|
void tearOff();
|
2007-04-19 20:29:27 +00:00
|
|
|
virtual void clicked(QAction *);
|
|
|
|
|
|
|
|
private:
|
|
|
|
QGridLayout * layout_;
|
|
|
|
QList<QAction *> actions_;
|
2007-06-21 09:51:50 +00:00
|
|
|
bool tornoff_;
|
2017-07-03 17:45:58 +00:00
|
|
|
TearOff * tearoffwidget_;
|
2007-04-19 20:29:27 +00:00
|
|
|
};
|
|
|
|
|
2007-06-17 17:55:36 +00:00
|
|
|
|
2007-04-19 20:29:27 +00:00
|
|
|
/**
|
|
|
|
* Popup menu for a toolbutton.
|
|
|
|
* We need this to keep track whether
|
|
|
|
* it is necessary to enable/disable
|
|
|
|
* the toolbutton
|
|
|
|
*/
|
|
|
|
class ButtonMenu : public QMenu {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2007-09-28 22:26:28 +00:00
|
|
|
ButtonMenu(const QString & title, QWidget * parent);
|
2007-04-19 20:29:27 +00:00
|
|
|
void add(QAction *);
|
|
|
|
|
|
|
|
public Q_SLOTS:
|
|
|
|
void updateParent();
|
|
|
|
|
|
|
|
private:
|
|
|
|
QList<QAction *> actions_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2006-11-19 17:12:33 +00:00
|
|
|
} // namespace frontend
|
2006-10-21 00:16:43 +00:00
|
|
|
} // namespace lyx
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
#endif // ICONPALETTE_H
|