2005-11-14 18:53:46 +03:00
|
|
|
/*
|
|
|
|
* Copyright 2005, Haiku, Inc. All Rights Reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2002-10-23 17:54:44 +04:00
|
|
|
#ifndef _FILE_PANEL_H
|
|
|
|
#define _FILE_PANEL_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <Directory.h>
|
2005-11-14 18:53:46 +03:00
|
|
|
#include <Entry.h>
|
2002-10-23 17:54:44 +04:00
|
|
|
#include <Node.h>
|
|
|
|
|
2005-11-14 18:53:46 +03:00
|
|
|
class BMessage;
|
|
|
|
class BMessenger;
|
|
|
|
class BWindow;
|
|
|
|
struct stat;
|
2009-05-22 19:15:16 +04:00
|
|
|
struct stat_beos;
|
2002-10-23 17:54:44 +04:00
|
|
|
|
|
|
|
|
|
|
|
class BRefFilter {
|
2005-11-14 18:53:46 +03:00
|
|
|
public:
|
2008-04-19 11:01:48 +04:00
|
|
|
#if __GNUC__ > 2
|
2008-04-17 00:11:54 +04:00
|
|
|
virtual ~BRefFilter() {};
|
|
|
|
#endif
|
2005-11-14 18:53:46 +03:00
|
|
|
virtual bool Filter(const entry_ref* ref, BNode* node,
|
2009-05-22 19:15:16 +04:00
|
|
|
struct stat_beos* stat, const char* mimeType) = 0;
|
2002-10-23 17:54:44 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
enum file_panel_mode {
|
|
|
|
B_OPEN_PANEL,
|
|
|
|
B_SAVE_PANEL
|
|
|
|
};
|
|
|
|
|
|
|
|
enum file_panel_button {
|
|
|
|
B_CANCEL_BUTTON,
|
|
|
|
B_DEFAULT_BUTTON
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class BFilePanel {
|
2005-11-14 18:53:46 +03:00
|
|
|
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();
|
2002-10-23 17:54:44 +04:00
|
|
|
|
|
|
|
void Show();
|
|
|
|
void Hide();
|
|
|
|
bool IsShowing() const;
|
|
|
|
|
2005-11-14 18:53:46 +03:00
|
|
|
virtual void WasHidden();
|
|
|
|
virtual void SelectionChanged();
|
|
|
|
virtual void SendMessage(const BMessenger* target, BMessage* message);
|
2002-10-23 17:54:44 +04:00
|
|
|
|
|
|
|
BWindow* Window() const;
|
|
|
|
BMessenger Messenger() const;
|
|
|
|
BRefFilter* RefFilter() const;
|
|
|
|
|
|
|
|
file_panel_mode PanelMode() const;
|
|
|
|
|
2005-11-14 18:53:46 +03:00
|
|
|
void SetTarget(BMessenger target);
|
|
|
|
void SetMessage(BMessage* message);
|
2002-10-23 17:54:44 +04:00
|
|
|
|
|
|
|
void SetRefFilter(BRefFilter* filter);
|
|
|
|
void SetSaveText(const char* text);
|
2005-11-14 18:53:46 +03:00
|
|
|
void SetButtonLabel(file_panel_button button, const char* label);
|
2014-12-04 11:26:49 +03:00
|
|
|
void SetNodeFlavors(uint32 flavors);
|
2002-10-23 17:54:44 +04:00
|
|
|
|
2005-11-14 18:53:46 +03:00
|
|
|
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;
|
2002-10-23 17:54:44 +04:00
|
|
|
|
2005-11-14 18:53:46 +03:00
|
|
|
void SetHideWhenDone(bool hideWhenDone);
|
|
|
|
bool HidesWhenDone() const;
|
2002-10-23 17:54:44 +04:00
|
|
|
|
|
|
|
void Refresh();
|
|
|
|
void Rewind();
|
2005-11-14 18:53:46 +03:00
|
|
|
status_t GetNextSelectedRef(entry_ref* ref);
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
BWindow* fWindow;
|
2002-10-23 17:54:44 +04:00
|
|
|
uint32 _reserved[10];
|
|
|
|
};
|
|
|
|
|
2005-11-14 18:53:46 +03:00
|
|
|
#endif /* _FILE_PANEL_H */
|