コード例 #1
0
 LRESULT WM_SIZE(int /*long*/ wParam, int /*long*/ lParam) {
   LRESULT result = super.WM_SIZE(wParam, lParam);
   if (result != null) return result;
   /*
    * Feature in Windows.  When a progress bar with the style
    * PBS_MARQUEE becomes too small, the animation (currently
    * a small bar moving from right to left) does not have
    * enough space to draw.  The result is that the progress
    * bar does not appear to be moving.  The fix is to detect
    * this case, clear the PBS_MARQUEE style and emulate the
    * animation using PBM_STEPIT.
    *
    * NOTE:  This only happens on Window XP.
    */
   if ((style & SWT.INDETERMINATE) != 0) {
     if (OS.WIN32_VERSION == OS.VERSION(5, 1) || (OS.COMCTL32_MAJOR >= 6 && !OS.IsAppThemed())) {
       forceResize();
       RECT rect = new RECT();
       OS.GetClientRect(handle, rect);
       int oldBits = OS.GetWindowLong(handle, OS.GWL_STYLE);
       int newBits = oldBits;
       if (rect.right - rect.left < MINIMUM_WIDTH) {
         newBits &= ~OS.PBS_MARQUEE;
       } else {
         newBits |= OS.PBS_MARQUEE;
       }
       if (newBits != oldBits) {
         stopTimer();
         OS.SetWindowLong(handle, OS.GWL_STYLE, newBits);
         startTimer();
       }
     }
   }
   return result;
 }
コード例 #2
0
 void releaseWidget() {
   super.releaseWidget();
   stopTimer();
 }