Summary: | Browser widget accessibility font options | ||
---|---|---|---|
Product: | [Eclipse Project] Platform | Reporter: | Andy Cheadle <amc4> |
Component: | SWT | Assignee: | Grant Gayed <grant_gayed> |
Status: | NEW --- | QA Contact: | |
Severity: | enhancement | ||
Priority: | P3 | CC: | carolynmacleod4, chrriis, daniel_megert, dvoytenko, zanetu |
Version: | 3.2.1 | ||
Target Milestone: | --- | ||
Hardware: | All | ||
OS: | All | ||
Whiteboard: |
Description
Andy Cheadle
2006-10-12 02:08:48 EDT
I'm not sure if this would become Browser api, but it should become doable once the eclipse 3.3 plan item in bug 154124 is addressed. Note to self: nsIDOMWindow->SetTextZoom . *** Bug 177365 has been marked as a duplicate of this bug. *** FYI here's how zooming is done with a SWT.MOZILLA style Browser (requires XULRunner >= 1.9): public class Snippet329 { static int zoom = 10; static Browser browser; public static void main(String [] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new GridLayout(2, true)); try { browser = new Browser(shell, SWT.MOZILLA); } catch (SWTError e) { System.out.println("Could not instantiate Browser: " + e.getMessage()); display.dispose(); return; } GridData data = new GridData(); data.heightHint = data.widthHint = 400; data.horizontalSpan = 2; browser.setLayoutData(data); Button zoomIn = new Button(shell, SWT.PUSH); zoomIn.setText("Zoom In"); zoomIn.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { setZoom(++zoom); } }); Button zoomOut = new Button(shell, SWT.PUSH); zoomOut.setText("Zoom Out"); zoomOut.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { if (zoom > 1) { setZoom(--zoom); } } }); shell.pack(); shell.open(); browser.setUrl("http://www.eclipse.org"); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); } static void setZoom(int zoom) { nsIWebBrowser webBrowser = (nsIWebBrowser)browser.getWebBrowser(); nsIInterfaceRequestor req = (nsIInterfaceRequestor)webBrowser.queryInterface(nsIInterfaceRequestor.NS_IINTERFACEREQUESTOR_IID); nsIDocShell docShell = (nsIDocShell)req.getInterface(nsIDocShell.NS_IDOCSHELL_IID); nsIContentViewer contentView = docShell.getContentViewer(); nsIMarkupDocumentViewer docView = (nsIMarkupDocumentViewer)contentView.queryInterface(nsIMarkupDocumentViewer.NS_IMARKUPDOCUMENTVIEWER_IID); float value = zoom / 10f; System.out.println("zoom: " + value); docView.setFullZoom(value); } } Not sure if this is helpful for zooming programmatically in IE. http://social.msdn.microsoft.com/Forums/en-US/Vsexpressvb/thread/e542c4e6-acb6-44d4-b742-beab5528ac74 |