OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [tools/] [src/] [tools/] [configtool/] [standalone/] [wxwin/] [splittree.h] - Blame information for rev 438

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 26 unneback
/////////////////////////////////////////////////////////////////////////////
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: splittree.h,v 1.1.1.1 2004-02-14 13:28:46 phoenix Exp $
10
// Copyright:   (c) Julian Smart
11
//
12
// This program is part of the eCos host tools.
13
//
14
// This program is free software; you can redistribute it and/or modify it
15
// under the terms of the GNU General Public License as published by the Free
16
// Software Foundation; either version 2 of the License, or (at your option)
17
// any later version.
18
//
19
// This program is distributed in the hope that it will be useful, but WITHOUT
20
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
22
// more details.
23
//
24
// You should have received a copy of the GNU General Public License along with
25
// this program; if not, write to the Free Software Foundation, Inc.,
26
// 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
27
//
28
/////////////////////////////////////////////////////////////////////////////
29
 
30
#ifndef _WX_SPLITTREE_H_
31
#define _WX_SPLITTREE_H_
32
 
33
#ifdef __GNUG__
34
        #pragma interface "splittree.cpp"
35
#endif
36
 
37
// Set this to 1 to use generic tree control (doesn't yet work properly)
38
#define USE_GENERIC_TREECTRL 0
39
 
40
#include "wx/wx.h"
41
#include "wx/treectrl.h"
42
#include "wx/splitter.h"
43
#include "ecscrolwin.h"
44
 
45
#if USE_GENERIC_TREECTRL
46
#include "wx/generic/treectlg.h"
47
#ifndef wxTreeCtrl
48
#define wxTreeCtrl wxGenericTreeCtrl
49
#define sm_classwxTreeCtrl sm_classwxGenericTreeCtrl
50
#endif
51
#endif
52
 
53
class wxRemotelyScrolledTreeCtrl;
54
class wxThinSplitterWindow;
55
class wxSplitterScrolledWindow;
56
 
57
/*
58
 * wxRemotelyScrolledTreeCtrl
59
 *
60
 * This tree control disables its vertical scrollbar and catches scroll
61
 * events passed by a scrolled window higher in the hierarchy.
62
 * It also updates the scrolled window vertical scrollbar as appropriate.
63
 */
64
 
65
class wxRemotelyScrolledTreeCtrl: public wxTreeCtrl
66
{
67
        DECLARE_CLASS(wxRemotelyScrolledTreeCtrl)
68
public:
69
    wxRemotelyScrolledTreeCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pt = wxDefaultPosition,
70
        const wxSize& sz = wxDefaultSize, long style = wxTR_HAS_BUTTONS);
71
        ~wxRemotelyScrolledTreeCtrl();
72
 
73
//// Events
74
        void OnSize(wxSizeEvent& event);
75
        void OnExpand(wxTreeEvent& event);
76
    void OnScroll(wxScrollWinEvent& event);
77
 
78
//// Overrides
79
    // Override this in case we're using the generic tree control.
80
    // Calls to this should disable the vertical scrollbar.
81
 
82
    // Number of pixels per user unit (0 or -1 for no scrollbar)
83
    // Length of virtual canvas in user units
84
    // Length of page in user units
85
    virtual void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY,
86
                             int noUnitsX, int noUnitsY,
87
                             int xPos = 0, int yPos = 0,
88
                             bool noRefresh = FALSE );
89
 
90
    // In case we're using the generic tree control.
91
    // Get the view start
92
    virtual void GetViewStart(int *x, int *y) const;
93
 
94
    // In case we're using the generic tree control.
95
    virtual void PrepareDC(wxDC& dc);
96
 
97
    // In case we're using the generic tree control.
98
    virtual int GetScrollPos(int orient) const;
99
 
100
//// Helpers
101
        void HideVScrollbar();
102
 
103
        // Calculate the tree overall size so we can set the scrollbar
104
        // correctly
105
        void CalcTreeSize(wxRect& rect);
106
        void CalcTreeSize(const wxTreeItemId& id, wxRect& rect);
107
 
108
        // Adjust the containing wxScrolledWindow's scrollbars appropriately
109
        void AdjustRemoteScrollbars();
110
 
111
        // Find the scrolled window that contains this control
112
        ecScrolledWindow* GetScrolledWindow() const;
113
 
114
    // Scroll to the given line (in scroll units where each unit is
115
    // the height of an item)
116
    void ScrollToLine(int posHoriz, int posVert);
117
 
118
//// Accessors
119
 
120
        // The companion window is one which will get notified when certain
121
        // events happen such as node expansion
122
        void SetCompanionWindow(wxWindow* companion) { m_companionWindow = companion; }
123
        wxWindow* GetCompanionWindow() const { return m_companionWindow; }
124
 
125
 
126
    DECLARE_EVENT_TABLE()
127
protected:
128
        wxWindow*       m_companionWindow;
129
};
130
 
131
/*
132
 * wxTreeCompanionWindow
133
 *
134
 * A window displaying values associated with tree control items.
135
 */
136
 
137
class wxTreeCompanionWindow: public wxWindow
138
{
139
public:
140
    DECLARE_CLASS(wxTreeCompanionWindow)
141
 
142
    wxTreeCompanionWindow(wxWindow* parent, wxWindowID id = -1,
143
      const wxPoint& pos = wxDefaultPosition,
144
      const wxSize& sz = wxDefaultSize,
145
      long style = 0);
146
 
147
//// Overrides
148
        virtual void DrawItem(wxDC& dc, wxTreeItemId id, const wxRect& rect);
149
 
150
//// Events
151
        void OnPaint(wxPaintEvent& event);
152
    void OnScroll(wxScrollWinEvent& event);
153
        void OnExpand(wxTreeEvent& event);
154
 
155
//// Operations
156
 
157
//// Accessors
158
        wxRemotelyScrolledTreeCtrl* GetTreeCtrl() const { return m_treeCtrl; };
159
        void SetTreeCtrl(wxRemotelyScrolledTreeCtrl* treeCtrl) { m_treeCtrl = treeCtrl; }
160
 
161
//// Data members
162
protected:
163
        wxRemotelyScrolledTreeCtrl*     m_treeCtrl;
164
 
165
    DECLARE_EVENT_TABLE()
166
};
167
 
168
 
169
/*
170
 * wxThinSplitterWindow
171
 *
172
 * Implements a splitter with a less obvious sash
173
 * than the usual one.
174
 */
175
 
176
class wxThinSplitterWindow: public wxSplitterWindow
177
{
178
public:
179
    DECLARE_DYNAMIC_CLASS(wxThinSplitterWindow)
180
 
181
    wxThinSplitterWindow(wxWindow* parent, wxWindowID id = -1,
182
      const wxPoint& pos = wxDefaultPosition,
183
      const wxSize& sz = wxDefaultSize,
184
      long style = wxSP_3D | wxCLIP_CHILDREN);
185
 
186
//// Overrides
187
 
188
    void SizeWindows();
189
    // Tests for x, y over sash. Overriding this allows us to increase
190
    // the tolerance.
191
    bool SashHitTest(int x, int y, int tolerance = 2);
192
        void DrawSash(wxDC& dc);
193
 
194
//// Events
195
 
196
    void OnSize(wxSizeEvent& event);
197
 
198
//// Operations
199
 
200
//// Accessors
201
 
202
//// Data members
203
protected:
204
    DECLARE_EVENT_TABLE()
205
};
206
 
207
/*
208
 * wxSplitterScrolledWindow
209
 *
210
 * This scrolled window is aware of the fact that one of its
211
 * children is a splitter window. It passes on its scroll events
212
 * (after some processing) to both splitter children for them
213
 * scroll appropriately.
214
 */
215
 
216
class wxSplitterScrolledWindow: public ecScrolledWindow
217
{
218
public:
219
    DECLARE_DYNAMIC_CLASS(wxSplitterScrolledWindow)
220
 
221
    wxSplitterScrolledWindow(wxWindow* parent, wxWindowID id = -1,
222
      const wxPoint& pos = wxDefaultPosition,
223
      const wxSize& sz = wxDefaultSize,
224
      long style = 0);
225
 
226
//// Overrides
227
 
228
//// Events
229
 
230
    void OnScroll(wxScrollWinEvent& event);
231
    void OnSize(wxSizeEvent& event);
232
 
233
//// Operations
234
 
235
//// Accessors
236
 
237
//// Data members
238
public:
239
    DECLARE_EVENT_TABLE()
240
};
241
 
242
#endif
243
        // _SPLITTREE_H_

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.