X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4a3bdee6a979146c426cd058e9bfe6b58135b124..3285ee538be44537a0d4e43252db18f5e7362782:/contrib/src/deprecated/treelay.cpp diff --git a/contrib/src/deprecated/treelay.cpp b/contrib/src/deprecated/treelay.cpp index f9cac7c4e0..ffdfddf21f 100644 --- a/contrib/src/deprecated/treelay.cpp +++ b/contrib/src/deprecated/treelay.cpp @@ -44,22 +44,22 @@ wxTreeLayout::wxTreeLayout() m_ySpacing = 20; m_topMargin = 5; m_leftMargin = 5; - m_orientation = FALSE; + m_orientation = false; m_parentNode = 0; } void wxTreeLayout::DoLayout(wxDC& dc, long topId) { - if (topId != -1) + if (topId != wxID_ANY) SetTopNode(topId); long actualTopId = GetTopNode(); long id = actualTopId; - while (id != -1) + while (id != wxID_ANY) { SetNodeX(id, 0); SetNodeY(id, 0); - ActivateNode(id, FALSE); + ActivateNode(id, false); id = GetNextNode(id); } m_lastY = m_topMargin; @@ -77,7 +77,7 @@ void wxTreeLayout::Draw(wxDC& dc) void wxTreeLayout::DrawNodes(wxDC& dc) { long id = GetTopNode(); - while (id != -1) + while (id != wxID_ANY) { if (NodeActive(id)) DrawNode(id, dc); @@ -88,9 +88,9 @@ void wxTreeLayout::DrawNodes(wxDC& dc) void wxTreeLayout::DrawBranches(wxDC& dc) { long id = GetTopNode(); - while (id != -1) + while (id != wxID_ANY) { - if (GetNodeParent(id) > -1) + if (GetNodeParent(id) != wxID_ANY) { long parent = GetNodeParent(id); if (NodeActive(parent)) @@ -144,7 +144,7 @@ void wxTreeLayout::CalcLayout(long nodeId, int level, wxDC& dc) GetChildren(nodeId, children); int n = children.GetCount(); - if (m_orientation == FALSE) + if (m_orientation == false) { // Left to right // X Calculations @@ -155,12 +155,12 @@ void wxTreeLayout::CalcLayout(long nodeId, int level, wxDC& dc) long x = 0; long y = 0; long parentId = GetNodeParent(nodeId); - if (parentId != -1) + if (parentId != wxID_ANY) GetNodeSize(parentId, &x, &y, dc); SetNodeX(nodeId, (long)(GetNodeX(parentId) + m_xSpacing + x)); } - wxNode *node = children.GetFirst(); + wxList::compatibility_iterator node = children.GetFirst(); while (node) { CalcLayout((long)node->GetData(), level+1, dc); @@ -169,7 +169,7 @@ void wxTreeLayout::CalcLayout(long nodeId, int level, wxDC& dc) // Y Calculations long averageY; - ActivateNode(nodeId, TRUE); + ActivateNode(nodeId, true); if (n > 0) { @@ -204,12 +204,12 @@ void wxTreeLayout::CalcLayout(long nodeId, int level, wxDC& dc) long x = 0; long y = 0; long parentId = GetNodeParent(nodeId); - if (parentId != -1) + if (parentId != wxID_ANY) GetNodeSize(parentId, &x, &y, dc); SetNodeY(nodeId, (long)(GetNodeY(parentId) + m_ySpacing + y)); } - wxNode *node = children.GetFirst(); + wxList::compatibility_iterator node = children.GetFirst(); while (node) { CalcLayout((long)node->GetData(), level+1, dc); @@ -218,7 +218,7 @@ void wxTreeLayout::CalcLayout(long nodeId, int level, wxDC& dc) // X Calculations long averageX; - ActivateNode(nodeId, TRUE); + ActivateNode(nodeId, true); if (n > 0) { @@ -273,8 +273,8 @@ void wxTreeLayoutStored::Initialize(int n) for (i = 0; i < n; i++) { m_nodes[i].m_name = wxT(""); - m_nodes[i].m_active = FALSE; - m_nodes[i].m_parentId = -1; + m_nodes[i].m_active = false; + m_nodes[i].m_parentId = wxID_ANY; m_nodes[i].m_x = 0; m_nodes[i].m_y = 0; } @@ -311,17 +311,17 @@ long wxTreeLayoutStored::AddChild(const wxString& name, long parent) { i = parent; } - else + else { m_parentNode = m_num; } - + m_nodes[m_num].m_parentId = i; m_nodes[m_num].m_name = name; m_nodes[m_num].m_x = m_nodes[m_num].m_y = 0; m_nodes[m_num].m_clientData = 0; m_num ++; - + return (m_num - 1); } else @@ -340,7 +340,7 @@ long wxTreeLayoutStored::NameToId(const wxString& name) void wxTreeLayoutStored::GetChildren(long id, wxList& list) { long currentId = GetTopNode(); - while (currentId != -1) + while (currentId != wxID_ANY) { if (id == GetNodeParent(currentId)) list.Append((wxObject *)currentId); @@ -399,24 +399,24 @@ wxString wxTreeLayoutStored::GetNodeName(long id) long wxTreeLayoutStored::GetNodeParent(long id) { - if (id != -1) + if (id != wxID_ANY) { wxASSERT(id < m_num); return m_nodes[id].m_parentId; } else - return -1; + return wxNOT_FOUND; } long wxTreeLayoutStored::GetNextNode(long id) { wxASSERT(id < m_num); - if ((id != -1) && (id < (m_num - 1))) + if ((id != wxID_ANY) && (id < (m_num - 1))) return id + 1; else - return -1; + return wxNOT_FOUND; } void wxTreeLayoutStored::SetClientData(long id, long clientData)