HaikuDepot: Simple TextListener interface, not yet used.
This commit is contained in:
@@ -27,6 +27,7 @@ local textDocumentSources =
|
||||
TextDocumentLayout.cpp
|
||||
TextDocumentView.cpp
|
||||
TextEditor.cpp
|
||||
TextListener.cpp
|
||||
TextSelection.cpp
|
||||
TextSpan.cpp
|
||||
TextView.cpp
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* Copyright 2014, Stephan Aßmus <[email protected]>.
|
||||
* All rights reserved. Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
#include "TextListener.h"
|
||||
|
||||
|
||||
// #pragma mark - TextChangeEvent
|
||||
|
||||
|
||||
TextChangeEvent::TextChangeEvent(int32 firstChangedParagraph,
|
||||
int32 changedParagraphCount)
|
||||
:
|
||||
fFirstChangedParagraph(firstChangedParagraph),
|
||||
fChangedParagraphCount(changedParagraphCount)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
TextChangeEvent::TextChangeEvent()
|
||||
:
|
||||
fFirstChangedParagraph(0),
|
||||
fChangedParagraphCount(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
TextChangeEvent::~TextChangeEvent()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark - TextChangedEvent
|
||||
|
||||
|
||||
TextChangingEvent::TextChangingEvent(int32 firstChangedParagraph,
|
||||
int32 changedParagraphCount)
|
||||
:
|
||||
TextChangeEvent(firstChangedParagraph, changedParagraphCount)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
TextChangingEvent::TextChangingEvent()
|
||||
:
|
||||
TextChangeEvent()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
TextChangingEvent::~TextChangingEvent()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TextChangingEvent::Cancel()
|
||||
{
|
||||
fIsCanceled = true;
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark - TextChangedEvent
|
||||
|
||||
|
||||
TextChangedEvent::TextChangedEvent(int32 firstChangedParagraph,
|
||||
int32 changedParagraphCount)
|
||||
:
|
||||
TextChangeEvent(firstChangedParagraph, changedParagraphCount)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
TextChangedEvent::TextChangedEvent()
|
||||
:
|
||||
TextChangeEvent()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
TextChangedEvent::~TextChangedEvent()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark - TextListener
|
||||
|
||||
|
||||
TextListener::TextListener()
|
||||
:
|
||||
BReferenceable()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
TextListener::~TextListener()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TextListener::TextChanging(TextChangingEvent& event)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TextListener::TextChanged(TextChangedEvent& event)
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright 2014, Stephan Aßmus <[email protected]>.
|
||||
* All rights reserved. Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef TEXT_LISTENER_H
|
||||
#define TEXT_LISTENER_H
|
||||
|
||||
|
||||
#include <Referenceable.h>
|
||||
|
||||
|
||||
class TextChangeEvent {
|
||||
protected:
|
||||
TextChangeEvent();
|
||||
TextChangeEvent(int32 firstChangedParagraph,
|
||||
int32 changedParagraphCount);
|
||||
virtual ~TextChangeEvent();
|
||||
|
||||
public:
|
||||
int32 FirstChangedParagraph() const
|
||||
{ return fFirstChangedParagraph; }
|
||||
int32 ChangedParagraphCount() const
|
||||
{ return fChangedParagraphCount; }
|
||||
|
||||
private:
|
||||
int32 fFirstChangedParagraph;
|
||||
int32 fChangedParagraphCount;
|
||||
};
|
||||
|
||||
|
||||
class TextChangingEvent : public TextChangeEvent {
|
||||
public:
|
||||
TextChangingEvent(int32 firstChangedParagraph,
|
||||
int32 changedParagraphCount);
|
||||
virtual ~TextChangingEvent();
|
||||
|
||||
void Cancel();
|
||||
bool IsCanceled() const
|
||||
{ return fIsCanceled; }
|
||||
|
||||
private:
|
||||
TextChangingEvent();
|
||||
|
||||
private:
|
||||
bool fIsCanceled;
|
||||
};
|
||||
|
||||
|
||||
class TextChangedEvent : public TextChangeEvent {
|
||||
public:
|
||||
TextChangedEvent(int32 firstChangedParagraph,
|
||||
int32 changedParagraphCount);
|
||||
virtual ~TextChangedEvent();
|
||||
|
||||
private:
|
||||
TextChangedEvent();
|
||||
};
|
||||
|
||||
|
||||
class TextListener : public BReferenceable {
|
||||
public:
|
||||
TextListener();
|
||||
virtual ~TextListener();
|
||||
|
||||
virtual void TextChanging(TextChangingEvent& event);
|
||||
|
||||
virtual void TextChanged(TextChangedEvent& event);
|
||||
};
|
||||
|
||||
|
||||
#endif // TEXT_LISTENER_H
|
||||
Reference in New Issue
Block a user