2003-10-10 21:08:55 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
2007-04-25 01:24:38 +00:00
|
|
|
* \file RenderButton.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 RENDERBUTTON_H
|
|
|
|
#define RENDERBUTTON_H
|
2003-10-10 21:08:55 +00:00
|
|
|
|
2007-04-25 01:24:38 +00:00
|
|
|
#include "RenderBase.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
#include "Box.h"
|
2006-10-11 19:40:50 +00:00
|
|
|
#include "support/docstring.h"
|
2003-10-10 21:08:55 +00:00
|
|
|
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
namespace lyx {
|
|
|
|
|
|
|
|
|
2003-10-10 21:08:55 +00:00
|
|
|
class RenderButton : public RenderBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
RenderButton();
|
|
|
|
|
2007-08-30 18:03:17 +00:00
|
|
|
RenderBase * clone(Inset const *) const;
|
2003-10-10 21:08:55 +00:00
|
|
|
|
|
|
|
/// compute the size of the object returned in dim
|
2007-09-21 20:39:47 +00:00
|
|
|
virtual void metrics(MetricsInfo & mi, Dimension & dim) const;
|
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;
|
|
|
|
|
|
|
|
/// Provide the text for the button
|
2006-10-21 00:16:43 +00:00
|
|
|
void update(docstring const &, bool editable);
|
2003-10-10 21:08:55 +00:00
|
|
|
|
|
|
|
/// The "sensitive area" box, i.e., the button area
|
|
|
|
Box box() const { return button_box_; }
|
|
|
|
///
|
|
|
|
void setBox(Box b) { button_box_ = b; }
|
|
|
|
|
2003-10-25 20:09:52 +00:00
|
|
|
/// equivalent to dynamic_cast
|
|
|
|
virtual RenderButton * asButton() { return this; }
|
|
|
|
|
2003-10-10 21:08:55 +00:00
|
|
|
private:
|
|
|
|
/// The stored data.
|
2006-10-21 00:16:43 +00:00
|
|
|
docstring text_;
|
2003-10-10 21:08:55 +00:00
|
|
|
bool editable_;
|
|
|
|
Box button_box_;
|
|
|
|
};
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
} // namespace lyx
|
|
|
|
|
2007-04-25 01:24:38 +00:00
|
|
|
#endif // NOT RENDERBUTTON_H
|