-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskView.cpp
46 lines (36 loc) · 922 Bytes
/
TaskView.cpp
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
/*
* Copyright 2024, My Name <[email protected]>
* All rights reserved. Distributed under the terms of the MIT license.
*/
#include "TaskView.h"
#include "TaskRoster.h"
#include <LayoutBuilder.h>
#include <iostream>
#include <ostream>
TaskView::TaskView()
:
BView("task view", B_WILL_DRAW)
{
fListView = new BListView("listview");
BLayoutBuilder::Group<>(this, B_VERTICAL, 0.0f)
.Add(fListView)
.End();
SetFlags(Flags() | B_PULSE_NEEDED);
}
/* virtual*/
void
TaskView::Pulse()
{
fListView->MakeEmpty();
TaskRoster* roster = TaskRoster::Get();
for (int32 i = 0; i < roster->CountTasks(); i++) {
TaskDescriptor* t = roster->TaskAt(i);
BString text;
text << t->name << " (" << t->id << ") ";
if (t->status == TaskDescriptor::STATUS_RUNNING)
text << " running";
else if (t->status == TaskDescriptor::STATUS_STOPPED)
text << " stopped";
fListView->AddItem(new BStringItem(text));
}
}