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

#include <JTreeNode.h>

Inheritance diagram for JTreeNode:
[legend]

Public Member Functions

 JTreeNode (JTree *tree, const bool isOpenable=true)
 
 ~JTreeNode () override
 
bool IsRoot () const
 
JSize GetDepth () const
 
JTreeGetTree ()
 
const JTreeGetTree () const
 
bool HasTree () const
 
bool GetTree (JTree **tree)
 
bool GetTree (const JTree **tree) const
 
JTreeNodeGetParent ()
 
const JTreeNodeGetParent () const
 
bool HasParent () const
 
bool GetParent (JTreeNode **parent)
 
bool GetParent (const JTreeNode **parent) const
 
JIndex GetIndexInParent () const
 
bool GetIndexInParent (JIndex *index) const
 
void DisconnectFromParent ()
 
bool IsOpenable () const
 
virtual bool OKToOpen () const
 
bool HasChildren () const
 
JSize GetChildCount () const
 
JTreeNodeGetChild (const JIndex index)
 
const JTreeNodeGetChild (const JIndex index) const
 
JSize GetDescendantCount () const
 
void CollectDescendants (JPtrArray< JTreeNode > *list)
 
bool FindChild (const JTreeNode *child, JIndex *index) const
 
bool ChildIndexValid (const JIndex index) const
 
void InsertAtIndex (const JIndex index, JTreeNode *child)
 
void Prepend (JTreeNode *child)
 
void Append (JTreeNode *child)
 
void InsertBefore (const JTreeNode *before, JTreeNode *child)
 
void InsertAfter (const JTreeNode *after, JTreeNode *child)
 
void Remove (JTreeNode *child)
 
void DeleteAllChildren ()
 
void InsertSorted (JTreeNode *child)
 
bool GetChildCompareFunction (std::function< std::weak_ordering(JTreeNode *const &, JTreeNode *const &)> **compare, JListT::SortOrder *order)
 
void SetChildCompareFunction (const std::function< std::weak_ordering(JTreeNode *const &, JTreeNode *const &)> compare, const JListT::SortOrder order, const bool propagate)
 
void SortChildren (const bool propagate=false)
 
void MoveToIndex (JTreeNode *child, const JIndex index)
 
void MoveBefore (const JTreeNode *before, JTreeNode *child)
 
void MoveAfter (const JTreeNode *after, JTreeNode *child)
 
- 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

void ShouldBeOpenable (const bool openable)
 
void Receive (JBroadcaster *sender, const Message &message) 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)
 
virtual void ReceiveGoingAway (JBroadcaster *sender)
 

Friends

class JTree
 

Detailed Description

Base class for elements stored by JTree.


(not virtual since this is root class, and it needs to be lightweight)

Constructor & Destructor Documentation

◆ JTreeNode()

JTreeNode::JTreeNode ( JTree tree,
const bool  isOpenable = true 
)

tree can be nullptr. By not providing a constructor that takes a parent, we allow tree to be nullptr, and we allow JNamedTreeList to keep a sorted list of nodes.

◆ ~JTreeNode()

JTreeNode::~JTreeNode ( )
override

Member Function Documentation

◆ Append()

void JTreeNode::Append ( JTreeNode child)
inline

◆ ChildIndexValid()

bool JTreeNode::ChildIndexValid ( const JIndex  index) const
inline

◆ CollectDescendants()

void JTreeNode::CollectDescendants ( JPtrArray< JTreeNode > *  list)

Fills the list with all of our descendants. We do not clear the list first.

◆ DeleteAllChildren()

void JTreeNode::DeleteAllChildren ( )

◆ DisconnectFromParent()

void JTreeNode::DisconnectFromParent ( )

Removes us from our parent, if we have one.

◆ FindChild()

bool JTreeNode::FindChild ( const JTreeNode child,
JIndex index 
) const
inline

◆ GetChild() [1/2]

JTreeNode * JTreeNode::GetChild ( const JIndex  index)

We assert that it has children so clients don't have to. This is consistent because it already asserts if index is invalid, and not having any children implies that all indices are invalid.

◆ GetChild() [2/2]

const JTreeNode * JTreeNode::GetChild ( const JIndex  index) const

◆ GetChildCompareFunction()

bool JTreeNode::GetChildCompareFunction ( std::function< std::weak_ordering(JTreeNode *const &, JTreeNode *const &)> **  compare,
JListT::SortOrder order 
)
inline

◆ GetChildCount()

JSize JTreeNode::GetChildCount ( ) const
inline

◆ GetDepth()

JSize JTreeNode::GetDepth ( ) const
inline

◆ GetDescendantCount()

JSize JTreeNode::GetDescendantCount ( ) const

Returns the total number of descendants of this node.

◆ GetIndexInParent() [1/2]

JIndex JTreeNode::GetIndexInParent ( ) const

The first version asserts that we have a parent. The second version returns false if we don't have a parent.

◆ GetIndexInParent() [2/2]

bool JTreeNode::GetIndexInParent ( JIndex index) const

◆ GetParent() [1/4]

JTreeNode * JTreeNode::GetParent ( )

◆ GetParent() [2/4]

const JTreeNode * JTreeNode::GetParent ( ) const

◆ GetParent() [3/4]

bool JTreeNode::GetParent ( const JTreeNode **  parent) const
inline

◆ GetParent() [4/4]

bool JTreeNode::GetParent ( JTreeNode **  parent)
inline

◆ GetTree() [1/4]

JTree * JTreeNode::GetTree ( )

◆ GetTree() [2/4]

const JTree * JTreeNode::GetTree ( ) const

◆ GetTree() [3/4]

bool JTreeNode::GetTree ( const JTree **  tree) const
inline

◆ GetTree() [4/4]

bool JTreeNode::GetTree ( JTree **  tree)
inline

◆ HasChildren()

bool JTreeNode::HasChildren ( ) const
inline

◆ HasParent()

bool JTreeNode::HasParent ( ) const
inline

◆ HasTree()

bool JTreeNode::HasTree ( ) const
inline

◆ InsertAfter()

void JTreeNode::InsertAfter ( const JTreeNode after,
JTreeNode child 
)

◆ InsertAtIndex()

void JTreeNode::InsertAtIndex ( const JIndex  index,
JTreeNode child 
)

◆ InsertBefore()

void JTreeNode::InsertBefore ( const JTreeNode before,
JTreeNode child 
)

◆ InsertSorted()

void JTreeNode::InsertSorted ( JTreeNode child)

◆ IsOpenable()

bool JTreeNode::IsOpenable ( ) const
inline

◆ IsRoot()

bool JTreeNode::IsRoot ( ) const

◆ MoveAfter()

void JTreeNode::MoveAfter ( const JTreeNode after,
JTreeNode child 
)
inline

◆ MoveBefore()

void JTreeNode::MoveBefore ( const JTreeNode before,
JTreeNode child 
)
inline

◆ MoveToIndex()

void JTreeNode::MoveToIndex ( JTreeNode child,
const JIndex  index 
)
inline

◆ OKToOpen()

bool JTreeNode::OKToOpen ( ) const
virtual

Not inline because it is virtual.

◆ Prepend()

void JTreeNode::Prepend ( JTreeNode child)
inline

◆ Receive()

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

We have to broadcast messages while itsChildren is sorted. We only get these messages if itsTree != nullptr.

Reimplemented from JBroadcaster.

◆ Remove()

void JTreeNode::Remove ( JTreeNode child)

◆ SetChildCompareFunction()

void JTreeNode::SetChildCompareFunction ( const std::function< std::weak_ordering(JTreeNode *const &, JTreeNode *const &)>  compare,
const JListT::SortOrder  order,
const bool  propagate 
)

If propagate, sets the same compareFn on all descendants.

◆ ShouldBeOpenable()

void JTreeNode::ShouldBeOpenable ( const bool  openable)
protected

◆ SortChildren()

void JTreeNode::SortChildren ( const bool  propagate = false)

Useful for forcing a sort if the children have changed.

Friends And Related Symbol Documentation

◆ JTree

friend class JTree
friend

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