diff options
| author | Michael R Sweet <michael.r.sweet@gmail.com> | 2002-04-13 22:17:46 +0000 |
|---|---|---|
| committer | Michael R Sweet <michael.r.sweet@gmail.com> | 2002-04-13 22:17:46 +0000 |
| commit | dc355ebb5477bd3c4374658d3db2a935ae3fb935 (patch) | |
| tree | d7f360c3d09a41abf9e2acbbfcc81eb563175fb9 /src/Fl_Input.cxx | |
| parent | 7f0c218c1c96eebb2c0694909d237e7d3bdc0c97 (diff) | |
Add Fl::dnd_text_ops() methods.
Fl_Input now conditionally supports DND out via run-time option.
Fl_Input now clears selection if you click inside the selection when
DND is turned on.
Added support for scheme, dndTextOps, and visibleFocus resources under
X11.
Documented all X resources supported under X11...
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2078 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_Input.cxx')
| -rw-r--r-- | src/Fl_Input.cxx | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/src/Fl_Input.cxx b/src/Fl_Input.cxx index d59555787..edd79a2c4 100644 --- a/src/Fl_Input.cxx +++ b/src/Fl_Input.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Input.cxx,v 1.10.2.15.2.8 2002/04/11 11:52:41 easysw Exp $" +// "$Id: Fl_Input.cxx,v 1.10.2.15.2.9 2002/04/13 22:17:46 easysw Exp $" // // Input widget for the Fast Light Tool Kit (FLTK). // @@ -36,7 +36,6 @@ #include "flstring.h" #include <stdio.h> -#define DND_OUT 1 void Fl_Input::draw() { if (input_type() == FL_HIDDEN_INPUT) return; @@ -290,8 +289,7 @@ int Fl_Input::handle(int event) { } else return handle_key(); case FL_PUSH: -#if DND_OUT - { + if (Fl::dnd_text_ops()) { int oldpos = position(), oldmark = mark(); Fl_Boxtype b = box(); Fl_Input_::handle_mouse( @@ -302,13 +300,13 @@ int Fl_Input::handle(int event) { if (Fl::focus()==this && !Fl::event_state(FL_SHIFT) && input_type()!=FL_SECRET_INPUT && (newpos >= mark() && newpos < position() || newpos >= position() && newpos < mark())) { - // user clicked int the selection, may be trying to drag + // user clicked in the selection, may be trying to drag drag_start = newpos; return 1; } drag_start = -1; } -#endif + if (Fl::focus() != this) { Fl::focus(this); handle(FL_FOCUS); @@ -316,17 +314,17 @@ int Fl_Input::handle(int event) { break; case FL_DRAG: -#if DND_OUT - if (drag_start >= 0) { - if (Fl::event_is_click()) return 1; // debounce the mouse - // save the position because sometimes we don't get DND_ENTER: - dnd_save_position = position(); - dnd_save_mark = mark(); - // drag the data: - copy(0); Fl::dnd(); - return 1; + if (Fl::dnd_text_ops()) { + if (drag_start >= 0) { + if (Fl::event_is_click()) return 1; // debounce the mouse + // save the position because sometimes we don't get DND_ENTER: + dnd_save_position = position(); + dnd_save_mark = mark(); + // drag the data: + copy(0); Fl::dnd(); + return 1; + } } -#endif break; case FL_RELEASE: @@ -336,6 +334,10 @@ int Fl_Input::handle(int event) { } else if (!Fl::event_is_click()) { // copy drag-selected text to the clipboard. copy(0); + } else if (Fl::event_is_click() && drag_start >= 0) { + // user clicked in the field and wants to reset the cursor position... + position(drag_start, drag_start); + drag_start = -1; } return 1; @@ -393,5 +395,5 @@ Fl_Input::Fl_Input(int x, int y, int w, int h, const char *l) } // -// End of "$Id: Fl_Input.cxx,v 1.10.2.15.2.8 2002/04/11 11:52:41 easysw Exp $". +// End of "$Id: Fl_Input.cxx,v 1.10.2.15.2.9 2002/04/13 22:17:46 easysw Exp $". // |
