Haiku API Bindings
FilePanel
Not logged in

Documentation | StorageKit | FilePanel

NAME

FilePanel

VERSION

0.01

SYNOPSIS

Perl

use HaikuR1::FilePanel qw(:all);

my $panel = HaikuR1::FilePanel->new(
    mode => $mode,
    target => $target,
    directory => $directory,
    flavors => $flavors,
    allowMultipleSelection => $allowMultipleSelection,
    message => $message,
    filter => $filter,
    modal => $modal,
    hideWhenDone => $hideWhenDone,
);
$panel->Show();

Python

from HaikuR1.StorageKit import FilePanel, B_CANCEL_BUTTON, B_DEFAULT_BUTTON, B_OPEN_PANEL, B_SAVE_PANEL

panel = FilePanel(
    mode = mode,
    target = target,
    directory = directory,
    flavors = flavors,
    allowMultipleSelection = allowMultipleSelection,
    message = message,
    filter = filter,
    modal = modal,
    hideWhenDone = hideWhenDone,
)
panel.Show()

DESCRIPTION

Exposes the BFilePanel object.

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

METHODS

Constructor

Creates a FilePanel.

Perl

HaikuR1::FilePanel->new(
    mode => $mode,
    target => $target,
    directory => $directory,
    flavors => $flavors,
    allowMultipleSelection => $allowMultipleSelection,
    message => $message,
    filter => $filter,
    modal => $modal,
    hideWhenDone => $hideWhenDone,
);

Python

FilePanel(
    mode = mode,
    target = target,
    directory = directory,
    flavors = flavors,
    allowMultipleSelection = allowMultipleSelection,
    message = message,
    filter = filter,
    modal = modal,
    hideWhenDone = hideWhenDone,
)

A note on node flavors:

Please note that symlinks are not resolved; the value passed in the message will be the name of the symlink, not the name of the underlying file.

Labels

SetSaveText

SetButtonLabel

Sets the default file name or the button labels.

Perl

$filepanel->SetSaveText($text);
$filepanel->SetButtonLabel($button, $label);

Python

filepanel.SetSaveText(text)
filepanel.SetButtonLabel(button, label)

Messenger

Returns the Messenger that will be used to send messages in response to events.

Perl

$filepanel->Messenger();

Python

filepanel.Messenger()

PanelMode

Returns the panel mode.

Perl

$filepanel->PanelMode();

Python

filepanel.PanelMode()

RefFilter

Returns the RefFilter associated with the FilePanel.

Perl

$filepanel->RefFilter();

Python

filepanel.RefFilter()

Refresh

Runs the entries in the panel's current directory through the RefFilter again.

Note that you do not need to call this method to update the panel when the contents of the directory change; that will happen automatically.

Perl

$filepanel->Refresh();

Python

filepanel.Refresh()

SelectedRefs

GetNextSelectedRef

Rewind

GetNextSelectedRef and Rewind allow you to iterate through the selected entries.

SelectedRefs is not part of the Haiku API. It is a convenience method implemented in the glue code, allowing you to get all the selected items at once, wrapped up in a native list.

Perl

$filepanel->SelectedRefs();
$filepanel->GetNextSelectedRef();
$filepanel->Rewind();

Python

filepanel.SelectedRefs()
filepanel.GetNextSelectedRef()
filepanel.Rewind()

Settings

SetTarget

SetMessage

SetRefFilter

SetNodeFlavors

SetPanelDirectory

GetPanelDirectory

SetHideWhenDone

HidesWhenDone

These methods change the settings used to create the FilePanel.

Notes:

Perl

$filepanel->PanelMode();
$filepanel->SetTarget($target);
$filepanel->SetMessage($message);
$filepanel->SetRefFilter($filter);
$filepanel->SetNodeFlavors($flavors);
$filepanel->SetPanelDirectory($directory);
$filepanel->GetPanelDirectory();
$filepanel->SetHideWhenDone($hideWhenDone);
$filepanel->HidesWhenDone();

Python

filepanel.PanelMode()
filepanel.SetTarget(target)
filepanel.SetMessage(message)
filepanel.SetRefFilter(filter)
filepanel.SetNodeFlavors(flavors)
filepanel.SetPanelDirectory(directory)
filepanel.GetPanelDirectory()
filepanel.SetHideWhenDone(hideWhenDone)
filepanel.HidesWhenDone()

Show

Hide

IsShowing

These methods so what you expect.

Perl

$filepanel->Show();
$filepanel->Hide();
$filepanel->IsShowing();

Python

filepanel.Show()
filepanel.Hide()
filepanel.IsShowing()

Window

Returns the Window created by the FilePanel object.

Perl

$filepanel->Window();

Python

filepanel.Window()

EVENTS

SelectionChanged

Called when the selection changes. (Use SelectedRefs to get the new selection.)

Perl

$filepanel->SelectionChanged();

Python

filepanel.SelectionChanged()

SendMessage

Called when the Save or Open button is clicked. The default versions uses the [Messenger] to send the message, so you either need to do that yourself or call the default version.

Perl

$filepanel->SendMessage($target, $message);

Python

filepanel.SendMessage(target, message)

WasHidden

Called when user action hides the panel. (It is not called when you call Hide.)

Perl

$filepanel->WasHidden();

Python

filepanel.WasHidden()

CONSTANTS

Buttons

Perl

use HaikuR1::FilePanel qw(:file_panel_button)

Python

Python does not support export tags.

Modes

Perl

use HaikuR1::FilePanel qw(:file_panel_mode)

Python

Python does not support export tags.