]> git.lyx.org Git - lyx.git/blob - src/insets/updatableinset.h
conmsolidate scrolling code
[lyx.git] / src / insets / updatableinset.h
1 // -*- C++ -*-
2 /**
3  * \file updatableinset.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Alejandro Aguilar Sierra
8  * \author Jürgen Vigna
9  * \author Lars Gullik Bjønnes
10  * \author Matthias Ettrich
11  *
12  * Full author contact details are available in file CREDITS.
13  */
14
15 #ifndef UPDATABLEINSET_H
16 #define UPDATABLEINSET_H
17
18 //  Updatable Insets. These insets can receive directly user interaction.
19 //  Note that all pure methods from Inset class are pure here too.
20 //  [Alejandro 080596]
21
22 #include "inset.h"
23
24 class UpdatableInset : public InsetOld {
25 public:
26         ///
27         UpdatableInset() : scx(0) {}
28         ///
29         virtual EDITABLE editable() const;
30         /// identification as text inset in a cursor slice
31         UpdatableInset * asUpdatableInset() { return this; }
32
33         /// return the cursor dim
34         virtual void getCursorDim(int &, int &) const;
35         ///
36         virtual bool showInsetDialog(BufferView *) const { return false; }
37
38 protected:
39         ///  An updatable inset could handle lyx editing commands
40         virtual void doDispatch(LCursor & cur, FuncRequest & cmd);
41         /// scrolls to absolute position in maxwidth * sx units
42         void setScroll(int maxwidth, double sx) const;
43         /// scrolls offset pixels
44         void setScroll(int maxwidth, int offset) const;
45         /// returns the actual scroll value
46         virtual int scroll(bool recursive = true) const;
47         ///
48         mutable int scx;
49 };
50
51 #endif