blob: e3d27fabca6c3cfe794a3bb6cdb8e55080e68130 [file] [log] [blame]
DRC2ff39b82011-07-28 08:38:59 +00001//
2// "$Id: Fl_File_Input.H 8712 2011-05-22 09:45:40Z AlbrechtS $"
3//
4// File_Input header file for the Fast Light Tool Kit (FLTK).
5//
6// Copyright 1998-2010 by Bill Spitzak and others.
7// Original version Copyright 1998 by Curtis Edwards.
8//
9// This library is free software; you can redistribute it and/or
10// modify it under the terms of the GNU Library General Public
11// License as published by the Free Software Foundation; either
12// version 2 of the License, or (at your option) any later version.
13//
14// This library is distributed in the hope that it will be useful,
15// but WITHOUT ANY WARRANTY; without even the implied warranty of
16// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17// Library General Public License for more details.
18//
19// You should have received a copy of the GNU Library General Public
20// License along with this library; if not, write to the Free Software
21// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22// USA.
23//
24// Please report all bugs and problems on the following page:
25//
26// http://www.fltk.org/str.php
27//
28
29/* \file
30 Fl_File_Input widget . */
31
32#ifndef Fl_File_Input_H
33# define Fl_File_Input_H
34
35# include <FL/Fl_Input.H>
36
37/**
38 \class Fl_File_Input
39 \brief This widget displays a pathname in a text input field.
40
41 A navigation bar located above the input field allows the user to
42 navigate upward in the directory tree.
43 You may want to handle FL_WHEN_CHANGED events for tracking text changes
44 and also FL_WHEN_RELEASE for button release when changing to parent dir.
45 FL_WHEN_RELEASE callback won't be called if the directory clicked
46 is the same as the current one.
47
48 <P align=CENTER> \image html Fl_File_Input.png </P>
49 \image latex Fl_File_Input.png "Fl_File_Input" width=6cm
50
51 \note As all Fl_Input derived objects, Fl_File_Input may call its callback
52 when losing focus (see FL_UNFOCUS) to update its state like its cursor shape.
53 One resulting side effect is that you should call clear_changed() early in your callback
54 to avoid reentrant calls if you plan to show another window or dialog box in the callback.
55*/
56class FL_EXPORT Fl_File_Input : public Fl_Input {
57
58 Fl_Color errorcolor_;
59 char ok_entry_;
60 uchar down_box_;
61 short buttons_[200];
62 short pressed_;
63
64 void draw_buttons();
65 int handle_button(int event);
66 void update_buttons();
67
68public:
69
70 Fl_File_Input(int X, int Y, int W, int H, const char *L=0);
71
72 virtual int handle(int event);
73
74protected:
75 virtual void draw();
76
77public:
78 /** Gets the box type used for the navigation bar. */
79 Fl_Boxtype down_box() const { return (Fl_Boxtype)down_box_; }
80 /** Sets the box type to use for the navigation bar. */
81 void down_box(Fl_Boxtype b) { down_box_ = b; }
82
83 /**
84 Gets the current error color.
85 \todo Better docs for Fl_File_Input::errorcolor() - is it even used?
86 */
87 Fl_Color errorcolor() const { return errorcolor_; }
88 /** Sets the current error color to \p c */
89 void errorcolor(Fl_Color c) { errorcolor_ = c; }
90
91 int value(const char *str);
92 int value(const char *str, int len);
93
94 /**
95 Returns the current value, which is a pointer to an internal buffer
96 and is valid only until the next event is handled.
97 */
98 const char *value() { return Fl_Input_::value(); }
99};
100
101#endif // !Fl_File_Input_H
102
103
104//
105// End of "$Id: Fl_File_Input.H 8712 2011-05-22 09:45:40Z AlbrechtS $".
106//