• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/ap/gpl/amule/wxWidgets-2.8.12/contrib/include/wx/deprecated/
1///////////////////////////////////////////////////////////////////////////////
2// Name:        treelay.h
3// Purpose:     wxTreeLayout class
4// Author:      Julian Smart
5// Modified by:
6// Created:     7/4/98
7// RCS-ID:      $Id: treelay.h 35650 2005-09-23 12:56:45Z MR $
8// Copyright:   (c) 1998 Julian Smart
9// Licence:     wxWindows licence
10///////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_TREELAY_H_
13#define _WX_TREELAY_H_
14
15#ifndef WX_PRECOMP
16#include "wx/object.h"
17class wxList;
18class wxDC;
19class wxMouseEvent;
20#endif
21
22#include "wx/deprecated/setup.h"
23#include "wx/string.h"
24
25#if wxUSE_TREELAYOUT
26
27class WXDLLIMPEXP_DEPRECATED wxTreeLayout: public wxObject
28{
29public:
30    wxTreeLayout();
31    virtual ~wxTreeLayout() { }
32
33    // Redefine these
34    virtual void GetChildren(long id, wxList& list) = 0;
35    virtual long GetNextNode(long id) = 0;
36    virtual long GetNodeParent(long id) = 0;
37    virtual long GetNodeX(long id) = 0;
38    virtual long GetNodeY(long id) = 0;
39    virtual void SetNodeX(long id, long x) = 0;
40    virtual void SetNodeY(long id, long y) = 0;
41    virtual void ActivateNode(long id, bool active) = 0;
42    virtual bool NodeActive(long id) = 0;
43
44    // Optional redefinition
45    void Initialize(void);
46    inline virtual void SetNodeName(long WXUNUSED(id), const wxString& WXUNUSED(name)) {}
47    inline virtual wxString GetNodeName(long WXUNUSED(id)) { return wxString(wxT("")); }
48    virtual void GetNodeSize(long id, long *x, long *y, wxDC& dc);
49    virtual void Draw(wxDC& dc);
50    virtual void DrawNodes(wxDC& dc);
51    virtual void DrawBranches(wxDC& dc);
52    virtual void DrawNode(long id, wxDC& dc);
53    virtual void DrawBranch(long from, long to, wxDC& dc);
54
55    // Don't redefine
56    virtual void DoLayout(wxDC& dc, long topNode = -1);
57
58    // Accessors -- don't redefine
59    inline void SetTopNode(long id) { m_parentNode = id; }
60    inline long GetTopNode(void) const { return m_parentNode; }
61    inline void SetSpacing(long x, long y) { m_xSpacing = x; m_ySpacing = y; }
62    inline long GetXSpacing(void) const { return m_xSpacing; }
63    inline long GetYSpacing(void) const { return m_ySpacing; }
64    inline void SetMargins(long x, long y) { m_leftMargin = x; m_topMargin = y; }
65    inline long GetTopMargin(void) const { return m_topMargin; }
66    inline long GetLeftMargin(void) const { return m_leftMargin; }
67
68    inline bool GetOrientation(void) const { return m_orientation; }
69    inline void SetOrientation(bool orient) { m_orientation = orient; }
70
71private:
72    void CalcLayout(long node_id, int level, wxDC& dc);
73
74protected:
75    long          m_parentNode;
76    long          m_lastY;
77    long          m_lastX;
78    long          m_xSpacing;
79    long          m_ySpacing;
80    long          m_topMargin;
81    long          m_leftMargin;
82    bool          m_orientation; // true for top-to-bottom, false for left-to-right
83
84private:
85    DECLARE_ABSTRACT_CLASS(wxTreeLayout)
86};
87
88class WXDLLIMPEXP_DEPRECATED wxStoredNode
89{
90public:
91    wxString      m_name;
92    long          m_x, m_y;
93    long          m_parentId;
94    bool          m_active;
95    long          m_clientData;
96};
97
98/*
99 * A version of wxTreeLayout with storage for nodes
100 */
101
102class WXDLLIMPEXP_DEPRECATED wxTreeLayoutStored: public wxTreeLayout
103{
104public:
105    wxTreeLayoutStored(int noNodes = 200);
106    virtual ~wxTreeLayoutStored(void);
107    void Initialize(int n);
108
109    wxString HitTest(wxMouseEvent& event, wxDC& dc);
110    wxStoredNode* GetNode(long id) const;
111    inline int GetNumNodes() const { return m_maxNodes; };
112    inline int GetNodeCount() const { return m_num; };
113
114    virtual void GetChildren(long id, wxList& list);
115    virtual long GetNextNode(long id);
116    virtual long GetNodeParent(long id);
117    virtual long GetNodeX(long id);
118    virtual long GetNodeY(long id);
119    virtual void SetNodeX(long id, long x);
120    virtual void SetNodeY(long id, long y);
121    virtual void SetNodeName(long id, const wxString& name);
122    virtual wxString GetNodeName(long id);
123    virtual void ActivateNode(long id, bool active);
124    virtual bool NodeActive(long id);
125    virtual void SetClientData(long id, long clientData);
126    virtual long GetClientData(long id) const;
127
128    virtual long AddChild(const wxString& name, const wxString& parent = wxT(""));
129    virtual long AddChild(const wxString& name, long parent);
130    virtual long NameToId(const wxString& name);
131
132    // Data members
133private:
134    wxStoredNode*     m_nodes;
135    int               m_num;
136    int               m_maxNodes;
137
138private:
139    DECLARE_DYNAMIC_CLASS(wxTreeLayoutStored)
140    DECLARE_NO_COPY_CLASS(wxTreeLayoutStored)
141};
142
143// For backward compatibility
144#define wxStoredTree wxTreeLayoutStored
145
146#endif
147    // wxUSE_TREELAYOUT
148
149#endif
150 // _WX_TREELAY_H_
151
152