JX Application Framework
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | List of all members
JTableSelectionIterator Class Reference

#include <JTableSelectionIterator.h>

Inheritance diagram for JTableSelectionIterator:
[legend]

Public Types

enum  Direction {
  kIterateByRow ,
  kIterateByCol
}
 
enum  Position {
  kStartAtBeginning ,
  kStartAtEnd ,
  kStartBefore ,
  kStartAfter
}
 

Public Member Functions

 JTableSelectionIterator (const JTableSelection *tableSelection, const Direction d=kIterateByCol, const Position start=kStartAtBeginning, const JIndex row=0, const JIndex col=0)
 
 JTableSelectionIterator (const JTableSelectionIterator &source)
 
 ~JTableSelectionIterator () override
 
Direction GetDirection () const
 
void SetDirection (const Direction d)
 
bool Prev (JPoint *cell)
 
bool Prev (JIndex *row, JIndex *col)
 
bool Next (JPoint *cell)
 
bool Next (JIndex *row, JIndex *col)
 
void MoveTo (const Position newPosition, const JPoint &cell)
 
void MoveTo (const Position newPosition, const JIndex row, const JIndex col)
 
bool AtBeginning () const
 
bool AtEnd () const
 
- Public Member Functions inherited from JBroadcaster
 JBroadcaster ()
 
virtual ~JBroadcaster ()
 
JBroadcasteroperator= (const JBroadcaster &source)
 
bool HasSenders () const
 
JSize GetSenderCount () const
 
bool HasRecipients () const
 
JSize GetRecipientCount () const
 
virtual JString ToString () const
 
template<class T >
void ListenTo (const JBroadcaster *sender, const std::function< void(const T &)> &f)
 

Protected Member Functions

const JTableSelectionGetTableSelection () const
 
void Receive (JBroadcaster *sender, const Message &message) override
 
void ReceiveGoingAway (JBroadcaster *sender) override
 
- Protected Member Functions inherited from JBroadcaster
 JBroadcaster (const JBroadcaster &source)
 
void ListenTo (const JBroadcaster *sender)
 
void StopListening (const JBroadcaster *sender)
 
void ClearWhenGoingAway (const JBroadcaster *sender, void *pointerToMember)
 
void StopListening (const JBroadcaster *sender, const std::type_info &messageType)
 
template<class T >
void Send (JBroadcaster *recipient, const T &message)
 
template<class T >
void Broadcast (const T &message)
 
void SendWithFeedback (JBroadcaster *recipient, Message *message)
 
void BroadcastWithFeedback (Message *message)
 
virtual void ReceiveWithFeedback (JBroadcaster *sender, Message *message)
 

Detailed Description

This class provides a simple, error-resistant way to retrieve the
coordinates of the cells that are selected and can iterate over the
table either by row or by column.

The cursor values run from one to row/col count.

Member Enumeration Documentation

◆ Direction

Enumerator
kIterateByRow 
kIterateByCol 

◆ Position

Enumerator
kStartAtBeginning 
kStartAtEnd 
kStartBefore 
kStartAfter 

Constructor & Destructor Documentation

◆ JTableSelectionIterator() [1/2]

JTableSelectionIterator::JTableSelectionIterator ( const JTableSelection tableSelection,
const Direction  d = kIterateByCol,
const Position  start = kStartAtBeginning,
const JIndex  row = 0,
const JIndex  col = 0 
)

We can't overload the constructor to provide one that takes a JPoint because then the compiler can't tell which one to call because of all the default values.

◆ JTableSelectionIterator() [2/2]

JTableSelectionIterator::JTableSelectionIterator ( const JTableSelectionIterator source)

◆ ~JTableSelectionIterator()

JTableSelectionIterator::~JTableSelectionIterator ( )
override

Member Function Documentation

◆ AtBeginning()

bool JTableSelectionIterator::AtBeginning ( ) const

Return true if iterator is positioned at the top left of the table or if the table has been deleted.

◆ AtEnd()

bool JTableSelectionIterator::AtEnd ( ) const

Return true if iterator is positioned at the bottom right of the table or if the table has been deleted.

◆ GetDirection()

JTableSelectionIterator::Direction JTableSelectionIterator::GetDirection ( ) const
inline

◆ GetTableSelection()

const JTableSelection * JTableSelectionIterator::GetTableSelection ( ) const
inlineprotected

◆ MoveTo() [1/2]

void JTableSelectionIterator::MoveTo ( const Position  newPosition,
const JIndex  row,
const JIndex  col 
)
inline

◆ MoveTo() [2/2]

void JTableSelectionIterator::MoveTo ( const Position  newPosition,
const JPoint cell 
)

◆ Next() [1/2]

bool JTableSelectionIterator::Next ( JIndex row,
JIndex col 
)

Return true if there is a next selected cell, fetching the coordinates of the cell and incrementing the iterator position. Otherwise return false without fetching or incrementing.

◆ Next() [2/2]

bool JTableSelectionIterator::Next ( JPoint cell)

◆ Prev() [1/2]

bool JTableSelectionIterator::Prev ( JIndex row,
JIndex col 
)

Return true if there is a previous selected cell, fetching the coordinates of the cell and decrementing the iterator position. Otherwise return false without fetching or decrementing.

◆ Prev() [2/2]

bool JTableSelectionIterator::Prev ( JPoint cell)

◆ Receive()

void JTableSelectionIterator::Receive ( JBroadcaster sender,
const Message message 
)
overrideprotectedvirtual

Process the given message from the given sender. This function is not pure virtual because not all classes will want to implement it.

Reimplemented from JBroadcaster.

◆ ReceiveGoingAway()

void JTableSelectionIterator::ReceiveGoingAway ( JBroadcaster sender)
overrideprotectedvirtual

The given sender has been deleted.

Warning: Since this function may be called from within a -chain- of destructors, it is not usually safe to do anything inside this function other than directly changing instance variables (e.g. setting pointers to nullptr).

This function is not pure virtual because not all classes will want to implement it.

Reimplemented from JBroadcaster.

◆ SetDirection()

void JTableSelectionIterator::SetDirection ( const Direction  d)
inline

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