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

Subversion Repositories openrisc

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

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

Line No. Rev Author Line
1 26 unneback
/////////////////////////////////////////////////////////////////////////////
2
// Name:        ecscrolwin.h
3
// Purpose:     ecScrolledWindow class
4
//              Used here to avoid any harmful changes in the equivalent wxWindows class
5
// Author:      Julian Smart
6
// Modified by:
7
// Created:     01/02/97
8
// RCS-ID:      $Id: ecscrolwin.h,v 1.1.1.1 2004-02-14 13:28:53 phoenix Exp $
9
// Copyright:   (c) Julian Smart and Markus Holzem
10
// Licence:     wxWindows license
11
/////////////////////////////////////////////////////////////////////////////
12
 
13
#ifndef _EC_SCROLLWIN_H_
14
#define _EC_SCROLLWIN_H_
15
 
16
#ifdef __GNUG__
17
    #pragma interface "ecscrolwin.h"
18
#endif
19
 
20
// ----------------------------------------------------------------------------
21
// headers and constants
22
// ----------------------------------------------------------------------------
23
 
24
#include "wx/window.h"
25
#include "wx/panel.h"
26
 
27
// 1 to use our own scroled window to insulate us from
28
// wxWindows changes
29
 
30
#if wxRELEASE_NUMBER < 2302
31
#define ecUSE_OWN_SCROLLED_WINDOW 1
32
#else
33
#define ecUSE_OWN_SCROLLED_WINDOW 0
34
#endif
35
 
36
#if !ecUSE_OWN_SCROLLED_WINDOW
37
#include "wx/scrolwin.h"
38
#endif
39
 
40
WXDLLEXPORT_DATA(extern const wxChar*) wxPanelNameStr;
41
 
42
// default scrolled window style
43
#ifndef wxScrolledWindowStyle
44
#define wxScrolledWindowStyle (wxHSCROLL | wxVSCROLL)
45
#endif
46
 
47
// ----------------------------------------------------------------------------
48
// ecScrolledWindow
49
// ----------------------------------------------------------------------------
50
 
51
#if ecUSE_OWN_SCROLLED_WINDOW
52
 
53
class ecScrolledWindow : public wxPanel
54
{
55
public:
56
    ecScrolledWindow();
57
    ecScrolledWindow(wxWindow *parent,
58
                     wxWindowID id = -1,
59
                     const wxPoint& pos = wxDefaultPosition,
60
                     const wxSize& size = wxDefaultSize,
61
                     long style = wxScrolledWindowStyle,
62
                     const wxString& name = wxPanelNameStr)
63
    {
64
        Create(parent, id, pos, size, style, name);
65
    }
66
 
67
    ~ecScrolledWindow();
68
 
69
    bool Create(wxWindow *parent,
70
                wxWindowID id,
71
                const wxPoint& pos = wxDefaultPosition,
72
                const wxSize& size = wxDefaultSize,
73
                long style = wxScrolledWindowStyle,
74
                const wxString& name = wxPanelNameStr);
75
 
76
    // Normally the ecScrolledWindow will scroll itself, but in
77
    // some rare occasions you might want it to scroll another
78
    // window (e.g. a child of it in order to scroll only a portion
79
    // the area between the scrollbars (spreadsheet: only cell area
80
    // will move).
81
    virtual void SetTargetWindow( wxWindow *target );
82
    virtual wxWindow *GetTargetWindow();
83
 
84
    // Number of pixels per user unit (0 or -1 for no scrollbar)
85
    // Length of virtual canvas in user units
86
    // Length of page in user units
87
    virtual void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY,
88
                             int noUnitsX, int noUnitsY,
89
                             int xPos = 0, int yPos = 0,
90
                             bool noRefresh = FALSE );
91
 
92
    // Physically scroll the window
93
    virtual void Scroll(int x_pos, int y_pos);
94
 
95
#if WXWIN_COMPATIBILITY
96
    virtual void GetScrollUnitsPerPage(int *x_page, int *y_page) const;
97
    virtual void CalcUnscrolledPosition(int x, int y, float *xx, float *yy) const;
98
#endif
99
 
100
    int GetScrollPageSize(int orient) const;
101
    void SetScrollPageSize(int orient, int pageSize);
102
 
103
    virtual void GetScrollPixelsPerUnit(int *x_unit, int *y_unit) const;
104
 
105
    // Enable/disable Windows scrolling in either direction.
106
    // If TRUE, wxWindows scrolls the canvas and only a bit of
107
    // the canvas is invalidated; no Clear() is necessary.
108
    // If FALSE, the whole canvas is invalidated and a Clear() is
109
    // necessary. Disable for when the scroll increment is used
110
    // to actually scroll a non-constant distance
111
    virtual void EnableScrolling(bool x_scrolling, bool y_scrolling);
112
 
113
    // Get the view start
114
    virtual void GetViewStart(int *x, int *y) const;
115
    // Compatibility
116
    void ViewStart(int *x, int *y) const
117
       { GetViewStart( x, y ); }
118
 
119
    // Actual size in pixels when scrolling is taken into account
120
    virtual void GetVirtualSize(int *x, int *y) const;
121
 
122
    // Set the scale factor, used in PrepareDC
123
    void SetScale(double xs, double ys) { m_scaleX = xs; m_scaleY = ys; }
124
    double GetScaleX() const { return m_scaleX; }
125
    double GetScaleY() const { return m_scaleY; }
126
 
127
    virtual void CalcScrolledPosition(int x, int y, int *xx, int *yy) const;
128
    virtual void CalcUnscrolledPosition(int x, int y, int *xx, int *yy) const;
129
 
130
    // Adjust the scrollbars
131
    virtual void AdjustScrollbars(void);
132
 
133
    // Override this function to draw the graphic (or just process EVT_PAINT)
134
    virtual void OnDraw(wxDC& WXUNUSED(dc)) {};
135
 
136
    // Override this function if you don't want to have ecScrolledWindow
137
    // automatically change the origin according to the scroll position.
138
    virtual void PrepareDC(wxDC& dc);
139
 
140
    // implementation from now on
141
    void OnScroll(wxScrollWinEvent& event);
142
    void OnSize(wxSizeEvent& event);
143
    void OnPaint(wxPaintEvent& event);
144
    void OnChar(wxKeyEvent& event);
145
 
146
    // Calculate scroll increment
147
    virtual int CalcScrollInc(wxScrollWinEvent& event);
148
 
149
protected:
150
    wxWindow             *m_targetWindow;
151
    int                   m_xScrollPixelsPerLine;
152
    int                   m_yScrollPixelsPerLine;
153
    bool                  m_xScrollingEnabled;
154
    bool                  m_yScrollingEnabled;
155
    int                   m_xScrollPosition;
156
    int                   m_yScrollPosition;
157
    int                   m_xScrollLines;
158
    int                   m_yScrollLines;
159
    int                   m_xScrollLinesPerPage;
160
    int                   m_yScrollLinesPerPage;
161
    double                m_scaleX;
162
    double                m_scaleY;
163
 
164
private:
165
    DECLARE_EVENT_TABLE()
166
    DECLARE_ABSTRACT_CLASS(ecScrolledWindow)
167
        };
168
 
169
#else
170
class ecScrolledWindow : public wxScrolledWindow
171
{
172
public:
173
    ecScrolledWindow(wxWindow *parent,
174
                     wxWindowID id = -1,
175
                     const wxPoint& pos = wxDefaultPosition,
176
                     const wxSize& size = wxDefaultSize,
177
                     long style = wxScrolledWindowStyle,
178
                     const wxString& name = wxPanelNameStr)
179
    {
180
        Create(parent, id, pos, size, style, name);
181
    }
182
    DECLARE_CLASS(ecScrolledWindow)
183
};
184
 
185
#endif
186
 
187
#endif
188
    // _EC_SCROLLWIN_H_

powered by: WebSVN 2.1.0

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