/* * Copyright 2006-2010, Haiku Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: * Stephan Aßmus * Adrien Destugues * Axel Dörfler, axeld@pinc-software.de * Oliver Tappe */ #ifndef LANGUAGE_LIST_VIEW_H #define LANGUAGE_LIST_VIEW_H #include #include #include class LanguageListItem : public BStringItem { public: LanguageListItem(const char* text, const char* id, const char* langCode, const char* countryCode = NULL); LanguageListItem(const LanguageListItem& other); virtual ~LanguageListItem(); const BString& ID() const { return fID; } const BString& Code() const { return fCode; } virtual void DrawItem(BView* owner, BRect frame, bool complete = false); virtual void Update(BView* owner, const BFont* font); private: BString fID; BString fCode; BBitmap* fIcon; }; class LanguageListView : public BOutlineListView { public: LanguageListView(const char* name, list_view_type type); virtual ~LanguageListView(); LanguageListItem* ItemForLanguageID(const char* code, int32* _index = NULL) const; LanguageListItem* ItemForLanguageCode(const char* code, int32* _index = NULL) const; void SetDeleteMessage(BMessage* message); void SetDragMessage(BMessage* message); virtual bool InitiateDrag(BPoint point, int32 index, bool wasSelected); virtual void MouseMoved(BPoint where, uint32 transit, const BMessage* dragMessage); virtual void AttachedToWindow(); virtual void MessageReceived(BMessage* message); virtual void KeyDown(const char* bytes, int32 numBytes); private: bool _AcceptsDragMessage(const BMessage* message) const; private: int32 fDropIndex; BMessage* fDeleteMessage; BMessage* fDragMessage; }; #endif // LANGUAGE_LIST_VIEW_H