mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-30 21:24:14 +00:00
a837d22ab9
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23408 a592a061-630c-0410-9148-cb99ea01b6c8
100 lines
2.0 KiB
C++
100 lines
2.0 KiB
C++
// -*- C++ -*-
|
|
/**
|
|
* \file Row.h
|
|
* This file is part of LyX, the document processor.
|
|
* Licence details can be found in the file COPYING.
|
|
*
|
|
* \author Matthias Ettrich
|
|
* \author Lars Gullik Bjønnes
|
|
*
|
|
* Full author contact details are available in file CREDITS.
|
|
*
|
|
* Metrics for an on-screen text row.
|
|
*/
|
|
|
|
#ifndef ROW_H
|
|
#define ROW_H
|
|
|
|
#include "support/types.h"
|
|
|
|
#include "Dimension.h"
|
|
|
|
|
|
namespace lyx {
|
|
|
|
/**
|
|
* An on-screen row of text. A paragraph is broken into a
|
|
* RowList for display. Each Row contains position pointers
|
|
* into the first and last character positions of that row.
|
|
*/
|
|
class Row {
|
|
public:
|
|
///
|
|
Row();
|
|
///
|
|
Row(pos_type pos);
|
|
///
|
|
bool changed() const { return changed_; }
|
|
///
|
|
void setChanged(bool c) { changed_ = c; }
|
|
///
|
|
void setCrc(size_type crc) const;
|
|
/// Set the selection begin and end.
|
|
/**
|
|
* This is const because we update the selection status only at draw()
|
|
* time.
|
|
*/
|
|
void setSelection(pos_type sel_beg, pos_type sel_end) const;
|
|
|
|
///
|
|
void pos(pos_type p);
|
|
///
|
|
pos_type pos() const { return pos_; }
|
|
///
|
|
void endpos(pos_type p);
|
|
///
|
|
pos_type endpos() const { return end_; }
|
|
///
|
|
void setDimension(Dimension const & dim);
|
|
///
|
|
Dimension const & dimension() const { return dim_; }
|
|
///
|
|
int height() const { return dim_.height(); }
|
|
///
|
|
int width() const { return dim_.wid; }
|
|
///
|
|
int ascent() const { return dim_.asc; }
|
|
///
|
|
int descent() const { return dim_.des; }
|
|
|
|
/// current debugging only
|
|
void dump(char const * = "") const;
|
|
|
|
/// width of a separator (i.e. space)
|
|
double separator;
|
|
/// width of hfills in the label
|
|
double label_hfill;
|
|
/// the x position of the row
|
|
double x;
|
|
///
|
|
mutable pos_type sel_beg;
|
|
///
|
|
mutable pos_type sel_end;
|
|
private:
|
|
/// has the Row appearance changed since last drawing?
|
|
mutable bool changed_;
|
|
/// CRC of row contents.
|
|
mutable size_type crc_;
|
|
/// first pos covered by this row
|
|
pos_type pos_;
|
|
/// one behind last pos covered by this row
|
|
pos_type end_;
|
|
/// Row dimension.
|
|
Dimension dim_;
|
|
};
|
|
|
|
|
|
} // namespace lyx
|
|
|
|
#endif
|