Fl_File_Input.H 3.3 KB

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