This commit was manufactured by cvs2svn to create tag
[lyx.git] / src / BufferView.h
blob07bc95f88a3d72b922443318d0108614bfa20b7c
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.
10 * ======================================================*/
12 #ifndef BUFFER_VIEW_H
13 #define BUFFER_VIEW_H
15 #ifdef __GNUG__
16 #pragma interface
17 #endif
19 #include FORMS_H_LOCATION
20 #include "BackStack.h"
22 class LyXView;
23 class Buffer;
24 class LyXScreen;
25 class Inset;
27 ///
28 class BufferView {
29 public:
30 ///
31 BufferView(LyXView *owner, int ,int ,int, int);
32 ///
33 Buffer *currentBuffer() { return _buffer; }
34 ///
35 FL_OBJECT *getWorkArea() { return work_area; }
36 ///
37 void setBuffer(Buffer *b);
38 ///
39 void resize();
40 ///
41 void redraw();
42 ///
43 void fitCursor();
44 ///
45 void update();
46 ///
47 void updateScrollbar();
48 ///
49 void redoCurrentBuffer();
50 ///
51 int resizeCurrentBuffer();
52 ///
53 void gotoError();
54 ///
55 void cursorPrevious();
56 ///
57 void cursorNext();
58 ///
59 bool available() const;
60 ///
61 LyXView *getOwner() { return _owner; }
62 ///
63 LyXScreen *getScreen()
65 fl_set_timer(timer_cursor, 0.4);
66 return screen;
68 ///
69 void savePosition();
70 ///
71 void restorePosition();
72 private:
73 /// Update pixmap of screen
74 void updateScreen();
75 ///
76 int workAreaExpose();
77 ///
78 void create_view(int, int, int, int);
79 ///
80 Inset * checkInsetHit(int &x, int &y);
81 ///
82 int ScrollUp(long time);
83 ///
84 int ScrollDown(long time);
85 ///
86 void ScrollUpOnePage(long /*time*/);
87 ///
88 void ScrollDownOnePage(long /*time*/);
90 public:
91 /// A callback for the up arrow in the scrollbar.
92 static void UpCB(FL_OBJECT *ob, long);
94 /// A callback for the slider in the scrollbar.
95 static void ScrollCB(FL_OBJECT *ob, long);
97 /// A callback for the down arrow in the scrollbar.
98 static void DownCB(FL_OBJECT *ob, long);
101 static void CursorToggleCB(FL_OBJECT *ob, long);
102 /** Work area free object handler
104 static int work_area_handler(FL_OBJECT *, int event,
105 FL_Coord, FL_Coord, int key, void *xev);
106 private:
108 int WorkAreaMotionNotify(FL_OBJECT *ob,
109 Window win,
110 int w, int h,
111 XEvent *ev, void *d);
113 int WorkAreaSelectionNotify(FL_OBJECT *, Window win,
114 int /*w*/, int /*h*/,
115 XEvent *event, void */*d*/);
117 int WorkAreaButtonPress(FL_OBJECT *ob,
118 Window win,
119 int w, int h,
120 XEvent *ev, void *d);
122 int WorkAreaButtonRelease(FL_OBJECT *ob,
123 Window win,
124 int w, int h,
125 XEvent *ev, void *d);
127 LyXView *_owner;
129 Buffer *_buffer;
131 LyXScreen *screen;
133 long current_scrollbar_value;
135 int work_area_width;
137 bool lyx_focus;
139 bool work_area_focus;
141 FL_OBJECT *work_area;
143 FL_OBJECT *figinset_canvas;
145 FL_OBJECT *scrollbar;
147 FL_OBJECT *button_down;
149 FL_OBJECT *button_up;
151 FL_OBJECT *timer_cursor;
153 BackStack backstack;
155 int last_click_x, last_click_y;
158 #endif