First few additions to create scroll wheel support for multiline Fl_Input.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6888 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Matthias Melcher
2009-09-19 21:16:21 +00:00
parent 08dea80a5a
commit 62eac883d1
2 changed files with 14 additions and 1 deletions
+2 -1
View File
@@ -120,7 +120,7 @@ class FL_EXPORT Fl_Input_ : public Fl_Widget {
\p mark_, no text is selected */ \p mark_, no text is selected */
int mark_; int mark_;
/** \internal Offset to text origin within wdget bounds */ /** \internal Offset to text origin within widget bounds */
int xscroll_, yscroll_; int xscroll_, yscroll_;
/** \internal Minimal update pointer. Display requirs redraw from here to the end /** \internal Minimal update pointer. Display requirs redraw from here to the end
@@ -206,6 +206,7 @@ protected:
/** \internal Vertical offset of text to top edge of widget. */ /** \internal Vertical offset of text to top edge of widget. */
int yscroll() const {return yscroll_;} int yscroll() const {return yscroll_;}
void yscroll(int y) { yscroll_ = y; damage(FL_DAMAGE_EXPOSE);}
/* Return the number of lines displayed on a single page. */ /* Return the number of lines displayed on a single page. */
int linesPerPage(); int linesPerPage();
+12
View File
@@ -621,6 +621,18 @@ int Fl_Input::handle(int event) {
take_focus(); take_focus();
return 1; return 1;
/* TODO: this will scroll the area, but stop if the cursor would become invisible.
That clipping happens in drawtext(). Do we change the clipping or should
we move the cursor (ouch)?
case FL_MOUSEWHEEL:
if (Fl::e_dy > 0) {
yscroll( yscroll() - Fl::e_dy*15 );
} else if (Fl::e_dy < 0) {
yscroll( yscroll() - Fl::e_dy*15 );
}
return 1;
*/
} }
Fl_Boxtype b = box(); Fl_Boxtype b = box();
return Fl_Input_::handletext(event, return Fl_Input_::handletext(event,