diff --git a/src/apps/haiku-depot/Jamfile b/src/apps/haiku-depot/Jamfile index 1c8808a86e..882a5f7c90 100644 --- a/src/apps/haiku-depot/Jamfile +++ b/src/apps/haiku-depot/Jamfile @@ -27,6 +27,7 @@ local textDocumentSources = TextDocumentLayout.cpp TextDocumentView.cpp TextEditor.cpp + TextListener.cpp TextSelection.cpp TextSpan.cpp TextView.cpp diff --git a/src/apps/haiku-depot/textview/TextListener.cpp b/src/apps/haiku-depot/textview/TextListener.cpp new file mode 100644 index 0000000000..4819b5ff11 --- /dev/null +++ b/src/apps/haiku-depot/textview/TextListener.cpp @@ -0,0 +1,111 @@ +/* + * Copyright 2014, Stephan Aßmus . + * 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) +{ +} diff --git a/src/apps/haiku-depot/textview/TextListener.h b/src/apps/haiku-depot/textview/TextListener.h new file mode 100644 index 0000000000..a3f8993b40 --- /dev/null +++ b/src/apps/haiku-depot/textview/TextListener.h @@ -0,0 +1,71 @@ +/* + * Copyright 2014, Stephan Aßmus . + * All rights reserved. Distributed under the terms of the MIT License. + */ +#ifndef TEXT_LISTENER_H +#define TEXT_LISTENER_H + + +#include + + +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