home *** CD-ROM | disk | FTP | other *** search
- package icontrols.marquee;
-
- import com.ms.wd.ui.Bitmap;
- import com.ms.wd.ui.Control;
- import com.ms.wd.ui.Graphics;
- import com.ms.wd.ui.Point;
- import com.ms.wd.ui.Rectangle;
- import com.ms.wd.win32.RECT;
- import com.ms.wd.win32.Windows;
-
- public class ImageElement implements IMarqueeElement {
- Bitmap m_bitmapCached;
- Graphics m_graphicsCached;
- Rectangle m_location = new Rectangle();
- Object m_tag;
- int m_wrapCount = 0;
-
- public void create(Control ctl, int width, int height) {
- if (this.m_bitmapCached != null) {
- Point size = this.m_bitmapCached.getSize();
- this.m_location.width = width > size.x | width == 0 ? size.x : width;
- this.m_location.height = height > size.y | height == 0 ? size.y : height;
- this.m_graphicsCached = this.m_bitmapCached.getGraphics();
- }
-
- }
-
- public ImageElement(Object tag, Bitmap bitmap) {
- this.m_tag = tag;
- this.m_bitmapCached = bitmap;
- }
-
- public Object getTag() {
- return this.m_tag;
- }
-
- public Object getTag(int x, int y) {
- return this.m_location.contains(x, y) ? this.m_tag : null;
- }
-
- public void paintIn(Rectangle rec, Graphics g) {
- if (this.m_graphicsCached != null) {
- RECT recIntersect = new RECT();
- RECT recPaint = rec.toRECT();
- RECT recLocation = this.m_location.toRECT();
- if (Windows.IntersectRect(recIntersect, recPaint, recLocation)) {
- Windows.BitBlt(g.getHandle(), recIntersect.left, recIntersect.top, recIntersect.right - recIntersect.left, recIntersect.bottom - recIntersect.top, this.m_graphicsCached.getHandle(), recIntersect.left - this.m_location.x, recIntersect.top - this.m_location.y, 13369376);
- }
- }
-
- }
-
- public void scroll(int x, int y) {
- Rectangle var10000 = this.m_location;
- var10000.x += x;
- var10000 = this.m_location;
- var10000.y += y;
- }
-
- public int getWrapCount() {
- return this.m_wrapCount;
- }
-
- public void setWrapCount(int count) {
- this.m_wrapCount = count;
- }
-
- public void finalize() {
- if (this.m_graphicsCached != null) {
- this.m_graphicsCached.dispose();
- this.m_graphicsCached = null;
- }
-
- }
-
- public Rectangle getBounds() {
- return this.m_location;
- }
-
- public void setLocation(int x, int y) {
- Rectangle var10000 = this.m_location;
- var10000.x += x;
- var10000 = this.m_location;
- var10000.y += y;
- }
- }
-