src/java.desktop/unix/classes/sun/awt/X11/XChoicePeer.java

Print this page




  33 // FIXME: tab traversal should be disabled when mouse is captured (4816336)
  34 
  35 // FIXME: key and mouse events should not be delivered to listeners when the Choice is unfurled.  Must override handleNativeKey/MouseEvent (4816336)
  36 
  37 // FIXME: test programmatic add/remove/clear/etc
  38 
  39 // FIXME: account for unfurling at the edge of the screen
  40 // Note: can't set x,y on layout(), 'cause moving the top-level to the
  41 // edge of the screen won't call layout().  Just do it on paint, I guess
  42 
  43 // TODO: make painting more efficient (i.e. when down arrow is pressed, only two items should need to be repainted.
  44 
  45 public class XChoicePeer extends XComponentPeer implements ChoicePeer, ToplevelStateListener {
  46     private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XChoicePeer");
  47 
  48     private static final int MAX_UNFURLED_ITEMS = 10;  // Maximum number of
  49     // items to be displayed
  50     // at a time in an
  51     // unfurled Choice
  52     // Description of these constants in ListHelper
  53     public final static int TEXT_SPACE = 1;
  54     public final static int BORDER_WIDTH = 1;
  55     public final static int ITEM_MARGIN = 1;
  56     public final static int SCROLLBAR_WIDTH = 15;
  57 
  58 
  59     // SHARE THESE!
  60     private static final Insets focusInsets = new Insets(0,0,0,0);
  61 
  62 
  63     static final int WIDGET_OFFSET = 18;
  64 
  65     // Stolen from Tiny
  66     static final int            TEXT_XPAD = 8;
  67     static final int            TEXT_YPAD = 6;
  68 
  69     // FIXME: Motif uses a different focus color for the item within
  70     // the unfurled Choice list and for when the Choice itself is focused and
  71     // popped up.
  72     static final Color focusColor = Color.black;
  73 
  74     // TODO: there is a time value that the mouse is held down.  If short
  75     // enough,  the Choice stays popped down.  If long enough, Choice
  76     // is furled when the mouse is released




  33 // FIXME: tab traversal should be disabled when mouse is captured (4816336)
  34 
  35 // FIXME: key and mouse events should not be delivered to listeners when the Choice is unfurled.  Must override handleNativeKey/MouseEvent (4816336)
  36 
  37 // FIXME: test programmatic add/remove/clear/etc
  38 
  39 // FIXME: account for unfurling at the edge of the screen
  40 // Note: can't set x,y on layout(), 'cause moving the top-level to the
  41 // edge of the screen won't call layout().  Just do it on paint, I guess
  42 
  43 // TODO: make painting more efficient (i.e. when down arrow is pressed, only two items should need to be repainted.
  44 
  45 public class XChoicePeer extends XComponentPeer implements ChoicePeer, ToplevelStateListener {
  46     private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XChoicePeer");
  47 
  48     private static final int MAX_UNFURLED_ITEMS = 10;  // Maximum number of
  49     // items to be displayed
  50     // at a time in an
  51     // unfurled Choice
  52     // Description of these constants in ListHelper
  53     public static final int TEXT_SPACE = 1;
  54     public static final int BORDER_WIDTH = 1;
  55     public static final int ITEM_MARGIN = 1;
  56     public static final int SCROLLBAR_WIDTH = 15;
  57 
  58 
  59     // SHARE THESE!
  60     private static final Insets focusInsets = new Insets(0,0,0,0);
  61 
  62 
  63     static final int WIDGET_OFFSET = 18;
  64 
  65     // Stolen from Tiny
  66     static final int            TEXT_XPAD = 8;
  67     static final int            TEXT_YPAD = 6;
  68 
  69     // FIXME: Motif uses a different focus color for the item within
  70     // the unfurled Choice list and for when the Choice itself is focused and
  71     // popped up.
  72     static final Color focusColor = Color.black;
  73 
  74     // TODO: there is a time value that the mouse is held down.  If short
  75     // enough,  the Choice stays popped down.  If long enough, Choice
  76     // is furled when the mouse is released