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;
}
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;
}
Aggregations