Planeshift
pawsfilenavigation.h
Go to the documentation of this file.
1 /*
2  * Author: Andrew Mann
3  *
4  * Copyright (C) 2004 Atomic Blue (info@planeshift.it, http://www.atomicblue.org)
5  *
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation (version 2 of the License)
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17  *
18  */
19 
20 #ifndef PAWS_FILENAVIGATION_HEADER
21 #define PAWS_FILENAVIGATION_HEADER
22 
23 #include "paws/pawswidget.h"
24 
25 class pawsEditTextBox;
26 class pawsTextBox;
27 class pawsButton;
28 class pawsListBox;
29 class pawsComboBox;
30 
36 {
37 public:
38  virtual void Execute(const csString &string) = 0;
39  // can be -1
40  virtual ~iOnFileSelectedAction() {};
41 };
42 
44 {
45 public:
47  virtual ~pawsFileNavigation();
49 
50  // implemented virtual functions from pawsWidgets
51  virtual bool PostSetup();
52  virtual bool OnButtonPressed(int mouseButton, int keyModifier, pawsWidget* widget);
53  virtual bool OnChange(pawsWidget* widget);
54  virtual void OnListAction(pawsListBox* selected, int status);
55  virtual bool OnKeyDown(utf32_char keyCode, utf32_char key, int modifiers);
56 
58  virtual void Show();
59 
60 
62  // filename edit box.
63  virtual const char* GetFullPathFilename();
64 
66  virtual const char* GetCurrentPath();
67 
75  virtual int GetSelectionState();
76 
78  virtual void SetActionButtonText(const char* actiontext);
79 
81  virtual bool SetSelectedFilename(const char* filename);
82 
83  virtual bool SetFileFilters(const char* filename);
84 
86  virtual bool FillFileList();
87 
88  void Initialize(const csString &filename, const csString &filter, iOnFileSelectedAction* action);
89 
90  static pawsFileNavigation* Create(
91  const csString &label, const csString &filter, iOnFileSelectedAction* action, const char* xmlWidget = "filenavigation.xml");
92 
93 protected:
95  virtual bool SetFilterForSelection(const char* filename);
96  virtual const char* GetFilterForSelection();
98  virtual bool SmartAppendPath(const char* append);
100  virtual bool SmartSetPath(const char* path);
101  virtual bool UpOnePath();
102  virtual bool DownOnePath(const char* pathstring,int pathlen);
103  virtual bool RelativeIsFile(const char* filename);
104 
105 protected:
107  csRef<iVFS> vfs;
108 
110  csString current_path;
111 
112  csArray<csString> zip_mounts;
113 
116 
119 
121  // reconstructed on each call to GetFullPathFilename()
123 
126 
128 };
129 
131 
134 #endif // #ifndef PAWS_FILENAVIGATION_HEADER
135 
int selection_state
Stores the current selection state (none selected, canceled, or perform)
The main base widget that all other widgets should inherit from.
Definition: pawswidget.h:116
csString current_path
The current virtual path.
virtual void Execute(const csString &string)=0
pawsListBox * filelistbox
The file display listbox child of this widget.
An edit box widget/.
Definition: pawstextbox.h:409
pawsListBox * dirlistbox
The directory display listbox child of this widget.
CREATE_PAWS_FACTORY(pawsFileNavigation)
A simple list box widget.
Definition: pawslistbox.h:202
char * fullpathandfilename
A buffer used to construct the full path and file of a selected file. Not always valid.
csRef< iVFS > vfs
A reference to the iVFS for the file system, used for navigation.
iOnFileSelectedAction * action
void void Initialize(iObjectRegistry *object_reg)
A simple button widget.
Definition: pawsbutton.h:43
A basic combo box widget.
Definition: pawscombo.h:53
csArray< csString > zip_mounts
A basic text box widget.
Definition: pawstextbox.h:42