AlbumShaper  1.0a3
Public Member Functions | Private Member Functions | Private Attributes
GroupIcon Class Reference

Displays group icon and text, also contains pointer to widget for setting group settings. More...

#include <groupIcon.h>

Inheritance diagram for GroupIcon:
Inheritance graph
[legend]
Collaboration diagram for GroupIcon:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 GroupIcon (QIconView *parent, QPixmap icon, QString text, QWidget *settingsWidget)
void paintItem (QPainter *p, const QColorGroup &cg)
void paintFocus (QPainter *p, const QColorGroup &cg)
void setMousedOver (bool val)
QWidgetgetSettingsWidget ()

Private Member Functions

void initializeItemRect ()

Private Attributes

QIconViewparent
QWidgetsettingsWidget
bool mousedOver

Detailed Description

Displays group icon and text, also contains pointer to widget for setting group settings.

Definition at line 28 of file groupIcon.h.


Constructor & Destructor Documentation

GroupIcon::GroupIcon ( QIconView parent,
QPixmap  icon,
QString  text,
QWidget settingsWidget 
)

Definition at line 22 of file groupIcon.cpp.

References initializeItemRect(), mousedOver, parent, and settingsWidget.

                                                             :
                      QIconViewItem(parent, text, icon)
{
  this->parent = parent;
  this->settingsWidget = settingsWidget;
  mousedOver = false;
  
  //initialize item rectangle
  initializeItemRect();
}

Member Function Documentation

QWidget * GroupIcon::getSettingsWidget ( )

Definition at line 70 of file groupIcon.cpp.

References settingsWidget.

{ return settingsWidget; }
void GroupIcon::initializeItemRect ( ) [private]

Definition at line 74 of file groupIcon.cpp.

References parent.

Referenced by GroupIcon().

{
  //reset pixmap rect
  QRect pr = pixmapRect();
  int prWidth  = pr.width();
  int prHeight = pr.height();
  pr.setTopLeft( QPoint(3,3) );
  pr.setBottomRight( QPoint(pr.left()+prWidth, pr.top()+prHeight) );
  setPixmapRect( pr );
  
  //reset text rect
  int textWidth = ((GroupsWidget*)parent)->getTextWidth();
  QRect tr = textRect();
  tr.setTop( pixmapRect().top() );
  tr.setBottom( pixmapRect().bottom() );
  tr.setLeft( pixmapRect().right() + 2 );
  tr.setRight( tr.left() + textWidth );
  setTextRect( tr );
  
  //reset item rect using pixmap and text rect dimensions
  int itemW = 3 + pixmapRect().width() + (tr.left() - pr.right()) + textRect().width() + 3;
  int itemH = 3 + pixmapRect().height() + 3;
  setItemRect( QRect( pixmapRect().left() - 3, pixmapRect().top() - 3, itemW, itemH ) );
}
void GroupIcon::paintFocus ( QPainter *  p,
const QColorGroup &  cg 
)

Definition at line 68 of file groupIcon.cpp.

{ }
void GroupIcon::paintItem ( QPainter *  p,
const QColorGroup &  cg 
)

Definition at line 34 of file groupIcon.cpp.

References height, and mousedOver.

{
  p->save();
  QRect r = rect();

  //if selected paint dark blue background and outline
  if(isSelected())
  {
    //Draw Selected Color (dark blue)
    p->fillRect( r, QColor(193, 210, 238) );

    //draw selection rectangle (darker blue)
    p->setPen( QColor(49, 106, 197) );
    p->drawRect(r);
  }
  //else if pseudo selected paint ligher blue background with outline
  else if(mousedOver)
  {
    //Draw Pseudo Selected Color (light blue)
    p->fillRect( r, QColor(224, 232, 246) );

    //draw selection rectangle (darker blue)
    p->setPen( QColor(152, 180, 226) );
    p->drawRect(r);
  }

  p->restore();

  p->drawPixmap( x()+3 , y() + ( height() - pixmap()->height() ) / 2, *pixmap());

  int align = AlignLeft | WordBreak | BreakAnywhere;
  p->drawText( textRect( FALSE ), align, text());
}
void GroupIcon::setMousedOver ( bool  val)

Definition at line 72 of file groupIcon.cpp.

References mousedOver.

Referenced by ConfigurationWidget::clearPseudoSelection(), and ConfigurationWidget::repaintGroup().

{ mousedOver = val; }

Member Data Documentation

bool GroupIcon::mousedOver [private]

Definition at line 53 of file groupIcon.h.

Referenced by GroupIcon(), paintItem(), and setMousedOver().

Definition at line 51 of file groupIcon.h.

Referenced by GroupIcon(), and initializeItemRect().

Definition at line 52 of file groupIcon.h.

Referenced by getSettingsWidget(), and GroupIcon().


The documentation for this class was generated from the following files: