1 // 2 // "$Id$" 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. Distribution and use rights are outlined in 10 // the file "COPYING" which should have been included with this file. If this 11 // file is missing or damaged, see the license at: 12 // 13 // http://www.fltk.org/COPYING.php 14 // 15 // Please report all bugs and problems on the following page: 16 // 17 // http://www.fltk.org/str.php 18 // 19 20 /* \file 21 Fl_File_Input widget . */ 22 23 #ifndef Fl_File_Input_H 24 # define Fl_File_Input_H 25 26 # include <FL/Fl_Input.H> 27 28 /** 29 \class Fl_File_Input 30 \brief This widget displays a pathname in a text input field. 31 32 A navigation bar located above the input field allows the user to 33 navigate upward in the directory tree. 34 You may want to handle FL_WHEN_CHANGED events for tracking text changes 35 and also FL_WHEN_RELEASE for button release when changing to parent dir. 36 FL_WHEN_RELEASE callback won't be called if the directory clicked 37 is the same as the current one. 38 39 <P align=CENTER> \image html Fl_File_Input.png </P> 40 \image latex Fl_File_Input.png "Fl_File_Input" width=6cm 41 42 \note As all Fl_Input derived objects, Fl_File_Input may call its callback 43 when losing focus (see FL_UNFOCUS) to update its state like its cursor shape. 44 One resulting side effect is that you should call clear_changed() early in your callback 45 to avoid reentrant calls if you plan to show another window or dialog box in the callback. 46 */ 47 class FL_EXPORT Fl_File_Input : public Fl_Input { 48 49 Fl_Color errorcolor_; 50 char ok_entry_; 51 uchar down_box_; 52 short buttons_[200]; 53 short pressed_; 54 55 void draw_buttons(); 56 int handle_button(int event); 57 void update_buttons(); 58 59 public: 60 61 Fl_File_Input(int X, int Y, int W, int H, const char *L=0); 62 63 virtual int handle(int event); 64 65 protected: 66 virtual void draw(); 67 68 public: 69 /** Gets the box type used for the navigation bar. */ down_box()70 Fl_Boxtype down_box() const { return (Fl_Boxtype)down_box_; } 71 /** Sets the box type to use for the navigation bar. */ down_box(Fl_Boxtype b)72 void down_box(Fl_Boxtype b) { down_box_ = b; } 73 74 /** 75 Gets the current error color. 76 \todo Better docs for Fl_File_Input::errorcolor() - is it even used? 77 */ errorcolor()78 Fl_Color errorcolor() const { return errorcolor_; } 79 /** Sets the current error color to \p c */ errorcolor(Fl_Color c)80 void errorcolor(Fl_Color c) { errorcolor_ = c; } 81 82 int value(const char *str); 83 int value(const char *str, int len); 84 85 /** 86 Returns the current value, which is a pointer to an internal buffer 87 and is valid only until the next event is handled. 88 */ value()89 const char *value() { return Fl_Input_::value(); } 90 }; 91 92 #endif // !Fl_File_Input_H 93 94 95 // 96 // End of "$Id$". 97 // 98