blob: 171d9113df52f7fc944e3d88f3547054ece88f3c [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2000, 2007 IBM Corporation and others.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*
*******************************************************************************/
package org.eclipse.dltk.internal.ui.util;
import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.custom.ViewForm;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.ToolBar;
/**
* A <code>ViewerPane</code> is a convenience class which installs a
* <code>CLabel</code> and a <code>Toolbar</code> in a <code>ViewForm</code>.
* <P>
*/
public class ViewerPane extends ViewForm {
private ToolBarManager fToolBarManager;
public ViewerPane(Composite parent, int style) {
super(parent, style);
marginWidth= 0;
marginHeight= 0;
CLabel label= new CLabel(this, SWT.NONE);
setTopLeft(label);
ToolBar tb= new ToolBar(this, SWT.FLAT);
setTopCenter(tb);
fToolBarManager= new ToolBarManager(tb);
}
/**
* Sets the receiver's title text.
*/
public void setText(String label) {
CLabel cl= (CLabel) getTopLeft();
cl.setText(label);
}
public String getText() {
CLabel cl= (CLabel) getTopLeft();
return cl.getText();
}
/**
* Sets the receiver's title image.
*/
public void setImage(Image image) {
CLabel cl= (CLabel) getTopLeft();
cl.setImage(image);
}
public Image getImage() {
CLabel cl= (CLabel) getTopLeft();
return cl.getImage();
}
public ToolBarManager getToolBarManager() {
return fToolBarManager;
}
}