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
|
|
|
|
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-08-30 18:03:17 +00:00
|
|
|
virtual 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.
|
2007-09-21 20:39:47 +00:00
|
|
|
virtual void 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;
|
2007-09-21 20:39:47 +00:00
|
|
|
///
|
|
|
|
Dimension const & dimension() const { return dim_; };
|
|
|
|
|
2006-12-04 04:31:18 +00:00
|
|
|
/// render state, exact meaning of state is render-specific
|
2011-02-13 09:56:54 +00:00
|
|
|
void setRenderState(bool state) { state_ = state; }
|
2006-12-04 04:31:18 +00:00
|
|
|
/// get render state
|
2011-02-13 09:56:54 +00:00
|
|
|
bool 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:
|
2009-07-14 15:51:21 +00:00
|
|
|
RenderBase() : state_(false) {}
|
2009-07-14 19:46:17 +00:00
|
|
|
RenderBase(RenderBase const &x) : state_(x.state_){}
|
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_
|
2009-07-14 15:51:21 +00:00
|
|
|
bool 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
|