Files
haiku-beta6/headers/os/storage/FilePanel.h
T

100 lines
2.4 KiB
C++
Raw Normal View History

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