|
| BFilePanel (file_panel_mode mode=B_OPEN_PANEL, BMessenger *target=NULL, const entry_ref *directory=NULL, uint32 nodeFlavors=0, bool allowMultipleSelection=true, BMessage *message=NULL, BRefFilter *refFilter=NULL, bool modal=false, bool hideWhenDone=true) |
| Creates and initializes a BFilePanel object. More...
|
|
virtual | ~BFilePanel () |
| Destroys the file panel object. More...
|
|
status_t | GetNextSelectedRef (entry_ref *ref) |
| Sets the ref pointer to the next entry in the directory. More...
|
|
void | GetPanelDirectory (entry_ref *ref) const |
| Gets the entry ref of the panel and sets ref to point to it. More...
|
|
void | Hide () |
| Hides the file panel. More...
|
|
bool | HidesWhenDone () const |
| Gets whether or not the panel should hide on confirm or cancel. More...
|
|
bool | IsShowing () const |
| Determines whether or not the file panel is shown. More...
|
|
BMessenger | Messenger () const |
| Gets the panel's target messenger object. More...
|
|
file_panel_mode | PanelMode () const |
| Gets the panel mode, either B_OPEN_PANEL or B_SAVE_PANEL . More...
|
|
BRefFilter * | RefFilter () const |
| Gets the BRefFilter object associated with the panel. More...
|
|
void | Refresh () |
| Refresh the directory or the panel causing the entries to be re-run through the BRefFilter::Filter() method. More...
|
|
void | Rewind () |
| Sets the entry ref back to the top of the list. More...
|
|
virtual void | SendMessage (const BMessenger *target, BMessage *message) |
| Sends the message to the target BHandler messenger. More...
|
|
void | SetButtonLabel (file_panel_button button, const char *label) |
| Set the button label specified by button to text. More...
|
|
void | SetHideWhenDone (bool hideWhenDone) |
| Sets whether or not the panel should hide on confirm or cancel. More...
|
|
void | SetMessage (BMessage *message) |
| Sets the target messenge. More...
|
|
void | SetPanelDirectory (const BEntry *newDirectory) |
| Sets the entry ref of the panel to the directory referenced by entry. More...
|
|
void | SetPanelDirectory (const BDirectory *newDirectory) |
| Sets the entry ref of the panel to the directory referenced by dir. More...
|
|
void | SetPanelDirectory (const entry_ref *newDirectory) |
| Sets the entry ref of the panel to the directory contained by ref. More...
|
|
void | SetPanelDirectory (const char *newDirectory) |
| Sets the entry ref of the panel to the directory referenced by path. More...
|
|
void | SetRefFilter (BRefFilter *filter) |
| Sets the BRefFilter used by the panel to filter entries. More...
|
|
void | SetSaveText (const char *text) |
| Set some save text to display in the save dialog. More...
|
|
void | SetTarget (BMessenger target) |
| Sets the target messenger. More...
|
|
void | Show () |
| Displays the file panel on screen. More...
|
|
BWindow * | Window () const |
| Gets a pointer to the BWindow object used by the file panel. More...
|
|
|
virtual void | WasHidden () |
| Hook method that gets called when the file panel is hidden due to a user action. More...
|
|
virtual void | SelectionChanged () |
| Hook method that gets called when the entry ref references by the file panel changes. More...
|
|
Displays a standard Open/Save dialog.
A save panel looks like this:
An open dialog looks similar but doesn't have a text box for the file name.
You generally construct a BFilePanel object in response to a user action for example the user clicks on a "Open" or "Save"/"Save As" menu item. Constructing an open or save panel is easy:
You can then call methods to indicate what directory to display, whether
or not multiple selections are allowed, whether or not the user is
allowed to open a directory, what target view to send send notifications,
and more. See the constructor for details.
You can modify the look of your BFilePanel object by calling the
SetButtonLabel() and SetSaveText() methods. If you want to change the look
even more radically you can get alter the panel's BWindow and BView
objects. You get the window by calling the Window() method. With a pointer
to the panel's BWindow object you can drill down to the various views
contained therein.
Once you have constructed and customized your BFilePanel object you should
call the Show() method to display the panel to the user.
When the user confirms or cancels a BMessage object is constructed and sent
to the target of the BFilePanel object. You can specify a different
target in the constructor or by calling the SetTarget() method.
<b>Open Notifications</b>
For open notifications the default target is \c be_app_messenger and is
caught by the RefsReceived() method The \c what field is set to
\c B_REFS_RECEIVED. You can set your own message by calling the
SetMessage() method; in this case the message will be sent to the target's
MessageReceived() method instead.
The \c refs field of the message contains an \c entry_ref structure
for each entry that the user has selected. The \c refs field is of
type \c B_REF_TYPE. If the selected entry is a symlink to a file you'll
need to dereference the file yourself. You can do this more easily by
turning the \c ref into a BEntry passing \c true into the \c traverse
argument like this:
<b>Save Notifications</b>
Save notifications are always sent to the target's MessageReceived()
method unlike open notifications. The \c what field of the message is
set to \c B_SAVE_REQUESTED. The \c directory field contain a single
\c entry_ref structure that points to the directory that the entry is
saved to. The text that the user typed in the save panel's text view
is put in the \c name field and is of type \c B_STRING_TYPE.
<b>Cancel Notifications</b>
Cancel notifications are sent when the panel is hidden whether by the
user clicking the cancel button, closing the dialog, or confirming the
action (assuming hide-when-done is turned on).
Cancel notifications can be caught by the MessageReceived() method of
the target. The \c what field is set to \c B_CANCEL. The \c old_what
field is set to the previous what value which is useful if you have
overridden the default message. The \c what field of the message you
sent is put in the \c old_what field.
The \c source field is a pointer of \c B_POINTER_TYPE to the closed
BFilePanel object. When the BFilePanel object is closed it is not
destroyed, it is hidden instead. You can then delete the BFilePanel
object or leave it be and simply call Show() to use the panel next time
you need it.
\since BeOS R3