📄 screen.java
字号:
//#if !polish.Bugs.noTranslucencyWithDrawRgb
//#if polish.color.overlay:defined
//#= this.previousScreenOverlayBackground = new TranslucentSimpleBackground( ${polish.color.overlay} );
//#else
//# this.previousScreenOverlayBackground = new TranslucentSimpleBackground( 0xAA000000 );
//#endif
//#endif
//# }
//#endif
//# }
//#endif
// inform all root items that they belong to this screen
// and that they will be shown soon:
Item[] items = getRootItems();
for (int i = 0; i < items.length; i++) {
Item item = items[i];
item.screen = this;
item.showNotify();
}
if (this.container != null) {
this.container.showNotify();
}
//#if tmp.ignoreMotorolaTitleCall
//# this.ignoreMotorolaTitleCall = true;
//#endif
//#if tmp.fullScreen && polish.midp2 && !polish.blackberry
// this is needed on Sony Ericsson for example,
// since the fullscreen mode is not resumed automatically
// when the previous screen was in the "normal" mode:
//#if ! tmp.fullScreenInPaint
super.setFullScreenMode( true );
//#endif
//#endif
// init components:
int width = this.screenWidth - (this.marginLeft + this.marginRight);
//#ifdef tmp.menuFullScreen
//#ifdef tmp.useExternalMenuBar
//# if (!this.menuBar.isInitialised) {
//# this.menuBar.init( width, width );
//# }
//#else
if (this.menuOpened) {
if (!this.menuContainer.isInitialised) {
this.menuContainer.init( width, width );
}
} else
//#endif
//#endif
if (this.container != null && !this.container.isInitialised) {
this.container.init( width, width );
}
if (this.gauge != null && !this.gauge.isInitialised) {
this.gauge.init( width, width );
}
//#ifdef tmp.usingTitle
if (this.title != null && !this.title.isInitialised) {
this.title.init( width, width );
}
//#endif
//#ifndef polish.skipTicker
if (this.ticker != null && !this.ticker.isInitialised) {
this.ticker.init( width, width );
}
//#endif
calculateContentArea(0, 0, this.screenWidth, this.screenHeight);
} catch (Exception e) {
//#debug error
//# System.out.println("error while calling showNotify" + e );
}
// register this screen:
StyleSheet.currentScreen = this;
//#ifdef polish.Vendor.Siemens
//# this.showNotifyTime = System.currentTimeMillis();
//#endif
}
/**
* Unregisters this screen and notifies all items that they will not be shown anymore.
*/
public void hideNotify() {
//#if polish.css.repaint-previous-screen
//#if polish.Screen.dontBufferPreviousScreen
//# this.previousScreen = null;
//#else
//# this.previousScreenImage = null;
//#endif
//#if !polish.Bugs.noTranslucencyWithDrawRgb
//# this.previousScreenOverlayBackground = null;
//#endif
//#endif
//#ifdef polish.Vendor.Siemens
//# // Siemens sometimes calls hideNotify directly
//# // after showNotify for some reason.
//# // So hideNotify checks how long the screen
//# // has been shown - if not long enough,
//# // the call will be ignored:
//# if (System.currentTimeMillis() - this.showNotifyTime < 500) {
//#debug
//# System.out.println("Ignoring hideNotify on Siemens");
//# return;
//# }
//#endif
//#debug
//# System.out.println("hideNotify " + this);
//#if !polish.css.repaint-previous-screen
// un-register this screen:
if (StyleSheet.currentScreen == this) {
StyleSheet.currentScreen = null;
}
//#endif
Item[] items = getRootItems();
for (int i = 0; i < items.length; i++) {
Item item = items[i];
item.hideNotify();
}
if (this.container != null) {
this.container.hideNotify();
}
//#ifdef tmp.ignoreMotorolaTitleCall
//# this.ignoreMotorolaTitleCall = true;
//#endif
}
/**
* Sets the style of this screen.
*
* @param style the style
*/
public void setStyle(Style style) {
if (style != this.style ) {
this.style.releaseResources();
}
//#debug
//# System.out.println("Setting screen-style for " + getClass().getName() );
this.style = style;
this.background = style.background;
this.border = style.border;
this.marginTop = style.marginTop;
this.marginBottom = style.marginBottom;
this.marginLeft = style.marginRight;
this.marginRight = style.marginRight;
if (this.container != null) {
// use the same style for the container - but ignore the background and border settings:
this.container.setStyle(style, true);
}
this.isLayoutVCenter = (( style.layout & Item.LAYOUT_VCENTER ) == Item.LAYOUT_VCENTER);
this.isLayoutBottom = !this.isLayoutVCenter
&& (( style.layout & Item.LAYOUT_BOTTOM ) == Item.LAYOUT_BOTTOM);
this.isLayoutCenter = (( style.layout & Item.LAYOUT_CENTER ) == Item.LAYOUT_CENTER);
this.isLayoutRight = !this.isLayoutCenter
&& (( style.layout & Item.LAYOUT_RIGHT ) == Item.LAYOUT_RIGHT);
this.isLayoutHorizontalShrink = (style.layout & Item.LAYOUT_SHRINK) == Item.LAYOUT_SHRINK;
this.isLayoutVerticalShrink = (style.layout & Item.LAYOUT_VSHRINK) == Item.LAYOUT_VSHRINK;
//#if polish.css.scrollindicator-up-image && !tmp.useScrollBar
//# String scrollUpUrl = style.getProperty(102);
//# if (scrollUpUrl != null) {
//# try {
//# this.scrollIndicatorUpImage = StyleSheet.getImage(scrollUpUrl, null, true);
//# } catch (IOException e) {
//#debug error
//# System.out.println("Unable to load scroll up image" + e );
//# }
//# } else {
//# this.scrollIndicatorUpImage = null;
//# }
//#endif
//#if polish.css.scrollindicator-down-image && !tmp.useScrollBar
//# String scrollDownUrl = style.getProperty(103);
//# if (scrollDownUrl != null) {
//# try {
//# this.scrollIndicatorDownImage = StyleSheet.getImage(scrollDownUrl, null, true);
//# } catch (IOException e) {
//#debug error
//# System.out.println("Unable to load scroll down image" + e );
//# }
//# } else {
//# this.scrollIndicatorDownImage = null;
//# }
//#endif
//#if polish.css.scrollindicator-up-image && polish.css.scrollindicator-down-image && !tmp.useScrollBar
//# if (this.scrollIndicatorUpImage != null && this.scrollIndicatorDownImage != null) {
//# int height = this.scrollIndicatorUpImage.getHeight() + this.scrollIndicatorDownImage.getHeight();
//# int width = Math.max( this.scrollIndicatorUpImage.getWidth(), this.scrollIndicatorDownImage.getWidth() );
//# this.scrollIndicatorWidth = width;
//# this.scrollIndicatorX = this.screenWidth / 2 - width / 2;
//#ifdef tmp.menuFullScreen
//#ifdef tmp.useExternalMenuBar
//# this.scrollIndicatorY = this.fullScreenHeight - (this.menuBar.marginBottom + 1 + height);
//#else
//# this.scrollIndicatorY = this.fullScreenHeight - (height + 1);
//#endif
//#elif polish.vendor.Siemens
//# // set the position of scroll indicator for Siemens devices
//# // on the left side, so that the menu-indicator is visible:
//# this.scrollIndicatorWidth = width;
//# this.scrollIndicatorX = 0;
//# this.scrollIndicatorY = this.screenHeight - height - 1;
//#else
//# // set position of scroll indicator:
//# this.scrollIndicatorWidth = width;
//# this.scrollIndicatorX = this.screenWidth - width - 1;
//# this.scrollIndicatorY = this.screenHeight - height - 1;
//#endif
//# }
//#endif
//#if polish.css.scrollindicator-color && !tmp.useScrollBar
//# Integer scrollIndicatorColorInt = style.getIntProperty( 36 );
//# if (scrollIndicatorColorInt != null) {
//# this.scrollIndicatorColor = scrollIndicatorColorInt.intValue();
//# }
//#endif
//#if tmp.usingTitle && polish.css.title-style
//# this.titleStyle = (Style) style.getObjectProperty(2);
//# if (this.titleStyle != null && this.title != null) {
//# this.title.setStyle(this.titleStyle);
//# int width = this.screenWidth - (this.marginLeft + this.marginRight);
//# this.titleHeight = this.title.getItemHeight( width, width );
//# } else {
//#endif
//#if tmp.usingTitle
if (this.title != null && this.title.isInitialised) {
this.title.isInitialised = false;
int width = this.screenWidth - (this.marginLeft + this.marginRight);
this.titleHeight = this.title.getItemHeight( width, width );
}
//#endif
//#if tmp.usingTitle && polish.css.title-style
//# }
//#endif
//#if tmp.usingTitle && polish.css.title-position
//# Integer titlePositionInt = style.getIntProperty(115);
//# if (titlePositionInt == null && this.title != null && this.title.style != null) {
//# titlePositionInt = this.title.style.getIntProperty(115);
//# }
//# if (titlePositionInt != null) {
//# this.paintTitleAtTop = (titlePositionInt.intValue() == POSITION_TOP);
//# }
//#
//#endif
//#if tmp.useScrollBar && polish.css.scrollbar-style
//# Style scrollbarStyle = (Style) style.getObjectProperty(126);
//# if (scrollbarStyle != null) {
//# this.scrollBar.setStyle( scrollbarStyle );
//# }
//#endif
//#if tmp.useScrollBar && polish.css.scrollbar-position
//# Integer scrollBarPositionInt = style.getIntProperty( 118 );
//# if (scrollBarPositionInt == null && this.scrollBar.style != null) {
//# scrollBarPositionInt = this.scrollBar.style.getIntProperty( 118 );
//# }
//# if (scrollBarPositionInt != null) {
//# this.paintScrollBarOnRightSide = (scrollBarPositionInt.intValue() != POSITION_LEFT);
//# }
//#endif
//#ifdef polish.css.foreground-image
//# String foregroundImageUrl = this.style.getProperty(52);
//# if (foregroundImageUrl == null) {
//# this.foregroundImage = null;
//# } else {
//# try {
//# this.foregroundImage = StyleSheet.getImage(foregroundImageUrl, null,true);
//#ifdef polish.css.foreground-x
//# Integer xInteger = this.style.getIntProperty(53);
//# if (xInteger != null) {
//# this.foregroundX = xInteger.intValue();
//# }
//#endif
//#ifdef polish.css.foreground-y
//# Integer yInteger = this.style.getIntProperty(54);
//# if (yInteger != null) {
//# this.foregroundY = yInteger.intValue();
//# }
//#endif
//# } catch (IOException e) {
//#debug error
//# System.out.println("Unable to load foreground-image [" + foregroundImageUrl + "]: " + e);
//# }
//# }
//#endif
//#if polish.css.clip-screen-info
//# Boolean clipScreenInfoBool = style.getBooleanProperty( 87 );
//# if (clipScreenInfoBool != null) {
//# this.clipScreenInfo = clipScreenInfoBool.booleanValue();
//# }
//#endif
//#if polish.css.menubar-style && tmp.useExternalMenuBar
//# Style menuBarStyle = (Style) style.getObjectProperty(117);
//# if (menuBarStyle != null) {
//# this.menuBar.setStyle( menuBarStyle );
//# }
//#endif
//#ifndef polish.skipTicker
//#if polish.css.ticker-position
//# Integer tickerPositionInt = style.getIntProperty(114);
//# if (tickerPositionInt == null && this.ticker != null && this.ticker.style != null) {
//# tickerPositionInt = this.ticker.style.getIntProperty(114);
//# }
//# if (tickerPositionInt != null) {
//# this.paintTickerAtTop = (tickerPositionInt.intValue() == POSITION_TOP);
//# }
//#endif
//#endif
//#if polish.css.repaint-previous-screen
//# Boolean repaintPreviousScreenBool = style.getBooleanProperty(116);
//# if (repaintPreviousScreenBool != null) {
//# this.repaintPreviousScreen = repaintPreviousScreenBool.booleanValue();
//# }
//#endif
//#if polish.css.separate-menubar
//# Boolean separateMenubarBool = style.getBooleanProperty("separate-menubar");
//# if (separateMenubarBool != null) {
//# this.separateMenubar = separateMenubarBool.booleanValue();
//# }
//#endif
//#if tmp.menuFullScreen
//#if polish.css.background-bottom
//# Integer backgroundBottomInt = style.getIntProperty(153);
//# if (backgroundBottomInt != null) {
//# this.excludeMenuBarForBackground = backgroundBottomInt.intValue() == 1;
//# }
//#endif
//#endif
//#ifdef tmp.usingTitle
//#if polish.css.background-top
//# Integer backgroundTopInt = style.getIntProperty(154);
//# if (backgroundTopInt != null) {
//# this.excludeTitleForBackground = backgroundTopInt.intValue() == 1;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -