Permalink
Browse files

Merge pull request #10 from kutu/master

Несколько обновлений
  • Loading branch information...
2 parents ae7fb50 + 4ca43cf commit f4079cd9f00fd37e657bfc9526f5b81c17ddccb5 @develar committed Oct 4, 2012
View
@@ -6,3 +6,8 @@ Thumbs.db
target
+.settings
+.actionScriptProperties
+.flexLibProperties
+.project
+*.swc
@@ -441,7 +441,7 @@ public final class CC {
* will take precedence. Push is normally used when the grid has not been defined in the layout.
* <p>
* If multiple components in a column has push weights set the largest one will be used for the column.
- * @return The current push value. Default is <code>null</code>.
+ * @return The current push value. Default is <code>NaN</code>.
*/
public function get pushX():Number {
return _pushX;
@@ -452,7 +452,7 @@ public final class CC {
* will take precedence. Push is normally used when the grid has not been defined in the layout.
* <p>
* If multiple components in a column has push weights set the largest one will be used for the column.
- * @param weight The new push value. Default is <code>null</code>.
+ * @param weight The new push value. Default is <code>NaN</code>.
*/
public function set pushX(weight:Number):void {
_pushX = weight;
@@ -463,7 +463,7 @@ public final class CC {
* will take precedence. Push is normally used when the grid has not been defined in the layout.
* <p>
* If multiple components in a row has push weights set the largest one will be used for the row.
- * @return The current push value. Default is <code>null</code>.
+ * @return The current push value. Default is <code>NaN</code>.
*/
public function get pushY():Number {
return _pushY;
@@ -474,7 +474,7 @@ public final class CC {
* will take precedence. Push is normally used when the grid has not been defined in the layout.
* <p>
* If multiple components in a row has push weights set the largest one will be used for the row.
- * @param value The new push value. Default is <code>null</code>.
+ * @param value The new push value. Default is <code>NaN</code>.
*/
public function set pushY(value:Number):void {
_pushY = value;
@@ -2,6 +2,14 @@ package net.miginfocom.layout {
/** A class that wraps the important parts of a Component.
*/
public interface ComponentWrapper {
+ /** Returns the actual object that this wrapper is aggregating. This might be needed for getting
+ * information about the object that the wrapper interface does not provide.
+ * <p>
+ * If this is a container the container should be returned instead.
+ * @return The actual object that this wrapper is aggregating. Not <code>null</code>.
+ */
+ function get component():Object;
+
/** Returns the current x coordinate for this component.
* @return The current x coordinate for this component.
*/
@@ -271,8 +271,8 @@ public final class Grid {
continue; // To work with situations where there are components that does not have a layout manager, or not this one.
}
- hasPushX ||= (visible || hideMode > 1) && cc.pushX == cc.pushX;
- hasPushY ||= (visible || hideMode > 1) && cc.pushY == cc.pushY;
+ hasPushX ||= (visible || hideMode > 1) && !isNaN(cc.pushX);
+ hasPushY ||= (visible || hideMode > 1) && !isNaN(cc.pushY);
if (cc != rootCc) { // If not first in a cell
if (cc.newline || !cc.boundsInGrid || cc.dockSide != -1) {
@@ -14,7 +14,11 @@ public class FlashComponentWrapper implements ComponentWrapper {
this.c = c;
_constraints = constraints;
}
-
+
+ public function get component():Object {
+ return c;
+ }
+
private var _constraints:CC;
public function get constraints():CC {
return _constraints;
@@ -3,13 +3,15 @@ import flash.display.DisplayObjectContainer;
import net.miginfocom.layout.AbstractMigLayout;
import net.miginfocom.layout.Grid;
+import net.miginfocom.layout.LayoutCallback;
import net.miginfocom.layout.LayoutUtil;
import net.miginfocom.layout.PlatformDefaults;
public class MigLayout extends AbstractMigLayout {
private var lastHash:int = -1;
private var lastInvalidW:Number;
private var lastInvalidH:Number;
+ private var callbackList:Vector.<LayoutCallback>;
public function MigLayout(layoutConstraints:String = null, colConstraints:String = null, rowConstraints:String = null) {
super(layoutConstraints, colConstraints, rowConstraints);
@@ -39,6 +41,12 @@ public class MigLayout extends AbstractMigLayout {
grid.layout(0, 0, w, h, lc != null && lc.debugMillis > 0, false);
}
}
+
+ public function addLayoutCallback(cb:LayoutCallback):void {
+ if (!cb) return;
+ if (!callbackList) callbackList = new Vector.<LayoutCallback>();
+ callbackList.push(cb);
+ }
/** Check if something has changed and if so recreate it to the cached objects.
* @param container The container that is the target for this layout manager.
@@ -82,7 +90,7 @@ public class MigLayout extends AbstractMigLayout {
//setDebug(par, getDebugMillis() > 0);
if (grid == null) {
- grid = new Grid(container, lc, rowSpecs, colSpecs, null);
+ grid = new Grid(container, lc, rowSpecs, colSpecs, callbackList);
}
flags &= ~INVALID;
@@ -28,6 +28,10 @@ internal class FlexComponentWrapper implements ComponentWrapper {
flags = 0;
}
}
+
+ public function get component():Object {
+ return c;
+ }
public function get x():Number {
return c.getLayoutBoundsX();

0 comments on commit f4079cd

Please sign in to comment.