2003-10-10 21:08:55 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
|
|
|
* \file render_base.h
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author Angus Leeming
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef RENDER_BASE_H
|
|
|
|
#define RENDER_BASE_H
|
|
|
|
|
|
|
|
#include "dimension.h"
|
|
|
|
|
2003-11-03 17:47:28 +00:00
|
|
|
#include <memory>
|
|
|
|
|
2004-04-13 17:25:23 +00:00
|
|
|
class InsetBase;
|
2003-10-10 21:08:55 +00:00
|
|
|
class MetricsInfo;
|
|
|
|
class PainterInfo;
|
|
|
|
|
2003-10-25 20:09:52 +00:00
|
|
|
class RenderButton;
|
|
|
|
class RenderGraphic;
|
|
|
|
class RenderPreview;
|
|
|
|
class RenderMonitoredPreview;
|
2003-10-10 21:08:55 +00:00
|
|
|
|
|
|
|
class RenderBase {
|
|
|
|
public:
|
|
|
|
virtual ~RenderBase() {}
|
|
|
|
|
2004-04-13 17:25:23 +00:00
|
|
|
virtual std::auto_ptr<RenderBase> clone(InsetBase const *) const = 0;
|
2003-10-10 21:08:55 +00:00
|
|
|
|
|
|
|
/// compute the size of the object returned in dim
|
|
|
|
virtual void metrics(MetricsInfo & mi, Dimension & dim) const = 0;
|
|
|
|
/// draw inset and update (xo, yo)-cache
|
|
|
|
virtual void draw(PainterInfo & pi, int x, int y) const = 0;
|
|
|
|
|
2003-10-25 20:09:52 +00:00
|
|
|
/// equivalent to dynamic_cast
|
|
|
|
virtual RenderButton * asButton() { return 0; }
|
|
|
|
virtual RenderGraphic * asGraphic() { return 0; }
|
|
|
|
virtual RenderPreview * asPreview() { return 0; }
|
|
|
|
virtual RenderMonitoredPreview * asMonitoredPreview() { return 0; }
|
|
|
|
|
2003-10-10 21:08:55 +00:00
|
|
|
protected:
|
|
|
|
RenderBase() {}
|
|
|
|
RenderBase(RenderBase const &) {}
|
|
|
|
void operator=(RenderBase const &) {}
|
|
|
|
|
2003-10-12 18:54:12 +00:00
|
|
|
/// Cached
|
2003-10-10 21:08:55 +00:00
|
|
|
mutable Dimension dim_;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // NOT RENDER_BASE_H
|