Fl_File_Input.H 3.0 KB

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