2 * Copyright 2011, Axel Dörfler, axeld@pinc-software.de.
3 * Distributed under the terms of the MIT License.
7 #include "ApplicationsView.h"
9 #include "LaunchButton.h"
13 static const uint32 kMsgActivateApp
= 'AcAp';
16 ApplicationsView::ApplicationsView(uint32 location
)
18 BGroupView((location
& (kTopEdge
| kBottomEdge
)) != 0
19 ? B_HORIZONTAL
: B_VERTICAL
)
24 ApplicationsView::~ApplicationsView()
30 ApplicationsView::AttachedToWindow()
32 // TODO: make this dynamic!
35 be_roster
->GetAppList(&teamList
);
37 for (int32 i
= 0; i
< teamList
.CountItems(); i
++) {
39 team_id team
= (team_id
)teamList
.ItemAt(i
);
40 if (be_roster
->GetRunningAppInfo(team
, &appInfo
) == B_OK
)
47 ApplicationsView::MessageReceived(BMessage
* message
)
49 switch (message
->what
) {
51 be_roster
->ActivateApp(message
->FindInt32("team"));
55 BGroupView::MessageReceived(message
);
62 ApplicationsView::_AddTeam(app_info
& info
)
64 if ((info
.flags
& B_BACKGROUND_APP
) != 0)
67 BMessage
* message
= new BMessage(kMsgActivateApp
);
68 message
->AddInt32("team", info
.team
);
70 LaunchButton
* button
= new LaunchButton(info
.signature
, NULL
, message
,
72 button
->SetTo(&info
.ref
);