]> git.lyx.org Git - lyx.git/blob - src/BufferView.h
Finish to add wrappers for xforms callbacks. Now dec C++ 6.1 compiles lyx
[lyx.git] / src / BufferView.h
1 // -*- C++ -*-
2 /* This file is part of
3 * ======================================================
4
5 *           LyX, The Document Processor
6 *        
7 *           Copyright (C) 1995 Matthias Ettrich
8 *           Copyright (C) 1995-1998 The LyX Team.
9 *
10 *======================================================*/
11
12 #ifndef _BUFFER_VIEW_H
13 #define _BUFFER_VIEW_H
14
15 #ifdef __GNUG__
16 #pragma interface
17 #endif
18
19 #include FORMS_H_LOCATION
20
21 class LyXView;
22 class Buffer;
23 class LyXScreen;
24 class BackStack;
25 class Inset;
26
27 ///
28 class BufferView {
29 public:
30         ///
31         BufferView(LyXView *owner, int ,int ,int, int);
32         ///
33         ~BufferView();
34         ///
35         Buffer *currentBuffer() { return _buffer; }
36         ///
37         FL_OBJECT *getWorkArea() { return work_area; }
38         ///
39         void setBuffer(Buffer *b);
40         ///
41         void resize();
42         ///
43         void redraw();
44         ///
45         void fitCursor();
46         ///
47         void update();
48         ///
49         void updateScrollbar();
50         ///
51         void redoCurrentBuffer();
52         ///
53         int resizeCurrentBuffer();
54         ///
55         void gotoError();
56         ///
57         void cursorPrevious();
58         ///
59         void cursorNext();
60         /// 
61         bool available() const;
62         ///
63         LyXView *getOwner() { return _owner; }
64         ///
65         LyXScreen *getScreen()
66         {
67                 fl_set_timer(timer_cursor, 0.4);
68                 return screen;
69         }
70         ///
71         void savePosition();
72         ///
73         void restorePosition();
74 private:
75         /// Update pixmap of screen
76         void updateScreen();
77         ///
78         int workAreaExpose();
79         ///
80         void create_view(int, int, int, int);
81         ///
82         Inset * checkInsetHit(int &x, int &y);
83         /// 
84         int ScrollUp(long time);
85         ///
86         int ScrollDown(long time);
87         ///
88         void ScrollUpOnePage(long /*time*/);
89         ///
90         void ScrollDownOnePage(long /*time*/);
91
92 public:
93         /// A callback for the up arrow in the scrollbar.
94         static void UpCB(FL_OBJECT *ob, long);
95
96         /// A callback for the slider in the scrollbar.
97         static void ScrollCB(FL_OBJECT *ob, long);
98
99         /// A callback for the down arrow in the scrollbar.
100         static void DownCB(FL_OBJECT *ob, long);
101
102         ///
103         static void CursorToggleCB(FL_OBJECT *ob, long);
104         /** Work area free object handler
105          */
106         static int work_area_handler(FL_OBJECT *, int event,
107                                      FL_Coord, FL_Coord, int key, void *xev);
108 private:
109         ///
110         int WorkAreaMotionNotify(FL_OBJECT *ob,
111                                  Window win,
112                                  int w, int h,
113                                  XEvent *ev, void *d);
114         ///
115         int WorkAreaSelectionNotify(FL_OBJECT *, Window win,
116                                     int /*w*/, int /*h*/,
117                                     XEvent *event, void */*d*/);
118         ///
119         int WorkAreaButtonPress(FL_OBJECT *ob,
120                                 Window win,
121                                 int w, int h,
122                                 XEvent *ev, void *d);
123         ///
124         int WorkAreaButtonRelease(FL_OBJECT *ob,
125                                   Window win,
126                                   int w, int h,
127                                   XEvent *ev, void *d);
128         ///
129         LyXView *_owner;
130         ///
131         Buffer *_buffer;
132         ///
133         LyXScreen *screen;
134         ///
135         long current_scrollbar_value;
136         ///
137         int work_area_width;
138         ///
139         bool lyx_focus;
140         ///
141         bool work_area_focus;
142         ///
143         FL_OBJECT *work_area;
144         ///
145         FL_OBJECT *figinset_canvas;
146         ///
147         FL_OBJECT *scrollbar;
148         ///
149         FL_OBJECT *button_down;
150         ///
151         FL_OBJECT *button_up;
152         ///
153         FL_OBJECT *timer_cursor;
154         ///
155         BackStack *backstack;
156         ///
157         int last_click_x, last_click_y;
158 };
159
160 #endif