Search in sources :

Example 1 with UIToolBarItemImpl

use of com.biglybt.ui.swt.pifimpl.UIToolBarItemImpl in project BiglyBT by BiglySoftware.

the class ToolBarView method createItemSO.

private void createItemSO(ToolBarItem item, String templatePrefix, int position) {
    ToolBarItemSO existingItemSO;
    synchronized (mapToolBarItemToSO) {
        existingItemSO = mapToolBarItemToSO.get(item);
    }
    if (existingItemSO != null) {
        SWTSkinObject so = existingItemSO.getSO();
        if (so != null) {
            so.dispose();
        }
    }
    String templateID = templatePrefix;
    if (position == SWT.RIGHT) {
        templateID += ".right";
    } else if (position == SWT.LEFT) {
        templateID += ".left";
    } else if (position == SWT.SINGLE) {
        templateID += ".lr";
    }
    Control attachToControl = getLastControl(item.getGroupID());
    String id = "toolbar:" + item.getID();
    SWTSkinObject so = skin.createSkinObject(id, templateID, getGroupSO(item.getGroupID()));
    if (so != null) {
        ToolBarItemSO itemSO;
        itemSO = new ToolBarItemSO((UIToolBarItemImpl) item, so);
        if (attachToControl != null) {
            FormData fd = (FormData) so.getControl().getLayoutData();
            fd.left = new FormAttachment(attachToControl);
        }
        initSO(so, itemSO);
        if (initComplete) {
            Utils.relayout(so.getControl().getParent());
        }
    }
}
Also used : FormData(org.eclipse.swt.layout.FormData) ToolBarItemSO(com.biglybt.ui.swt.toolbar.ToolBarItemSO) SWTSkinObject(com.biglybt.ui.swt.skin.SWTSkinObject) Control(org.eclipse.swt.widgets.Control) UIToolBarItemImpl(com.biglybt.ui.swt.pifimpl.UIToolBarItemImpl) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 2 with UIToolBarItemImpl

use of com.biglybt.ui.swt.pifimpl.UIToolBarItemImpl in project BiglyBT by BiglySoftware.

the class ToolBarView method createItem.

private ToolBarItem createItem(ToolBarView tbv, String id, String imageid, String textID) {
    UIToolBarItemImpl base = new UIToolBarItemImpl(id);
    base.setImageID(imageid);
    base.setTextID(textID);
    return base;
}
Also used : UIToolBarItemImpl(com.biglybt.ui.swt.pifimpl.UIToolBarItemImpl)

Example 3 with UIToolBarItemImpl

use of com.biglybt.ui.swt.pifimpl.UIToolBarItemImpl in project BiglyBT by BiglySoftware.

the class ToolBarView method createItemSO.

private void createItemSO(Map<UIToolBarItem, ToolBarItemSO> newMap, ToolBarItem item, String templatePrefix, int position) {
    ToolBarItemSO existingItemSO = newMap.get(item);
    if (existingItemSO != null) {
        SWTSkinObject so = existingItemSO.getSO();
        if (so != null) {
            so.dispose();
        }
    }
    String templateID = templatePrefix;
    if (position == SWT.RIGHT) {
        templateID += ".right";
    } else if (position == SWT.LEFT) {
        templateID += ".left";
    } else if (position == SWT.SINGLE) {
        templateID += ".lr";
    }
    Control attachToControl = getLastControl(item.getGroupID());
    String id = "toolbar:" + item.getID();
    SWTSkinObject so = skin.createSkinObject(id, templateID, getGroupSO(item.getGroupID()));
    if (so != null) {
        ToolBarItemSO itemSO;
        itemSO = new ToolBarItemSO((UIToolBarItemImpl) item, so);
        if (attachToControl != null) {
            FormData fd = (FormData) so.getControl().getLayoutData();
            fd.left = new FormAttachment(attachToControl);
        }
        initSO(newMap, so, itemSO);
        if (initComplete) {
            Utils.relayout(so.getControl().getParent());
        }
    }
}
Also used : FormData(org.eclipse.swt.layout.FormData) ToolBarItemSO(com.biglybt.ui.swt.toolbar.ToolBarItemSO) SWTSkinObject(com.biglybt.ui.swt.skin.SWTSkinObject) Control(org.eclipse.swt.widgets.Control) UIToolBarItemImpl(com.biglybt.ui.swt.pifimpl.UIToolBarItemImpl) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Aggregations

UIToolBarItemImpl (com.biglybt.ui.swt.pifimpl.UIToolBarItemImpl)3 SWTSkinObject (com.biglybt.ui.swt.skin.SWTSkinObject)2 ToolBarItemSO (com.biglybt.ui.swt.toolbar.ToolBarItemSO)2 FormAttachment (org.eclipse.swt.layout.FormAttachment)2 FormData (org.eclipse.swt.layout.FormData)2 Control (org.eclipse.swt.widgets.Control)2