diff --git a/src/prefs/datatranslations/DataTranslationsView.cpp b/src/prefs/datatranslations/DataTranslationsView.cpp index eb2177a9bd..4ea310678f 100644 --- a/src/prefs/datatranslations/DataTranslationsView.cpp +++ b/src/prefs/datatranslations/DataTranslationsView.cpp @@ -11,54 +11,53 @@ #include "DataTranslationsView.h" -DataTranslationsView::DataTranslationsView(BRect rect, const char *name, list_view_type type = B_SINGLE_SELECTION_LIST) : - BListView(rect, name, B_SINGLE_SELECTION_LIST, B_FOLLOW_ALL_SIDES) -{ - - messagerunner = NULL; +DataTranslationsView::DataTranslationsView(BRect rect, const char *name, + list_view_type type = B_SINGLE_SELECTION_LIST) + : BListView(rect, name, B_SINGLE_SELECTION_LIST, B_FOLLOW_ALL_SIDES) +{ } -void DataTranslationsView::MessageReceived(BMessage *message) +DataTranslationsView::~DataTranslationsView() { +} +void +DataTranslationsView::MessageReceived(BMessage *message) +{ uint32 type; int32 count; switch (message->what) { case B_SIMPLE_DATA: + // Tell the application object that a + // file has been dropped on this view message->GetInfo("refs", &type, &count); - if ( count>0 && type == B_REF_TYPE ) - { + if (count > 0 && type == B_REF_TYPE) { message->what = B_REFS_RECEIVED; be_app->PostMessage(message); Invalidate(); } break; + default: BView::MessageReceived(message); break; } } -void DataTranslationsView::MouseMoved(BPoint point, uint32 transit, const BMessage *msg) +void +DataTranslationsView::MouseMoved(BPoint point, uint32 transit, const BMessage *msg) { - if ((transit == B_ENTERED_VIEW) && (msg != NULL)) - { - BRect x( 0, 0, 110, 278); - SetHighColor(220,0,0); + if (msg && transit == B_ENTERED_VIEW) { + // Draw a red box around the inside of the view + // to tell the user that this view accepts drops + SetHighColor(220,0,0); SetPenSize(4); - StrokeRect(x); + StrokeRect(Bounds()); SetHighColor(0,0,0); - } - if ((transit == B_EXITED_VIEW) && (msg != NULL)) - { - Invalidate(); - } - return; + + } else if (msg && transit == B_EXITED_VIEW) + Invalidate(); } -DataTranslationsView::~DataTranslationsView() -{ - if (messagerunner != NULL) delete messagerunner; -} diff --git a/src/prefs/datatranslations/DataTranslationsView.h b/src/prefs/datatranslations/DataTranslationsView.h index ee152d410f..8f4b72290f 100644 --- a/src/prefs/datatranslations/DataTranslationsView.h +++ b/src/prefs/datatranslations/DataTranslationsView.h @@ -10,22 +10,17 @@ #include #include -#include - class DataTranslationsView : public BListView { - public: - DataTranslationsView(BRect rect, - const char *name, list_view_type type = B_SINGLE_SELECTION_LIST ); - - ~DataTranslationsView(); - void MessageReceived(BMessage *message); - virtual void MouseMoved(BPoint point, uint32 transit, const BMessage *msg); - - private: +public: + DataTranslationsView(BRect rect, const char *name, + list_view_type type = B_SINGLE_SELECTION_LIST); + + ~DataTranslationsView(); - - BMessageRunner *messagerunner; + void MessageReceived(BMessage *message); + + virtual void MouseMoved(BPoint point, uint32 transit, const BMessage *msg); }; #endif