2003-10-10 21:08:55 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
2007-04-25 01:24:38 +00:00
|
|
|
* \file RenderBase.h
|
2003-10-10 21:08:55 +00:00
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2007-04-25 01:24:38 +00:00
|
|
|
#ifndef RENDERBASE_H
|
|
|
|
#define RENDERBASE_H
|
2003-10-10 21:08:55 +00:00
|
|
|
|
2007-04-26 04:41:58 +00:00
|
|
|
#include "Dimension.h"
|
2003-10-10 21:08:55 +00:00
|
|
|
|
2003-11-03 17:47:28 +00:00
|
|
|
#include <memory>
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
2007-04-29 13:39:47 +00:00
|
|
|
class Inset;
|
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() {}
|
|
|
|
|
2007-04-29 13:39:47 +00:00
|
|
|
virtual std::auto_ptr<RenderBase> clone(Inset const *) const = 0;
|
2003-10-10 21:08:55 +00:00
|
|
|
|
2006-11-28 15:15:49 +00:00
|
|
|
/// compute the size of the object returned in dim.
|
|
|
|
/// \retval true if the metrics has changed.
|
|
|
|
virtual bool metrics(MetricsInfo & mi, Dimension & dim) const = 0;
|
2003-10-10 21:08:55 +00:00
|
|
|
/// draw inset and update (xo, yo)-cache
|
|
|
|
virtual void draw(PainterInfo & pi, int x, int y) const = 0;
|
2006-12-04 04:31:18 +00:00
|
|
|
/// render state, exact meaning of state is render-specific
|
|
|
|
void setRenderState(int state) { state_ = state; }
|
|
|
|
/// get render state
|
2007-05-28 22:27:45 +00:00
|
|
|
int renderState() const { return state_; }
|
2003-10-10 21:08:55 +00:00
|
|
|
|
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 &) {}
|
2004-11-23 23:04:52 +00:00
|
|
|
RenderBase & operator=(RenderBase const &) { return *this; }
|
2003-10-10 21:08:55 +00:00
|
|
|
|
2006-12-04 04:31:18 +00:00
|
|
|
/// render state. currently, render_button uses this to store mouse_hover_
|
|
|
|
int state_;
|
2003-10-12 18:54:12 +00:00
|
|
|
/// Cached
|
2003-10-10 21:08:55 +00:00
|
|
|
mutable Dimension dim_;
|
|
|
|
};
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
} // namespace lyx
|
|
|
|
|
2007-04-25 01:24:38 +00:00
|
|
|
#endif // NOT RENDERBASE_H
|