Rewrote FilePanel.h, cleanup.

Removed public functions run_open_panel() and run_save_panel() - they are deprecated
now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14917 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2005-11-14 15:53:46 +00:00
parent d28317fcba
commit 02e5c93fd6
2 changed files with 48 additions and 101 deletions

View File

@ -1,50 +1,28 @@
/******************************************************************************* /*
/ * Copyright 2005, Haiku, Inc. All Rights Reserved.
/ File: FilePanel.h * Distributed under the terms of the MIT License.
/ */
/ Description: BFilePanel and BRefFilter classes, and
/ run_open_panel()/run_save_panel functions.
/
/ Copyright 1993-98, Be Incorporated, All Rights Reserved.
/
*******************************************************************************/
#ifndef _FILE_PANEL_H #ifndef _FILE_PANEL_H
#define _FILE_PANEL_H #define _FILE_PANEL_H
#ifndef _BE_BUILD_H
#include <BeBuild.h>
#endif
#include <sys/stat.h>
#include <Entry.h>
#include <Directory.h> #include <Directory.h>
#include <Entry.h>
#include <Node.h> #include <Node.h>
class BMessage;
/*- Old fashioned, one-shot, heavily-defaulted panel functions. -*/ class BMessenger;
class BWindow;
extern _IMPEXP_TRACKER void run_open_panel(); struct stat;
extern _IMPEXP_TRACKER void run_save_panel();
/*---BRefFilter--------------------------------------------------*/
/* BRefFilter is used by BFilePanel. Every time the user selects
* an item in a file panel, the Filter() func is sent to the
* panel's BRefFilter object. Filter()'s return value determines
* whether the item is admitted into the panel's list of
* displayed items. Optional.
*/
class BRefFilter { class BRefFilter {
public: public:
virtual bool Filter(const entry_ref *, BNode *, struct stat *, virtual bool Filter(const entry_ref* ref, BNode* node,
const char *mimetype) = 0; struct stat* stat, const char* mimeType) = 0;
}; };
/*---File Panel constants etc------------------------------------*/
enum file_panel_mode { enum file_panel_mode {
B_OPEN_PANEL, B_OPEN_PANEL,
B_SAVE_PANEL B_SAVE_PANEL
@ -55,34 +33,14 @@ enum file_panel_button {
B_DEFAULT_BUTTON B_DEFAULT_BUTTON
}; };
class BWindow;
class BMessenger;
class BMessage;
/*---------------------------------------------------------------*/
/*----BFilePanel-------------------------------------------------*/
/* Most of the contructor parameters can also be set through individual
* funcs. But these can't:
*
* file_panel_mode mode
* uint32 node_flavors
* bool modal
*/
class BFilePanel { class BFilePanel {
public: public:
BFilePanel(file_panel_mode mode = B_OPEN_PANEL, BFilePanel(file_panel_mode mode = B_OPEN_PANEL,
BMessenger *target = 0, BMessenger* target = NULL, const entry_ref* directory = NULL,
const entry_ref *start_directory = 0, uint32 nodeFlavors = 0, bool allowMultipleSelection = true,
uint32 node_flavors = 0, BMessage* message = NULL, BRefFilter* refFilter = NULL,
bool allow_multiple_selection = true, bool modal = false, bool hideWhenDone = true);
BMessage *message = 0,
BRefFilter * = 0,
bool modal = false,
bool hide_when_done = true);
virtual ~BFilePanel(); virtual ~BFilePanel();
void Show(); void Show();
@ -91,37 +49,35 @@ virtual ~BFilePanel();
virtual void WasHidden(); virtual void WasHidden();
virtual void SelectionChanged(); virtual void SelectionChanged();
virtual void SendMessage(const BMessenger*, BMessage*); virtual void SendMessage(const BMessenger* target, BMessage* message);
BWindow* Window() const; BWindow* Window() const;
BMessenger Messenger() const; BMessenger Messenger() const;
BRefFilter* RefFilter() const; BRefFilter* RefFilter() const;
void GetPanelDirectory(entry_ref *) const;
file_panel_mode PanelMode() const; file_panel_mode PanelMode() const;
void SetTarget(BMessenger); void SetTarget(BMessenger target);
void SetMessage(BMessage *msg); void SetMessage(BMessage* message);
void SetRefFilter(BRefFilter* filter); void SetRefFilter(BRefFilter* filter);
void SetSaveText(const char* text); void SetSaveText(const char* text);
void SetButtonLabel(file_panel_button, const char *label); void SetButtonLabel(file_panel_button button, const char* label);
void SetPanelDirectory(const BEntry *new_directory); void SetPanelDirectory(const BEntry* newDirectory);
void SetPanelDirectory(const BDirectory *new_directory); void SetPanelDirectory(const BDirectory* newDirectory);
void SetPanelDirectory(const entry_ref *new_directory); void SetPanelDirectory(const entry_ref* newDirectory);
void SetPanelDirectory(const char *new_directory); void SetPanelDirectory(const char* newDirectory);
void GetPanelDirectory(entry_ref* ref) const;
void SetHideWhenDone(bool); void SetHideWhenDone(bool hideWhenDone);
bool HidesWhenDone(void) const; bool HidesWhenDone() const;
void Refresh(); void Refresh();
void Rewind(); void Rewind();
status_t GetNextSelectedRef(entry_ref*); status_t GetNextSelectedRef(entry_ref* ref);
private: private:
#if !_PR3_COMPATIBLE_
virtual void _ReservedFilePanel1(); virtual void _ReservedFilePanel1();
virtual void _ReservedFilePanel2(); virtual void _ReservedFilePanel2();
virtual void _ReservedFilePanel3(); virtual void _ReservedFilePanel3();
@ -130,22 +86,9 @@ virtual void _ReservedFilePanel5();
virtual void _ReservedFilePanel6(); virtual void _ReservedFilePanel6();
virtual void _ReservedFilePanel7(); virtual void _ReservedFilePanel7();
virtual void _ReservedFilePanel8(); virtual void _ReservedFilePanel8();
#endif
BWindow* fWindow; BWindow* fWindow;
#if !_PR3_COMPATIBLE_
uint32 _reserved[10]; uint32 _reserved[10];
#endif
public:
// deprecated calls, do not use
BFilePanel(file_panel_mode mode, BMessenger *, entry_ref *,
uint32 , bool, BMessage *, BRefFilter *, bool modal,
bool hide_when_done);
void SetPanelDirectory(BEntry*);
void SetPanelDirectory(BDirectory*);
void SetPanelDirectory(entry_ref*);
}; };
#endif #endif /* _FILE_PANEL_H */

View File

@ -50,6 +50,10 @@ extern "C" _IMPEXP_ROOT int _kset_fd_limit_(int num);
#undef _IMPEXP_ROOT #undef _IMPEXP_ROOT
#endif #endif
// these two calls are deprecated
extern _IMPEXP_TRACKER void run_open_panel();
extern _IMPEXP_TRACKER void run_save_panel();
void void
run_open_panel() run_open_panel()
{ {