4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
9 * Full author contact details are available in file CREDITS.
30 /// Common base class to all insets
34 typedef ptrdiff_t difference_type;
35 /// short of anything else reasonable
36 typedef size_t size_type;
37 /// type for cell indices
38 typedef size_t idx_type;
39 /// type for cursor positions
40 typedef ptrdiff_t pos_type;
41 /// type for row numbers
42 typedef size_t row_type;
43 /// type for column numbers
44 typedef size_t col_type;
46 /// virtual base class destructor
47 virtual ~InsetBase() {}
48 /// replicate ourselves
49 virtual std::auto_ptr<InsetBase> clone() const = 0;
51 /// identification as math inset
52 virtual MathInset * asMathInset() { return 0; }
53 /// identification as non-math inset
54 virtual UpdatableInset * asUpdatableInset() { return 0; }
56 // the real dispatcher
58 dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos);
59 // the real dispatcher
60 DispatchResult dispatch(FuncRequest const & cmd);
63 virtual void edit(BufferView * bv, bool left);
65 virtual void edit(BufferView * bv, int x, int y);
67 /// compute the size of the object returned in dim
68 virtual void metrics(MetricsInfo & mi, Dimension & dim) const = 0;
69 /// draw inset and update (xo, yo)-cache
70 virtual void draw(PainterInfo & pi, int x, int y) const = 0;
72 /// request "external features"
73 virtual void validate(LaTeXFeatures &) const {}
74 /// Appends \c list with all labels found within this inset.
75 virtual void getLabelList(Buffer const &,
76 std::vector<std::string> & /* list */) const {}
78 // the real dispatcher
81 priv_dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos);