2002-06-18 15:44:30 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
|
|
|
* \file WorkArea.h
|
2002-09-05 15:14:23 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-06-18 15:44:30 +00:00
|
|
|
*
|
|
|
|
* \author unknown
|
2002-10-21 17:38:09 +00:00
|
|
|
* \author John Levon
|
2002-09-05 14:10:50 +00:00
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2002-06-18 15:44:30 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef WORKAREA_H
|
|
|
|
#define WORKAREA_H
|
|
|
|
|
|
|
|
#include "frontends/key_state.h"
|
|
|
|
|
2003-09-06 20:08:10 +00:00
|
|
|
#include <boost/shared_ptr.hpp>
|
2002-06-18 15:44:30 +00:00
|
|
|
#include <boost/signals/signal0.hpp>
|
|
|
|
#include <boost/signals/signal1.hpp>
|
|
|
|
#include <boost/signals/signal2.hpp>
|
|
|
|
|
2003-09-06 20:08:10 +00:00
|
|
|
#include "support/std_string.h"
|
2002-06-18 15:44:30 +00:00
|
|
|
|
2002-06-19 23:55:55 +00:00
|
|
|
class Painter;
|
2003-09-04 03:54:04 +00:00
|
|
|
class FuncRequest;
|
2003-09-06 20:08:10 +00:00
|
|
|
class LyXKeySym;
|
2002-06-24 20:28:12 +00:00
|
|
|
|
2002-06-19 23:55:55 +00:00
|
|
|
/**
|
|
|
|
* The work area class represents the widget that provides the
|
|
|
|
* view onto a document. It is owned by the BufferView, and
|
|
|
|
* is responsible for handing events back to its owning BufferView.
|
|
|
|
* It works in concert with the LyXScreen class to update the
|
|
|
|
* widget view of a document.
|
|
|
|
*/
|
2002-06-18 15:44:30 +00:00
|
|
|
class WorkArea {
|
|
|
|
public:
|
2003-09-06 20:08:10 +00:00
|
|
|
typedef boost::shared_ptr<LyXKeySym> LyXKeySymPtr;
|
2002-06-19 23:55:55 +00:00
|
|
|
|
2002-06-18 15:44:30 +00:00
|
|
|
WorkArea() {}
|
2002-06-19 23:55:55 +00:00
|
|
|
|
2002-06-18 15:44:30 +00:00
|
|
|
virtual ~WorkArea() {}
|
2002-06-24 20:28:12 +00:00
|
|
|
|
2002-06-19 23:55:55 +00:00
|
|
|
/// return the painter object for this work area
|
2002-06-18 15:44:30 +00:00
|
|
|
virtual Painter & getPainter() = 0;
|
2002-06-24 20:28:12 +00:00
|
|
|
|
2002-06-19 23:55:55 +00:00
|
|
|
/// return the width of the work area in pixels
|
2002-06-18 15:44:30 +00:00
|
|
|
virtual int workWidth() const = 0;
|
2002-06-19 23:55:55 +00:00
|
|
|
/// return the height of the work area in pixels
|
2002-06-18 15:44:30 +00:00
|
|
|
virtual int workHeight() const = 0;
|
2002-06-24 20:28:12 +00:00
|
|
|
|
2002-06-19 23:55:55 +00:00
|
|
|
/**
|
|
|
|
* Update the scrollbar.
|
|
|
|
* @param height the total document height in pixels
|
|
|
|
* @param pos the current position in the document, in pixels
|
|
|
|
* @param line_height the line-scroll amount, in pixels
|
|
|
|
*/
|
|
|
|
virtual void setScrollbarParams(int height, int pos, int line_height) = 0;
|
2002-06-24 20:28:12 +00:00
|
|
|
|
2002-06-19 23:55:55 +00:00
|
|
|
// FIXME: this is an odd place to have it, but xforms needs it here ...
|
2002-06-18 15:44:30 +00:00
|
|
|
/// a selection exists
|
|
|
|
virtual void haveSelection(bool) const = 0;
|
2002-06-19 23:55:55 +00:00
|
|
|
/// get the X clipboard contents
|
2002-06-18 15:44:30 +00:00
|
|
|
virtual string const getClipboard() const = 0;
|
2002-06-19 23:55:55 +00:00
|
|
|
/// fill the clipboard
|
2002-06-18 15:44:30 +00:00
|
|
|
virtual void putClipboard(string const &) const = 0;
|
2002-06-24 20:28:12 +00:00
|
|
|
|
2002-06-20 20:37:42 +00:00
|
|
|
/// work area dimensions have changed
|
|
|
|
boost::signal0<void> workAreaResize;
|
2002-06-19 23:55:55 +00:00
|
|
|
/// the scrollbar has changed
|
2002-06-18 15:44:30 +00:00
|
|
|
boost::signal1<void, int> scrollDocView;
|
2002-06-19 23:55:55 +00:00
|
|
|
/// a key combination has been pressed
|
2002-06-18 15:44:30 +00:00
|
|
|
boost::signal2<void, LyXKeySymPtr, key_modifier::state> workAreaKeyPress;
|
2002-08-28 08:30:27 +00:00
|
|
|
/// some mouse event
|
|
|
|
boost::signal1<void, FuncRequest> dispatch;
|
2002-06-18 15:44:30 +00:00
|
|
|
/// emitted when an X client has requested our selection
|
|
|
|
boost::signal0<void> selectionRequested;
|
|
|
|
/// emitted when another X client has stolen our selection
|
|
|
|
boost::signal0<void> selectionLost;
|
|
|
|
};
|
2002-06-24 20:28:12 +00:00
|
|
|
|
2002-06-18 15:44:30 +00:00
|
|
|
#endif // WORKAREA_H
|