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
|
2006-06-20 08:39:16 +00:00
|
|
|
* \author Abdelrazak Younes
|
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
|
|
|
*/
|
|
|
|
|
2006-07-08 22:55:22 +00:00
|
|
|
// X11 use a define called CursorShape, and we really want to use
|
|
|
|
// that name our selves. Therefore we do something similar to what is done
|
|
|
|
// in kde/fixx11h.h:
|
|
|
|
namespace X {
|
|
|
|
#ifdef CursorShape
|
|
|
|
#ifndef FIXX11H_CursorShape
|
|
|
|
#define FIXX11H_CursorShape
|
|
|
|
int const XCursorShape = CursorShape;
|
|
|
|
#undef CursorShape
|
|
|
|
int const CursorShape = CursorShape;
|
|
|
|
#endif
|
|
|
|
#undef CursorShape
|
|
|
|
#endif
|
|
|
|
} // namespace X
|
|
|
|
|
|
|
|
|
2006-06-20 08:39:16 +00:00
|
|
|
#ifndef BASE_WORKAREA_H
|
|
|
|
#define BASE_WORKAREA_H
|
|
|
|
|
2002-06-18 15:44:30 +00:00
|
|
|
#include "frontends/key_state.h"
|
2006-04-13 12:18:42 +00:00
|
|
|
#include "frontends/LyXKeySym.h"
|
2006-07-08 22:06:50 +00:00
|
|
|
#include "frontends/Timeout.h"
|
2002-06-18 15:44:30 +00:00
|
|
|
|
2006-06-20 08:39:16 +00:00
|
|
|
class BufferView;
|
2002-06-18 15:44:30 +00:00
|
|
|
|
2006-06-20 08:39:16 +00:00
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
2002-06-18 15:44:30 +00:00
|
|
|
|
2002-06-19 23:55:55 +00:00
|
|
|
class Painter;
|
2002-06-24 20:28:12 +00:00
|
|
|
|
2006-07-08 22:55:22 +00:00
|
|
|
/// types of cursor in work area
|
|
|
|
enum CursorShape {
|
|
|
|
/// normal I-beam
|
|
|
|
BAR_SHAPE,
|
|
|
|
/// L-shape for locked insets of a different language
|
|
|
|
L_SHAPE,
|
|
|
|
/// reverse L-shape for RTL text
|
|
|
|
REVERSED_L_SHAPE
|
|
|
|
};
|
|
|
|
|
|
|
|
|
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.
|
2006-06-20 08:39:16 +00:00
|
|
|
* It works in concert with the BaseScreen class to update the
|
2002-06-19 23:55:55 +00:00
|
|
|
* widget view of a document.
|
|
|
|
*/
|
2002-06-18 15:44:30 +00:00
|
|
|
class WorkArea {
|
|
|
|
public:
|
2006-06-26 16:55:35 +00:00
|
|
|
WorkArea(BufferView * buffer_view = 0);
|
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
|
|
|
|
2006-06-26 16:55:35 +00:00
|
|
|
void setBufferView(BufferView * buffer_view);
|
|
|
|
|
2006-07-03 22:31:51 +00:00
|
|
|
///
|
|
|
|
BufferView & bufferView();
|
|
|
|
///
|
|
|
|
BufferView const & bufferView() const;
|
|
|
|
|
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
|
2006-06-20 08:39:16 +00:00
|
|
|
virtual int width() const = 0;
|
|
|
|
|
2002-06-19 23:55:55 +00:00
|
|
|
/// return the height of the work area in pixels
|
2006-06-20 08:39:16 +00:00
|
|
|
virtual int height() 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
|
|
|
|
2006-06-20 08:39:16 +00:00
|
|
|
/// redraw the screen, without using existing pixmap
|
2006-07-08 20:24:32 +00:00
|
|
|
virtual void redraw();
|
2006-06-20 08:39:16 +00:00
|
|
|
|
2006-07-08 21:04:21 +00:00
|
|
|
///
|
|
|
|
void processKeySym(LyXKeySymPtr key, key_modifier::state state);
|
|
|
|
|
2006-06-20 08:39:16 +00:00
|
|
|
/// grey out (no buffer)
|
|
|
|
void greyOut();
|
|
|
|
|
|
|
|
/// paint the cursor and store the background
|
2006-06-26 16:55:35 +00:00
|
|
|
virtual void showCursor(int x, int y, int h, CursorShape shape) = 0;
|
2006-06-20 08:39:16 +00:00
|
|
|
|
|
|
|
/// hide the cursor
|
|
|
|
virtual void removeCursor() = 0;
|
|
|
|
|
2006-07-08 22:06:50 +00:00
|
|
|
/// Show the cursor
|
|
|
|
void showCursor();
|
|
|
|
/// Hide the cursor
|
|
|
|
void hideCursor();
|
|
|
|
/// toggle the cursor's visibility
|
|
|
|
void toggleCursor();
|
|
|
|
|
2006-06-20 08:39:16 +00:00
|
|
|
protected:
|
|
|
|
/// cause the display of the given area of the work area
|
|
|
|
virtual void expose(int x, int y, int w, int h) = 0;
|
|
|
|
|
2006-06-26 16:55:35 +00:00
|
|
|
///
|
|
|
|
BufferView * buffer_view_;
|
|
|
|
|
2006-06-20 08:39:16 +00:00
|
|
|
private:
|
|
|
|
///
|
|
|
|
void checkAndGreyOut();
|
|
|
|
|
|
|
|
///
|
|
|
|
bool greyed_out_;
|
2006-07-08 22:06:50 +00:00
|
|
|
|
|
|
|
///
|
|
|
|
bool cursor_visible_;
|
|
|
|
|
|
|
|
///
|
|
|
|
Timeout cursor_timeout_;
|
2002-06-18 15:44:30 +00:00
|
|
|
};
|
2002-06-24 20:28:12 +00:00
|
|
|
|
2006-06-20 08:39:16 +00:00
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
|
|
|
|
|
|
|
#endif // BASE_WORKAREA_H
|