示例#1
0
文件: action.cpp 项目: bagdxk/openafs
void Actions_Refresh (void)
{
   size_t nItems = 0;
   TCHAR szText[ cchRESOURCE ];

   HWND hList;
   if ((hList = GetDlgItem (l.hAction, IDC_ACTION_LIST)) != NULL)
      {
      LPARAM lpOld = FL_StartChange (hList, TRUE);

      if (l.pActionList)
         {
         for (size_t ii = 0; ii < l.pActionList->cEntries; ++ii)
            {
            LPTSTR pszDesc;
            if ((pszDesc = GetActionDescription (&l.pActionList->aEntries[ ii ].Action)) != NULL)
               {
               SYSTEMTIME st;
               TicksToElapsedTime (&st, GetTickCount() - l.pActionList->aEntries[ ii ].Action.csecActive);
               FormatElapsed (szText, TEXT("%s"), &st);

               FASTLISTADDITEM flai;
               memset (&flai, 0x00, sizeof(flai));
               flai.hParent = NULL;
               flai.iFirstImage = IMAGE_NOIMAGE;
               flai.iSecondImage = IMAGE_NOIMAGE;
               flai.pszText = pszDesc;
               flai.lParam = (LPARAM)ii;
               flai.dwFlags = FLIF_DISALLOW_SELECT;

               HLISTITEM hItem;
               if ((hItem = FastList_AddItem (hList, &flai)) != NULL)
                  FastList_SetItemText (hList, hItem, 1, szText);

               ++nItems;

               FreeString (pszDesc);
               }
            }
         }

      FL_EndChange (hList, lpOld);
      }

   if (nItems == 0)
      GetString (szText, IDS_ACTION_DESC_NONE);
   else if (nItems == 1)
      GetString (szText, IDS_ACTION_DESC_ONE);
   else // (nItems >= 2)
      GetString (szText, IDS_ACTION_DESC_MULT);
   SetDlgItemText (l.hAction, IDC_ACTION_DESC, szText);
}
void ItemState::PrintStates()
{
    std::cout << GetActionDescription(curAct) << std::endl;
}