Haiku API Bindings
Roster
Not logged in

Documentation | ApplicationKit | Roster

SYNOPSIS

Perl

Python

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);

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

Python

HaikuR1::Roster->new();

ActivateApp

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

Perl

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

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

Python

$roster->FindApp($app);

GetAppList

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

Perl

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

Python

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

IsRunning

Returns true if a given application is running.

Perl

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

Python

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

Notifications

StartWatching

StopWatching

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

Perl

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

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

Python

$roster->TeamFor($app);

CONSTANTS

Application flags

Perl

Python

use HaikuR1::Roster qw(:app_flags)

Watch notifications

Perl

Python

use HaikuR1::Roster qw(:watch_notification)

These three notification messages will have the following fields:

Watch requests

Perl

Python

use HaikuR1::Roster qw(:watch_request)