]> git.saurik.com Git - wxWidgets.git/blame - contrib/include/wx/gizmos/splittree.h
compilation fix
[wxWidgets.git] / contrib / include / wx / gizmos / splittree.h
CommitLineData
58580a7e
JS
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
ab7ce33c 17#if defined(__GNUG__) && !defined(__APPLE__)
7f60145d 18 #pragma interface "splittree.h"
58580a7e
JS
19#endif
20
936a13b5 21#include "wx/gizmos/gizmos.h"
086ab766 22
58580a7e
JS
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
936a13b5 51class WXDLLIMPEXP_GIZMOS wxRemotelyScrolledTreeCtrl: public wxTreeCtrl
58580a7e 52{
7f60145d 53 DECLARE_CLASS(wxRemotelyScrolledTreeCtrl)
58580a7e
JS
54public:
55 wxRemotelyScrolledTreeCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pt = wxDefaultPosition,
56 const wxSize& sz = wxDefaultSize, long style = wxTR_HAS_BUTTONS);
7f60145d 57 ~wxRemotelyScrolledTreeCtrl();
58580a7e
JS
58
59//// Events
7f60145d
RD
60 void OnSize(wxSizeEvent& event);
61 void OnExpand(wxTreeEvent& event);
58580a7e 62 void OnScroll(wxScrollWinEvent& event);
7f60145d 63 void OnPaint(wxPaintEvent& event);
58580a7e
JS
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
43bcf4c9
JS
84 // In case we're using the generic tree control.
85 virtual int GetScrollPos(int orient) const;
86
58580a7e 87//// Helpers
7f60145d 88 void HideVScrollbar();
58580a7e 89
7f60145d
RD
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);
58580a7e 94
7f60145d
RD
95 // Adjust the containing wxScrolledWindow's scrollbars appropriately
96 void AdjustRemoteScrollbars();
58580a7e 97
7f60145d
RD
98 // Find the scrolled window that contains this control
99 wxScrolledWindow* GetScrolledWindow() const;
58580a7e
JS
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
1a584f14
JS
105//// Accessors
106
7f60145d
RD
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; }
1a584f14
JS
111
112
58580a7e
JS
113 DECLARE_EVENT_TABLE()
114protected:
7f60145d
RD
115 wxWindow* m_companionWindow;
116 bool m_drawRowLines;
58580a7e
JS
117};
118
1a584f14
JS
119/*
120 * wxTreeCompanionWindow
121 *
122 * A window displaying values associated with tree control items.
123 */
124
936a13b5 125class WXDLLIMPEXP_GIZMOS wxTreeCompanionWindow: public wxWindow
1a584f14
JS
126{
127public:
128 DECLARE_CLASS(wxTreeCompanionWindow)
129
130 wxTreeCompanionWindow(wxWindow* parent, wxWindowID id = -1,
131 const wxPoint& pos = wxDefaultPosition,
132 const wxSize& sz = wxDefaultSize,
133 long style = 0);
134
135//// Overrides
7f60145d 136 virtual void DrawItem(wxDC& dc, wxTreeItemId id, const wxRect& rect);
1a584f14
JS
137
138//// Events
7f60145d 139 void OnPaint(wxPaintEvent& event);
1a584f14 140 void OnScroll(wxScrollWinEvent& event);
7f60145d 141 void OnExpand(wxTreeEvent& event);
1a584f14
JS
142
143//// Operations
144
145//// Accessors
7f60145d
RD
146 wxRemotelyScrolledTreeCtrl* GetTreeCtrl() const { return m_treeCtrl; };
147 void SetTreeCtrl(wxRemotelyScrolledTreeCtrl* treeCtrl) { m_treeCtrl = treeCtrl; }
1a584f14
JS
148
149//// Data members
150protected:
7f60145d 151 wxRemotelyScrolledTreeCtrl* m_treeCtrl;
1a584f14
JS
152
153 DECLARE_EVENT_TABLE()
154};
155
156
58580a7e
JS
157/*
158 * wxThinSplitterWindow
159 *
160 * Implements a splitter with a less obvious sash
161 * than the usual one.
162 */
163
936a13b5 164class WXDLLIMPEXP_GIZMOS wxThinSplitterWindow: public wxSplitterWindow
58580a7e
JS
165{
166public:
167 DECLARE_DYNAMIC_CLASS(wxThinSplitterWindow)
168
169 wxThinSplitterWindow(wxWindow* parent, wxWindowID id = -1,
170 const wxPoint& pos = wxDefaultPosition,
171 const wxSize& sz = wxDefaultSize,
172 long style = wxSP_3D | wxCLIP_CHILDREN);
0199503b 173 ~wxThinSplitterWindow();
58580a7e
JS
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);
7f60145d 181 void DrawSash(wxDC& dc);
58580a7e
JS
182
183//// Events
086ab766 184
58580a7e
JS
185 void OnSize(wxSizeEvent& event);
186
187//// Operations
188
189//// Accessors
190
191//// Data members
192protected:
0199503b
RD
193 wxPen* m_facePen;
194 wxBrush* m_faceBrush;
195
58580a7e
JS
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
936a13b5 208class WXDLLIMPEXP_GIZMOS wxSplitterScrolledWindow: public wxScrolledWindow
58580a7e
JS
209{
210public:
211 DECLARE_DYNAMIC_CLASS(wxSplitterScrolledWindow)
212
213 wxSplitterScrolledWindow(wxWindow* parent, wxWindowID id = -1,
214 const wxPoint& pos = wxDefaultPosition,
215 const wxSize& sz = wxDefaultSize,
216 long style = 0);
217
218//// Overrides
219
220//// Events
086ab766 221
58580a7e
JS
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_