Haiku API Bindings
Roster
Not logged in

Documentation | ApplicationKit | Roster

SYNOPSIS

Perl

use HaikuR1::Roster qw(B_SOME_APP_LAUNCHED B_SOME_APP_QUIT);

my $roster = HaikuR1::Roster->new();

my $team = $roster->Launch($some_app);
my $info = $roster->GetRunningAppInfo($team);

Python

from HaikuR1.ApplicationKit import Roster, B_SOME_APP_LAUNCHED B_SOME_APP_QUIT

roster = Roster()

team = roster.Launch(some_app)
info = roster.GetRunningAppInfo(team)

DESCRIPTION

Exposes the BRoster object.

For more information on Roster, see the Be Book class description, the Be Book overview, and the Haiku Book class description.

METHODS

Constructor

Creates a Roster object.

Perl

HaikuR1::Roster->new();

Python

Roster()

ActivateApp

Activates the application with the given team id. The target application must have a Window on screen. May signal an error.

Perl

$roster->ActivateApp($team);

Python

roster.ActivateApp(team)

An integer, the id of the team to activate.

Broadcast

Sends a Message to all running applications, unless the application does not accept messages. May signal an error.

Perl

$roster->Broadcast($message, $replyTo);

Python

roster.Broadcast(message, replyTo)

FindApp

Returns an entry_ref for the application that handles a given file, or signals an error if no such application is found.

Perl

$roster->FindApp($app);

Python

roster.FindApp(app)

GetAppList

Returns a List of ids for running teams (= processes).

Perl

$roster->GetAppList($signature);

Python

roster.GetAppList(signature)

GetAppInfo

GetRunningAppInfo

GetActiveAppInfo

Returns an app_info structure for the application in question, or signals B_ERROR if no such application is running.

Perl

$roster->GetAppInfo($app);
$roster->GetRunningAppInfo($team);
$roster->GetActiveAppInfo();

Python

roster.GetAppInfo(app)
roster.GetRunningAppInfo(team)
roster.GetActiveAppInfo()

IsRunning

Returns true if a given application is running.

Perl

$roster->IsRunning($app);

Python

roster.IsRunning(app)

Launch

Launches an application and returns the team id for the new application, or signals an error if it fails.

If you need to know whether an application was already running, you can check the error variable (Perl $HaikuR1::Error, Python HaikuR1.error). Although the method does not signal an error for an application that is already running, it does set this error to B_ALREADY_RUNNING. (Of course, it only does this if the application's flags are set to B_EXCLUSIVE_LAUNCH or B_SINGLE_LAUNCH.)

Perl

$roster->Launch($app, $args);

Python

roster.Launch(app, args)

Notifications

StartWatching

StopWatching

Starts or stops watching for application events: launch, quit, activate. May signal an error.

Perl

$roster->StartWatching($target, $eventMask);
$roster->StopWatching($target);

Python

roster.StartWatching(target, eventMask)
roster.StopWatching(target)

Recent Items

GetRecentDocuments

GetRecentFolders

GetRecentApps

AddToRecentDocuments

AddToRecentFolders

The Get methods return a Message; the items fetched will be entry_refs in the Message's refs field.

Other than that, these methods do what you expect.

Perl

$roster->GetRecentDocuments($maxCount, $fileTypes, $signature);
$roster->GetRecentFolders($maxCount, $signature);
$roster->GetRecentApps($maxCount);
$roster->AddToRecentDocuments($document, $signature);
$roster->AddToRecentFolders($folder, $signature);

Python

roster.GetRecentDocuments(maxCount, fileTypes, signature)
roster.GetRecentFolders(maxCount, signature)
roster.GetRecentApps(maxCount)
roster.AddToRecentDocuments(document, signature)
roster.AddToRecentFolders(folder, signature)

TeamFor

Returns the team (= process) id for a given application, or signals B_ERROR if no such application is running.

Perl

$roster->TeamFor($app);

Python

roster.TeamFor(app)

CONSTANTS

Application flags

Perl

use HaikuR1::Roster qw(:app_flags)

Python

Python does not support export tags.

Watch notifications

Perl

use HaikuR1::Roster qw(:watch_notification)

Python

Python does not support export tags.

These three notification messages will have the following fields:

Watch requests

Perl

use HaikuR1::Roster qw(:watch_request)

Python

Python does not support export tags.