javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/widgets/Widget.java
changeset 50 023eef975703
parent 49 35baca0e7a2e
equal deleted inserted replaced
49:35baca0e7a2e 50:023eef975703
    48  * </p>
    48  * </p>
    49  *
    49  *
    50  * @see #checkSubclass
    50  * @see #checkSubclass
    51  */
    51  */
    52 public abstract class Widget {
    52 public abstract class Widget {
       
    53     // The handles of the child-most and the root-most QObject within the
       
    54     // Widget, respectively. For Controls these are QWidgets but for some 
       
    55     // Widgets only QObjects (e.g. QActions for MenuItems). Both can be 
       
    56     // assigned the same QObject. If the handles are nonzero and not equal then
       
    57     // handle is always (directly or indirectly) a QObject child of topHandle. 
    53     int handle, topHandle;
    58     int handle, topHandle;
    54 
    59 
    55     int style, state;
    60     int style, state;
    56     Display display;
    61     Display display;
    57     EventTable eventTable;
    62     EventTable eventTable;
   310     if(packageProxy != null) {
   315     if(packageProxy != null) {
   311         packageProxy.createHandle(index);
   316         packageProxy.createHandle(index);
   312     } else {
   317     } else {
   313         createHandle_pp (index);
   318         createHandle_pp (index);
   314     }
   319     }
       
   320     if(Display.objectNames) {
       
   321         if(handle != 0) {
       
   322             OS.QObject_setObjectName(handle, this.getClass().getName() + " Widget.handle");
       
   323         }
       
   324         if(topHandle != 0 && topHandle != handle) {
       
   325             OS.QObject_setObjectName(topHandle, this.getClass().getName() + " Widget.topHandle");
       
   326         }
       
   327     }
   315     // If subclasses didn't specify topHandle then it's assumed that there's
   328     // If subclasses didn't specify topHandle then it's assumed that there's
   316     // only one QWidget. I.e. handle is the root widget.
   329     // only one QWidget. I.e. handle is the root widget.
   317     if(topHandle == 0) topHandle = handle;
   330     if(topHandle == 0) topHandle = handle;
   318     if(packageProxy != null) {
   331     if(packageProxy != null) {
   319         packageProxy.hookEvents();
   332         packageProxy.hookEvents();
   323     if(packageProxy != null) {
   336     if(packageProxy != null) {
   324         packageProxy.register();
   337         packageProxy.register();
   325     } else {
   338     } else {
   326         register_pp();
   339         register_pp();
   327     }
   340     }
       
   341     fixMousePropagation();
   328 }
   342 }
   329 
   343 
   330 void deregister_pp () {
   344 void deregister_pp () {
   331     if (handle != 0) Display.removeWidget (handle);
   345     if (handle != 0) Display.removeWidget (handle);
   332 }
   346 }
   376     SWT.error (code);
   390     SWT.error (code);
   377 }
   391 }
   378 
   392 
   379 final boolean filters (int eventType) {
   393 final boolean filters (int eventType) {
   380     return Display.filters (eventType);
   394     return Display.filters (eventType);
       
   395 }
       
   396 
       
   397 void fixMousePropagation() {
   381 }
   398 }
   382 
   399 
   383 static final Command[] getCommands(Control control) {
   400 static final Command[] getCommands(Control control) {
   384     return control.getCommands();
   401     return control.getCommands();
   385 }
   402 }
   507  * </ul>
   524  * </ul>
   508  */
   525  */
   509 public int getStyle () {
   526 public int getStyle () {
   510     checkWidget ();
   527     checkWidget ();
   511     return style;
   528     return style;
   512 }
       
   513 
       
   514 // Experimental support for StyleSheets
       
   515 public String getStyleSheet(){
       
   516     checkWidget();
       
   517     return OS.QWidget_styleSheet(handle);
       
   518 }
   529 }
   519 
   530 
   520 void hookEvents_pp () {
   531 void hookEvents_pp () {
   521 }
   532 }
   522 
   533 
  1181         }
  1192         }
  1182         return;
  1193         return;
  1183     }
  1194     }
  1184 
  1195 
  1185     if(key.equals(WidgetConstant.CSS_ID)){
  1196     if(key.equals(WidgetConstant.CSS_ID)){
  1186     	OS.QObject_setObjectName(topHandle,(String)value);
  1197         OS.QObject_setObjectName(topHandle,(String)value);
  1187     	// Do not return here and let Widget store the key
  1198         // Do not return here and let Widget store the key
  1188     	// value.
  1199         // value.
  1189     }
  1200     }
  1190 
  1201 
  1191     int index = 1;
  1202     int index = 1;
  1192     Object [] table = null;
  1203     Object [] table = null;
  1193     if ((state & WidgetState.KEYED_DATA) != 0) {
  1204     if ((state & WidgetState.KEYED_DATA) != 0) {