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:
parent
d28317fcba
commit
02e5c93fd6
@ -1,50 +1,28 @@
|
||||
/*******************************************************************************
|
||||
/
|
||||
/ File: FilePanel.h
|
||||
/
|
||||
/ Description: BFilePanel and BRefFilter classes, and
|
||||
/ run_open_panel()/run_save_panel functions.
|
||||
/
|
||||
/ Copyright 1993-98, Be Incorporated, All Rights Reserved.
|
||||
/
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright 2005, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _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 <Entry.h>
|
||||
#include <Node.h>
|
||||
|
||||
|
||||
/*- Old fashioned, one-shot, heavily-defaulted panel functions. -*/
|
||||
|
||||
extern _IMPEXP_TRACKER void run_open_panel();
|
||||
extern _IMPEXP_TRACKER void run_save_panel();
|
||||
class BMessage;
|
||||
class BMessenger;
|
||||
class BWindow;
|
||||
struct stat;
|
||||
|
||||
|
||||
/*---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 {
|
||||
public:
|
||||
virtual bool Filter(const entry_ref *, BNode *, struct stat *,
|
||||
const char *mimetype) = 0;
|
||||
public:
|
||||
virtual bool Filter(const entry_ref* ref, BNode* node,
|
||||
struct stat* stat, const char* mimeType) = 0;
|
||||
};
|
||||
|
||||
|
||||
/*---File Panel constants etc------------------------------------*/
|
||||
|
||||
enum file_panel_mode {
|
||||
B_OPEN_PANEL,
|
||||
B_SAVE_PANEL
|
||||
@ -55,97 +33,62 @@ enum file_panel_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 {
|
||||
|
||||
public:
|
||||
BFilePanel(file_panel_mode mode = B_OPEN_PANEL,
|
||||
BMessenger *target = 0,
|
||||
const entry_ref *start_directory = 0,
|
||||
uint32 node_flavors = 0,
|
||||
bool allow_multiple_selection = true,
|
||||
BMessage *message = 0,
|
||||
BRefFilter * = 0,
|
||||
bool modal = false,
|
||||
bool hide_when_done = true);
|
||||
|
||||
virtual ~BFilePanel();
|
||||
public:
|
||||
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);
|
||||
virtual ~BFilePanel();
|
||||
|
||||
void Show();
|
||||
void Hide();
|
||||
bool IsShowing() const;
|
||||
|
||||
virtual void WasHidden();
|
||||
virtual void SelectionChanged();
|
||||
virtual void SendMessage(const BMessenger*, BMessage*);
|
||||
virtual void WasHidden();
|
||||
virtual void SelectionChanged();
|
||||
virtual void SendMessage(const BMessenger* target, BMessage* message);
|
||||
|
||||
BWindow* Window() const;
|
||||
BMessenger Messenger() const;
|
||||
BRefFilter* RefFilter() const;
|
||||
void GetPanelDirectory(entry_ref *) const;
|
||||
|
||||
file_panel_mode PanelMode() const;
|
||||
|
||||
void SetTarget(BMessenger);
|
||||
void SetMessage(BMessage *msg);
|
||||
void SetTarget(BMessenger target);
|
||||
void SetMessage(BMessage* message);
|
||||
|
||||
void SetRefFilter(BRefFilter* filter);
|
||||
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 BDirectory *new_directory);
|
||||
void SetPanelDirectory(const entry_ref *new_directory);
|
||||
void SetPanelDirectory(const char *new_directory);
|
||||
void SetPanelDirectory(const BEntry* newDirectory);
|
||||
void SetPanelDirectory(const BDirectory* newDirectory);
|
||||
void SetPanelDirectory(const entry_ref* newDirectory);
|
||||
void SetPanelDirectory(const char* newDirectory);
|
||||
void GetPanelDirectory(entry_ref* ref) const;
|
||||
|
||||
void SetHideWhenDone(bool);
|
||||
bool HidesWhenDone(void) const;
|
||||
void SetHideWhenDone(bool hideWhenDone);
|
||||
bool HidesWhenDone() const;
|
||||
|
||||
void Refresh();
|
||||
void Rewind();
|
||||
status_t GetNextSelectedRef(entry_ref*);
|
||||
status_t GetNextSelectedRef(entry_ref* ref);
|
||||
|
||||
private:
|
||||
private:
|
||||
virtual void _ReservedFilePanel1();
|
||||
virtual void _ReservedFilePanel2();
|
||||
virtual void _ReservedFilePanel3();
|
||||
virtual void _ReservedFilePanel4();
|
||||
virtual void _ReservedFilePanel5();
|
||||
virtual void _ReservedFilePanel6();
|
||||
virtual void _ReservedFilePanel7();
|
||||
virtual void _ReservedFilePanel8();
|
||||
|
||||
#if !_PR3_COMPATIBLE_
|
||||
virtual void _ReservedFilePanel1();
|
||||
virtual void _ReservedFilePanel2();
|
||||
virtual void _ReservedFilePanel3();
|
||||
virtual void _ReservedFilePanel4();
|
||||
virtual void _ReservedFilePanel5();
|
||||
virtual void _ReservedFilePanel6();
|
||||
virtual void _ReservedFilePanel7();
|
||||
virtual void _ReservedFilePanel8();
|
||||
#endif
|
||||
|
||||
BWindow *fWindow;
|
||||
|
||||
#if !_PR3_COMPATIBLE_
|
||||
BWindow* fWindow;
|
||||
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 */
|
||||
|
@ -50,6 +50,10 @@ extern "C" _IMPEXP_ROOT int _kset_fd_limit_(int num);
|
||||
#undef _IMPEXP_ROOT
|
||||
#endif
|
||||
|
||||
// these two calls are deprecated
|
||||
extern _IMPEXP_TRACKER void run_open_panel();
|
||||
extern _IMPEXP_TRACKER void run_save_panel();
|
||||
|
||||
void
|
||||
run_open_panel()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user