Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [albireo-dev] SWT size/layout management

Gordon Hirsch wrote:
> Regarding the name... I didn't change it, but I agree that it could be 
> confusing. It's really about the *preferred* values changing, so maybe 
> it should be "sizePreferencesChanged()"?

Yes, it's about the preferred sizes. I renamed it to preferredSizeChanged
(sounds less abstract than 'sizePreferencesChanged').

Bruno


Index: src/org/eclipse/albireo/core/SwingControl.java
===================================================================
RCS file: /cvsroot/technology/org.eclipse.albireo/org.eclipse.albireo.core/src/org/eclipse/albireo/core/SwingControl.java,v
retrieving revision 1.24
diff -c -3 -r1.24 SwingControl.java
*** src/org/eclipse/albireo/core/SwingControl.java	11 Feb 2008 22:46:31 -0000	1.24
--- src/org/eclipse/albireo/core/SwingControl.java	12 Feb 2008 13:55:46 -0000
***************
*** 389,399 ****
                      // System.out.println("Laying out after size update");
                      if (!isDisposed()) {
                          try {
                              Point minPoint = new Point(min.width, min.height);
                              Point prefPoint = new Point(pref.width, pref.height);
                              Point maxPoint = new Point(max.width, max.height);
!                             inhibitSizePropagationToAWT = true;
!                             controlResized(minPoint, prefPoint, maxPoint);
                          } finally {
                              inhibitSizePropagationToAWT = false;
                          }
--- 389,399 ----
                      // System.out.println("Laying out after size update");
                      if (!isDisposed()) {
                          try {
+                             inhibitSizePropagationToAWT = true;
                              Point minPoint = new Point(min.width, min.height);
                              Point prefPoint = new Point(pref.width, pref.height);
                              Point maxPoint = new Point(max.width, max.height);
!                             preferredSizeChanged(minPoint, prefPoint, maxPoint);
                          } finally {
                              inhibitSizePropagationToAWT = false;
                          }
***************
*** 505,519 ****
      }
  
      /**
!      * Called when the size of this control changed.
       * <p>
       * This method is part of the size propagation from AWT to SWT.
       * It is called on the SWT event thread.
!      * @param minPoint the minimum size for the control, as reported by AWT 
!      * @param prefPoint  the preferred size for the control, as reported by AWT 
!      * @param maxPoint  the maximum size for the control, as reported by AWT
       */
!     public abstract void controlResized(Point minPoint, Point prefPoint, Point maxPoint);
  
      // This is called by the layout when it assigns a size and position to this
      // Control.
--- 505,532 ----
      }
  
      /**
!      * Called when the preferred sizes of this control, as computed by
!      * {@link #computeSize(int, int, boolean)}, have changed. This method
!      * should change the size of this SWT control and of other SWT controls
!      * in the window (as appropriate).
       * <p>
       * This method is part of the size propagation from AWT to SWT.
       * It is called on the SWT event thread.
!      * <p>
!      * You should implement this method, usually by calling
!      * <code>layout()</code> on the uppermost parent of this control that
!      * is influenced by size changes of this control. Usually this is done
!      * through a call <code>getParent().layout()</code>, or
!      * <code>getParent().getParent().layout()</code>, or similar.
!      * <p>
!      * The parameters <var>minPoint</var>, <var>prefPoint</var>,
!      * <var>maxPoint</var> can usually be ignored: It is enough to rely on the
!      * {@link #computeSize(int, int, boolean)} method.
!      * @param minPoint the minimum size for this control, as reported by AWT 
!      * @param prefPoint the preferred size for this control, as reported by AWT 
!      * @param maxPoint the maximum size for this control, as reported by AWT
       */
!     public abstract void preferredSizeChanged(Point minPoint, Point prefPoint, Point maxPoint);
  
      // This is called by the layout when it assigns a size and position to this
      // Control.


Back to the top