X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f6bcfd974ef26faf6f91a62cac09827e09463fd1..5c6bd4a9570c63619275710f0b91a93231532b98:/include/wx/generic/treelay.h diff --git a/include/wx/generic/treelay.h b/include/wx/generic/treelay.h index 02a697132f..b202da646e 100644 --- a/include/wx/generic/treelay.h +++ b/include/wx/generic/treelay.h @@ -2,7 +2,7 @@ // Name: treelay.h // Purpose: wxTreeLayout class // Author: Julian Smart -// Modified by: +// Modified by: // Created: 7/4/98 // RCS-ID: $Id$ // Copyright: (c) 1998 Julian Smart @@ -12,19 +12,27 @@ #ifndef _WX_TREELAY_H_ #define _WX_TREELAY_H_ -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(__APPLE__) #pragma interface "wxtree.h" #endif -#include +#ifndef WX_PRECOMP +#include "wx/object.h" +class wxList; +class wxDC; +class wxMouseEvent; +#endif + +#include "wx/string.h" + +#if wxUSE_TREELAYOUT class WXDLLEXPORT wxTreeLayout: public wxObject { - DECLARE_ABSTRACT_CLASS(wxTreeLayout) - public: wxTreeLayout(); - + virtual ~wxTreeLayout() { } + // Redefine these virtual void GetChildren(long id, wxList& list) = 0; virtual long GetNextNode(long id) = 0; @@ -35,21 +43,21 @@ public: virtual void SetNodeY(long id, long y) = 0; virtual void ActivateNode(long id, bool active) = 0; virtual bool NodeActive(long id) = 0; - + // Optional redefinition void Initialize(void); - inline virtual void SetNodeName(long id, const wxString& name) {} - inline virtual wxString GetNodeName(long id) { return wxString(""); } + inline virtual void SetNodeName(long WXUNUSED(id), const wxString& WXUNUSED(name)) {} + inline virtual wxString GetNodeName(long WXUNUSED(id)) { return wxString(wxT("")); } virtual void GetNodeSize(long id, long *x, long *y, wxDC& dc); virtual void Draw(wxDC& dc); virtual void DrawNodes(wxDC& dc); virtual void DrawBranches(wxDC& dc); virtual void DrawNode(long id, wxDC& dc); virtual void DrawBranch(long from, long to, wxDC& dc); - + // Don't redefine virtual void DoLayout(wxDC& dc, long topNode = -1); - + // Accessors -- don't redefine inline void SetTopNode(long id) { m_parentNode = id; } inline long GetTopNode(void) const { return m_parentNode; } @@ -59,15 +67,13 @@ public: inline void SetMargins(long x, long y) { m_leftMargin = x; m_topMargin = y; } inline long GetTopMargin(void) const { return m_topMargin; } inline long GetLeftMargin(void) const { return m_leftMargin; } - + inline bool GetOrientation(void) const { return m_orientation; } inline void SetOrientation(bool orient) { m_orientation = orient; } - + private: void CalcLayout(long node_id, int level, wxDC& dc); - - // Members - + protected: long m_parentNode; long m_lastY; @@ -77,6 +83,9 @@ protected: long m_topMargin; long m_leftMargin; bool m_orientation; // TRUE for top-to-bottom, FALSE for left-to-right + +private: + DECLARE_ABSTRACT_CLASS(wxTreeLayout) }; class WXDLLEXPORT wxStoredNode @@ -95,17 +104,16 @@ public: class WXDLLEXPORT wxTreeLayoutStored: public wxTreeLayout { - DECLARE_DYNAMIC_CLASS(wxTreeLayoutStored) public: wxTreeLayoutStored(int noNodes = 200); - ~wxTreeLayoutStored(void); + virtual ~wxTreeLayoutStored(void); void Initialize(int n); - + wxString HitTest(wxMouseEvent& event, wxDC& dc); wxStoredNode* GetNode(long id) const; inline int GetNumNodes() const { return m_maxNodes; }; inline int GetNodeCount() const { return m_num; }; - + virtual void GetChildren(long id, wxList& list); virtual long GetNextNode(long id); virtual long GetNodeParent(long id); @@ -119,20 +127,27 @@ public: virtual bool NodeActive(long id); virtual void SetClientData(long id, long clientData); virtual long GetClientData(long id) const; - - virtual long AddChild(const wxString& name, const wxString& parent = ""); + + virtual long AddChild(const wxString& name, const wxString& parent = wxT("")); + virtual long AddChild(const wxString& name, long parent); virtual long NameToId(const wxString& name); - + // Data members private: wxStoredNode* m_nodes; int m_num; int m_maxNodes; + +private: + DECLARE_DYNAMIC_CLASS(wxTreeLayoutStored) }; // For backward compatibility #define wxStoredTree wxTreeLayoutStored +#endif + // wxUSE_TREELAYOUT + #endif // _WX_TREELAY_H_ - +