JX Application Framework
|
#include <JTreeNode.h>
Public Member Functions | |
JTreeNode (JTree *tree, const bool isOpenable=true) | |
~JTreeNode () override | |
bool | IsRoot () const |
JSize | GetDepth () const |
JTree * | GetTree () |
const JTree * | GetTree () const |
bool | HasTree () const |
bool | GetTree (JTree **tree) |
bool | GetTree (const JTree **tree) const |
JTreeNode * | GetParent () |
const JTreeNode * | GetParent () 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 |
JTreeNode * | GetChild (const JIndex index) |
const JTreeNode * | GetChild (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) |
![]() | |
JBroadcaster () | |
virtual | ~JBroadcaster () |
JBroadcaster & | operator= (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 |
![]() | |
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 |
Base class for elements stored by JTree. (not virtual since this is root class, and it needs to be lightweight)
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.
|
override |
|
inline |
Fills the list with all of our descendants. We do not clear the list first.
void JTreeNode::DeleteAllChildren | ( | ) |
void JTreeNode::DisconnectFromParent | ( | ) |
Removes us from our parent, if we have one.
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.
|
inline |
|
inline |
|
inline |
JSize JTreeNode::GetDescendantCount | ( | ) | const |
Returns the total number of descendants of this node.
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.
JTreeNode * JTreeNode::GetParent | ( | ) |
const JTreeNode * JTreeNode::GetParent | ( | ) | const |
JTree * JTreeNode::GetTree | ( | ) |
const JTree * JTreeNode::GetTree | ( | ) | const |
|
inline |
|
inline |
|
inline |
void JTreeNode::InsertSorted | ( | JTreeNode * | child | ) |
|
inline |
bool JTreeNode::IsRoot | ( | ) | const |
|
virtual |
Not inline because it is virtual.
|
inline |
|
overrideprotectedvirtual |
We have to broadcast messages while itsChildren is sorted. We only get these messages if itsTree != nullptr.
Reimplemented from JBroadcaster.
void JTreeNode::Remove | ( | JTreeNode * | child | ) |
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.
|
protected |
void JTreeNode::SortChildren | ( | const bool | propagate = false | ) |
Useful for forcing a sort if the children have changed.
|
friend |