Kard Class Reference

#include <kard.h>

Collaboration diagram for Kard:

Collaboration graph
[legend]

List of all members.


Detailed Description

This draws a card image. This is not particularly useful directly. Capable images are png and xpm.

Author:
John Schneiderman

Public Types

enum  PreferredSize { PREFERRED_WIDTH = 70, PREFERRED_HEIGHT = 90 }

Signals

void cardSelected (Kard &kard)

Public Member Functions

const Cardcard ()
const QPixmap & cardBack () const
const QPixmap & cardFront () const
void flipCard ()
bool isFaceUp () const
bool isSelected () const
 Kard (const Card &card, bool faceUp, QWidget *parent=0)
 Kard (QWidget *parent=0)
Kardoperator= (const Kard &kard)
void setCard (const Card &card)
void setCardBack (const QString &cardBackFilename)
void setCardBack (const QPixmap &cardBack)
void setCardFront (const QPixmap &cardFront)
void setCardPath (const QString &cardPath)
void setFaceUp (bool faceUp)
void setSelected (bool select)
QSize sizeHint () const
 ~Kard ()

Protected Member Functions

virtual void mouseDoubleClickEvent (QMouseEvent *event)
virtual void mouseMoveEvent (QMouseEvent *event)
virtual void mousePressEvent (QMouseEvent *event)
virtual void paintEvent (QPaintEvent *event)

Properties

QPixmap m_cardBack
QPixmap m_cardFront
bool m_faceUp
bool m_selected

Member Enumeration Documentation

These are the preferred sizes.

Parameters:
PREFERRED_WIDTH is the preferred width of the card.
PREFERRED_HEIGHT is the preferred height of the card.


Constructor & Destructor Documentation

Kard::Kard ( QWidget *  parent = 0  ) 

A constructor to create a plain card.

Parameters:
parent is the parent of this widget.

Kard::Kard ( const Card card,
bool  faceUp,
QWidget *  parent = 0 
)

A constructor to create a specific card.

Parameters:
card is the card the widget represents.
faceUp is weather the widget should display the card face up or face down. True means face up.
parent is the parent of this widget.

Kard::~Kard (  ) 

Destructor for our object..


Member Function Documentation

const Card & Kard::card (  ) 

This gives what card is currently being displayed.

Returns:
the card displayed.

const QPixmap & Kard::cardBack (  )  const

Gives the current image for the back of the card card.

Returns:
the card's back image.

const QPixmap & Kard::cardFront (  )  const

Gives the current image for the front of the card.

Returns:
the card's front image.

void Kard::cardSelected ( Kard kard  )  [signal]

This is the signal emitted when the card is selected by a double left click.

Parameters:
kard is *this.
Note:
The card will be set as selected when the signal is sent.

void Kard::flipCard (  ) 

This flips the displayed images. Front to back, back to front.

bool Kard::isFaceUp (  )  const

This determines if the card is facing up.

Returns:
true if it is facing up, false elsewise.

bool Kard::isSelected (  )  const

This determines if a user has selected this card.

Returns:
true if the card has been selected, false elsewise.

void Kard::mouseDoubleClickEvent ( QMouseEvent *  event  )  [protected, virtual]

This is how a user selects a card.

Parameters:
event is the generating event.
Note:
the meaning of each click is as follows:
Double clicking the left mouse button will select the card.

void Kard::mouseMoveEvent ( QMouseEvent *  event  )  [protected, virtual]

This checks to see if we are trying to drag the Kard.

Parameters:
event is the generating event.

void Kard::mousePressEvent ( QMouseEvent *  event  )  [protected, virtual]

This starts the dragging check for the card.

Parameters:
event is the generating event.

Kard & Kard::operator= ( const Kard kard  ) 

This will assign a Kard into *this.

Parameters:
kard is the kard we want to assign into *this.
Returns:
*this.

void Kard::paintEvent ( QPaintEvent *  event  )  [protected, virtual]

This draws the card image.

Parameters:
event is the source of the generating event.

void Kard::setCard ( const Card card  ) 

This sets the card we want to be displayed. The image itself is pulled from the mime source in the binary.

Parameters:
card is the card to display.
Exceptions:
KardsGTError if the card image is not found.

void Kard::setCardBack ( const QString &  cardBackFilename  ) 

This will set the card's back image.

Parameters:
cardBackFilename is the file-name to use for the image of the kard.
Exceptions:
KardsGTError if the image file cannot be found.

void Kard::setCardBack ( const QPixmap &  cardBack  ) 

This will set the card's back image. Generally this will be some design pattern.

Parameters:
cardBack is the image that the back of the card should have.
Exceptions:
KardsGTError if back is null.

void Kard::setCardFront ( const QPixmap &  cardFront  ) 

This will set the card's front image. Generally this will be the suit and rank of a card.

Parameters:
cardFront is the image that the front of the card should have.
Exceptions:
KardsGTError if front is null.

void Kard::setCardPath ( const QString &  cardPath  ) 

This will set the card's front image.

Parameters:
cardPath is the path to the directory that holds all the kard images.

void Kard::setFaceUp ( bool  faceUp  ) 

This sets whether a card should be facing up.

Parameters:
faceUp should be true if you wish for the front image to be displayed, false elsewise.

void Kard::setSelected ( bool  select  ) 

This sets whether a card has been selected.

Parameters:
select when true will select this kard, false will un-set our selection.
Note:
if select is true then cardSelected signal will be emitted.

if the card had already been selected then nothing will happen.

QSize Kard::sizeHint (  )  const

This gives the preferred size of the card.

Returns:
the size of the card.


Property Documentation

QPixmap Kard::m_cardBack [read, write]

Parameters:
m_cardBack is the image on the back of the card.

QPixmap Kard::m_cardFront [read, write]

Parameters:
m_cardFront is the image on the front of the card.

bool Kard::m_faceUp [read, write]

Parameters:
m_faceUp is true if we are displaying the front of the card and false if we're displaying the back of the card.

bool Kard::m_selected [read, write]

Parameters:
m_selected is true if the card has been selected, false elsewise.


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

Generated on Tue Aug 12 23:24:01 2008 for KardsGT by  doxygen 1.5.5