blob: 40d403fe788d4078a879c995af719ebfae01c35b [file] [log] [blame]
/*
* Copyright (c) 2008, 2009 Borland Software Corp.
*
* All rights reserved. This program and the accompanying materials
* 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:
* Artem Tikhomirov (Borland) - initial API and implementation
*/
«IMPORT 'http://www.eclipse.org/gmf/2008/Widget'»
«EXTENSION Widgets»
«DEFINE Main(compositeVar : String) FOR widget::Layout»«ERROR 'abstract Main FOR Layout'»«ENDDEFINE»
«DEFINE Main(compositeVar : String) FOR widget::FormLayout
«compositeVar».setLayout(new org.eclipse.swt.layout.FormLayout());
org.eclipse.swt.layout.FormData «compositeVar»FD;
«FOREACH data AS fd
«compositeVar»FD = new org.eclipse.swt.layout.FormData();
«IF fd.left <> null»«compositeVar»FD.left = «EXPAND x FOR fd.left»;
«ENDIF
«IF fd.right <> null»«compositeVar»FD.right = «EXPAND x FOR fd.right»;
«ENDIF
«IF fd.top <> null»«compositeVar»FD.top = «EXPAND x FOR fd.top»;
«ENDIF
«IF fd.bottom <> null»«compositeVar»FD.bottom = «EXPAND x FOR fd.bottom»;
«ENDIF
«fieldName(fd.widget)».setLayoutDatacompositeVar»FD);
«ENDFOREACH
«ENDDEFINE»
«DEFINE x FOR widget::Attachment
«IF control = null»new org.eclipse.swt.layout.FormAttachment(0, «offset»)«ELSE»new org.eclipse.swt.layout.FormAttachmentfieldName(control)», «offset», org.eclipse.swt.SWTalign»)«ENDIF»«ENDDEFINE»
«DEFINE Main(compositeVar : String) FOR widget::GridLayout
«compositeVar».setLayout(new org.eclipse.swt.layout.GridLayoutcolumns», «equalColumns»));
«FOREACH data AS fd
org.eclipse.jface.layout.GridDataFactory.swtDefaults()«EXPAND align FOR fd»«EXPAND span FOR fd»«EXPAND grab FOR fd».applyTofieldName(fd.widget)»);
«ENDFOREACH
«ENDDEFINE»
«DEFINE Main(compositeVar : String) FOR widget::FillLayout
«compositeVar».setLayout(new org.eclipse.swt.layout.FillLayoutIF vertical»org.eclipse.swt.SWT.VERTICAL«ENDIF»));
«ENDDEFINE»
/////////////////////
// GridData internals
//
«DEFINE align FOR widget::GridData».align(SWTEXPAND alignLiteral FOR hAlign», SWTEXPAND alignLiteral FOR vAlign»)«ENDDEFINE»
«DEFINE span FOR widget::GridData»«IF hSpan > 1 or vSpan > 1».spanhSpan», «vSpan»)«ENDIF»«ENDDEFINE»
«DEFINE grab FOR widget::GridData»«IF hGrab or vGrab».grabhGrab», «vGrab»)«ENDIF»«ENDDEFINE»
«DEFINE alignLiteral FOR widget::Alignment»«IF self = widget::Alignment::LEFT»BEGINNING«ELSEIF self = widget::Alignment::RIGHT»END«ELSE»«self»«ENDIF»«ENDDEFINE»