2 * Copyright 2006-2010, Haiku Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
6 * Stephan Aßmus <superstippi@gmx.de>
7 * Adrien Destugues <pulkomandy@gmail.com>
8 * Axel Dörfler, axeld@pinc-software.de
9 * Oliver Tappe <zooey@hirschkaefer.de>
11 #ifndef LANGUAGE_LIST_VIEW_H
12 #define LANGUAGE_LIST_VIEW_H
15 #include <OutlineListView.h>
16 #include <StringItem.h>
20 class LanguageListItem
: public BStringItem
{
22 LanguageListItem(const char* text
,
23 const char* id
, const char* languageCode
);
25 const LanguageListItem
& other
);
27 const BString
& ID() const { return fID
; }
28 const BString
& Code() const { return fCode
; }
30 virtual void DrawItem(BView
* owner
, BRect frame
,
31 bool complete
= false);
34 void DrawItemWithTextOffset(BView
* owner
,
35 BRect frame
, bool complete
,
44 class LanguageListItemWithFlag
: public LanguageListItem
{
46 LanguageListItemWithFlag(const char* text
,
47 const char* id
, const char* languageCode
,
48 const char* countryCode
= NULL
);
49 LanguageListItemWithFlag(
50 const LanguageListItemWithFlag
& other
);
51 virtual ~LanguageListItemWithFlag();
53 virtual void Update(BView
* owner
, const BFont
* font
);
55 virtual void DrawItem(BView
* owner
, BRect frame
,
56 bool complete
= false);
64 class LanguageListView
: public BOutlineListView
{
66 LanguageListView(const char* name
,
68 virtual ~LanguageListView();
70 LanguageListItem
* ItemForLanguageID(const char* code
,
71 int32
* _index
= NULL
) const;
72 LanguageListItem
* ItemForLanguageCode(const char* code
,
73 int32
* _index
= NULL
) const;
75 void SetDeleteMessage(BMessage
* message
);
76 void SetDragMessage(BMessage
* message
);
77 void SetGlobalDropTargetIndicator(bool isGlobal
);
79 virtual void Draw(BRect updateRect
);
80 virtual bool InitiateDrag(BPoint point
, int32 index
,
82 virtual void MouseMoved(BPoint where
, uint32 transit
,
83 const BMessage
* dragMessage
);
84 virtual void MouseUp(BPoint point
);
85 virtual void AttachedToWindow();
86 virtual void MessageReceived(BMessage
* message
);
87 virtual void KeyDown(const char* bytes
, int32 numBytes
);
90 bool _AcceptsDragMessage(
91 const BMessage
* message
) const;
95 BRect fDropTargetHighlightFrame
;
96 bool fGlobalDropTargetIndicator
;
97 BMessage
* fDeleteMessage
;
98 BMessage
* fDragMessage
;
102 #endif // LANGUAGE_LIST_VIEW_H