]>
Commit | Line | Data |
---|---|---|
c801d85f KB |
1 | /* |
2 | * Author: Robert Roebling | |
3 | * | |
4 | * Copyright: (C) 1997,1998 Robert Roebling | |
5 | * | |
6 | * This library is free software; you can redistribute it and/or | |
7 | * modify it under the terms of the wxWindows Licence, which | |
8 | * you have received with this library (see Licence.htm). | |
9 | * | |
10 | */ | |
11 | ||
12 | #ifndef FileList_h | |
13 | #define FileList_h | |
14 | ||
15 | #ifdef __GNUG__ | |
16 | #pragma interface | |
17 | #endif | |
18 | ||
19 | #include "wx/wx.h" | |
20 | #include "wx/listctrl.h" | |
21 | ||
22 | //----------------------------------------------------------------------------- | |
23 | // derived classes | |
24 | //----------------------------------------------------------------------------- | |
25 | ||
26 | class wxFileData; | |
27 | class wxFileCtrl; | |
28 | ||
29 | //----------------------------------------------------------------------------- | |
30 | // wxFileData | |
31 | //----------------------------------------------------------------------------- | |
32 | ||
33 | class wxFileData : public wxObject | |
34 | { | |
35 | DECLARE_DYNAMIC_CLASS(wxFileData); | |
36 | ||
37 | private: | |
38 | wxString m_name; | |
39 | wxString m_fileName; | |
40 | long m_size; | |
41 | int m_hour; | |
42 | int m_minute; | |
43 | int m_year; | |
44 | int m_month; | |
45 | int m_day; | |
46 | wxString m_permissions; | |
47 | bool m_isDir; | |
48 | bool m_isLink; | |
49 | bool m_isExe; | |
50 | ||
51 | public: | |
52 | wxFileData( void ) {}; | |
53 | wxFileData( const wxString &name, const wxString &fname ); | |
54 | wxString GetName(void) const; | |
55 | wxString GetFullName(void) const; | |
56 | wxString GetHint(void) const; | |
57 | wxString GetEntry( const int num ); | |
58 | bool IsDir( void ); | |
59 | bool IsLink( void ); | |
60 | bool IsExe( void ); | |
61 | long GetSize( void ); | |
62 | bool NewNameIsLegal( const wxString &s ); | |
63 | bool Rename( const wxString &s ); | |
64 | void MakeItem( wxListItem &item ); | |
65 | }; | |
66 | ||
67 | //----------------------------------------------------------------------------- | |
68 | // wxFileCtrl | |
69 | //----------------------------------------------------------------------------- | |
70 | ||
71 | class wxFileCtrl : public wxListCtrl | |
72 | { | |
73 | DECLARE_DYNAMIC_CLASS(wxFileCtrl); | |
74 | ||
75 | public: | |
76 | ||
77 | static wxFileCtrl* m_lastFocus; | |
78 | ||
79 | private: | |
80 | wxString m_dirName; | |
81 | bool m_showHidden; | |
e3e65dac RR |
82 | int m_dragStartX; |
83 | int m_dragStartY; | |
84 | int m_dragCount; | |
c801d85f KB |
85 | |
86 | public: | |
87 | wxFileCtrl( void ); | |
88 | wxFileCtrl( wxWindow *win, const wxWindowID id, const wxString &dirName, | |
89 | const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, | |
90 | const long style = wxLC_LIST, const wxString &name = "filelist" ); | |
91 | void ChangeToListMode(); | |
92 | void ChangeToReportMode(); | |
93 | void ChangeToIconMode(); | |
94 | void ShowHidden( bool show = TRUE ); | |
95 | void Update( void ); | |
96 | virtual void StatusbarText( char *WXUNUSED(text) ) {}; | |
97 | int FillList( wxStringList &list ); | |
98 | void DeleteFiles(void); | |
99 | void CopyFiles( char *dest ); | |
100 | void MoveFiles( char *dest ); | |
101 | void RenameFile(void); | |
102 | void MakeDir(void); | |
103 | void GoToParentDir(void); | |
104 | void GoToHomeDir(void); | |
105 | void GoToDir( const wxString &dir ); | |
106 | void GetDir( wxString &dir ); | |
107 | void OnListDeleteItem( wxListEvent &event ); | |
108 | void OnListKeyDown( wxListEvent &event ); | |
109 | void OnListEndLabelEdit( wxListEvent &event ); | |
110 | void OnSetFocus( wxFocusEvent &event ); | |
111 | ||
112 | DECLARE_EVENT_TABLE() | |
113 | }; | |
114 | ||
115 | #endif // FileList_h |