2002-05-01 01:50:16 +04:00
|
|
|
//
|
2005-02-25 00:55:12 +03:00
|
|
|
// "$Id$"
|
2002-05-01 01:50:16 +04:00
|
|
|
//
|
|
|
|
// File_Input header file for the Fast Light Tool Kit (FLTK).
|
|
|
|
//
|
2010-11-29 00:06:39 +03:00
|
|
|
// Copyright 1998-2010 by Bill Spitzak and others.
|
2002-05-01 01:50:16 +04:00
|
|
|
// Original version Copyright 1998 by Curtis Edwards.
|
|
|
|
//
|
2011-07-19 08:49:30 +04:00
|
|
|
// This library is free software. Distribution and use rights are outlined in
|
|
|
|
// the file "COPYING" which should have been included with this file. If this
|
|
|
|
// file is missing or damaged, see the license at:
|
|
|
|
//
|
|
|
|
// http://www.fltk.org/COPYING.php
|
2002-05-01 01:50:16 +04:00
|
|
|
//
|
2005-04-16 04:13:17 +04:00
|
|
|
// Please report all bugs and problems on the following page:
|
|
|
|
//
|
|
|
|
// http://www.fltk.org/str.php
|
2002-05-01 01:50:16 +04:00
|
|
|
//
|
|
|
|
|
2008-10-15 17:46:06 +04:00
|
|
|
/* \file
|
2008-09-16 11:26:22 +04:00
|
|
|
Fl_File_Input widget . */
|
|
|
|
|
2002-05-01 01:50:16 +04:00
|
|
|
#ifndef Fl_File_Input_H
|
|
|
|
# define Fl_File_Input_H
|
|
|
|
|
|
|
|
# include <FL/Fl_Input.H>
|
|
|
|
|
2008-10-01 22:43:10 +04:00
|
|
|
/**
|
|
|
|
\class Fl_File_Input
|
|
|
|
\brief This widget displays a pathname in a text input field.
|
2002-05-01 01:50:16 +04:00
|
|
|
|
2008-10-01 22:43:10 +04:00
|
|
|
A navigation bar located above the input field allows the user to
|
|
|
|
navigate upward in the directory tree.
|
2008-10-06 03:10:33 +04:00
|
|
|
You may want to handle FL_WHEN_CHANGED events for tracking text changes
|
|
|
|
and also FL_WHEN_RELEASE for button release when changing to parent dir.
|
2011-05-22 13:45:40 +04:00
|
|
|
FL_WHEN_RELEASE callback won't be called if the directory clicked
|
|
|
|
is the same as the current one.
|
|
|
|
|
2010-12-09 02:53:04 +03:00
|
|
|
<P align=CENTER> \image html Fl_File_Input.png </P>
|
|
|
|
\image latex Fl_File_Input.png "Fl_File_Input" width=6cm
|
2011-05-22 13:45:40 +04:00
|
|
|
|
2008-10-06 03:10:33 +04:00
|
|
|
\note As all Fl_Input derived objects, Fl_File_Input may call its callback
|
2011-05-22 13:45:40 +04:00
|
|
|
when losing focus (see FL_UNFOCUS) to update its state like its cursor shape.
|
2008-10-06 03:10:33 +04:00
|
|
|
One resulting side effect is that you should call clear_changed() early in your callback
|
|
|
|
to avoid reentrant calls if you plan to show another window or dialog box in the callback.
|
2008-10-01 22:43:10 +04:00
|
|
|
*/
|
2011-01-24 20:04:22 +03:00
|
|
|
class FL_EXPORT Fl_File_Input : public Fl_Input {
|
|
|
|
|
2002-05-01 01:50:16 +04:00
|
|
|
Fl_Color errorcolor_;
|
|
|
|
char ok_entry_;
|
|
|
|
uchar down_box_;
|
|
|
|
short buttons_[200];
|
|
|
|
short pressed_;
|
|
|
|
|
|
|
|
void draw_buttons();
|
|
|
|
int handle_button(int event);
|
|
|
|
void update_buttons();
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2008-10-01 22:43:10 +04:00
|
|
|
Fl_File_Input(int X, int Y, int W, int H, const char *L=0);
|
2002-05-01 01:50:16 +04:00
|
|
|
|
2008-10-01 22:43:10 +04:00
|
|
|
virtual int handle(int event);
|
2009-02-18 12:27:54 +03:00
|
|
|
|
|
|
|
protected:
|
2002-08-14 20:49:38 +04:00
|
|
|
virtual void draw();
|
2002-05-01 01:50:16 +04:00
|
|
|
|
2009-02-18 12:27:54 +03:00
|
|
|
public:
|
2008-10-01 22:43:10 +04:00
|
|
|
/** Gets the box type used for the navigation bar. */
|
2002-05-01 01:50:16 +04:00
|
|
|
Fl_Boxtype down_box() const { return (Fl_Boxtype)down_box_; }
|
2008-10-01 22:43:10 +04:00
|
|
|
/** Sets the box type to use for the navigation bar. */
|
2002-05-01 01:50:16 +04:00
|
|
|
void down_box(Fl_Boxtype b) { down_box_ = b; }
|
2008-10-01 22:43:10 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
Gets the current error color.
|
|
|
|
\todo Better docs for Fl_File_Input::errorcolor() - is it even used?
|
|
|
|
*/
|
2002-05-01 01:50:16 +04:00
|
|
|
Fl_Color errorcolor() const { return errorcolor_; }
|
2009-03-24 04:40:44 +03:00
|
|
|
/** Sets the current error color to \p c */
|
2002-05-01 01:50:16 +04:00
|
|
|
void errorcolor(Fl_Color c) { errorcolor_ = c; }
|
2008-10-01 22:43:10 +04:00
|
|
|
|
|
|
|
int value(const char *str);
|
|
|
|
int value(const char *str, int len);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the current value, which is a pointer to an internal buffer
|
|
|
|
and is valid only until the next event is handled.
|
|
|
|
*/
|
2002-05-01 01:50:16 +04:00
|
|
|
const char *value() { return Fl_Input_::value(); }
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // !Fl_File_Input_H
|
|
|
|
|
|
|
|
|
|
|
|
//
|
2005-02-25 00:55:12 +03:00
|
|
|
// End of "$Id$".
|
2002-05-01 01:50:16 +04:00
|
|
|
//
|