Remove unused NotifyingTextView class

This commit is contained in:
Jaidyn Ann 2021-07-29 22:47:30 -05:00
parent 420340b6b4
commit ebc9d4041f
7 changed files with 6 additions and 147 deletions

View File

@ -24,8 +24,6 @@
#include <StringView.h>
#include <TextControl.h>
#include <libinterface/NotifyingTextView.h>
#include "ChatProtocol.h"
#include "ChatProtocolAddOn.h"
#include "Utils.h"
@ -219,8 +217,7 @@ ProtocolTemplate::Load(BView* parent, BMessage* settings)
B_WILL_DRAW);
layout.Add(label);
NotifyingTextView* textView
= new NotifyingTextView(name);
BTextView* textView = new BTextView(name);
control = new BScrollView("NA", textView, 0, false, true);
textView->SetText(value);
}
@ -314,8 +311,7 @@ ProtocolTemplate::Save(BView* parent, BMessage* settings, BString* errorText)
if (checkBox)
settings->AddBool(name, (checkBox->Value() == B_CONTROL_ON));
NotifyingTextView* textView
= dynamic_cast<NotifyingTextView*>(view);
BTextView* textView = dynamic_cast<BTextView*>(view);
if (textView)
settings->AddString(name, textView->Text());
}

View File

@ -135,8 +135,6 @@ AccountDialog::MessageReceived(BMessage* msg)
case kCancel:
Close();
break;
case kChanged:
break;
default:
BWindow::MessageReceived(msg);
}

View File

@ -20,8 +20,6 @@
#include <TextControl.h>
#include <Window.h>
#include <libinterface/NotifyingTextView.h>
TemplateView::TemplateView(const char* name)
: BView(name, B_WILL_DRAW)
@ -42,8 +40,7 @@ TemplateView::AttachedToWindow()
= dynamic_cast<BMenuField*>(child);
BTextControl* textControl
= dynamic_cast<BTextControl*>(child);
NotifyingTextView* textView
= dynamic_cast<NotifyingTextView*>(child);
BTextView* textView = dynamic_cast<BTextView*>(child);
BCheckBox* checkBox = dynamic_cast<BCheckBox*>(child);
if (menuField)
@ -52,34 +49,19 @@ TemplateView::AttachedToWindow()
if (menu) {
if (i == 0)
menu->MakeFocus(true);
for (int32 j = 0; j < menu->CountItems(); j++) {
BMenuItem* item = menu->ItemAt(j);
item->SetMessage(new BMessage(kChanged));
item->SetTarget(Window());
}
menu->SetTargetForItems(Window());
}
if (textControl) {
if (textControl)
if (i == 0)
textControl->MakeFocus(true);
textControl->SetMessage(new BMessage(kChanged));
textControl->SetTarget(Window());
}
if (checkBox) {
if (checkBox)
if (i == 0)
checkBox->MakeFocus(true);
checkBox->SetMessage(new BMessage(kChanged));
checkBox->SetTarget(Window());
}
if (textView) {
if (textView)
if (i == 0)
textView->MakeFocus(true);
textView->SetMessage(new BMessage(kChanged));
textView->SetTarget(Window());
}
}
}

View File

@ -8,9 +8,6 @@
#include <View.h>
const uint32 kChanged = 'CHGD';
class TemplateView : public BView {
public:
TemplateView(const char* name);

View File

@ -38,7 +38,6 @@ SRCS = \
libs/libinterface/Divider.cpp \
libs/libinterface/EnterTextView.cpp \
libs/libinterface/MenuButton.cpp \
libs/libinterface/NotifyingTextView.cpp \
libs/libinterface/PictureView.cpp
# Specify the resource definition files to use. Full or relative paths can be

View File

@ -1,77 +0,0 @@
/*
* Copyright 2009-2010, Pier Luigi Fiorini. All rights reserved.
* Copyright 2009, Michael Davidson. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Michael Davidson, slaad@bong.com.au
* Pier Luigi Fiorini, pierluigi.fiorini@gmail.com
*/
#include <Messenger.h>
#include "NotifyingTextView.h"
NotifyingTextView::NotifyingTextView(const char* name, uint32 flags)
: BTextView(name, flags),
fMessenger(NULL)
{
}
NotifyingTextView::~NotifyingTextView()
{
if (fMessenger != NULL)
delete fMessenger;
}
void
NotifyingTextView::SetTarget(const BHandler* handler)
{
if (fMessenger != NULL)
delete fMessenger;
fMessenger = new BMessenger(handler);
}
BMessage*
NotifyingTextView::Message() const
{
return fMessage;
}
void
NotifyingTextView::SetMessage(BMessage* msg)
{
fMessage = msg;
}
void
NotifyingTextView::InsertText(const char* text, int32 length,
int32 offset, const text_run_array* runs)
{
if ((fMessenger != NULL) && fMessenger->IsValid()) {
BMessage msg(*fMessage);
msg.AddPointer("source", this);
fMessenger->SendMessage(&msg);
}
BTextView::InsertText(text, length, offset, runs);
}
void
NotifyingTextView::DeleteText(int32 start, int32 finish)
{
if ((fMessenger != NULL) && fMessenger->IsValid()) {
BMessage msg(*fMessage);
msg.AddPointer("source", this);
fMessenger->SendMessage(&msg);
}
BTextView::DeleteText(start, finish);
}

View File

@ -1,36 +0,0 @@
/*
* Copyright 2009-2010, Pier Luigi Fiorini. All rights reserved.
* Copyright 2009, Michael Davidson. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _NOTIFYING_TEXT_VIEW_H
#define _NOTIFYING_TEXT_VIEW_H
#include <Handler.h>
#include <Message.h>
#include <TextView.h>
class BMessenger;
class NotifyingTextView : public BTextView {
public:
NotifyingTextView(const char* name, uint32 flags
= B_WILL_DRAW | B_PULSE_NEEDED);
~NotifyingTextView();
void SetTarget(const BHandler* handler);
BMessage* Message() const;
void SetMessage(BMessage* msg);
protected:
virtual void InsertText(const char* text, int32 length,
int32 offset, const text_run_array* runs = NULL);
virtual void DeleteText(int32 start, int32 finish);
private:
BMessenger* fMessenger;
BMessage* fMessage;
};
#endif // _NOTIFYING_TEXT_VIEW_H