1 //
2 // "$Id: DiffChooser.h 388 2006-06-07 16:09:03Z fabien $"
3 //
4 // DiffChooser widget definitions.
5 //
6 // Copyright 2005 by Michael Sweet.
7 //
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License v2 as published
10 // by the Free Software Foundation.
11 //
12 // This program 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
15 // GNU General Public License for more details.
16 //
17 
18 #ifndef _DiffChooser_h_
19 #  define _DiffChooser_h_
20 #  include <FL/Fl.H>
21 #  include <FL/Fl_Group.H>
22 #  include <FL/Fl_File_Browser.H>
23 #  include <FL/Fl_File_Input.H>
24 #  include "FavoritesMenu.h"
25 
26 #if defined(WIN32)
27 #include <io.h>
28 #define snprintf _snprintf
29 #define access _access
30 #else
31 #include <unistd.h>
32 #endif
33 
34 class DiffChooser : public Fl_Group
35 {
36   Fl_File_Input		input_;		// Input field
37   FavoritesMenu		menu_;		// Favorites button
38   Fl_File_Browser	browser_;	// File browser
39 
40   char			directory_[1024];// Directory name
41   char			filename_[1024];// Cached filename
42 
43   static void	browser_cb(Fl_File_Browser *fb, DiffChooser *dc);
44   static void	input_cb(Fl_File_Input *fi, DiffChooser *dc);
45   static void	menu_cb(FavoritesMenu *fm, DiffChooser *dc);
46 
47   public:
48 
49 		DiffChooser(int X, int Y, int W, int H, const char *L = (const char *)0);
50   int		count();
deselect()51   void		deselect() { browser_.deselect(); }
directory()52   const char	*directory() { return (directory_); }
selected(int i)53   int		selected(int i) { return (browser_.selected(i)); }
size()54   int		size() { return (browser_.size()); }
55   void		value(const char *f);
value()56   const char	*value() { return (input_.value()); }
57   const char	*value(int i);
58 };
59 
60 
61 #endif // !_DiffChooser_h_
62 
63 //
64 // End of "$Id: DiffChooser.h 388 2006-06-07 16:09:03Z fabien $".
65 //
66