2003-09-02 10:29:05 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
|
|
|
* \file GPainter.h
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author Huang Ying
|
|
|
|
*
|
2003-09-02 17:02:32 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2003-09-02 10:29:05 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GPAINTER_H
|
|
|
|
#define GPAINTER_H
|
|
|
|
|
2003-10-06 15:43:21 +00:00
|
|
|
#include "frontends/Painter.h"
|
|
|
|
|
2004-09-26 16:48:30 +00:00
|
|
|
#include <gtkmm.h>
|
2003-09-02 10:29:05 +00:00
|
|
|
|
2004-09-26 18:36:07 +00:00
|
|
|
#include <X11/Xft/Xft.h>
|
|
|
|
|
2003-09-02 10:29:05 +00:00
|
|
|
#include <map>
|
|
|
|
|
|
|
|
class LyXFont;
|
2004-05-19 15:11:37 +00:00
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
|
|
|
|
2003-09-02 10:29:05 +00:00
|
|
|
class GWorkArea;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GPainter - a painter implementation for Gtkmm
|
|
|
|
*/
|
|
|
|
class GPainter : public Painter {
|
|
|
|
public:
|
|
|
|
GPainter(GWorkArea &);
|
|
|
|
|
|
|
|
/// 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;
|
|
|
|
|
2003-09-18 11:48:11 +00:00
|
|
|
void setForeground(Glib::RefPtr<Gdk::GC> gc, LColor_color clr);
|
2003-09-02 10:29:05 +00:00
|
|
|
void setLineParam(Glib::RefPtr<Gdk::GC> gc,
|
|
|
|
line_style ls, line_width lw);
|
2003-09-18 11:48:11 +00:00
|
|
|
XftColor * getXftColor(LColor_color clr);
|
2003-09-02 10:29:05 +00:00
|
|
|
/// draw a line from point to point
|
2004-04-07 20:20:15 +00:00
|
|
|
virtual void line(
|
2003-09-02 10:29:05 +00:00
|
|
|
int x1, int y1,
|
|
|
|
int x2, int y2,
|
2003-09-18 11:48:11 +00:00
|
|
|
LColor_color,
|
2003-09-02 10:29:05 +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(
|
2003-09-02 10:29:05 +00:00
|
|
|
int const * xp,
|
|
|
|
int const * yp,
|
|
|
|
int np,
|
2003-09-18 11:48:11 +00:00
|
|
|
LColor_color,
|
2003-09-02 10:29:05 +00:00
|
|
|
line_style = line_solid,
|
|
|
|
line_width = line_thin);
|
|
|
|
|
|
|
|
/// draw a rectangle
|
2004-04-07 20:20:15 +00:00
|
|
|
virtual void rectangle(
|
2003-09-02 10:29:05 +00:00
|
|
|
int x, int y,
|
|
|
|
int w, int h,
|
2003-09-18 11:48:11 +00:00
|
|
|
LColor_color,
|
2003-09-02 10:29:05 +00:00
|
|
|
line_style = line_solid,
|
|
|
|
line_width = line_thin);
|
|
|
|
|
|
|
|
/// draw a filled rectangle
|
2004-04-07 20:20:15 +00:00
|
|
|
virtual void fillRectangle(
|
2003-09-02 10:29:05 +00:00
|
|
|
int x, int y,
|
|
|
|
int w, int h,
|
2003-09-18 11:48:11 +00:00
|
|
|
LColor_color);
|
2003-09-02 10:29:05 +00:00
|
|
|
|
|
|
|
/// draw a filled (irregular) polygon
|
2004-04-07 20:20:15 +00:00
|
|
|
virtual void fillPolygon(
|
2003-09-02 10:29:05 +00:00
|
|
|
int const * xp,
|
|
|
|
int const * yp,
|
|
|
|
int np,
|
2003-09-18 11:48:11 +00:00
|
|
|
LColor_color);
|
2003-09-02 10:29:05 +00:00
|
|
|
|
|
|
|
/// draw an arc
|
2004-04-07 20:20:15 +00:00
|
|
|
virtual void arc(
|
2003-09-02 10:29:05 +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);
|
2003-09-02 10:29:05 +00:00
|
|
|
|
|
|
|
/// draw a pixel
|
2004-04-07 20:20:15 +00:00
|
|
|
virtual void point(
|
2003-09-02 10:29:05 +00:00
|
|
|
int x, int y,
|
2003-09-18 11:48:11 +00:00
|
|
|
LColor_color);
|
2003-09-02 10:29:05 +00:00
|
|
|
|
|
|
|
/// draw an image from the image cache
|
2004-04-07 20:20:15 +00:00
|
|
|
virtual void image(int x, int y,
|
2003-09-02 10:29:05 +00:00
|
|
|
int w, int h,
|
2004-05-19 15:11:37 +00:00
|
|
|
graphics::Image const & image);
|
2003-09-02 10:29:05 +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);
|
2003-09-02 10:29:05 +00:00
|
|
|
|
|
|
|
/** Draw a string at position x, y (y is the baseline)
|
|
|
|
* This is just for fast drawing
|
|
|
|
*/
|
2004-04-07 20:20:15 +00:00
|
|
|
virtual void text(int x, int y,
|
2003-09-02 10:29:05 +00:00
|
|
|
char const * str, size_t l,
|
|
|
|
LyXFont const & f);
|
|
|
|
|
2004-10-05 10:11:42 +00:00
|
|
|
virtual void text(int x, int y, wchar_t const * str, int l,
|
2003-09-02 10:29:05 +00:00
|
|
|
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,
|
2003-09-02 10:29:05 +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,
|
2003-09-02 10:29:05 +00:00
|
|
|
XChar2b const * str, size_t l,
|
|
|
|
LyXFont const & f);
|
|
|
|
|
|
|
|
private:
|
|
|
|
/// our owner who we paint upon
|
|
|
|
GWorkArea & owner_;
|
|
|
|
};
|
|
|
|
|
2004-05-19 15:11:37 +00:00
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
|
|
|
|
2003-09-02 10:29:05 +00:00
|
|
|
#endif // XPAINTER_H
|