Torque3D Documentation / _generateds / guiDirectoryFileListCtrl.h

guiDirectoryFileListCtrl.h

Engine/source/gui/controls/guiDirectoryFileListCtrl.h

More...

Classes:

Detailed Description

 1
 2//-----------------------------------------------------------------------------
 3// Copyright (c) 2012 GarageGames, LLC
 4//
 5// Permission is hereby granted, free of charge, to any person obtaining a copy
 6// of this software and associated documentation files (the "Software"), to
 7// deal in the Software without restriction, including without limitation the
 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 9// sell copies of the Software, and to permit persons to whom the Software is
10// furnished to do so, subject to the following conditions:
11//
12// The above copyright notice and this permission notice shall be included in
13// all copies or substantial portions of the Software.
14//
15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21// IN THE SOFTWARE.
22//-----------------------------------------------------------------------------
23
24#ifndef _GUI_DIRECTORYFILELISTCTRL_H_
25#define _GUI_DIRECTORYFILELISTCTRL_H_
26
27#ifndef _PLATFORM_H_
28#include "platform/platform.h"
29#endif
30
31#ifndef _GUI_LISTBOXCTRL_H_
32#include "gui/controls/guiListBoxCtrl.h"
33#endif
34
35class GuiDirectoryFileListCtrl : public GuiListBoxCtrl
36{
37private:
38   typedef GuiListBoxCtrl Parent;
39protected:
40   StringTableEntry mFilePath;
41   StringTableEntry mFilter;
42
43   void openDirectory();
44   
45   static bool _setFilePath( void *object, const char *index, const char *data )
46   {
47      GuiDirectoryFileListCtrl* ctrl = ( GuiDirectoryFileListCtrl* ) object;
48      ctrl->setCurrentPath( data, ctrl->mFilter );
49      return false;
50   }
51   static bool _setFilter( void *object, const char *index, const char *data )
52   {
53      GuiDirectoryFileListCtrl* ctrl = ( GuiDirectoryFileListCtrl* ) object;
54      ctrl->setCurrentFilter( data );
55      return false;
56   }
57   
58public:
59   GuiDirectoryFileListCtrl();
60   
61   DECLARE_CONOBJECT(GuiDirectoryFileListCtrl);
62   DECLARE_DESCRIPTION( "A control that displays a list of files from within a single\n"
63                        "directory in the game file system." );
64   
65   static void initPersistFields();
66   
67   void update() { openDirectory(); }
68
69   /// Set the current path to grab files from
70   bool setCurrentPath( const char* path, const char* filter );
71   void setCurrentFilter( const char* filter );
72
73   /// Get the currently selected file's name
74   StringTableEntry getSelectedFileName();
75
76   virtual void onMouseDown(const GuiEvent &event);
77   virtual bool onWake();
78};
79
80#endif
81