experimental 24-bit image protocol
[nikiroo-utils.git] / src / jexer / TComboBox.java
index fe2fdacf7a794e5620fad37fabeeec49097196c9..b64dbde058ad006d4a5d80fd83e9ddd4303e8ba2 100644 (file)
@@ -114,12 +114,12 @@ public class TComboBox extends TWidget {
                     field.setText(list.getSelected());
                     list.setEnabled(false);
                     list.setVisible(false);
-                    TComboBox.this.setHeight(1);
+                    TComboBox.super.setHeight(1);
                     if (TComboBox.this.limitToListValue == false) {
                         TComboBox.this.activate(field);
                     }
                     if (updateAction != null) {
-                        updateAction.DO();
+                        updateAction.DO(TComboBox.this);
                     }
                 }
             }
@@ -130,7 +130,7 @@ public class TComboBox extends TWidget {
 
         list.setEnabled(false);
         list.setVisible(false);
-        setHeight(1);
+        super.setHeight(1);
         if (limitToListValue) {
             field.setEnabled(false);
         } else {
@@ -215,6 +215,33 @@ public class TComboBox extends TWidget {
     // TWidget ----------------------------------------------------------------
     // ------------------------------------------------------------------------
 
+    /**
+     * Override TWidget's width: we need to set child widget widths.
+     *
+     * @param width new widget width
+     */
+    @Override
+    public void setWidth(final int width) {
+        if (field != null) {
+            field.setWidth(width - 3);
+        }
+        if (list != null) {
+            list.setWidth(width);
+        }
+        super.setWidth(width);
+    }
+
+    /**
+     * Override TWidget's height: we can only set height at construction
+     * time.
+     *
+     * @param height new widget height (ignored)
+     */
+    @Override
+    public void setHeight(final int height) {
+        // Do nothing
+    }
+
     /**
      * Draw the combobox down arrow.
      */
@@ -253,7 +280,7 @@ public class TComboBox extends TWidget {
     public void hideList() {
         list.setEnabled(false);
         list.setVisible(false);
-        setHeight(1);
+        super.setHeight(1);
         if (limitToListValue == false) {
             activate(field);
         }
@@ -265,7 +292,7 @@ public class TComboBox extends TWidget {
     public void showList() {
         list.setEnabled(true);
         list.setVisible(true);
-        setHeight(list.getHeight() + 1);
+        super.setHeight(list.getHeight() + 1);
         activate(list);
     }