Mousewheel support for browsers and help view.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1541 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet 2001-08-02 20:18:54 +00:00
parent 2d3fd88eeb
commit af75829757
3 changed files with 13 additions and 18 deletions

View File

@ -11,7 +11,7 @@ TODO - Added new alignment bit FL_ALIGN_TEXT_OVER_IMAGE.
TODO - Added keyboard navigation to all widgets. TODO - Added keyboard navigation to all widgets.
CORE - Added support for mouse wheels using the new - Added support for mouse wheels using the new
FL_MOUSEWHEEL event type. Get the mouse wheel FL_MOUSEWHEEL event type. Get the mouse wheel
movement values from Fl::e_dx (horizontal) and movement values from Fl::e_dx (horizontal) and
Fl::e_dy (vertical). Fl::e_dy (vertical).

View File

@ -1,5 +1,5 @@
// //
// "$Id: Fl_Browser_.cxx,v 1.10.2.16 2001/07/05 00:20:41 uid28863 Exp $" // "$Id: Fl_Browser_.cxx,v 1.10.2.16.2.1 2001/08/02 20:18:54 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,6 +551,10 @@ 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:
position(position() + Fl::e_dy * incr_height());
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;
my = py = Fl::event_y(); my = py = Fl::event_y();
@ -707,5 +711,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 2001/07/05 00:20:41 uid28863 Exp $". // End of "$Id: Fl_Browser_.cxx,v 1.10.2.16.2.1 2001/08/02 20:18:54 easysw Exp $".
// //

View File

@ -1,5 +1,5 @@
// //
// "$Id: Fl_HelpView.cxx,v 1.1.2.1 2001/08/02 19:43:49 easysw Exp $" // "$Id: Fl_HelpView.cxx,v 1.1.2.2 2001/08/02 20:18:54 easysw Exp $"
// //
// Fl_HelpView widget routines. // Fl_HelpView widget routines.
// //
@ -2199,24 +2199,15 @@ Fl_HelpView::handle(int event) // I - Event to handle
{ {
case FL_MOVE : case FL_MOVE :
case FL_PUSH : case FL_PUSH :
if (Fl::event_button() == 4)
{
// XFree86 maps button 4 to the "wheel up" motion...
topline(topline() - textsize_ * 3);
return (1);
}
else if (Fl::event_button() == 5)
{
// XFree86 maps button 5 to the "wheel down" motion...
topline(topline() + textsize_ * 3);
return (1);
}
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 :
topline(topline() + Fl::e_dy * textsize_ * 3);
return (1);
default : default :
// Use the Fl_Group handler... // Use the Fl_Group handler...
return (Fl_Group::handle(event)); return (Fl_Group::handle(event));
@ -3135,5 +3126,5 @@ scrollbar_callback(Fl_Widget *s, void *)
// //
// End of "$Id: Fl_HelpView.cxx,v 1.1.2.1 2001/08/02 19:43:49 easysw Exp $". // End of "$Id: Fl_HelpView.cxx,v 1.1.2.2 2001/08/02 20:18:54 easysw Exp $".
// //