Fix mouse wheel stuff for browser and helpview widgets (move 3 lines at

a time...)

Fl_Group::handle() now sends unknown events to the focus widget first,
then to any other child that will take it...


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1542 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet
2001-08-02 21:11:43 +00:00
parent af75829757
commit 85533d11be
5 changed files with 43 additions and 19 deletions
+8 -4
View File
@@ -1,5 +1,5 @@
// //
// "$Id: Fl_Browser_.cxx,v 1.10.2.16.2.1 2001/08/02 20:18:54 easysw Exp $" // "$Id: Fl_Browser_.cxx,v 1.10.2.16.2.2 2001/08/02 21:11:43 easysw Exp $"
// //
// Base Browser widget class for the Fast Light Tool Kit (FLTK). // Base Browser widget class for the Fast Light Tool Kit (FLTK).
// //
@@ -551,9 +551,13 @@ int Fl_Browser_::handle(int event) {
static char whichway; static char whichway;
static int py; static int py;
switch (event) { switch (event) {
case FL_MOUSEWHEEL: case FL_MOUSEWHEEL: {
position(position() + Fl::e_dy * incr_height()); int i = position() + Fl::e_dy * incr_height() * 3;
if (i < 0) i = 0;
else if (i > (full_height() - h())) i = full_height() - h();
position(i);
return (1); return (1);
}
case FL_PUSH: case FL_PUSH:
if (!Fl::event_inside(X, Y, W, H)) return 0; if (!Fl::event_inside(X, Y, W, H)) return 0;
@@ -711,5 +715,5 @@ void Fl_Browser_::item_select(void*, int) {}
int Fl_Browser_::item_selected(void* l) const {return l==selection_;} int Fl_Browser_::item_selected(void* l) const {return l==selection_;}
// //
// End of "$Id: Fl_Browser_.cxx,v 1.10.2.16.2.1 2001/08/02 20:18:54 easysw Exp $". // End of "$Id: Fl_Browser_.cxx,v 1.10.2.16.2.2 2001/08/02 21:11:43 easysw Exp $".
// //
+17 -2
View File
@@ -1,5 +1,5 @@
// //
// "$Id: Fl_Group.cxx,v 1.8.2.8.2.2 2001/08/02 15:31:59 easysw Exp $" // "$Id: Fl_Group.cxx,v 1.8.2.8.2.3 2001/08/02 21:11:43 easysw Exp $"
// //
// Group widget for the Fast Light Tool Kit (FLTK). // Group widget for the Fast Light Tool Kit (FLTK).
// //
@@ -189,6 +189,21 @@ int Fl_Group::handle(int event) {
Fl_Tooltip::exit(this); // tooltip Fl_Tooltip::exit(this); // tooltip
default: default:
// For all other events, try to give to each child, starting at focus:
for (i = 0; i < children(); i ++)
if (Fl::focus_ == child(i)) break;
if (i >= children()) i = 0;
if (children()) {
for (int j = i;;) {
if (send(child(j), event)) return 1;
j++;
if (j >= children()) j = 0;
if (j == i) break;
}
}
return 0; return 0;
} }
@@ -523,5 +538,5 @@ void Fl_Group::draw_outside_label(const Fl_Widget& w) const {
} }
// //
// End of "$Id: Fl_Group.cxx,v 1.8.2.8.2.2 2001/08/02 15:31:59 easysw Exp $". // End of "$Id: Fl_Group.cxx,v 1.8.2.8.2.3 2001/08/02 21:11:43 easysw Exp $".
// //
+10 -4
View File
@@ -1,5 +1,5 @@
// //
// "$Id: Fl_HelpView.cxx,v 1.1.2.2 2001/08/02 20:18:54 easysw Exp $" // "$Id: Fl_HelpView.cxx,v 1.1.2.3 2001/08/02 21:11:43 easysw Exp $"
// //
// Fl_HelpView widget routines. // Fl_HelpView widget routines.
// //
@@ -2197,15 +2197,21 @@ Fl_HelpView::handle(int event) // I - Event to handle
switch (event) switch (event)
{ {
case FL_MOVE :
case FL_PUSH : case FL_PUSH :
case FL_MOVE :
xx = Fl::event_x() - x(); xx = Fl::event_x() - x();
yy = Fl::event_y() - y() + topline_; yy = Fl::event_y() - y() + topline_;
if (!scrollbar_.visible() || xx < (w() - 20)) if (!scrollbar_.visible() || xx < (w() - 20))
break; break;
case FL_MOUSEWHEEL : case FL_MOUSEWHEEL :
topline(topline() + Fl::e_dy * textsize_ * 3); i = topline() + Fl::e_dy * textsize_ * 3;
if (i < 0)
i = 0;
else if (i > (size_ - h()))
i = size_ - h();
topline(i);
return (1); return (1);
default : default :
@@ -3126,5 +3132,5 @@ scrollbar_callback(Fl_Widget *s, void *)
// //
// End of "$Id: Fl_HelpView.cxx,v 1.1.2.2 2001/08/02 20:18:54 easysw Exp $". // End of "$Id: Fl_HelpView.cxx,v 1.1.2.3 2001/08/02 21:11:43 easysw Exp $".
// //
+6 -6
View File
@@ -1,5 +1,5 @@
// //
// "$Id: Fl_x.cxx,v 1.24.2.24.2.1 2001/08/02 20:09:25 easysw Exp $" // "$Id: Fl_x.cxx,v 1.24.2.24.2.2 2001/08/02 21:11:43 easysw Exp $"
// //
// X specific code for the Fast Light Tool Kit (FLTK). // X specific code for the Fast Light Tool Kit (FLTK).
// //
@@ -449,11 +449,11 @@ int fl_handle(const XEvent& xevent)
case ButtonPress: case ButtonPress:
Fl::e_keysym = FL_Button + xevent.xbutton.button; Fl::e_keysym = FL_Button + xevent.xbutton.button;
set_event_xy(); set_event_xy();
if (xevent.xbutton.button == 4) { if (xevent.xbutton.button == Button4) {
Fl::e_dy = +1; Fl::e_dy = -1; // Up
event = FL_MOUSEWHEEL; event = FL_MOUSEWHEEL;
} else if (xevent.xbutton.button == 5) { } else if (xevent.xbutton.button == Button5) {
Fl::e_dy = -1; Fl::e_dy = +1; // Down
event = FL_MOUSEWHEEL; event = FL_MOUSEWHEEL;
} else { } else {
Fl::e_state |= (FL_BUTTON1 << (xevent.xbutton.button-1)); Fl::e_state |= (FL_BUTTON1 << (xevent.xbutton.button-1));
@@ -927,5 +927,5 @@ void Fl_Window::make_current() {
#endif #endif
// //
// End of "$Id: Fl_x.cxx,v 1.24.2.24.2.1 2001/08/02 20:09:25 easysw Exp $". // End of "$Id: Fl_x.cxx,v 1.24.2.24.2.2 2001/08/02 21:11:43 easysw Exp $".
// //
+2 -3
View File
@@ -1,5 +1,5 @@
# #
# "$Id: Makefile,v 1.19.2.7.2.4 2001/08/02 19:43:49 easysw Exp $" # "$Id: Makefile,v 1.19.2.7.2.5 2001/08/02 21:11:43 easysw Exp $"
# #
# Test/example program makefile for the Fast Light Tool Kit (FLTK). # Test/example program makefile for the Fast Light Tool Kit (FLTK).
# #
@@ -72,7 +72,6 @@ $(ALL): ../lib/$(LIBNAME)
# Programs needing special instructions... # Programs needing special instructions...
help: help.cxx help: help.cxx
echo Compiling and linking $@... echo Compiling and linking $@...
echo $(CXX) -I.. $(CXXFLAGS) help.cxx -o $@ $(LINKFLTK) $(LDLIBS) $(IMAGELIBS)
$(CXX) -I.. $(CXXFLAGS) help.cxx -o $@ $(LINKFLTK) $(LDLIBS) $(IMAGELIBS) $(CXX) -I.. $(CXXFLAGS) help.cxx -o $@ $(LINKFLTK) $(LDLIBS) $(IMAGELIBS)
keyboard: keyboard.cxx keyboard_ui.cxx keyboard: keyboard.cxx keyboard_ui.cxx
echo Compiling and linking $@... echo Compiling and linking $@...
@@ -128,5 +127,5 @@ install:
@echo Nothing to install in test directory. @echo Nothing to install in test directory.
# #
# End of "$Id: Makefile,v 1.19.2.7.2.4 2001/08/02 19:43:49 easysw Exp $". # End of "$Id: Makefile,v 1.19.2.7.2.5 2001/08/02 21:11:43 easysw Exp $".
# #