BTRFS: Implement BTree::Path and change _Find.
[haiku.git] / src / apps / soundrecorder / SoundListView.cpp
blob42cab62d92c00acf43f37c738bd03e1c8f431560
1 /*
2 * Copyright 2005, Jérôme Duval. All rights reserved.
3 * Distributed under the terms of the MIT License.
5 * Inspired by SoundCapture from Be newsletter (Media Kit Basics: Consumers
6 * and Producers)
7 */
8 #include <Catalog.h>
9 #include <Entry.h>
10 #include <Locale.h>
12 #include "SoundListView.h"
15 #undef B_TRANSLATION_CONTEXT
16 #define B_TRANSLATION_CONTEXT "SoundListView"
19 SoundListView::SoundListView(
20 const BRect & area,
21 const char * name,
22 uint32 resize) :
23 BListView(area, name, B_SINGLE_SELECTION_LIST, resize)
28 SoundListView::~SoundListView()
33 void
34 SoundListView::Draw(BRect updateRect)
36 if (IsEmpty()) {
37 SetLowColor(ViewColor());
38 FillRect(Bounds(), B_SOLID_LOW);
40 SetHighColor(ui_color(B_PANEL_TEXT_COLOR));
41 BFont font(be_bold_font);
42 SetFont(&font);
43 font_height height;
44 font.GetHeight(&height);
45 float width = font.StringWidth(B_TRANSLATE("Drop files here"));
47 BPoint pt;
48 pt.x = (Bounds().Width() - width) / 2;
49 pt.y = (Bounds().Height() + height.ascent + height.descent)/ 2;
50 DrawString(B_TRANSLATE("Drop files here"), pt);
52 BListView::Draw(updateRect);
56 void
57 SoundListView::AttachedToWindow()
59 BListView::AttachedToWindow();
60 SetViewColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
61 B_LIGHTEN_1_TINT));
65 SoundListItem::SoundListItem(
66 const BEntry & entry,
67 bool isTemp)
68 : BStringItem(""),
69 fEntry(entry),
70 fIsTemp(isTemp)
72 char name[256];
73 fEntry.GetName(name);
74 SetText(name);
78 SoundListItem::~SoundListItem()