Search in sources :

Example 16 with SWTSkinObject

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

the class MainMenuV3 method createViewMenuItem.

// ====================================
/**
 * @param viewMenu
 */
public static MenuItem createViewMenuItem(final SWTSkin skin, Menu viewMenu, final String textID, final String configID, final String viewID, final boolean fast, int menuIndex) {
    MenuItem item;
    if (!ConfigurationDefaults.getInstance().doesParameterDefaultExist(configID)) {
        COConfigurationManager.setBooleanDefault(configID, true);
    }
    item = MenuFactory.addMenuItem(viewMenu, SWT.CHECK, menuIndex, 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, fast);
            }
        }
    });
    SWTSkinUtils.setVisibility(skin, configID, viewID, COConfigurationManager.getBooleanParameter(configID), false, true);
    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 17 with SWTSkinObject

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

the class BaseMdiEntry method setPluginSkinObject.

/* (non-Javadoc)
	 * @see com.biglybt.ui.swt.pifimpl.UISWTViewImpl2#setPluginSkinObject(com.biglybt.ui.swt.pif.PluginUISWTSkinObject, org.eclipse.swt.widgets.Composite)
	 */
@Override
public void setPluginSkinObject(PluginUISWTSkinObject skinObject) {
    super.setPluginSkinObject(skinObject);
    Object initialDataSource = (datasource == null || ((datasource instanceof Object[]) && ((Object[]) datasource).length == 0)) ? getInitialDataSource() : datasource;
    if (initialDataSource != null) {
        if (skinObject instanceof SWTSkinObject) {
            ((SWTSkinObject) skinObject).triggerListeners(SWTSkinObjectListener.EVENT_DATASOURCE_CHANGED, initialDataSource);
        }
        triggerEvent(UISWTViewEvent.TYPE_DATASOURCE_CHANGED, initialDataSource);
    }
}
Also used : SWTSkinObject(com.biglybt.ui.swt.skin.SWTSkinObject) PluginUISWTSkinObject(com.biglybt.ui.swt.pif.PluginUISWTSkinObject) SWTSkinObject(com.biglybt.ui.swt.skin.SWTSkinObject) PluginUISWTSkinObject(com.biglybt.ui.swt.pif.PluginUISWTSkinObject)

Example 18 with SWTSkinObject

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

the class BaseMdiEntry method swt_hide.

protected void swt_hide() {
    SWTSkinObject skinObjectMaster = getSkinObjectMaster();
    if (skinObjectMaster instanceof SWTSkinObjectContainer) {
        SWTSkinObjectContainer container = (SWTSkinObjectContainer) skinObjectMaster;
        Control oldComposite = container.getControl();
        container.setVisible(false);
        if (oldComposite != null && !oldComposite.isDisposed()) {
            oldComposite.getShell().update();
        }
    }
    Composite oldComposite = getComposite();
    if (oldComposite != null && !oldComposite.isDisposed()) {
        oldComposite.setVisible(false);
        oldComposite.getShell().update();
    }
    try {
        triggerEvent(UISWTViewEvent.TYPE_FOCUSLOST, null);
    } catch (Exception e) {
        Debug.out(e);
    }
}
Also used : SWTSkinObject(com.biglybt.ui.swt.skin.SWTSkinObject) PluginUISWTSkinObject(com.biglybt.ui.swt.pif.PluginUISWTSkinObject) SWTSkinObjectContainer(com.biglybt.ui.swt.skin.SWTSkinObjectContainer) ConfigurationParameterNotFoundException(com.biglybt.core.config.impl.ConfigurationParameterNotFoundException)

Example 19 with SWTSkinObject

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

the class BaseMdiEntry method triggerEvent.

/* (non-Javadoc)
	 * @see com.biglybt.ui.swt.pifimpl.UISWTViewImpl2#triggerEvent(int, java.lang.Object)
	 */
@Override
public void triggerEvent(int eventType, Object data) {
    super.triggerEvent(eventType, data);
    if (eventType == UISWTViewEvent.TYPE_LANGUAGEUPDATE) {
        // } else {
        if (viewTitleInfo != null) {
            viewTitleInfoRefresh(viewTitleInfo);
        }
        updateUI();
        // }
        SWTSkinObject skinObjectMaster = getSkinObjectMaster();
        if (skinObjectMaster != null) {
            skinObjectMaster.triggerListeners(SWTSkinObjectListener.EVENT_LANGUAGE_CHANGE);
        }
    }
}
Also used : SWTSkinObject(com.biglybt.ui.swt.skin.SWTSkinObject) PluginUISWTSkinObject(com.biglybt.ui.swt.pif.PluginUISWTSkinObject)

Example 20 with SWTSkinObject

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

the class TabbedEntry method widgetDisposed.

@Override
public void widgetDisposed(DisposeEvent e) {
    setSwtItem(null);
    SWTThread instance = SWTThread.getInstance();
    triggerCloseListeners(instance != null && !instance.isTerminated());
    try {
        setEventListener(null, false);
    } catch (UISWTViewEventCancelledException e1) {
    }
    SWTSkinObject so = getSkinObject();
    if (so != null) {
        setSkinObjectMaster(null);
        so.getSkin().removeSkinObject(so);
    }
    // delay saving of removing of auto-open flag.  If after the delay, we are
    // still alive, it's assumed the user invoked the close, and we should
    // remove the auto-open flag
    Utils.execSWTThreadLater(0, new SWTRunnable() {

        @Override
        public void runWithDisplay(Display display) {
            // even though execThreadLater will not run on close of app because
            // the display is disposed, do a double check of tree disposal just
            // in case.  We don't want to trigger close listeners or
            // remove autoopen parameters if the user is closing the app (as
            // opposed to closing  the sidebar)
            mdi.removeItem(TabbedEntry.this);
            mdi.removeEntryAutoOpen(id);
        }
    });
}
Also used : UISWTViewEventCancelledException(com.biglybt.ui.swt.pifimpl.UISWTViewEventCancelledException) SWTSkinObject(com.biglybt.ui.swt.skin.SWTSkinObject) SWTRunnable(com.biglybt.ui.swt.utils.SWTRunnable) SWTThread(com.biglybt.ui.swt.mainwindow.SWTThread)

Aggregations

SWTSkinObject (com.biglybt.ui.swt.skin.SWTSkinObject)53 SWTSkinObjectContainer (com.biglybt.ui.swt.skin.SWTSkinObjectContainer)15 GridLayout (org.eclipse.swt.layout.GridLayout)8 SWTSkinObjectListener (com.biglybt.ui.swt.skin.SWTSkinObjectListener)7 SWTSkinButtonUtility (com.biglybt.ui.swt.skin.SWTSkinButtonUtility)5 SWTSkinObjectText (com.biglybt.ui.swt.skin.SWTSkinObjectText)5 SWTSkinObjectTextbox (com.biglybt.ui.swt.skin.SWTSkinObjectTextbox)5 GridData (org.eclipse.swt.layout.GridData)5 CoreRunningListener (com.biglybt.core.CoreRunningListener)4 MultipleDocumentInterface (com.biglybt.ui.mdi.MultipleDocumentInterface)4 FormAttachment (org.eclipse.swt.layout.FormAttachment)4 FormData (org.eclipse.swt.layout.FormData)4 Core (com.biglybt.core.Core)3 ToolBarItem (com.biglybt.ui.common.ToolBarItem)3 UIUpdatable (com.biglybt.ui.common.updater.UIUpdatable)3 UIUpdater (com.biglybt.ui.common.updater.UIUpdater)3 MdiEntry (com.biglybt.ui.mdi.MdiEntry)3 PluginUISWTSkinObject (com.biglybt.ui.swt.pif.PluginUISWTSkinObject)3 Control (org.eclipse.swt.widgets.Control)3 ActivitiesEntry (com.biglybt.activities.ActivitiesEntry)2