2000-02-10 17:53:36 +00:00
|
|
|
// -*- C++ -*-
|
2002-06-12 15:01:32 +00:00
|
|
|
/**
|
|
|
|
* \file XPainter.h
|
2002-09-05 15:14:23 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-03-21 17:27:08 +00:00
|
|
|
*
|
2002-06-12 15:01:32 +00:00
|
|
|
* \author unknown
|
2002-12-01 22:59:25 +00:00
|
|
|
* \author John Levon
|
2002-09-05 14:10:50 +00:00
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2002-06-12 15:01:32 +00:00
|
|
|
*/
|
2000-02-10 17:53:36 +00:00
|
|
|
|
2002-06-12 15:01:32 +00:00
|
|
|
#ifndef XPAINTER_H
|
|
|
|
#define XPAINTER_H
|
2000-02-10 17:53:36 +00:00
|
|
|
|
2002-06-12 15:01:32 +00:00
|
|
|
#include "frontends/Painter.h"
|
2000-02-10 17:53:36 +00:00
|
|
|
|
|
|
|
#include <X11/Xlib.h>
|
|
|
|
|
|
|
|
class LyXFont;
|
2004-05-19 15:11:37 +00:00
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
|
|
|
|
2002-06-18 15:44:30 +00:00
|
|
|
class XWorkArea;
|
2000-02-10 17:53:36 +00:00
|
|
|
|
2002-06-12 15:01:32 +00:00
|
|
|
/**
|
|
|
|
* XPainter - a painter implementation for Xlib
|
|
|
|
*/
|
|
|
|
class XPainter : public Painter {
|
2000-02-10 17:53:36 +00:00
|
|
|
public:
|
2002-06-18 15:44:30 +00:00
|
|
|
XPainter(XWorkArea &);
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2002-06-12 15:01:32 +00:00
|
|
|
/// return the width of the work area in pixels
|
|
|
|
virtual int paperWidth() const;
|
|
|
|
/// return the height of the work area in pixels
|
|
|
|
virtual int paperHeight() const;
|
|
|
|
|
|
|
|
/// draw a line from point to point
|
2004-04-07 20:20:15 +00:00
|
|
|
virtual void line(
|
2002-12-01 22:59:25 +00:00
|
|
|
int x1, int y1,
|
2002-06-12 15:01:32 +00:00
|
|
|
int x2, int y2,
|
2003-09-18 11:48:11 +00:00
|
|
|
LColor_color,
|
2002-06-12 15:01:32 +00:00
|
|
|
line_style = line_solid,
|
|
|
|
line_width = line_thin);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* lines - draw a set of lines
|
|
|
|
* @param xp array of points' x co-ords
|
|
|
|
* @param yp array of points' y co-ords
|
|
|
|
* @param np size of the points array
|
|
|
|
*/
|
2004-04-07 20:20:15 +00:00
|
|
|
virtual void lines(
|
2002-12-01 22:59:25 +00:00
|
|
|
int const * xp,
|
|
|
|
int const * yp,
|
2002-06-12 15:01:32 +00:00
|
|
|
int np,
|
2003-09-18 11:48:11 +00:00
|
|
|
LColor_color,
|
2002-06-12 15:01:32 +00:00
|
|
|
line_style = line_solid,
|
|
|
|
line_width = line_thin);
|
|
|
|
|
|
|
|
/// draw a rectangle
|
2004-04-07 20:20:15 +00:00
|
|
|
virtual void rectangle(
|
2002-06-12 15:01:32 +00:00
|
|
|
int x, int y,
|
|
|
|
int w, int h,
|
2003-09-18 11:48:11 +00:00
|
|
|
LColor_color,
|
2002-06-12 15:01:32 +00:00
|
|
|
line_style = line_solid,
|
|
|
|
line_width = line_thin);
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2002-06-12 15:01:32 +00:00
|
|
|
/// draw a filled rectangle
|
2004-04-07 20:20:15 +00:00
|
|
|
virtual void fillRectangle(
|
2002-06-12 15:01:32 +00:00
|
|
|
int x, int y,
|
|
|
|
int w, int h,
|
2003-09-18 11:48:11 +00:00
|
|
|
LColor_color);
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2002-06-12 15:01:32 +00:00
|
|
|
/// draw a filled (irregular) polygon
|
2004-04-07 20:20:15 +00:00
|
|
|
virtual void fillPolygon(
|
2002-12-01 22:59:25 +00:00
|
|
|
int const * xp,
|
|
|
|
int const * yp,
|
2002-06-12 15:01:32 +00:00
|
|
|
int np,
|
2003-09-18 11:48:11 +00:00
|
|
|
LColor_color);
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2002-06-12 15:01:32 +00:00
|
|
|
/// draw an arc
|
2004-04-07 20:20:15 +00:00
|
|
|
virtual void arc(
|
2002-06-12 15:01:32 +00:00
|
|
|
int x, int y,
|
|
|
|
unsigned int w, unsigned int h,
|
|
|
|
int a1, int a2,
|
2003-09-18 11:48:11 +00:00
|
|
|
LColor_color);
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2002-06-12 15:01:32 +00:00
|
|
|
/// draw a pixel
|
2004-04-07 20:20:15 +00:00
|
|
|
virtual void point(
|
2002-06-12 15:01:32 +00:00
|
|
|
int x, int y,
|
2003-09-18 11:48:11 +00:00
|
|
|
LColor_color);
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2002-06-12 15:01:32 +00:00
|
|
|
/// draw an image from the image cache
|
2004-04-07 20:20:15 +00:00
|
|
|
virtual void image(int x, int y,
|
2002-06-12 15:01:32 +00:00
|
|
|
int w, int h,
|
2004-05-19 15:11:37 +00:00
|
|
|
graphics::Image const & image);
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2002-06-12 15:01:32 +00:00
|
|
|
/// draw a string at position x, y (y is the baseline)
|
2004-04-07 20:20:15 +00:00
|
|
|
virtual void text(int x, int y,
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string const & str, LyXFont const & f);
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2000-02-10 17:53:36 +00:00
|
|
|
/** Draw a string at position x, y (y is the baseline)
|
2002-06-12 15:01:32 +00:00
|
|
|
* This is just for fast drawing
|
|
|
|
*/
|
2004-04-07 20:20:15 +00:00
|
|
|
virtual void text(int x, int y,
|
2002-06-12 15:01:32 +00:00
|
|
|
char const * str, size_t l,
|
|
|
|
LyXFont const & f);
|
|
|
|
|
|
|
|
/// draw a char at position x, y (y is the baseline)
|
2004-04-07 20:20:15 +00:00
|
|
|
virtual void text(int x, int y,
|
2002-06-12 15:01:32 +00:00
|
|
|
char c, LyXFont const & f);
|
|
|
|
|
|
|
|
/// draw a wide string at position x, y
|
2004-04-07 20:20:15 +00:00
|
|
|
void text(int x, int y,
|
2002-06-12 15:01:32 +00:00
|
|
|
XChar2b const * str, size_t l,
|
|
|
|
LyXFont const & f);
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2000-04-16 22:27:30 +00:00
|
|
|
private:
|
2002-06-12 15:01:32 +00:00
|
|
|
/// our owner who we paint upon
|
2002-06-18 15:44:30 +00:00
|
|
|
XWorkArea & owner_;
|
2000-02-10 17:53:36 +00:00
|
|
|
};
|
2000-04-16 22:27:30 +00:00
|
|
|
|
2004-05-19 15:11:37 +00:00
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
|
|
|
|
2002-06-12 15:01:32 +00:00
|
|
|
#endif // XPAINTER_H
|