下面列出了org.eclipse.swt.widgets.Composite#getClientArea ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
protected void layout(final Composite composite, final boolean flushCache) {
if (flushCache || !_calculated) {
recalculate(composite);
}
final Control[] children = composite.getChildren();
final Rectangle bounds = composite.getClientArea();
int y = _ganttHeaderSize;
for (int i = 0; i < children.length; i++) {
final Control child = children[i];
final Point wantedSize = child.computeSize(SWT.DEFAULT, SWT.DEFAULT);
child.setLocation(0, y);
child.setSize(bounds.width, bounds.height - y);
y += wantedSize.y;
}
}
public void paintControl( PaintEvent e )
{
idr.setProperty( IDeviceRenderer.GRAPHICS_CONTEXT, e.gc );
Composite co = (Composite) e.getSource( );
Rectangle re = co.getClientArea( );
Bounds bo = BoundsImpl.create( 0, 0, re.width, re.height );
bo.scale( 72d / idr.getDisplayServer( ).getDpiResolution( ) );
Generator gr = Generator.instance( );
try
{
gr.render( idr, gr.build( idr.getDisplayServer( ),
cm,
bo,
null,
null,
StyleProcessor.instance( ) ) );
}
catch ( ChartException ce )
{
ce.printStackTrace( );
}
}
protected void layout(Composite composite, boolean flushCache) {
Rectangle area = composite.getClientArea();
if(area.isEmpty()) return;
if(flushCache) computeSize(composite, -1, -1, flushCache);
ctree.getHeader().setBounds(
area.x,
area.y,
area.width,
headerSize.y
);
Point origin = ctree.getScrollPosition();
int height = area.height-headerSize.y;
ctree.body.setBounds(
area.x-origin.x,
area.y+headerSize.y-origin.y,
(gtk ? Math.max(area.width, headerSize.x) : area.width),
(gtk ? Math.max(height, contentHeight) : height)
);
layoutHeader();
layoutContent();
updateScrollBars();
}
/**
* {@inheritDoc}
*/
@Override
public void layout(final Composite composite, final boolean force) {
final Rectangle rect = composite.getClientArea();
final Control[] children = composite.getChildren();
for (final Control child : children) {
child.setSize(rect.width, rect.height);
}
}
@Override
public void layout(Composite composite, boolean force) {
Rectangle rect = composite.getClientArea();
Control[] children = composite.getChildren();
for (int i = 0; i < children.length; i++) {
children[i].setSize(rect.width, rect.height);
}
}
@Override
public void layout(Composite composite, boolean force) {
Rectangle rect = composite.getClientArea();
Control[] children = composite.getChildren();
for (int i = 0; i < children.length; i++) {
children[i].setSize(rect.width, rect.height);
}
}
public void layout(Composite composite, boolean force)
{
Rectangle rect = composite.getClientArea();
Control[] children = composite.getChildren();
for (int i = 0; i < children.length; i++)
{
children[i].setSize(rect.width, rect.height);
}
}
@Override
public void layout(Composite composite, boolean force) {
Rectangle rect = composite.getClientArea();
Control[] children = composite.getChildren();
for (int i = 0; i < children.length; i++) {
children[i].setSize(rect.width, rect.height);
}
}
/**
* Returns the client area for the given composite according to this
* layout.
*
* @param c
* the composite
* @return the client area rectangle
*/
public Rectangle getClientArea(Composite c) {
Rectangle rect = c.getClientArea();
rect.x = rect.x + marginWidth;
rect.y = rect.y + marginHeight;
rect.width = rect.width - 2 * marginWidth;
rect.height = rect.height - 2 * marginHeight;
return rect;
}
/**
* Returns the client area for the given composite according to this
* layout.
*
* @param c
* the composite
* @return the client area rectangle
*/
public Rectangle getClientArea(Composite c) {
Rectangle rect = c.getClientArea();
rect.x = rect.x + marginWidth;
rect.y = rect.y + marginHeight;
rect.width = rect.width - 2 * marginWidth;
rect.height = rect.height - 2 * marginHeight;
return rect;
}
public void layout( Composite editor, boolean force )
{
Rectangle bounds = editor.getClientArea( );
Point size = btnPopup.computeSize( SWT.DEFAULT, SWT.DEFAULT, force );
expressionText.setBounds( 0,
0,
bounds.width - size.x,
bounds.height );
btnPopup.setBounds( bounds.width - size.x, 0, size.x, bounds.height );
}
public void paintControl( PaintEvent e )
{
idr.setProperty( IDeviceRenderer.GRAPHICS_CONTEXT, e.gc );
Composite co = (Composite) e.getSource( );
Rectangle re = co.getClientArea( );
Bounds bo = BoundsImpl.create( 0, 0, re.width, re.height );
bo.scale( 72d / idr.getDisplayServer( ).getDpiResolution( ) );
RunTimeContext context = new RunTimeContext( );
context.setULocale( ULocale.getDefault( ) );
String[] set = {
"Items", "Amounts"};//$NON-NLS-1$ //$NON-NLS-2$
Object[][] data = {
{
"A", "B", "C"//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}, {
Integer.valueOf( 7 ), Integer.valueOf( 2 ), Integer.valueOf( 5 )
}
};
dree = new SimpleDataRowExpressionEvaluator( set, data );
Generator gr = Generator.instance( );
try
{
gr.bindData( dree, cm, context );
gr.render( idr, gr.build( idr.getDisplayServer( ),
cm,
bo,
null,
context,
null ) );
}
catch ( ChartException ce )
{
ce.printStackTrace( );
}
}
public void layout( Composite editor, boolean force )
{
Rectangle bounds = editor.getClientArea( );
Point size = btnPopup.computeSize( SWT.DEFAULT, SWT.DEFAULT, force );
expressionText.setBounds( 0,
0,
bounds.width - size.x,
bounds.height );
btnPopup.setBounds( bounds.width - size.x, 0, size.x, bounds.height );
}
public void layout( Composite editor, boolean force )
{
Rectangle bounds = editor.getClientArea( );
Point size = btnPopup.computeSize( SWT.DEFAULT, SWT.DEFAULT, force );
valueText.setBounds( 0, 0, bounds.width - size.x, bounds.height );
btnPopup.setBounds( bounds.width - size.x, 0, size.x, bounds.height );
}
public void layout( Composite editor, boolean force )
{
Rectangle bounds = editor.getClientArea( );
Point size = btnPopup.computeSize( SWT.DEFAULT, SWT.DEFAULT, force );
expressionText.setBounds( 0,
0,
bounds.width - size.x,
bounds.height );
btnPopup.setBounds( bounds.width - size.x, 0, size.x, bounds.height );
}
protected void layout( Composite composite, boolean flushCache )
{
Rectangle rect = composite.getClientArea( );
layout( composite,
true,
rect.x,
rect.y,
rect.width,
rect.height,
flushCache );
}
public void layout( Composite editor, boolean force )
{
Rectangle bounds = editor.getClientArea( );
Point size = button.computeSize( SWT.DEFAULT, SWT.DEFAULT, force );
if ( contents != null )
{
contents.setBounds( 0, 0, bounds.width - size.x, bounds.height );
}
button.setBounds( bounds.width - size.x, 0, size.x, bounds.height );
}
@Override
public void layout(Composite editor, boolean force) {
Rectangle bounds = editor.getClientArea();
Point size = button.computeSize(SWT.DEFAULT, SWT.DEFAULT, force);
if (contents != null) {
contents.setBounds(0, 0, bounds.width - size.x, bounds.height);
}
button.setBounds(bounds.width - size.x, 0, size.x, bounds.height);
}
@Override
protected void layout(Composite composite, boolean flushCache) {
if (styledText != null && !styledText.isDisposed()) {
Rectangle bounds = composite.getClientArea();
int height = bounds.height;
int perc = (int) (height * percSize); // 30% to the input
interactiveConsoleTextWidget.setBounds(bounds.x, bounds.y + height - perc, bounds.width,
perc);
styledText.setBounds(bounds.x, bounds.y, bounds.width, height - perc);
}
}
@Override
public void layout(Composite editor, boolean force) {
Rectangle bounds = editor.getClientArea();
Point size = hyperlink.computeSize(SWT.DEFAULT, SWT.DEFAULT, force);
if (contents != null) {
contents.setBounds(0, 0, bounds.width - size.x, bounds.height);
}
hyperlink
.setBounds(bounds.width - size.x, 0, size.x, bounds.height);
}