]> git.saurik.com Git - wxWidgets.git/blame_incremental - contrib/include/wx/gizmos/splittree.h
disable the first top level parent, not the topmost top level parent
[wxWidgets.git] / contrib / include / wx / gizmos / splittree.h
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: splittree.h
3// Purpose: Classes to achieve a remotely-scrolled tree in a splitter
4// window that can be scrolled by a scrolled window higher in the
5// hierarchy
6// Author: Julian Smart
7// Modified by:
8// Created: 8/7/2000
9// RCS-ID: $Id$
10// Copyright: (c) Julian Smart
11// Licence: wxWindows licence
12/////////////////////////////////////////////////////////////////////////////
13
14#ifndef _WX_SPLITTREE_H_
15#define _WX_SPLITTREE_H_
16
17#if defined(__GNUG__) && !defined(__APPLE__)
18 #pragma interface "splittree.h"
19#endif
20
21#include "wx/gizmos/gizmos.h"
22
23// Set this to 1 to use generic tree control (doesn't yet work properly)
24#define USE_GENERIC_TREECTRL 0
25
26#include "wx/wx.h"
27#include "wx/treectrl.h"
28#include "wx/splitter.h"
29#include "wx/scrolwin.h"
30
31#if USE_GENERIC_TREECTRL
32#include "wx/generic/treectlg.h"
33#ifndef wxTreeCtrl
34#define wxTreeCtrl wxGenericTreeCtrl
35#define sm_classwxTreeCtrl sm_classwxGenericTreeCtrl
36#endif
37#endif
38
39class wxRemotelyScrolledTreeCtrl;
40class wxThinSplitterWindow;
41class wxSplitterScrolledWindow;
42
43/*
44 * wxRemotelyScrolledTreeCtrl
45 *
46 * This tree control disables its vertical scrollbar and catches scroll
47 * events passed by a scrolled window higher in the hierarchy.
48 * It also updates the scrolled window vertical scrollbar as appropriate.
49 */
50
51class WXDLLIMPEXP_GIZMOS wxRemotelyScrolledTreeCtrl: public wxTreeCtrl
52{
53 DECLARE_CLASS(wxRemotelyScrolledTreeCtrl)
54public:
55 wxRemotelyScrolledTreeCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pt = wxDefaultPosition,
56 const wxSize& sz = wxDefaultSize, long style = wxTR_HAS_BUTTONS);
57 ~wxRemotelyScrolledTreeCtrl();
58
59//// Events
60 void OnSize(wxSizeEvent& event);
61 void OnExpand(wxTreeEvent& event);
62 void OnScroll(wxScrollWinEvent& event);
63 void OnPaint(wxPaintEvent& event);
64
65//// Overrides
66 // Override this in case we're using the generic tree control.
67 // Calls to this should disable the vertical scrollbar.
68
69 // Number of pixels per user unit (0 or -1 for no scrollbar)
70 // Length of virtual canvas in user units
71 // Length of page in user units
72 virtual void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY,
73 int noUnitsX, int noUnitsY,
74 int xPos = 0, int yPos = 0,
75 bool noRefresh = false );
76
77 // In case we're using the generic tree control.
78 // Get the view start
79 virtual void GetViewStart(int *x, int *y) const;
80
81 // In case we're using the generic tree control.
82 virtual void PrepareDC(wxDC& dc);
83
84 // In case we're using the generic tree control.
85 virtual int GetScrollPos(int orient) const;
86
87//// Helpers
88 void HideVScrollbar();
89
90 // Calculate the tree overall size so we can set the scrollbar
91 // correctly
92 void CalcTreeSize(wxRect& rect);
93 void CalcTreeSize(const wxTreeItemId& id, wxRect& rect);
94
95 // Adjust the containing wxScrolledWindow's scrollbars appropriately
96 void AdjustRemoteScrollbars();
97
98 // Find the scrolled window that contains this control
99 wxScrolledWindow* GetScrolledWindow() const;
100
101 // Scroll to the given line (in scroll units where each unit is
102 // the height of an item)
103 void ScrollToLine(int posHoriz, int posVert);
104
105//// Accessors
106
107 // The companion window is one which will get notified when certain
108 // events happen such as node expansion
109 void SetCompanionWindow(wxWindow* companion) { m_companionWindow = companion; }
110 wxWindow* GetCompanionWindow() const { return m_companionWindow; }
111
112
113 DECLARE_EVENT_TABLE()
114protected:
115 wxWindow* m_companionWindow;
116 bool m_drawRowLines;
117};
118
119/*
120 * wxTreeCompanionWindow
121 *
122 * A window displaying values associated with tree control items.
123 */
124
125class WXDLLIMPEXP_GIZMOS wxTreeCompanionWindow: public wxWindow
126{
127public:
128 DECLARE_CLASS(wxTreeCompanionWindow)
129
130 wxTreeCompanionWindow(wxWindow* parent, wxWindowID id = wxID_ANY,
131 const wxPoint& pos = wxDefaultPosition,
132 const wxSize& sz = wxDefaultSize,
133 long style = 0);
134
135//// Overrides
136 virtual void DrawItem(wxDC& dc, wxTreeItemId id, const wxRect& rect);
137
138//// Events
139 void OnPaint(wxPaintEvent& event);
140 void OnScroll(wxScrollWinEvent& event);
141 void OnExpand(wxTreeEvent& event);
142
143//// Operations
144
145//// Accessors
146 wxRemotelyScrolledTreeCtrl* GetTreeCtrl() const { return m_treeCtrl; };
147 void SetTreeCtrl(wxRemotelyScrolledTreeCtrl* treeCtrl) { m_treeCtrl = treeCtrl; }
148
149//// Data members
150protected:
151 wxRemotelyScrolledTreeCtrl* m_treeCtrl;
152
153 DECLARE_EVENT_TABLE()
154};
155
156
157/*
158 * wxThinSplitterWindow
159 *
160 * Implements a splitter with a less obvious sash
161 * than the usual one.
162 */
163
164class WXDLLIMPEXP_GIZMOS wxThinSplitterWindow: public wxSplitterWindow
165{
166public:
167 DECLARE_DYNAMIC_CLASS(wxThinSplitterWindow)
168
169 wxThinSplitterWindow(wxWindow* parent, wxWindowID id = wxID_ANY,
170 const wxPoint& pos = wxDefaultPosition,
171 const wxSize& sz = wxDefaultSize,
172 long style = wxSP_3D | wxCLIP_CHILDREN);
173 ~wxThinSplitterWindow();
174
175//// Overrides
176
177 void SizeWindows();
178 // Tests for x, y over sash. Overriding this allows us to increase
179 // the tolerance.
180 bool SashHitTest(int x, int y, int tolerance = 2);
181 void DrawSash(wxDC& dc);
182
183//// Events
184
185 void OnSize(wxSizeEvent& event);
186
187//// Operations
188
189//// Accessors
190
191//// Data members
192protected:
193 wxPen* m_facePen;
194 wxBrush* m_faceBrush;
195
196 DECLARE_EVENT_TABLE()
197};
198
199/*
200 * wxSplitterScrolledWindow
201 *
202 * This scrolled window is aware of the fact that one of its
203 * children is a splitter window. It passes on its scroll events
204 * (after some processing) to both splitter children for them
205 * scroll appropriately.
206 */
207
208class WXDLLIMPEXP_GIZMOS wxSplitterScrolledWindow: public wxScrolledWindow
209{
210public:
211 DECLARE_DYNAMIC_CLASS(wxSplitterScrolledWindow)
212
213 wxSplitterScrolledWindow(wxWindow* parent, wxWindowID id = wxID_ANY,
214 const wxPoint& pos = wxDefaultPosition,
215 const wxSize& sz = wxDefaultSize,
216 long style = 0);
217
218//// Overrides
219
220//// Events
221
222 void OnScroll(wxScrollWinEvent& event);
223 void OnSize(wxSizeEvent& event);
224
225//// Operations
226
227//// Accessors
228
229//// Data members
230public:
231 DECLARE_EVENT_TABLE()
232};
233
234#endif
235 // _SPLITTREE_H_