]> git.lyx.org Git - lyx.git/blobdiff - src/PainterBase.h
Fix deleting of paragraphs after undo (fix #236).
[lyx.git] / src / PainterBase.h
index 47fa8c89939a805e7571d2f92711f9c776fe4a1b..d397100e1aef58de636ceccbf0cc2c0c332ea739 100644 (file)
@@ -4,7 +4,7 @@
  * 
  *           LyX, The Document Processor
  *      
- *         Copyright 1998-2000 The LyX Team
+ *         Copyright 1998-2001 The LyX Team
  *
  *======================================================*/
 
@@ -20,6 +20,9 @@
 
 class WorkArea;
 class LyXFont;
+namespace grfx {
+       class GImage;
+}
 
 /** A painter class to encapsulate all graphics parameters and operations
    
@@ -33,13 +36,6 @@ class LyXFont;
  
  */
 class PainterBase {
-protected:
-        ///
-       static int dummy1;
-       ///
-       static int dummy2;
-       ///
-       static int dummy3;
 public:
        ///
        enum line_width {
@@ -48,7 +44,7 @@ public:
                ///
                line_thick
        };
-
+       
        ///
        enum line_style {
                ///
@@ -58,13 +54,13 @@ public:
                ///
                line_onoffdash
        };
-
+       
        ///
        explicit PainterBase(WorkArea & wa) : owner(wa) {}
        
        ///
        virtual ~PainterBase() {}
-
+       
        /* Screen geometry */
        ///
        int paperMargin() const;
@@ -79,7 +75,7 @@ public:
                LColor::color = LColor::foreground,
                enum line_style = line_solid,
                enum line_width = line_thin) = 0;
-
+       
        /** Draw the lines between the lines in xp and yp.
            xp and yp are arrays of points, and np is the
            number of them. */
@@ -88,13 +84,13 @@ public:
                LColor::color = LColor::foreground,
                enum line_style = line_solid,
                enum line_width = line_thin) = 0;
-
+       
        /// Here xp and yp are arrays of points
        virtual PainterBase & fillPolygon(
                int const * xp, int const * yp,
                int np,
-               LColor::color =LColor::foreground) = 0;
-
+               LColor::color = LColor::foreground) = 0;
+       
        /// Draw lines from x1,y1 to x2,y2. They are arrays
         virtual PainterBase & segments(
                int const * x1, int const * y1, 
@@ -114,7 +110,7 @@ public:
        virtual PainterBase & circle(
                int x, int y, unsigned int d,
                LColor::color = LColor::foreground);
-
+       
        /// Draw an ellipse
        virtual PainterBase & ellipse(
                int x, int y,
@@ -136,53 +132,41 @@ public:
        /// Fill a rectangle
        virtual PainterBase & fillRectangle(
                int x, int y, int w, int h,
-               LColor::color = LColor::background) = 0;
+               LColor::color) = 0;
        
        /// A filled rectangle with the shape of a 3D button
        virtual PainterBase & button(int x, int y, int w, int h);
-
+       
        /// 
         virtual PainterBase & buttonFrame(int x, int y, int w, int h);
        
        
        // For the figure inset
-       // This can't be part of the base since we don't know what window
-       // system we will be useing, or if are going to use pixmaps at all.
-       //virtual PainterBase & pixmap(int x, int y, Pixmap bitmap)=0;
-
+       virtual PainterBase & image(int x, int y, int w, int h,
+                                   grfx::GImage const & image) = 0;
        
        /// Draw a string at position x, y (y is the baseline)
        virtual PainterBase & text(int x, int y,
                                   string const & str, LyXFont const & f) = 0;
-
+       
        /** Draw a string at position x, y (y is the baseline)
            This is just for fast drawing */
        virtual PainterBase & text(int x, int y, char const * str, size_t l,
-                      LyXFont const & f) = 0;
-
+                                  LyXFont const & f) = 0;
+       
        /// Draw a char at position x, y (y is the baseline)
        virtual PainterBase & text(int x, int y, char c, LyXFont const & f)=0;
        
-       /** Draws a string and encloses it inside a rectangle. Returns
-           the size of the rectangle. If draw is false, we only calculate
-           the size. */
-       virtual PainterBase & rectText(int x, int baseline, 
-                          string const & string, 
-                          LyXFont const & font,
-                          LColor::color back,
-                          LColor::color frame, bool draw = true,
-                          int & width = PainterBase::dummy1,
-                          int & ascent = PainterBase::dummy2, 
-                          int & descent = PainterBase::dummy3);
-
-       /** Draw a string and encloses it inside a button frame. Returns
-           the size of the frame. If draw is false, we only calculate
-           the size. */
-       virtual PainterBase & buttonText(int x, int baseline, string const & s,
-                            LyXFont const & font, bool draw = true,
-                            int & width = PainterBase::dummy1,
-                            int & ascent = PainterBase::dummy2, 
-                            int & descent = PainterBase::dummy3);
+       /** Draws a string and encloses it inside a rectangle. */
+       PainterBase & rectText(int x, int baseline, 
+                              string const & string, 
+                              LyXFont const & font,
+                              LColor::color back,
+                              LColor::color frame);
+       
+       /** Draw a string and encloses it inside a button frame. */
+       PainterBase & buttonText(int x, int baseline, string const & s,
+                                LyXFont const & font);
 protected:
        ///
        WorkArea & owner;