Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 90888 Details for
Bug 75766
Allow mouse wheel to scroll without focus
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Scrolling manager to enable focusless mouse wheel scrolling
ScrollManager.java (text/x-java), 1.89 KB, created by
koonyue
on 2008-02-27 11:52:51 EST
(
hide
)
Description:
Scrolling manager to enable focusless mouse wheel scrolling
Filename:
MIME Type:
Creator:
koonyue
Created:
2008-02-27 11:52:51 EST
Size:
1.89 KB
patch
obsolete
>package com.fullsize.pdfimgextract.scrolling; > >import org.eclipse.swt.SWT; >import org.eclipse.swt.custom.ScrolledComposite; >import org.eclipse.swt.widgets.Control; >import org.eclipse.swt.widgets.Display; >import org.eclipse.swt.widgets.Event; >import org.eclipse.swt.widgets.Listener; >import org.eclipse.swt.widgets.Scrollable; >import org.eclipse.swt.widgets.Shell; > >public class ScrollManager { > private static ScrollManager _instance = new ScrollManager(); > > private ScrolledComposite _scroll = null; > > private ScrollManager() { > } > > public static ScrollManager getInstance() { > return _instance; > } > > public void registerScrollable(Control c) { > Control w = c; > boolean hit = false; > > while (w != null && !(w instanceof Shell)) { > if (w instanceof ScrolledComposite) { > this.addMouseWheelFilter((ScrolledComposite) w); > hit = true; > break; > } > w = w.getParent(); > } > > if (!hit) { > this.removeMouseWheelFilter(); > } > } > > private void addMouseWheelFilter(ScrolledComposite scroll) { > if (scroll == null) { > return; > } > > Display.getDefault().removeFilter(SWT.MouseWheel, mouseTrackListener); > this._scroll = scroll; > Display.getDefault().addFilter(SWT.MouseWheel, mouseTrackListener); > } > > private void removeMouseWheelFilter() { > Display.getDefault().removeFilter(SWT.MouseWheel, mouseTrackListener); > this._scroll = null; > } > > private Listener mouseTrackListener = new Listener() { > public void handleEvent(Event event) { > switch (event.type) { > case SWT.MouseWheel: > int direction = event.count > 0 ? -1 : 1; > if (direction > 0) { > _scroll.setOrigin(_scroll.getOrigin().x, _scroll > .getOrigin().y > + _scroll.getVerticalBar().getIncrement()); > } else { > _scroll.setOrigin(_scroll.getOrigin().x, _scroll > .getOrigin().y > - _scroll.getVerticalBar().getIncrement()); > } > } > } > }; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 75766
:
63769
| 90888 |
228900