#include <SelectionWidget.h>
Public Types | |
enum | State { Hoover, Selected, Activated } |
Public Member Functions | |
int | height () |
SelectionWidget (GraphicObject *, QWidget *parent=0) | |
void | setState (State s) |
State | state () |
GraphicObject * | widget () |
int | width () |
int | x (int xObj) |
int | y (int yObj) |
~SelectionWidget () | |
Protected Member Functions | |
virtual void | leaveEvent (QEvent *e) |
virtual void | mouseDoubleClickEvent (QMouseEvent *e) |
virtual void | mouseMoveEvent (QMouseEvent *e) |
virtual void | mousePressEvent (QMouseEvent *e) |
virtual void | mouseReleaseEvent (QMouseEvent *e) |
virtual void | paintEvent (QPaintEvent *) |
Protected Attributes | |
State | _state |
GraphicObject * | _widget |
SciFigs::SelectionWidget::SelectionWidget | ( | GraphicObject * | obj, |
QWidget * | parent = 0 |
||
) |
int SciFigs::SelectionWidget::height | ( | ) | [inline] |
References _widget, and SEL_WEIGHT.
Referenced by SciFigs::GraphicSheet::addSelection(), paintEvent(), and SciFigs::GraphicSheet::resizeObject().
{return _widget->height()+SEL_WEIGHT*2;}
void SciFigs::SelectionWidget::leaveEvent | ( | QEvent * | e | ) | [protected, virtual] |
References _widget, Hoover, SciFigs::GraphicObject::setSelected(), state(), and TRACE.
{ TRACE; if(state()==Hoover) { _widget->setSelected(0); deleteLater(); } }
void SciFigs::SelectionWidget::mouseDoubleClickEvent | ( | QMouseEvent * | e | ) | [protected, virtual] |
References _widget, SciFigs::GraphicObject::mouseDoubleClickEvent(), and TRACE.
{ TRACE; _widget->mouseDoubleClickEvent (e); }
void SciFigs::SelectionWidget::mouseMoveEvent | ( | QMouseEvent * | e | ) | [protected, virtual] |
References _widget, SciFigs::GraphicObject::mouseMoveEvent(), and TRACE.
{ TRACE; _widget->mouseMoveEvent (e); }
void SciFigs::SelectionWidget::mousePressEvent | ( | QMouseEvent * | e | ) | [protected, virtual] |
References _widget, SciFigs::GraphicObject::mousePressEvent(), and TRACE.
{ TRACE; _widget->mousePressEvent (e); }
void SciFigs::SelectionWidget::mouseReleaseEvent | ( | QMouseEvent * | e | ) | [protected, virtual] |
References _widget, SciFigs::GraphicObject::mouseReleaseEvent(), and TRACE.
{ TRACE; _widget->mouseReleaseEvent (e); }
void SciFigs::SelectionWidget::paintEvent | ( | QPaintEvent * | ) | [protected, virtual] |
References _state, Activated, height(), Hoover, SEL_WEIGHT, Selected, TRACE, and width().
{ TRACE; QPainter p(this); p.fillRect(0,0,width(),height(), Qt::white); switch (_state) { case Hoover: p.setPen(QPen(Qt::blue,SEL_WEIGHT)); //p.setBrush(QBrush(Qt::blue)); break; case Selected: p.setPen(QPen(Qt::gray,SEL_WEIGHT)); //p.setBrush(QBrush(Qt::gray)); break; case Activated: p.setPen(QPen(Qt::black,SEL_WEIGHT)); //p.setBrush(QBrush(Qt::black)); break; } /*p.drawRect(0,0,SEL_WEIGHT-1,SEL_WEIGHT-1); p.drawRect(width()-SEL_WEIGHT,0,SEL_WEIGHT-1,SEL_WEIGHT-1); p.drawRect(0,height()-SEL_WEIGHT,SEL_WEIGHT-1,SEL_WEIGHT-1); p.drawRect(width()-SEL_WEIGHT,height()-SEL_WEIGHT,SEL_WEIGHT-1,SEL_WEIGHT-1);*/ p.drawRect(1,1,width()-SEL_WEIGHT,height()-SEL_WEIGHT); }
void SciFigs::SelectionWidget::setState | ( | State | s | ) | [inline] |
References _state.
Referenced by SciFigs::GraphicObject::enterEvent(), and SciFigs::GraphicSheet::selectObjects().
{_state=s;update();}
State SciFigs::SelectionWidget::state | ( | ) | [inline] |
References _state.
Referenced by SciFigs::GraphicObject::isActive(), SciFigs::GraphicObject::isSelected(), leaveEvent(), SciFigs::GraphicObject::leaveEvent(), and SciFigs::GraphicObject::setActive().
{return _state;}
GraphicObject* SciFigs::SelectionWidget::widget | ( | ) | [inline] |
References _widget.
Referenced by SciFigs::GraphicSheet::activeObject(), SciFigs::GraphicSheet::addSelectNextChild(), SciFigs::GraphicSheet::alignX(), SciFigs::GraphicSheet::alignY(), SciFigs::GraphicSheet::cut(), SciFigs::GraphicSheet::removeObject(), SciFigs::GraphicSheet::selectNextChild(), SciFigs::GraphicSheet::selectObjects(), and SciFigs::GraphicSheet::showProperties().
{return _widget;}
int SciFigs::SelectionWidget::width | ( | ) | [inline] |
References _widget, and SEL_WEIGHT.
Referenced by SciFigs::GraphicSheet::addSelection(), paintEvent(), and SciFigs::GraphicSheet::resizeObject().
{return _widget->width()+SEL_WEIGHT*2;}
int SciFigs::SelectionWidget::x | ( | int | xObj | ) | [inline] |
References SEL_WEIGHT.
Referenced by SciFigs::GraphicSheet::addSelection(), and SciFigs::GraphicSheet::moveObject().
{return xObj-SEL_WEIGHT;}
int SciFigs::SelectionWidget::y | ( | int | yObj | ) | [inline] |
References SEL_WEIGHT.
Referenced by SciFigs::GraphicSheet::addSelection(), and SciFigs::GraphicSheet::moveObject().
{return yObj-SEL_WEIGHT;}
State SciFigs::SelectionWidget::_state [protected] |
Referenced by paintEvent(), SelectionWidget(), setState(), and state().
GraphicObject* SciFigs::SelectionWidget::_widget [protected] |
Referenced by height(), leaveEvent(), mouseDoubleClickEvent(), mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), SelectionWidget(), widget(), and width().