Mercurial > projects > dwt-addons
diff dwtx/jface/internal/text/InformationControlReplacer.d @ 150:5cf141e43417
...
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 24 Aug 2008 23:05:26 +0200 |
parents | 000f9136b8f7 |
children | a9566845f1cb |
line wrap: on
line diff
--- a/dwtx/jface/internal/text/InformationControlReplacer.d Sun Aug 24 22:41:48 2008 +0200 +++ b/dwtx/jface/internal/text/InformationControlReplacer.d Sun Aug 24 23:05:26 2008 +0200 @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation * Port to the D programming language: @@ -44,7 +44,7 @@ * @since 3.4 */ public class InformationControlReplacer : AbstractInformationControlManager { - + /** * Minimal width in pixels. */ @@ -53,7 +53,7 @@ * Minimal height in pixels. */ private static const int MIN_HEIGHT= 50; - + /** * Default control creator. */ @@ -68,11 +68,11 @@ private bool fDelayedInformationSet; private Rectangle fReplaceableArea; private Rectangle fContentBounds; - - + + /** * Creates a new information control replacer. - * + * * @param creator the default information control creator */ public this(IInformationControlCreator creator) { @@ -82,7 +82,7 @@ /** * Replace the information control. - * + * * @param informationPresenterControlCreator the information presenter control creator * @param contentBounds the bounds of the content area of the information control * @param information the information to show @@ -90,7 +90,7 @@ * @param takeFocus <code>true</code> iff the replacing information control should take focus */ public void replaceInformationControl(IInformationControlCreator informationPresenterControlCreator, Rectangle contentBounds, Object information, final Rectangle subjectArea, bool takeFocus) { - + try { fIsReplacing= true; if (! fDelayedInformationSet) @@ -99,11 +99,11 @@ takeFocus= true; // delayed input has been set, so the original info control must have been focused fContentBounds= contentBounds; fReplaceableArea= subjectArea; - + setCustomInformationControlCreator(informationPresenterControlCreator); - + takesFocusWhenVisible(takeFocus); - + showInformation(); } finally { fIsReplacing= false; @@ -113,7 +113,7 @@ setCustomInformationControlCreator(null); } } - + /* * @see dwtx.jface.text.AbstractInformationControlManager#computeInformation() */ @@ -122,8 +122,8 @@ setInformation(fReplacableInformation, fReplaceableArea); return; } - - if cast(DEBUG) + + if (DEBUG) System.out_.println("InformationControlReplacer: no active replaceable"); //$NON-NLS-1$ } @@ -136,40 +136,40 @@ */ public void showInformationControl(Rectangle subjectArea, Object information) { IInformationControl informationControl= getInformationControl(); - + Rectangle controlBounds= fContentBounds; if ( cast(IInformationControlExtension3)informationControl ) { IInformationControlExtension3 iControl3= cast(IInformationControlExtension3) informationControl; Rectangle trim= iControl3.computeTrim(); controlBounds= Geometry.add(controlBounds, trim); - + /* * Ensure minimal size. Interacting with a tiny information control * (resizing, selecting text) would be a pain. */ controlBounds.width= Math.max(controlBounds.width, MIN_WIDTH); controlBounds.height= Math.max(controlBounds.height, MIN_HEIGHT); - + getInternalAccessor().cropToClosestMonitor(controlBounds); } - + Point location= Geometry.getLocation(controlBounds); Point size= Geometry.getSize(controlBounds); - + // Caveat: some IInformationControls fail unless setSizeConstraints(..) is called with concrete values informationControl.setSizeConstraints(size.x, size.y); - + if ( cast(IInformationControlExtension2)informationControl ) (cast(IInformationControlExtension2) informationControl).setInput(information); else informationControl.setInformation(information.toString()); - + informationControl.setLocation(location); informationControl.setSize(size.x, size.y); - + showInformationControl(subjectArea); } - + /* * @see dwtx.jface.text.AbstractInformationControlManager#hideInformationControl() */ @@ -184,7 +184,7 @@ fReplacableInformation= input; if (! isReplacing()) { fDelayedInformationSet= true; - } else if (getCurrentInformationControl2() instanceof IInformationControlExtension2) { + } else if (cast(IInformationControlExtension2)getCurrentInformationControl2() ) { (cast(IInformationControlExtension2) getCurrentInformationControl2()).setInput(input); } else if (getCurrentInformationControl2() !is null) { getCurrentInformationControl2().setInformation(input.toString()); @@ -193,23 +193,23 @@ /** * Tells whether the replacer is currently replacing another information control. - * + * * @return <code>true</code> while code from {@link #replaceInformationControl(IInformationControlCreator, Rectangle, Object, Rectangle, bool)} is run */ public bool isReplacing() { return fIsReplacing; } - + /** * @return the current information control, or <code>null</code> if none available */ public IInformationControl getCurrentInformationControl2() { return getInternalAccessor().getCurrentInformationControl(); } - + /** * The number of pixels to blow up the keep-up zone. - * + * * @return the margin in pixels */ public int getKeepUpMargin() {