RemoteDrawingEngine: Reduce RP_READ_BITMAP result timeout.
[haiku.git] / src / preferences / locale / LanguageListView.h
blob79f5fa136553d837ad392a3c12c5d992f047fa2c
1 /*
2 * Copyright 2006-2010, Haiku Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
5 * Authors:
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>
17 #include <String.h>
20 class LanguageListItem : public BStringItem {
21 public:
22 LanguageListItem(const char* text,
23 const char* id, const char* languageCode);
24 LanguageListItem(
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);
33 protected:
34 void DrawItemWithTextOffset(BView* owner,
35 BRect frame, bool complete,
36 float textOffset);
38 private:
39 BString fID;
40 BString fCode;
44 class LanguageListItemWithFlag : public LanguageListItem {
45 public:
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);
58 private:
59 BString fCountryCode;
60 BBitmap* fIcon;
64 class LanguageListView : public BOutlineListView {
65 public:
66 LanguageListView(const char* name,
67 list_view_type type);
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,
81 bool wasSelected);
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);
89 private:
90 bool _AcceptsDragMessage(
91 const BMessage* message) const;
93 private:
94 int32 fDropIndex;
95 BRect fDropTargetHighlightFrame;
96 bool fGlobalDropTargetIndicator;
97 BMessage* fDeleteMessage;
98 BMessage* fDragMessage;
102 #endif // LANGUAGE_LIST_VIEW_H