• Skip to content
  • Skip to link menu
KDE 4.6 API Reference
  • KDE API Reference
  • kdelibs
  • KDE Home
  • Contact Us
 

Kate

  • Kate
  • TextRange
Public Member Functions

Kate::TextRange Class Reference

Class representing a 'clever' text range. More...

#include <katetextrange.h>

Inheritance diagram for Kate::TextRange:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 TextRange (TextBuffer &buffer, const KTextEditor::Range &range, InsertBehaviors insertBehavior, EmptyBehavior emptyBehavior=AllowEmpty)
 ~TextRange ()
KTextEditor::Attribute::Ptr attribute () const
bool attributeOnlyForViews () const
KTextEditor::Document * document () const
EmptyBehavior emptyBehavior () const
const KTextEditor::MovingCursor & end () const
const TextCursor & endInternal () const
KTextEditor::MovingRangeFeedback * feedback () const
bool hasAttribute () const
InsertBehaviors insertBehaviors () const
 operator const KTextEditor::Range () const
void setAttribute (KTextEditor::Attribute::Ptr attribute)
void setAttributeOnlyForViews (bool onlyForViews)
void setEmptyBehavior (EmptyBehavior emptyBehavior)
void setFeedback (KTextEditor::MovingRangeFeedback *feedback)
void setInsertBehaviors (InsertBehaviors insertBehaviors)
void setRange (const KTextEditor::Range &range)
void setRange (const KTextEditor::Cursor &start, const KTextEditor::Cursor &end)
void setView (KTextEditor::View *view)
void setZDepth (qreal zDepth)
const KTextEditor::MovingCursor & start () const
const TextCursor & startInternal () const
const KTextEditor::Range toRange () const
KTextEditor::View * view () const
qreal zDepth () const

Detailed Description

Class representing a 'clever' text range.

It will automagically move if the text inside the buffer it belongs to is modified. By intention no subclass of KTextEditor::Range, must be converted manually. A TextRange is allowed to be empty. If you call setInvalidateIfEmpty(true), a TextRange will become automatically invalid as soon as start() == end() position holds.

Definition at line 46 of file katetextrange.h.


Constructor & Destructor Documentation

Kate::TextRange::TextRange ( TextBuffer &  buffer,
const KTextEditor::Range &  range,
InsertBehaviors  insertBehavior,
EmptyBehavior  emptyBehavior = AllowEmpty 
)

Construct a text range.

A TextRange is not allowed to be empty, as soon as start == end position, it will become automatically invalid!

Parameters:
bufferparent text buffer
rangeThe initial text range assumed by the new range.
insertBehaviorDefine whether the range should expand when text is inserted adjacent to the range.
emptyBehaviorDefine whether the range should invalidate itself on becoming empty.

Definition at line 29 of file katetextrange.cpp.

Kate::TextRange::~TextRange ( )

Destruct the text block.

reset feedback, don't want feedback during destruction

trigger update, if we have attribute notify right view here we can ignore feedback, even with feedback, we want none if the range is deleted!

Definition at line 46 of file katetextrange.cpp.


Member Function Documentation

KTextEditor::Attribute::Ptr Kate::TextRange::attribute ( ) const [inline, virtual]

Gets the active Attribute for this range.

Returns:
a pointer to the active attribute

Implements KTextEditor::MovingRange.

Definition at line 173 of file katetextrange.h.

bool Kate::TextRange::attributeOnlyForViews ( ) const [inline, virtual]

Is this range's attribute only visible in views, not for example prints? Default is false.

Returns:
range visible only for views

Implements KTextEditor::MovingRange.

Definition at line 211 of file katetextrange.h.

KTextEditor::Document * Kate::TextRange::document ( ) const [virtual]

Gets the document to which this range is bound.

Returns:
a pointer to the document

Implements KTextEditor::MovingRange.

Definition at line 326 of file katetextrange.cpp.

EmptyBehavior Kate::TextRange::emptyBehavior ( ) const [inline, virtual]

Will this range invalidate itself if it becomes empty?

Returns:
behavior on becoming empty

Implements KTextEditor::MovingRange.

Definition at line 89 of file katetextrange.h.

const KTextEditor::MovingCursor& Kate::TextRange::end ( ) const [inline, virtual]

Retrieve end cursor of this range, read-only.

Returns:
end cursor

Implements KTextEditor::MovingRange.

Definition at line 131 of file katetextrange.h.

const TextCursor& Kate::TextRange::endInternal ( ) const [inline]

Nonvirtual version of end(), which is faster.

Returns:
end cursor

Definition at line 137 of file katetextrange.h.

KTextEditor::MovingRangeFeedback* Kate::TextRange::feedback ( ) const [inline, virtual]

Gets the active MovingRangeFeedback for this range.

Returns:
a pointer to the active MovingRangeFeedback

Implements KTextEditor::MovingRange.

Definition at line 195 of file katetextrange.h.

bool Kate::TextRange::hasAttribute ( ) const [inline]
Returns:
whether a nonzero attribute is set. This is faster than checking attribute(), because the reference-counting is omitted.

Definition at line 179 of file katetextrange.h.

KTextEditor::MovingRange::InsertBehaviors Kate::TextRange::insertBehaviors ( ) const [virtual]

Get current insert behaviors.

Returns:
current insert behaviors

Implements KTextEditor::MovingRange.

Definition at line 89 of file katetextrange.cpp.

Kate::TextRange::operator const KTextEditor::Range ( ) const [inline]

Convert this clever range into a dumb one.

Equal to toRange, allowing to use implicit conversion.

Returns:
normal range

Definition at line 149 of file katetextrange.h.

void Kate::TextRange::setAttribute ( KTextEditor::Attribute::Ptr  attribute) [virtual]

Sets the currently active attribute for this range.

This will trigger update of the relevant view parts.

Parameters:
attributeAttribute to assign to this range. If null, simply removes the previous Attribute.

remember the new attribute

notify buffer about attribute change, it will propagate the changes notify right view

Implements KTextEditor::MovingRange.

Definition at line 264 of file katetextrange.cpp.

void Kate::TextRange::setAttributeOnlyForViews ( bool  onlyForViews) [virtual]

Set if this range's attribute is only visible in views, not for example prints.

Parameters:
onlyForViewsattribute only valid for views

just set the value, no need to trigger updates, printing is not interruptable

Implements KTextEditor::MovingRange.

Definition at line 298 of file katetextrange.cpp.

void Kate::TextRange::setEmptyBehavior ( EmptyBehavior  emptyBehavior) [virtual]

Set if this range will invalidate itself if it becomes empty.

Parameters:
emptyBehaviorbehavior on becoming empty

nothing to do?

remember value

invalidate range?

Implements KTextEditor::MovingRange.

Definition at line 102 of file katetextrange.cpp.

void Kate::TextRange::setFeedback ( KTextEditor::MovingRangeFeedback *  feedback) [virtual]

Sets the currently active MovingRangeFeedback for this range.

This will trigger evaluation if feedback must be send again (for example if mouse is already inside range).

Parameters:
attributeMovingRangeFeedback to assign to this range. If null, simply removes the previous MovingRangeFeedback.

nothing changes, nop

remember the new feedback object

notify buffer about feedback change, it will propagate the changes notify right view

Implements KTextEditor::MovingRange.

Definition at line 278 of file katetextrange.cpp.

void Kate::TextRange::setInsertBehaviors ( InsertBehaviors  insertBehaviors) [virtual]

Set insert behaviors.

Parameters:
insertBehaviorsnew insert behaviors

nothing to do?

modify cursors

notify world

Implements KTextEditor::MovingRange.

Definition at line 68 of file katetextrange.cpp.

void Kate::TextRange::setRange ( const KTextEditor::Range &  range) [virtual]

Set the range of this range.

A TextRange is not allowed to be empty, as soon as start == end position, it will become automatically invalid!

Parameters:
rangenew range for this clever range

notify buffer about attribute change, it will propagate the changes notify right view

Implements KTextEditor::MovingRange.

Definition at line 122 of file katetextrange.cpp.

void Kate::TextRange::setRange ( const KTextEditor::Cursor &  start,
const KTextEditor::Cursor &  end 
) [inline]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Set the range of this range A TextRange is not allowed to be empty, as soon as start == end position, it will become automatically invalid!

Parameters:
startnew start for this clever range
endnew end for this clever range

Reimplemented from KTextEditor::MovingRange.

Definition at line 113 of file katetextrange.h.

void Kate::TextRange::setView ( KTextEditor::View *  view) [virtual]

Sets the currently active view for this range.

This will trigger update of the relevant view parts, if the view changed. Set view before the attribute, that will avoid not needed redraws.

Parameters:
attributeView to assign to this range. If null, simply removes the previous view.

nothing changes, nop

remember the new attribute

notify buffer about attribute change, it will propagate the changes notify all views (can be optimized later)

Implements KTextEditor::MovingRange.

Definition at line 243 of file katetextrange.cpp.

void Kate::TextRange::setZDepth ( qreal  zDepth) [virtual]

Set the current Z-depth of this range.

Ranges with smaller Z-depth than others will win during rendering. This will trigger update of the relevant view parts, if the depth changed. Set depth before the attribute, that will avoid not needed redraws. Default is 0.0.

Parameters:
zDepthnew Z-depth of this range

nothing changes, nop

remember the new attribute

notify buffer about attribute change, it will propagate the changes

Implements KTextEditor::MovingRange.

Definition at line 306 of file katetextrange.cpp.

const KTextEditor::MovingCursor& Kate::TextRange::start ( ) const [inline, virtual]

Retrieve start cursor of this range, read-only.

Returns:
start cursor

Implements KTextEditor::MovingRange.

Definition at line 119 of file katetextrange.h.

const TextCursor& Kate::TextRange::startInternal ( ) const [inline]

Non-virtual version of start(), which is faster.

Returns:
start cursor

Definition at line 125 of file katetextrange.h.

const KTextEditor::Range Kate::TextRange::toRange ( ) const [inline]

Convert this clever range into a dumb one.

Returns:
normal range

Reimplemented from KTextEditor::MovingRange.

Definition at line 143 of file katetextrange.h.

KTextEditor::View* Kate::TextRange::view ( ) const [inline, virtual]

Gets the active view for this range.

Might be already invalid, internally only used for pointer comparisons.

Returns:
a pointer to the active view

Implements KTextEditor::MovingRange.

Definition at line 156 of file katetextrange.h.

qreal Kate::TextRange::zDepth ( ) const [inline, virtual]

Gets the current Z-depth of this range.

Ranges with smaller Z-depth than others will win during rendering. Default is 0.0.

Returns:
current Z-depth of this range

Implements KTextEditor::MovingRange.

Definition at line 226 of file katetextrange.h.


The documentation for this class was generated from the following files:
  • katetextrange.h
  • katetextrange.cpp

Kate

Skip menu "Kate"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.7.3
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal