X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FPainterBase.h;h=e3b7d0747287ebb4956c4ef6cf34500234060ef7;hb=cb52251ccff29d6cbfa13ab90a96be566e3f41ac;hp=ab05dda52249385ae08e6a8a62313652a0ca74c9;hpb=cfdd73ea94c3cc0058459d67b1c62fabd31fbeb1;p=lyx.git diff --git a/src/PainterBase.h b/src/PainterBase.h index ab05dda522..e3b7d07472 100644 --- a/src/PainterBase.h +++ b/src/PainterBase.h @@ -4,12 +4,10 @@ * * LyX, The Document Processor * - * Copyright 1998-2000 The LyX Team + * Copyright 1998-2001 The LyX Team * *======================================================*/ -#ifdef USE_PAINTER - #ifndef PAINTERBASE_H #define PAINTERBASE_H @@ -22,7 +20,7 @@ class WorkArea; class LyXFont; -class LyXScreen; +class LyXImage; /** A painter class to encapsulate all graphics parameters and operations @@ -38,7 +36,11 @@ class LyXScreen; class PainterBase { protected: /// - static int dummy1, dummy2, dummy3; + static int dummy1; + /// + static int dummy2; + /// + static int dummy3; public: /// enum line_width { @@ -59,18 +61,19 @@ public: }; /// - PainterBase(WorkArea & wa) : owner(wa) {} + explicit PainterBase(WorkArea & wa) : owner(wa) {} /// virtual ~PainterBase() {} - /** Screen geometry */ + /* Screen geometry */ + /// + int paperMargin() const; /// - int paperMargin(); + int paperWidth() const; /// - int paperWidth(); + int paperHeight() const; - /**@Basic drawing routines */ /// Draw a line from point to point virtual PainterBase & line( int x1, int y1, int x2, int y2, @@ -91,7 +94,7 @@ public: 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( @@ -134,7 +137,7 @@ 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); @@ -142,65 +145,36 @@ public: /// virtual PainterBase & buttonFrame(int x, int y, int w, int h); - /**@Image stuff */ - /// 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; + // For the figure inset + virtual PainterBase & image(int x, int y, int w, int h, LyXImage const * image) = 0; - /**@String functions */ - /// 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; + 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, int l, + virtual PainterBase & text(int x, int y, char const * str, size_t l, 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; - - /// Get the width of text - int width(string const & s, LyXFont const & f); - - /** Get the width of text - This is just for fast width */ - int width(char const * s, int l, LyXFont const & f); - - /// Get the width of text - int width(char c, LyXFont const & f); - - /** 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); - /// This is preliminary - //BufferView const * getOwner() const { return &owner; } - -private: + + /** 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; }; #endif - -#endif