equal
deleted
inserted
replaced
26 import org.eclipse.swt.SWT; |
26 import org.eclipse.swt.SWT; |
27 import org.eclipse.swt.events.*; |
27 import org.eclipse.swt.events.*; |
28 import org.eclipse.swt.widgets.*; |
28 import org.eclipse.swt.widgets.*; |
29 import org.eclipse.swt.widgets.Display; |
29 import org.eclipse.swt.widgets.Display; |
30 import org.eclipse.swt.graphics.*; |
30 import org.eclipse.swt.graphics.*; |
31 import org.eclipse.swt.internal.extension.CompositeExtension; |
|
32 import org.eclipse.swt.internal.qt.graphics.WindowSurface; |
31 import org.eclipse.swt.internal.qt.graphics.WindowSurface; |
33 import org.eclipse.swt.internal.extension.MobileShellExtension; |
32 import org.eclipse.swt.internal.extension.MobileShellExtension; |
34 import org.eclipse.swt.internal.qt.SymbianWindowVisibilityListener; |
33 import org.eclipse.swt.internal.qt.SymbianWindowVisibilityListener; |
35 |
34 |
36 |
35 |
189 |
188 |
190 //On Screen Keypad |
189 //On Screen Keypad |
191 //private Composite keypadComposite; |
190 //private Composite keypadComposite; |
192 private CanvasKeypad onScreenkeypad; |
191 private CanvasKeypad onScreenkeypad; |
193 private static CanvasKeypad sharedKeypad; |
192 private static CanvasKeypad sharedKeypad; |
194 private int oskHeight; |
|
195 |
193 |
196 // Vector of flags that a certain key was pressed but was not released. |
194 // Vector of flags that a certain key was pressed but was not released. |
197 // Used to implement keyRepeated since eSWT does not support |
195 // Used to implement keyRepeated since eSWT does not support |
198 // key repeat events. |
196 // key repeat events. |
199 private Vector keysPressed; |
197 private Vector keysPressed; |
370 * @see Displayable#eswtConstructContent(int) |
368 * @see Displayable#eswtConstructContent(int) |
371 */ |
369 */ |
372 Composite eswtConstructContent(int style) |
370 Composite eswtConstructContent(int style) |
373 { |
371 { |
374 // Get JAD attribute |
372 // Get JAD attribute |
375 setMode(NO_BACKGROUND, JadAttributeUtil.isValue(JadAttributeUtil.ATTRIB_NOKIA_UI_ENHANCEMENT, |
373 setMode(NO_BACKGROUND, !JadAttributeUtil.isValue(JadAttributeUtil.ATTRIB_NOKIA_UI_ENHANCEMENT, |
376 JadAttributeUtil.VALUE_CANVAS_HAS_BACKGROUND)); |
374 JadAttributeUtil.VALUE_CANVAS_HAS_BACKGROUND)); |
377 if(isMode(NO_BACKGROUND)) |
375 if(isMode(NO_BACKGROUND)) |
378 { |
376 { |
379 style |= SWT.NO_BACKGROUND; |
377 style |= SWT.NO_BACKGROUND; |
380 } |
378 } |
432 |
430 |
433 canvasComp = super.eswtConstructContent(style); |
431 canvasComp = super.eswtConstructContent(style); |
434 canvasComp.setVisible(false); |
432 canvasComp.setVisible(false); |
435 |
433 |
436 createOnScreenKeypad(); |
434 createOnScreenKeypad(); |
437 |
435 return canvasComp; |
|
436 } |
|
437 |
|
438 void eswtInitGraphics() { |
438 // create graphics buffer |
439 // create graphics buffer |
439 graphicsBuffer = Buffer.createInstance(this, canvasComp); |
440 graphicsBuffer = Buffer.createInstance(this, canvasComp); |
440 |
|
441 return canvasComp; |
|
442 } |
441 } |
443 |
442 |
444 /** |
443 /** |
445 * Creates OSK(OnScreenKeypad), shared Keypad will be created for Canvas, |
444 * Creates OSK(OnScreenKeypad), shared Keypad will be created for Canvas, |
446 * seperate OSK will be created for each GameCanvas. |
445 * seperate OSK will be created for each GameCanvas. |
750 * code. |
749 * code. |
751 */ |
750 */ |
752 public String getKeyName(int keyCode) |
751 public String getKeyName(int keyCode) |
753 { |
752 { |
754 return KeyTable.getKeyName(keyCode); |
753 return KeyTable.getKeyName(keyCode); |
755 } |
|
756 /** |
|
757 * Gets height. |
|
758 * |
|
759 * @return Height of the Displayable in pixels. |
|
760 */ |
|
761 public int getHeight() |
|
762 { |
|
763 ESWTUIThreadRunner.syncExec(new Runnable() |
|
764 { |
|
765 public void run() |
|
766 { |
|
767 if(onScreenkeypad != null) |
|
768 { |
|
769 oskHeight = onScreenkeypad.getHeight(); |
|
770 } |
|
771 } |
|
772 }); |
|
773 return (super.getHeight() - oskHeight); |
|
774 |
|
775 } |
754 } |
776 |
755 |
777 /** |
756 /** |
778 * Callback to be implemented by the application to render the |
757 * Callback to be implemented by the application to render the |
779 * <code>Canvas</code>. The clip region of <code>Graphics</code> object |
758 * <code>Canvas</code>. The clip region of <code>Graphics</code> object |
1561 } |
1540 } |
1562 |
1541 |
1563 class CanvasShellVisibilityListener implements SymbianWindowVisibilityListener |
1542 class CanvasShellVisibilityListener implements SymbianWindowVisibilityListener |
1564 { |
1543 { |
1565 public void handleSymbianWindowVisibilityChange(Widget widget, boolean visible) { |
1544 public void handleSymbianWindowVisibilityChange(Widget widget, boolean visible) { |
1566 if (javax.microedition.lcdui.Canvas.this.getShell() == widget) |
1545 if (javax.microedition.lcdui.Canvas.this.getShell() == widget && graphicsBuffer != null) |
1567 { |
1546 { |
1568 graphicsBuffer.getWindowSurface().handleSymbianWindowVisibilityChange(visible); |
1547 WindowSurface surface = graphicsBuffer.getWindowSurface(); |
|
1548 if (surface != null) |
|
1549 surface.handleSymbianWindowVisibilityChange(visible); |
1569 } |
1550 } |
1570 } |
1551 } |
1571 } |
1552 } |
1572 } |
1553 } |