-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathStationListView.h
72 lines (62 loc) · 2.65 KB
/
StationListView.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
* File: StationListView.h
* Author: user
*
* Created on 26. Februar 2013, 09:22
*/
#ifndef STATIONLISTVIEW_H
#define STATIONLISTVIEW_H
#include <ListView.h>
#include <ListItem.h>
#include <Button.h>
#include <Window.h>
#include "Station.h"
#include "RadioSettings.h"
#include "StreamPlayer.h"
#define MSG_STATION_LIST 'STLS'
class StationListView;
class StationListViewItem : public BListItem {
friend class StationListView;
public:
StationListViewItem(Station* station);
virtual ~StationListViewItem();
virtual void DrawItem(BView* owner, BRect frame, bool complete);
void DrawBufferFillBar(BView* owner, BRect frame);
virtual void Update(BView *owner, const BFont* font);
Station* GetStation() { return fStation; }
void StateChanged(StreamPlayer::PlayState newState);
void SetFillRatio(float fillRatio);
StreamPlayer* Player() { return fPlayer; }
StreamPlayer::PlayState State();
void SetPlayer(StreamPlayer* player) {
fPlayer = player;
}
private:
StationListView* fList;
class Station* fStation;
StreamPlayer* fPlayer;
float fFillRatio;
static BBitmap* getButtonBitmap(StreamPlayer::PlayState state);
static BBitmap* buttonBitmap[3];
};
class StationListView : public BListView {
public:
StationListView(bool canPlay = false);
virtual ~StationListView();
void Sync(StationsList* stations);
virtual bool AddItem(Station* station);
virtual bool AddItem(StationListViewItem* item);
int32 StationIndex(Station* station);
StationListViewItem* Item(Station* station);
StationListViewItem* ItemAt(int32 index);
Station* StationAt(int32 index);
void SetPlayMessage(BMessage* playMsg);
bool CanPlay() { return fCanPlay; }
private:
virtual void MouseDown(BPoint where);
virtual void MouseUp(BPoint where);
BPoint whereDown;
BMessage* playMsg;
bool fCanPlay;
};
#endif /* STATIONLISTVIEW_H */