Initial Check in. Coded by Mattias Sundblad.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1135 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Phil Greenway
2002-09-23 23:01:55 +00:00
parent b23dde8600
commit f7afd44bda
13 changed files with 1827 additions and 0 deletions
+93
View File
@@ -0,0 +1,93 @@
#ifndef STYLED_EDIT_VIEW_H
#include "StyledEditView.h"
#endif
#ifndef _MESSAGE_H
#include <Message.h>
#endif
#ifndef CONSTANTS_H
#include "Constants.h"
#endif
#ifndef _MESSENGER_H
#include <Messenger.h>
#endif
#ifndef _RECT_H
#include <Rect.h>
#endif
StyledEditView::StyledEditView(BRect viewFrame, BRect textBounds, BHandler *handler) : BTextView(viewFrame, "textview",
textBounds, B_FOLLOW_ALL, B_FRAME_EVENTS|B_WILL_DRAW){
fHandler= handler;
fMessenger= new BMessenger(handler);
}/***StyledEditView()***/
StyledEditView::~StyledEditView(){
}/***~StyledEditView***/
void StyledEditView::FrameResized(float width, float height){
BTextView::FrameResized(width, height);
if(DoesWordWrap()){
BRect textRect;
textRect= Bounds();
textRect.OffsetTo(B_ORIGIN);
textRect.InsetBy(TEXT_INSET,TEXT_INSET);
SetTextRect(textRect);
}
}
void StyledEditView::Select(int32 start, int32 finish){
if(start==finish)
fChangeMessage= new BMessage(DISABLE_ITEMS);
else
fChangeMessage= new BMessage(ENABLE_ITEMS);
fMessenger->SendMessage(fChangeMessage);
BTextView::Select(start, finish);
}
void StyledEditView::InsertText(const char *text, int32 length, int32 offset, const text_run_array *runs){
fMessenger-> SendMessage(new BMessage(TEXT_CHANGED));
BTextView::InsertText(text, length, offset, runs);
}/****StyledEditView::InsertText()***/
void StyledEditView::DeleteText(int32 start, int32 finish){
fMessenger-> SendMessage(new BMessage(TEXT_CHANGED));
BTextView::DeleteText(start, finish);
}/***StyledEditView::DeleteText***/