pivot-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gbr...@apache.org
Subject svn commit: r935916 - /pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraListButtonSkin.java
Date Tue, 20 Apr 2010 13:37:55 GMT
Author: gbrown
Date: Tue Apr 20 13:37:55 2010
New Revision: 935916

URL: http://svn.apache.org/viewvc?rev=935916&view=rev
Log:
Resolve issue PIVOT-458.

Modified:
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraListButtonSkin.java

Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraListButtonSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraListButtonSkin.java?rev=935916&r1=935915&r2=935916&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraListButtonSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraListButtonSkin.java Tue
Apr 20 13:37:55 2010
@@ -43,6 +43,8 @@ import org.apache.pivot.wtk.Point;
 import org.apache.pivot.wtk.Theme;
 import org.apache.pivot.wtk.Window;
 import org.apache.pivot.wtk.WindowStateListener;
+import org.apache.pivot.wtk.Component;
+import org.apache.pivot.wtk.Mouse;
 import org.apache.pivot.wtk.effects.DropShadowDecorator;
 import org.apache.pivot.wtk.effects.Transition;
 import org.apache.pivot.wtk.effects.TransitionListener;
@@ -103,6 +105,7 @@ public class TerraListButtonSkin extends
     private Color borderColor;
     private Color disabledBorderColor;
     private Insets padding;
+    private boolean split;
     private int listSize = -1;
 
     // Derived colors
@@ -113,6 +116,9 @@ public class TerraListButtonSkin extends
     private Transition closeTransition = null;
     private DropShadowDecorator dropShadowDecorator = null;
 
+    private int mouseDownX;
+    private int mouseDownY;
+
     private static final int TRIGGER_WIDTH = 14;
 
     private static final int CLOSE_TRANSITION_DURATION = 250;
@@ -129,6 +135,7 @@ public class TerraListButtonSkin extends
         borderColor = theme.getColor(7);
         disabledBorderColor = theme.getColor(7);
         padding = new Insets(2, 3, 2, 3);
+        split = false;
 
         // Set the derived colors
         bevelColor = TerraTheme.brighten(backgroundColor);
@@ -533,6 +540,14 @@ public class TerraListButtonSkin extends
         setPadding(Insets.decode(padding));
     }
 
+    public boolean isSplit() {
+        return split;
+    }
+
+    public void setSplit(boolean split) {
+        this.split = split;
+    }
+
     public int getListSize() {
         return listSize;
     }
@@ -627,6 +642,15 @@ public class TerraListButtonSkin extends
         listView.getStyles().put("highlightBackgroundColor", listHighlightBackgroundColor);
     }
 
+    // Mouse events
+    @Override
+    public boolean mouseDown(Component component, Mouse.Button button, int x, int y) {
+        boolean consumed = super.mouseDown(component, button, x, y);
+        mouseDownX = x;
+        mouseDownY = y;
+        return consumed;
+    }
+
     // Button events
     @Override
     public void buttonPressed(Button button) {
@@ -644,6 +668,14 @@ public class TerraListButtonSkin extends
                     int width = getWidth();
                     int height = getHeight();
 
+                    if (split) {
+                        Bounds triggerBounds = new Bounds(Math.max(width - TRIGGER_WIDTH
- 1, 0), 0,
+                            TRIGGER_WIDTH + 1, Math.max(height, 0));
+                        if (!triggerBounds.contains(mouseDownX, mouseDownY)) {
+                            return;
+                        }
+                    }
+
                     // Adjust for list size
                     if (listSize == -1) {
                         listViewBorder.setPreferredHeight(-1);



Mime
View raw message