You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

107 lines
3.3KB

  1. //
  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. /* \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 as the current one.
  42. <P align=CENTER> \image html Fl_File_Input.png </P>
  43. \image latex Fl_File_Input.png "Fl_File_Input" width=6cm
  44. \note As all Fl_Input derived objects, Fl_File_Input may call its callback
  45. when losing 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. Fl_Color errorcolor_;
  51. char ok_entry_;
  52. uchar down_box_;
  53. short buttons_[200];
  54. short pressed_;
  55. void draw_buttons();
  56. int handle_button(int event);
  57. void update_buttons();
  58. public:
  59. Fl_File_Input(int X, int Y, int W, int H, const char *L=0);
  60. virtual int handle(int event);
  61. protected:
  62. virtual void draw();
  63. public:
  64. /** Gets the box type used for the navigation bar. */
  65. Fl_Boxtype down_box() const { return (Fl_Boxtype)down_box_; }
  66. /** Sets the box type to use for the navigation bar. */
  67. void down_box(Fl_Boxtype b) { down_box_ = b; }
  68. /**
  69. Gets the current error color.
  70. \todo Better docs for Fl_File_Input::errorcolor() - is it even used?
  71. */
  72. Fl_Color errorcolor() const { return errorcolor_; }
  73. /** Sets the current error color to \p c */
  74. void errorcolor(Fl_Color c) { errorcolor_ = c; }
  75. int value(const char *str);
  76. int value(const char *str, int len);
  77. /**
  78. Returns the current value, which is a pointer to an internal buffer
  79. and is valid only until the next event is handled.
  80. */
  81. const char *value() { return Fl_Input_::value(); }
  82. };
  83. #endif // !Fl_File_Input_H
  84. //
  85. // End of "$Id: Fl_File_Input.H 8712 2011-05-22 09:45:40Z AlbrechtS $".
  86. //