javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/widgets/Control.java
changeset 80 d6dafc5d983f
parent 78 71ad690e91f5
equal deleted inserted replaced
78:71ad690e91f5 80:d6dafc5d983f
   129         boolean isExtended) {
   129         boolean isExtended) {
   130     super(parent, style, extraStyle, packageProxy, isExtended);
   130     super(parent, style, extraStyle, packageProxy, isExtended);
   131     this.parent = parent;
   131     this.parent = parent;
   132     this.extraStyle = extraStyle;
   132     this.extraStyle = extraStyle;
   133     createWidget(0);
   133     createWidget(0);
   134     OS.QWidget_setParent(topHandle, parent.handle);
   134     
       
   135     // Children of Table are attached into the table itself, not the viewport.
       
   136     int containerHandle = parent.packageProxy != null ? 
       
   137         parent.packageProxy.handleWithChildren() : parent.handleWithChildren_pp();
       
   138     OS.QWidget_setParent(topHandle, containerHandle);
       
   139     
   135     OS.QWidget_resize(topHandle, 0, 0);
   140     OS.QWidget_resize(topHandle, 0, 0);
   136     if(isParentMirrored()) {
   141     if(isParentMirrored()) {
   137         Point size = OS.QWidget_size(topHandle);
   142         Point size = OS.QWidget_size(topHandle);
   138         OS.QWidget_move(topHandle, parent.getClientWidth() - size.x, 0);
   143         OS.QWidget_move(topHandle, parent.getClientWidth() - size.x, 0);
   139     }
   144     }
   144         this.parent.addControl_pp(this);
   149         this.parent.addControl_pp(this);
   145     }
   150     }
   146 }
   151 }
   147 
   152 
   148 void addCommand(final Command command) {
   153 void addCommand(final Command command) {
   149     if (command.control != this)
   154     // Impossible for Command.control to be anything else than 'this'
   150         return;
   155     // since addCommand is called from Command's register() only.
   151     if (commandList == null) {
   156     if (commandList == null) {
   152         commandList = new Command[1];
   157         commandList = new Command[1];
   153         commandList[0] = command;
   158         commandList[0] = command;
   154         return;
   159         return;
   155     }
   160     }
  2215     background = null;
  2220     background = null;
  2216     foreground = null;
  2221     foreground = null;
  2217 }
  2222 }
  2218 
  2223 
  2219 void removeCommand(final Command command) {
  2224 void removeCommand(final Command command) {
  2220     if (command.control != this)
  2225     // Impossible for Command.control to be anything else than 'this'
  2221         return;
  2226     // since removeCommand is called from Command's releaseParent() only.
  2222     if (commandList == null || commandList.length == 0)
  2227     if (commandList == null || commandList.length == 0)
  2223         return;
  2228         return;
  2224     if (commandList.length == 1 && command == commandList[0]) {
  2229     if (commandList.length == 1 && command == commandList[0]) {
  2225         commandList = null;
  2230         commandList = null;
  2226         return;
  2231         return;
  2996             if ((findBackgroundControl () != this) && canInheritBackgroundImage()) {
  3001             if ((findBackgroundControl () != this) && canInheritBackgroundImage()) {
  2997                 // If background is inherited then brush is set to null
  3002                 // If background is inherited then brush is set to null
  2998                 OS.QPalette_swt_setBrush(paletteHandle, bkRoles[j], 0);
  3003                 OS.QPalette_swt_setBrush(paletteHandle, bkRoles[j], 0);
  2999                 backgroundImageInherited(image);
  3004                 backgroundImageInherited(image);
  3000             } else {
  3005             } else {
  3001                 OS.QPalette_swt_setBrush(paletteHandle, bkRoles[j], Internal_GfxPackageSupport.getPixmapHandle(image));
  3006                 OS.QPalette_swt_setBrush(paletteHandle, bkRoles[j], Internal_GfxPackageSupport.getImageHandle(image));
  3002                 if(packageProxy != null) {
  3007                 if(packageProxy != null) {
  3003                     packageProxy.backgroundImageApplied(image);
  3008                     packageProxy.backgroundImageApplied(image);
  3004                 } else {
  3009                 } else {
  3005                     backgroundImageApplied_pp(image);
  3010                     backgroundImageApplied_pp(image);
  3006                 }
  3011                 }