All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines
Signals | Public Member Functions | Protected Member Functions | Properties
QGpGuiTools::ExpandTabTitle Class Reference

Brief description of class still missing. More...

#include <ExpandTabTitle.h>

List of all members.

Signals

void addActions (QMenu *)
void dock ()
void moveDown ()
void moveUp ()
void resize (int dy)

Public Member Functions

QWidget * content () const
bool docked () const
bool expanded () const
 ExpandTabTitle (QWidget *parent=0)
void setContent (QWidget *w)
void setDocked (bool d)
void setExpanded (bool e)
void setTitle (QString t)
QString title () const
 ~ExpandTabTitle ()

Protected Member Functions

virtual void contextMenuEvent (QContextMenuEvent *e)
virtual QSize minimumSizeHint () const
virtual void mouseMoveEvent (QMouseEvent *e)
virtual void mousePressEvent (QMouseEvent *e)
virtual void mouseReleaseEvent (QMouseEvent *e)
virtual void paintEvent (QPaintEvent *e)

Properties

bool expanded
QString title

Detailed Description

Brief description of class still missing.

Full description of class still missing


Constructor & Destructor Documentation

Description of constructor still missing

References TRACE.

    : QWidget(parent)
{
  TRACE;
  _content=0;
  _expanded=true;
  _docked=true;
  _expandHover=false;
  _moveUpHover=false;
  _moveDownHover=false;
  _dockHover=false;
  _expandPress=false;
  _moveUpPress=false;
  _moveDownPress=false;
  _dockPress=false;
  _resizeStart=-1;
  setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
}

Description of destructor still missing

References TRACE.

{
  TRACE;
}

Member Function Documentation

void QGpGuiTools::ExpandTabTitle::addActions ( QMenu *  ) [signal]

Referenced by contextMenuEvent().

QWidget* QGpGuiTools::ExpandTabTitle::content ( ) const [inline]
void QGpGuiTools::ExpandTabTitle::contextMenuEvent ( QContextMenuEvent *  e) [protected, virtual]

References addActions(), and TRACE.

{
  TRACE;
  QMenu m;
  emit addActions(&m);
  if(!m.actions().isEmpty())
    m.exec(mapToGlobal( e->pos()) );
}

Referenced by mouseReleaseEvent().

bool QGpGuiTools::ExpandTabTitle::docked ( ) const [inline]
bool QGpGuiTools::ExpandTabTitle::expanded ( ) const [inline]
{return _expanded;}
QSize QGpGuiTools::ExpandTabTitle::minimumSizeHint ( ) const [protected, virtual]

References TRACE.

{
  TRACE;
  int h=fontMetrics().lineSpacing ();
  if(h<_upDownSize) h=_upDownSize;
  return QSize(5*_spacing+2*_upDownSize+_expandSize+50,h+_spacing);
}
void QGpGuiTools::ExpandTabTitle::mouseMoveEvent ( QMouseEvent *  e) [protected, virtual]

References contains(), resize(), and TRACE.

{
  TRACE;
  _expandHover=false;
  _moveUpHover=false;
  _moveDownHover=false;
  if(_expandPress && expandRect().contains(e->pos()) ) {
    _expandHover=true;
  } else if(_moveUpPress && moveUpRect().contains(e->pos()) ) {
    _moveUpHover=true;
  } else if(_moveDownPress && moveDownRect().contains(e->pos()) ) {
    _moveDownHover=true;
  } else if(_dockPress && dockRect().contains(e->pos()) ) {
    _dockHover=true;
  } else if(_resizeStart>=0) {
    emit resize(e->globalY()-_resizeStart);
    _resizeStart=e->globalY();
  }
  update();
}
void QGpGuiTools::ExpandTabTitle::mousePressEvent ( QMouseEvent *  e) [protected, virtual]

References contains(), and TRACE.

{
  TRACE;
  if(expandRect().contains(e->pos()) ) {
    _expandPress=true;
    _expandHover=true;
  } else if(moveUpRect().contains(e->pos()) ) {
    _moveUpPress=true;
    _moveUpHover=true;
  } else if(moveDownRect().contains(e->pos()) ) {
    _moveDownPress=true;
    _moveDownHover=true;
  } else if(dockRect().contains(e->pos()) ) {
    _dockPress=true;
    _dockHover=true;
  } else {
    _resizeStart=e->globalY();
  }
  update();
}
void QGpGuiTools::ExpandTabTitle::mouseReleaseEvent ( QMouseEvent *  e) [protected, virtual]

References dock(), moveDown(), moveUp(), setExpanded(), and TRACE.

{
  TRACE;
  if(_expandHover) {
    setExpanded( !_expanded);
    _expandHover=false;
  } else if(_moveUpHover) {
    emit moveUp();
    _moveUpHover=false;
  } else if(_moveDownHover) {
    emit moveDown();
    _moveDownHover=false;
  } else if(_dockHover) {
    emit dock();
    _dockHover=false;
  } else if(_resizeStart>=0) {
    _resizeStart=-1;
  }
  _expandPress=false;
  _moveUpPress=false;
  _moveDownPress=false;
  _dockPress=false;
  update();
}

Referenced by mouseReleaseEvent().

Referenced by mouseReleaseEvent().

void QGpGuiTools::ExpandTabTitle::paintEvent ( QPaintEvent *  e) [protected, virtual]

References TRACE.

{
  TRACE;
  QPainter p(this);

  QStyleOptionButton option;
  option.state=QStyle::State_Active;
#ifdef Q_WS_MAC
  option.state |= QStyle::State_Raised;
#endif
  option.state &= ~QStyle::State_HasFocus;
  option.rect=rect();
  option.palette=palette();
  option.features=QStyleOptionButton::None;
  style()->drawControl(QStyle::CE_PushButton, &option, &p, this);

  QStyleOption buttonOption;
  buttonOption.palette=palette();

  // Expanded/Collapse button
  buttonOption.rect=expandRect();
  buttonOption.state=QStyle::State_Children;
  if(_expandHover) {
    buttonOption.rect.translate(1,1);
    if(!_expanded) buttonOption.state |= QStyle::State_Open;
  } else {
    if(_expanded) buttonOption.state |= QStyle::State_Open;
  }
  style()->drawPrimitive(QStyle::PE_IndicatorBranch, &buttonOption, &p, this);

  // Move up button
  buttonOption.rect=moveUpRect();
  if(_moveUpHover) buttonOption.rect.translate(1,1);
  buttonOption.state=isEnabled() ? QStyle::State_Enabled : QStyle::State_None;
  style()->drawPrimitive(QStyle::PE_IndicatorArrowUp, &buttonOption, &p, this);

  // Move down button
  buttonOption.rect=moveDownRect();
  if(_moveDownHover) buttonOption.rect.translate(1,1);
  style()->drawPrimitive(QStyle::PE_IndicatorArrowDown, &buttonOption, &p, this);

  // Dock/Undock button
  buttonOption.rect=dockRect();
  if(_dockHover) buttonOption.rect.translate(1,1);
  if(_docked)
    style()->drawItemPixmap(&p, buttonOption.rect, Qt::AlignCenter, style()->standardPixmap(QStyle::SP_TitleBarNormalButton) );
  else
    style()->drawItemPixmap(&p, buttonOption.rect, Qt::AlignCenter, style()->standardPixmap(QStyle::SP_TitleBarMaxButton) );

  // Title
  QRect textrect=QRect(2*_spacing + _expandSize, 0, width() - 2*_upDownSize - _expandSize - 5*_spacing, height());
  style()->drawItemText(&p, textrect, Qt::AlignCenter, palette(), isEnabled(), _title);
}
void QGpGuiTools::ExpandTabTitle::resize ( int  dy) [signal]

Referenced by mouseMoveEvent().

void QGpGuiTools::ExpandTabTitle::setContent ( QWidget *  w) [inline]

Referenced by QGpGuiTools::ExpandTabWidget::addWidget().

{_content=w;}
void QGpGuiTools::ExpandTabTitle::setDocked ( bool  d) [inline]

Referenced by QGpGuiTools::ExpandTabWidget::restoreState().

{_docked=d;}

References TRACE.

Referenced by mouseReleaseEvent(), and QGpGuiTools::ExpandTabWidget::restoreState().

{
  TRACE;
  if(e) {
    if(_content) _content->show();
  } else {
    if(_content) _content->hide();
  }
  _expanded=e;
  update();
}
void QGpGuiTools::ExpandTabTitle::setTitle ( QString  t) [inline]

Referenced by QGpGuiTools::ExpandTabWidget::addWidget().

{_title=t;}
QString QGpGuiTools::ExpandTabTitle::title ( ) const [inline]
{return _title;}

Property Documentation

QString QGpGuiTools::ExpandTabTitle::title [read, write]

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines