javauis/lcdui_qt/src/javax/microedition/lcdui/ScrolledTextComposite.java
changeset 79 2f468c1958d0
parent 23 98ccebc37403
equal deleted inserted replaced
76:4ad59aaee882 79:2f468c1958d0
    89 
    89 
    90     private Point calculateTextSize()
    90     private Point calculateTextSize()
    91     {
    91     {
    92         iTextScrolling = false;
    92         iTextScrolling = false;
    93         vBar.setVisible(false);
    93         vBar.setVisible(false);
    94         Point nextSize = iESWTTextLabel.computeSize(getClientArea().width,
    94         Point nextSize = iESWTTextLabel.computeSize(getParent().getClientArea().width,
    95                          SWT.DEFAULT);
    95                          SWT.DEFAULT);
    96         if(nextSize.y > getClientArea().height)
    96         if(nextSize.y > getParent().getClientArea().height)
    97         {
    97         {
    98             iTextScrolling = true;
    98             iTextScrolling = true;
    99             vBar.setVisible(true);
    99             vBar.setVisible(true);
   100             nextSize = iESWTTextLabel.computeSize(getClientArea().width,
   100             nextSize = iESWTTextLabel.computeSize(getClientArea().width,
   101                                                   SWT.DEFAULT);
   101                                                   SWT.DEFAULT);
   120     public void layout(boolean changed)
   120     public void layout(boolean changed)
   121     {
   121     {
   122         iESWTTextLabel.setSize(calculateTextSize());
   122         iESWTTextLabel.setSize(calculateTextSize());
   123 
   123 
   124         Rectangle contentRect = iESWTTextLabel.getBounds();
   124         Rectangle contentRect = iESWTTextLabel.getBounds();
   125         Rectangle hostRect = getClientArea();
   125         Rectangle hostRect = getParent().getClientArea();
   126         vBar.setMaximum(contentRect.height);
   126         vBar.setMaximum(contentRect.height);
   127         vBar.setThumb(Math.min(contentRect.height, hostRect.height));
   127         vBar.setThumb(Math.min(contentRect.height, hostRect.height));
   128         int vPage = contentRect.height - hostRect.height;
   128         int vPage = contentRect.height - hostRect.height;
   129         int vSelection = vBar.getSelection();
   129         int vSelection = vBar.getSelection();
   130         if(vSelection >= vPage)
   130         if(vSelection >= vPage)
   171         if(!resizing)
   171         if(!resizing)
   172         {
   172         {
   173             resizing = true;
   173             resizing = true;
   174             layout();
   174             layout();
   175             resizing = false;
   175             resizing = false;
       
   176             if((Display.getDisplay().getCurrent() instanceof Alert) &&
       
   177                  (isTextScrolling() == true))
       
   178             {
       
   179                 Display.getDisplay().getCurrent().setCommandsVisibility(true);
       
   180             }
   176         }
   181         }
   177     }
   182     }
   178 
   183 
   179     private void vScroll()
   184     private void vScroll()
   180     {
   185     {