javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/widgets/Shell.java
changeset 48 e0d6e9bd3ca7
parent 47 f40128debb5d
child 79 2f468c1958d0
equal deleted inserted replaced
47:f40128debb5d 48:e0d6e9bd3ca7
    10  *     IBM Corporation - initial API and implementation
    10  *     IBM Corporation - initial API and implementation
    11  *     Nokia Corporation - Qt implementation
    11  *     Nokia Corporation - Qt implementation
    12  *******************************************************************************/
    12  *******************************************************************************/
    13 package org.eclipse.swt.widgets;
    13 package org.eclipse.swt.widgets;
    14 
    14 
       
    15 import java.util.Vector;
       
    16 
    15 import org.eclipse.swt.SWT;
    17 import org.eclipse.swt.SWT;
    16 import org.eclipse.swt.events.ShellListener;
    18 import org.eclipse.swt.events.ShellListener;
    17 import org.eclipse.swt.graphics.Point;
    19 import org.eclipse.swt.graphics.Point;
    18 import org.eclipse.swt.graphics.Rectangle;
    20 import org.eclipse.swt.graphics.Rectangle;
    19 import org.eclipse.swt.internal.qt.OS;
    21 import org.eclipse.swt.internal.qt.OS;
       
    22 import org.eclipse.swt.internal.qt.SymbianWindowVisibilityListener;
    20 import org.eclipse.swt.internal.qt.WidgetState;
    23 import org.eclipse.swt.internal.qt.WidgetState;
    21 import org.eclipse.swt.internal.qt.graphics.WindowSurface;
    24 import org.eclipse.swt.internal.qt.graphics.WindowSurface;
    22 
    25 
    23 /**
    26 /**
    24  * Instances of this class represent the "windows"
    27  * Instances of this class represent the "windows"
   146  * handler, which would cause an infinite loop. To prevent this suppress resize
   149  * handler, which would cause an infinite loop. To prevent this suppress resize
   147  * events when Shell visibility is being changed.
   150  * events when Shell visibility is being changed.
   148  */
   151  */
   149 boolean suppressResizeEvent;
   152 boolean suppressResizeEvent;
   150 
   153 
       
   154 private Vector winVisibilityListeners = new Vector();
       
   155 
   151 /**
   156 /**
   152  * Constructs a new instance of this class. This is equivalent
   157  * Constructs a new instance of this class. This is equivalent
   153  * to calling <code>Shell((Display) null)</code>.
   158  * to calling <code>Shell((Display) null)</code>.
   154  *
   159  *
   155  * @exception SWTException <ul>
   160  * @exception SWTException <ul>
  1146     super.qt_event_keyrelease_pp(widgetHandle, key, modifier, character, nativeScanCode);
  1151     super.qt_event_keyrelease_pp(widgetHandle, key, modifier, character, nativeScanCode);
  1147     // Key event is canceled to prevent propagation from viewport to its parent
  1152     // Key event is canceled to prevent propagation from viewport to its parent
  1148     return true;
  1153     return true;
  1149 }
  1154 }
  1150 
  1155 
       
  1156 void qt_swt_event_symbianWindowHide() {
       
  1157     notifySymbianWindowVisibilityChange(false);
       
  1158 }
       
  1159 
       
  1160 void qt_swt_event_symbianWindowShow() {
       
  1161     notifySymbianWindowVisibilityChange(true);
       
  1162 }
       
  1163 
  1151 public Rectangle internal_getDefaultBounds() {
  1164 public Rectangle internal_getDefaultBounds() {
  1152     return defBounds;
  1165     return defBounds;
  1153 }
  1166 }
  1154 
  1167 
  1155 void qt_swt_event_widgetResized_pp(int widgetHandle, int oldWidth, int oldHeight, int width, int height, boolean sendResizeEvent) {
  1168 void qt_swt_event_widgetResized_pp(int widgetHandle, int oldWidth, int oldHeight, int width, int height, boolean sendResizeEvent) {
  1166 		windowSurface = new WindowSurface(this, true);
  1179 		windowSurface = new WindowSurface(this, true);
  1167 	}
  1180 	}
  1168 	return windowSurface;
  1181 	return windowSurface;
  1169 }
  1182 }
  1170 
  1183 
  1171 }
  1184 void addSymbianWindowVisibilityListener_pp(SymbianWindowVisibilityListener listener) {
       
  1185     if (!winVisibilityListeners.contains(listener))
       
  1186         winVisibilityListeners.addElement(listener);
       
  1187 }
       
  1188 
       
  1189 void removeSymbianWindowVisibilityListener_pp(SymbianWindowVisibilityListener listener) {
       
  1190     if (winVisibilityListeners.contains(listener))
       
  1191         winVisibilityListeners.removeElement(listener);
       
  1192 }
       
  1193 
       
  1194 void notifySymbianWindowVisibilityChange(boolean visible) {
       
  1195     int count = winVisibilityListeners.size();
       
  1196     for (int i = 0; i < count; i++) {
       
  1197         SymbianWindowVisibilityListener listener = (SymbianWindowVisibilityListener)(winVisibilityListeners.elementAt(i));
       
  1198         listener.handleSymbianWindowVisibilityChange(this, visible);
       
  1199     }
       
  1200 }
       
  1201 }