]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetbase.h
insetcharstyle drawing cosmetics
[lyx.git] / src / insets / insetbase.h
index a47414d3fa4f01dd3232e4dd2b2bf15e1cd37c12..d87ac7c15a96ddae2fb8a22e4215d985d3b5e4b8 100644 (file)
@@ -67,19 +67,19 @@ public:
        virtual MathInset * asMathInset() { return 0; }
        /// identification as non-math inset
        virtual UpdatableInset * asUpdatableInset() { return 0; }
-       /// true for 'math' math inset, but not for e.g. mbox 
+       /// true for 'math' math inset, but not for e.g. mbox
        virtual bool inMathed() const { return false; }
 
        // the real dispatcher
-       void dispatch(LCursor & cur, FuncRequest const & cmd);
+       void dispatch(LCursor & cur, FuncRequest & cmd);
        /// do we want to handle this event?
        virtual bool getStatus(LCursor & cur, FuncRequest const & cmd,
-               FuncStatus & status);
+               FuncStatus & status) const;
 
        /// cursor enters
        virtual void edit(LCursor & cur, bool left);
        /// cursor enters
-       virtual InsetBase * editXY(LCursor & cur, int x, int y);
+       virtual InsetBase * editXY(LCursor & cur, int x, int y) const;
 
        /// compute the size of the object returned in dim
        virtual void metrics(MetricsInfo & mi, Dimension & dim) const = 0;
@@ -98,16 +98,16 @@ public:
        /// add space for markers
        void metricsMarkers2(Dimension & dim, int framesize = 1) const;
        /// last drawn position for 'important' insets
-       virtual int xo() const { return 0; }
+       int xo() const;
        /// last drawn position for 'important' insets
-       virtual int yo() const { return 0; }
+       int yo() const;
        /// set x/y drawing position cache if available
        virtual void setPosCache(PainterInfo const &, int, int) const {}
        /// do we cover screen position x/y?
        virtual bool covers(int x, int y) const;
        /// get the screen positions of the cursor (see note in cursor.C)
-       virtual void getCursorPos(CursorSlice const & cur, int & x, int & y) const;
+       virtual void getCursorPos(LCursor const & cur, int & x, int & y) const;
+
        /// is this an inset that can be moved into?
        virtual bool isActive() const { return nargs() > 0; }
        /// Where should we go when we press the up or down cursor key?
@@ -147,16 +147,14 @@ public:
        virtual int cellXOffset(idx_type) const { return 0; }
        /// any additional y-offset when drawing a cell?
        virtual int cellYOffset(idx_type) const { return 0; }
-       /// can we enter this cell?
-       virtual bool validCell(idx_type) const { return true; }
-       /// number of embedded cells
-       virtual size_t nargs() const { return 0; }
-       /// number of rows in gridlike structures
-       virtual size_t nrows() const { return 0; }
-       /// number of columns in gridlike structures
-       virtual size_t ncols() const { return 0; }
+       /// number of embedded cells
+       virtual size_t nargs() const { return 0; }
+       /// number of rows in gridlike structures
+       virtual size_t nrows() const { return 0; }
+       /// number of columns in gridlike structures
+       virtual size_t ncols() const { return 0; }
        /// is called when the cursor leaves this inset
-       virtual void notifyCursorLeaves(idx_type) {}
+       virtual void notifyCursorLeaves(LCursor &) {}
 
        /// request "external features"
        virtual void validate(LaTeXFeatures &) const {}
@@ -296,10 +294,14 @@ public:
                ///
                VSPACE_CODE,
                ///
-               MATHGRID_CODE,
-               ///
-               MATHHULL_CODE
+               MATHMACROARG_CODE
        };
+
+       /** returns the Code corresponding to the \c name.
+        *  Eg, translate("branch") == BRANCH_CODE
+        */
+       static Code translate(std::string const & name);
+
        /// returns true the inset can hold an inset of given type
        virtual bool insetAllowed(Code) const { return false; }
        // if this inset has paragraphs should they be output all as default
@@ -351,7 +353,7 @@ public:
        virtual void addPreview(lyx::graphics::PreviewLoader &) const {}
 protected:
        // the real dispatcher
-       virtual void priv_dispatch(LCursor & cur, FuncRequest const & cmd);
+       virtual void priv_dispatch(LCursor & cur, FuncRequest & cmd);
 public:
        /// returns LyX code associated with the inset. Used for TOC, ...)
        virtual Code lyxCode() const { return NO_CODE; }
@@ -360,11 +362,8 @@ public:
        enum mode_type {UNDECIDED_MODE, TEXT_MODE, MATH_MODE};
        /// return text or mathmode if that is possible to determine
        virtual mode_type currentMode() const { return UNDECIDED_MODE; }
-
-       /// FIXME: This ought to die.
-       virtual void setOwner(UpdatableInset *) {}
-       ///
-       virtual UpdatableInset * owner() const { return 0; }
+       /// returns whether this inset is allowed in other insets of given mode
+       virtual bool allowedIn(mode_type) const { return true; }
 
        /// is this inset allowed within a font change?
        virtual bool noFontChange() const { return false; }