Laxkit  0.0.7.1
filedialog.h
1 //
2 //
3 // The Laxkit, a windowing toolkit
4 // Please consult http://laxkit.sourceforge.net about where to send any
5 // correspondence about this software.
6 //
7 // This library is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU Library General Public
9 // License as published by the Free Software Foundation; either
10 // version 2 of the License, or (at your option) any later version.
11 //
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // Library General Public License for more details.
16 //
17 // You should have received a copy of the GNU Library General Public
18 // License along with this library; if not, write to the Free Software
19 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 //
21 // Copyright (C) 2004-2007,2010 by Tom Lechner
22 //
23 #ifndef _LAX_FILEDIALOG_H
24 #define _LAX_FILEDIALOG_H
25 
26 #include <lax/rowframe.h>
27 #include <lax/menuinfo.h>
28 #include <lax/lineinput.h>
29 #include <lax/menuselector.h>
30 #include <lax/filepreviewer.h>
31 #include <lax/button.h>
32 
33 
34 #define FILES_GLOBAL_BOOKMARK (1<<15)
35 
36 #define FILES_MINIMAL (1<<16)
37 #define FILES_NO_BOOKMARKS (1<<17)
38 #define FILES_DETAILS (1<<18)
39 #define FILES_NO_FOLLOW_LINKS (1<<19)
40 
41 #define FILES_FILES_ONLY (1<<20)
42 
43  // NEW is really same as OPEN_ONE, except file must not already exist?
44  // SELECT_DIR is same as OPEN_ONE, but the selected thing must be a directory,
45  // or if none selected, then it is the current directory
46  // OPEN allows multiple files (not directories) to be selected and returned,
47  // and they don't have to all be in the same directory (be careful when selecting!!)
48 #define FILES_FROM_ONE_DIR (1<<21)
49 #define FILES_NEW (1<<22)
50 #define FILES_SELECT_DIR (1<<23)
51 #define FILES_OPEN_ONE (1<<24)
52 #define FILES_OPEN_MANY (1<<25)
53 #define FILES_OPENING ((1<<21)|(1<<22)|(1<<23)|(1<<24)|(1<<25))
54 
55  // SAVE and SAVE_AS allow the same things, but "Save" or "Save As" is a label somewhere
56 #define FILES_SAVE (1<<26)
57 #define FILES_SAVE_AS (1<<27)
58 #define FILES_ASK_TO_OVERWRITE (1<<28)
59 #define FILES_SAVING ((1<<26)|(1<<27)|(1<<28))
60 
61  // Have the preview alongside the list of files.
62 #define FILES_PREVIEW (1<<29)
63 
64 #define FILES_NO_CANCEL (1<<31)
65 
66 
67 
68 
69 namespace Laxkit {
70 
71 
72 //-------------------------------- FileDialog ------------------------------
73 class FileDialog : public RowFrame
74 {
75  protected:
76  MenuInfo files;
77  int getDirectory(const char *npath);
78 // FileLineInput *file;
79  LineInput *path,*mask,*file;
80  MenuSelector *filelist;
81  FilePreviewer *previewer;
82  unsigned long dialog_style;
83  Button *ok;
84  char *recentgroup;
85  int finalbuttons;
86  virtual int newBookmark(const char *pth);
87  virtual MenuInfo *BuildBookmarks();
88  virtual int closeWindow();
89  public:
90  FileDialog(anXWindow *parnt,const char *nname,const char *ntitle,unsigned long nstyle,
91  int xx,int yy,int ww,int hh,int brder,
92  unsigned long nowner,const char *nsend,
93  unsigned long ndstyle,
94  const char *nfile=NULL,const char *npath=NULL,const char *nmask=NULL,
95  const char *nrecentgroup=NULL);
96  virtual ~FileDialog();
97  virtual const char *whattype() { return "FileDialog"; }
98  virtual void OkButton(const char *textforok, const char *ttip);
99  virtual void AddFinalButton(const char *text, const char *ttip, int id, int position);
100  virtual int ClearFinalButton(int position);
101  virtual void Recent(const char *group);
102  virtual int preinit();
103  virtual int init();
104  virtual int GetState(void **state); // puts a NULL terminated char ** list of files in state
105  virtual int Event(const EventData *e,const char *mes);
106  virtual int send(int id);
107  virtual void GoUp();
108  virtual void Cd(const char *to);
109  virtual void RefreshDir();
110  virtual void SetFile(const char *f);
111  virtual int CharInput(unsigned int ch,const char *buffer,int len,unsigned int state,const LaxKeyboard *d);
112  virtual char *fullFilePath(const char *f);
113 };
114 
115 } //namespace Laxkit
116 
117 #endif
118 

Mon Feb 17 2014 11:52:56, Laxkit