haiku/headers/os/storage/FilePanel.h
Ingo Weinhold bcfe344c53 * Made our struct stat POSIX compliant again -- the time_t fields have been
replaced by timespec fields. Via macros the structure is still source
  compatible with the old one.
* Introduced header <compat/sys/stat.h> that defines the old stat structure
  (as stat_beos) and conversion functions
* Introduced versions for [l,f]stat().
* Added symbol versions for BDirectory::GetStatFor() for sake of binary
  compatibility.
* BStatable::GetStat(): Renamed the old method, changed its parameter to
  stat_beos*, and and made it private. Added a new version (using up a
  reserved vtable slot). It remains source and binary compatible.
* BRefFilter::Filter(): Changed the struct stat* parameter to struct stat_beos*
  for sake of binary compatibility. This breaks source compatibility, though,
  which we can't help, since the class doesn't have reserved vtable slots.
* Fixed several issues with the stat structure change, mostly adjusted uses of
  BRefFilter.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30830 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-22 15:15:16 +00:00

99 lines
2.3 KiB
C++

/*
* Copyright 2005, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _FILE_PANEL_H
#define _FILE_PANEL_H
#include <Directory.h>
#include <Entry.h>
#include <Node.h>
class BMessage;
class BMessenger;
class BWindow;
struct stat;
struct stat_beos;
class BRefFilter {
public:
#if __GNUC__ > 2
virtual ~BRefFilter() {};
#endif
virtual bool Filter(const entry_ref* ref, BNode* node,
struct stat_beos* stat, const char* mimeType) = 0;
};
enum file_panel_mode {
B_OPEN_PANEL,
B_SAVE_PANEL
};
enum file_panel_button {
B_CANCEL_BUTTON,
B_DEFAULT_BUTTON
};
class 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* target, BMessage* message);
BWindow* Window() const;
BMessenger Messenger() const;
BRefFilter* RefFilter() const;
file_panel_mode PanelMode() const;
void SetTarget(BMessenger target);
void SetMessage(BMessage* message);
void SetRefFilter(BRefFilter* filter);
void SetSaveText(const char* text);
void SetButtonLabel(file_panel_button button, const char* label);
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 hideWhenDone);
bool HidesWhenDone() const;
void Refresh();
void Rewind();
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;
uint32 _reserved[10];
};
#endif /* _FILE_PANEL_H */