Search in sources :

Example 56 with SWTSkinObject

use of com.biglybt.ui.swt.skin.SWTSkinObject in project BiglyBT by BiglySoftware.

the class MainMenuV3 method createPluginBarMenuItem.

// ====================================
/**
 * @param viewMenu
 */
public static MenuItem createPluginBarMenuItem(final SWTSkin skin, Menu viewMenu, final String textID, final String configID, final String viewID) {
    MenuItem item;
    if (!ConfigurationDefaults.getInstance().doesParameterDefaultExist(configID)) {
        COConfigurationManager.setBooleanDefault(configID, true);
    }
    item = MenuFactory.addMenuItem(viewMenu, SWT.CHECK, textID, new Listener() {

        @Override
        public void handleEvent(Event event) {
            SWTSkinObject skinObject = skin.getSkinObject(viewID);
            if (skinObject != null) {
                boolean newVisibility = !skinObject.isVisible();
                SWTSkinUtils.setVisibility(skin, configID, viewID, newVisibility, true);
            }
        }
    });
    SWTSkinUtils.setVisibility(skin, configID, viewID, COConfigurationManager.getBooleanParameter(configID), false);
    final MenuItem itemViewPluginBar = item;
    final ParameterListener listener = new ParameterListener() {

        @Override
        public void parameterChanged(String parameterName) {
            itemViewPluginBar.setSelection(COConfigurationManager.getBooleanParameter(parameterName));
        }
    };
    COConfigurationManager.addAndFireParameterListener(configID, listener);
    item.addDisposeListener(new DisposeListener() {

        @Override
        public void widgetDisposed(DisposeEvent e) {
            COConfigurationManager.removeParameterListener(configID, listener);
        }
    });
    return item;
}
Also used : SWTSkinObject(com.biglybt.ui.swt.skin.SWTSkinObject) ParameterListener(com.biglybt.core.config.ParameterListener) UIToolBarActivationListener(com.biglybt.pif.ui.toolbar.UIToolBarActivationListener) ParameterListener(com.biglybt.core.config.ParameterListener)

Example 57 with SWTSkinObject

use of com.biglybt.ui.swt.skin.SWTSkinObject in project BiglyBT by BiglySoftware.

the class BaseMDI method getEntryBySkinView.

/**
 * @param skinView
 * @return
 *
 * @since 3.1.1.1
 */
@Override
public MdiEntrySWT getEntryBySkinView(Object skinView) {
    SWTSkinObject so = ((SkinView) skinView).getMainSkinObject();
    BaseMdiEntry[] sideBarEntries = getEntries(new BaseMdiEntry[0]);
    for (int i = 0; i < sideBarEntries.length; i++) {
        BaseMdiEntry entry = sideBarEntries[i];
        SWTSkinObject entrySO = entry.getSkinObject();
        SWTSkinObject entrySOParent = entrySO == null ? entrySO : entrySO.getParent();
        if (entrySO == so || entrySO == so.getParent() || entrySOParent == so) {
            return entry;
        }
    }
    return null;
}
Also used : SWTSkinObject(com.biglybt.ui.swt.skin.SWTSkinObject) SkinView(com.biglybt.ui.swt.views.skin.SkinView)

Aggregations

SWTSkinObject (com.biglybt.ui.swt.skin.SWTSkinObject)57 SWTSkinObjectContainer (com.biglybt.ui.swt.skin.SWTSkinObjectContainer)13 SWTSkinObjectListener (com.biglybt.ui.swt.skin.SWTSkinObjectListener)7 FormData (org.eclipse.swt.layout.FormData)7 SWTSkinButtonUtility (com.biglybt.ui.swt.skin.SWTSkinButtonUtility)6 SWTSkinObjectText (com.biglybt.ui.swt.skin.SWTSkinObjectText)6 GridLayout (org.eclipse.swt.layout.GridLayout)6 FormAttachment (org.eclipse.swt.layout.FormAttachment)5 CoreRunningListener (com.biglybt.core.CoreRunningListener)4 ParameterListener (com.biglybt.core.config.ParameterListener)4 UIToolBarActivationListener (com.biglybt.pif.ui.toolbar.UIToolBarActivationListener)4 SWTSkin (com.biglybt.ui.swt.skin.SWTSkin)4 Point (org.eclipse.swt.graphics.Point)4 GridData (org.eclipse.swt.layout.GridData)4 Control (org.eclipse.swt.widgets.Control)4 Core (com.biglybt.core.Core)3 ToolBarItem (com.biglybt.ui.common.ToolBarItem)3 MultipleDocumentInterface (com.biglybt.ui.mdi.MultipleDocumentInterface)3 ImageLoader (com.biglybt.ui.swt.imageloader.ImageLoader)3 Composite (org.eclipse.swt.widgets.Composite)3