示例#1
0
void Filesets_OnEndTask_BeginDrag (HWND hDlg, LPTASKPACKET ptp)
{
   LPIDENT lpi = (LPIDENT)(ptp->lpUser);

   if (ptp->rc && TASKDATA(ptp)->fs.Type != ftCLONE)
      {
      HWND hList = GetDlgItem (hDlg, IDC_SET_LIST);
      HLISTITEM hItem = FL_GetSelected (hList);

      // When creating a drag image, we'll temporarily reset the object's
      // images so we can be sure it'll draw just the Fileset icon.
      //
      FastList_Begin (hList);
      int iImage1 = FastList_GetItemFirstImage (hList, hItem);
      int iImage2 = FastList_GetItemSecondImage (hList, hItem);
      FastList_SetItemFirstImage (hList, hItem, imageFILESET);
      FastList_SetItemSecondImage (hList, hItem, IMAGE_NOIMAGE);

      l.lpiDrag = lpi;
      l.lpiTarget = NULL;
      l.fDragging = TRUE;
      l.hDragImage = FastList_CreateDragImage (hList, hItem);

      FastList_SetItemFirstImage (hList, hItem, iImage1);
      FastList_SetItemSecondImage (hList, hItem, iImage2);
      FastList_End (hList);

      // Now we've got a drag image; start dragging.
      //
      ShowCursor (FALSE);
      SetCapture (hDlg);

      DWORD dw = GetMessagePos();
      POINT pt = { LOWORD(dw), HIWORD(dw) };
      ScreenToClient (NULL, &pt);

      ImageList_BeginDrag (l.hDragImage, 0, 8, 8);
      ImageList_DragEnter (NULL, pt.x, pt.y);
      }
}
示例#2
0
void Display_RefreshView (LPVIEWINFO pviNew, ICONVIEW ivNew)
{
   // Find the current VIEWINFO and ICONVIEW settings
   //
   HWND hDlg = GetTabChild (GetDlgItem (g.hMain, IDC_TAB));

   HWND hList;
   LPVIEWINFO pviOld;
   ICONVIEW *pivOld;
   switch (Display_GetActiveTab())
      {
      case ttUSERS:
         pivOld = &gr.ivUsr;
         pviOld = &gr.viewUsr;
         hList = GetDlgItem (hDlg, IDC_USERS_LIST);
         break;

      case ttGROUPS:
         pivOld = &gr.ivGrp;
         pviOld = &gr.viewGrp;
         hList = GetDlgItem (hDlg, IDC_GROUPS_LIST);
         break;

      case ttMACHINES:
         pivOld = &gr.ivMch;
         pviOld = &gr.viewMch;
         hList = GetDlgItem (hDlg, IDC_MACHINES_LIST);
         break;
      }

   if (IsWindow(hList))
      {
      FastList_Begin (hList);

      // If the VIEWINFO state has changed, fix it. This will change between
      // large icons, small icons and details, as well as correct the currently-
      // displayed columns to match what's in the new VIEWINFO structure.
      //
      BOOL fChangedLayouts = FALSE;

      if (memcmp (pviOld, pviNew, sizeof(VIEWINFO)))
         {
         FL_RestoreView (hList, pviNew);
         fChangedLayouts = ((pviOld->lvsView & FLS_VIEW_MASK) != (pviNew->lvsView & FLS_VIEW_MASK)) ? TRUE : FALSE;
         memcpy (pviOld, pviNew, sizeof(VIEWINFO));
         }

      // If the ICONVIEW state has changed, fix all items to show just
      // the appropriate icons. We'll also have to do this if we just changed
      // from details/small/large icons to another layout (that's what
      // fChangedLayouts indicates)
      //
      if ((*pivOld != ivNew) || (fChangedLayouts))
         {
         DWORD dwStyle = GetWindowLong (hList, GWL_STYLE);

         HLISTITEM hItem = NULL;
         while ((hItem = FastList_FindNext (hList, hItem)) != NULL)
            {
            ASID idObject = (ASID)FastList_GetItemParam (hList, hItem);

            int iFirstImage;
            int iSecondImage;
            if (pviOld == &gr.viewUsr)
               Display_GetImageIcons (dwStyle, ivNew, idObject, imageUSER, IMAGE_NOIMAGE, &iFirstImage, &iSecondImage);
            else if (pviOld == &gr.viewGrp)
               Display_GetImageIcons (dwStyle, ivNew, idObject, imageGROUP, IMAGE_NOIMAGE, &iFirstImage, &iSecondImage);
            else
               Display_GetImageIcons (dwStyle, ivNew, idObject, imageSERVER, IMAGE_NOIMAGE, &iFirstImage, &iSecondImage);

            FastList_SetItemFirstImage (hList, hItem, iFirstImage);
            FastList_SetItemSecondImage (hList, hItem, iSecondImage);
            }

         *pivOld = ivNew;
         }

      FastList_End (hList);
      }
}