2002-11-08 00:09:00 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
2003-03-14 00:20:42 +00:00
|
|
|
* \file qsetborder.h
|
2002-11-08 00:09:00 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author Edwin Leuven
|
2002-11-28 18:07:39 +00:00
|
|
|
* \author John Levon
|
2002-11-08 00:09:00 +00:00
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2002-11-08 00:09:00 +00:00
|
|
|
*/
|
|
|
|
#ifndef QSETBORDER_H
|
|
|
|
#define QSETBORDER_H
|
|
|
|
|
|
|
|
#include <qwidget.h>
|
|
|
|
#include <qpixmap.h>
|
|
|
|
|
2003-09-07 21:25:37 +00:00
|
|
|
class QColor;
|
2002-11-08 00:09:00 +00:00
|
|
|
class QMouseEvent;
|
|
|
|
class QPaintEvent;
|
2003-09-07 21:25:37 +00:00
|
|
|
class QResizeEvent;
|
2002-11-08 00:09:00 +00:00
|
|
|
|
|
|
|
class QSetBorder : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2002-11-15 05:44:14 +00:00
|
|
|
QSetBorder(QWidget * parent = 0, char const * name = 0, WFlags fl = 0);
|
2002-11-08 00:09:00 +00:00
|
|
|
|
|
|
|
bool getLeft();
|
|
|
|
bool getRight();
|
|
|
|
bool getTop();
|
|
|
|
bool getBottom();
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void rightSet(bool);
|
|
|
|
void leftSet(bool);
|
|
|
|
void topSet(bool);
|
|
|
|
void bottomSet(bool);
|
2002-11-27 18:47:09 +00:00
|
|
|
void clicked();
|
2002-11-15 05:44:14 +00:00
|
|
|
|
2002-11-08 00:09:00 +00:00
|
|
|
public slots:
|
2002-11-28 18:07:39 +00:00
|
|
|
void setLeftEnabled(bool);
|
|
|
|
void setRightEnabled(bool);
|
|
|
|
void setTopEnabled(bool);
|
|
|
|
void setBottomEnabled(bool);
|
2002-11-08 00:09:00 +00:00
|
|
|
void setLeft(bool);
|
|
|
|
void setRight(bool);
|
|
|
|
void setTop(bool);
|
|
|
|
void setBottom(bool);
|
2002-11-27 18:47:09 +00:00
|
|
|
void setAll(bool);
|
2002-11-08 00:09:00 +00:00
|
|
|
|
|
|
|
protected:
|
2002-11-15 05:44:14 +00:00
|
|
|
void mousePressEvent(QMouseEvent * e);
|
|
|
|
void paintEvent(QPaintEvent * e);
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2002-11-08 00:09:00 +00:00
|
|
|
private:
|
|
|
|
void init();
|
|
|
|
|
2002-11-28 18:07:39 +00:00
|
|
|
void drawLine(QColor const & col, int x, int y, int x2, int y2);
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2002-11-08 00:09:00 +00:00
|
|
|
void drawLeft(bool);
|
|
|
|
void drawRight(bool);
|
|
|
|
void drawTop(bool);
|
|
|
|
void drawBottom(bool);
|
|
|
|
|
2002-11-28 18:07:39 +00:00
|
|
|
struct Border {
|
|
|
|
Border() : set(true), enabled(true) {}
|
|
|
|
bool set;
|
|
|
|
bool enabled;
|
|
|
|
};
|
|
|
|
|
|
|
|
Border left_;
|
|
|
|
Border right_;
|
|
|
|
Border top_;
|
|
|
|
Border bottom_;
|
2002-11-08 00:09:00 +00:00
|
|
|
|
|
|
|
int m;
|
|
|
|
int l;
|
|
|
|
int w;
|
|
|
|
int h;
|
2002-11-27 20:23:53 +00:00
|
|
|
|
2002-11-08 00:09:00 +00:00
|
|
|
QPixmap buffer;
|
|
|
|
};
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2002-11-08 00:09:00 +00:00
|
|
|
#endif // QSETBORDER_H
|