コード例 #1
0
ファイル: flplugin.cpp プロジェクト: landswellsong/FAR
void FileList::PluginGetPanelInfo(PanelInfo &Info)
{
	CorrectPosition();
	Info.CurrentItem=CurFile;
	Info.TopPanelItem=CurTopFile;
	if(ShowShortNames) Info.Flags|=PFLAGS_ALTERNATIVENAMES;
	Info.ItemsNumber=FileCount;
	Info.SelectedItemsNumber=ListData?GetSelCount():0;
}
コード例 #2
0
ファイル: ListBoxCtrl.cpp プロジェクト: jjayne/nSIGHTS
void CListBoxCtrl::OnSelchange()
{
    if (multiSelection)
        {
            int numSel = GetSelCount();
            m_intValArray.AllocAndSetSize(numSel);
            GetSelItems(numSel, m_intValArray.tListData);
        }
    else
        (*m_pintVal) = GetCurSel();

    DoCallbacks();
}
コード例 #3
0
/******************************************************************************
 Function Name  :   OnRButtonDown

 Description    :   The framework calls this member function when the user
                    right clicks on the list box
 Input(s)       :    nFlags -
                    point -
 Output         :   -
 Functionality  :   Shows a popup menu to clear the contents of the listbox
 Member of      :   CNotificListbox

 Author(s)      :   Ravikumar Patil
 Date Created   :   27-03-2003
******************************************************************************/
void CNotificListbox::OnRButtonDown(UINT nFlags, CPoint point)
{
    if (GetCount() > 0)
    {
        CMenu* pomContextMenu = new CMenu;
        if (pomContextMenu != NULL)
        {
            // Load the Menu from the resource
            pomContextMenu->DestroyMenu();
            pomContextMenu->LoadMenu(IDM_OPERATION_LIST);
            CMenu* pomSubMenu = pomContextMenu->GetSubMenu(0);

            if (pomSubMenu != NULL)
            {
                CPoint omSrcPt = point;
                ClientToScreen(&omSrcPt);
                UINT unEnable;
                /* If no item is selected, make "Clear" and "Delete" menu
                items disabled */
                if (GetSelCount() <= 0)
                {
                    unEnable = MF_BYCOMMAND | MF_DISABLED | MF_GRAYED;
                }
                else
                {
                    unEnable = MF_BYCOMMAND | MF_ENABLED;
                }
                /* Clear should be commented as it is not dependent on selected item count */
                //pomSubMenu->EnableMenuItem(IDM_OPRTN_CLEAR, unEnable);
                pomSubMenu->EnableMenuItem(IDM_OPRTN_DELETE, unEnable);
                pomSubMenu->EnableMenuItem(ID_NOTIFICWND_COPYTOCLIPBOARD, unEnable);

                pomSubMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,
                                           omSrcPt.x, omSrcPt.y, this, NULL);
            }
            delete pomContextMenu;
            pomContextMenu = NULL;
        }
    }

    CListBox::OnRButtonDown(nFlags, point);
}
コード例 #4
0
ファイル: listbox.cpp プロジェクト: ryanlederman/furr
bool ListBox::GetSelItems(std::list<INT_PTR> *pList) {

  bool r = false;

  if (NULL != pList) {

    LONG_PTR lCount = GetSelCount();
    
    if (LB_ERR != lCount) {

      INT_PTR *piItems = new INT_PTR[lCount];

      if (NULL != piItems) {

        LONG_PTR lRet = LB_ERR;
        
        lRet = SendMsg(LB_GETSELITEMS, lCount, 
                       reinterpret_cast<LPARAM>(piItems));

        if (LB_ERR != lRet) {

          pList->clear();

          for (INT_PTR n = 0; n < lRet; n++) {

            pList->push_back(piItems[n]);

          }

          r = true;
        }

        delete[] piItems;
      }

    }

  }

  return r;
}
コード例 #5
0
ファイル: MixereView.cpp プロジェクト: victimofleisure/Mixere
void CMixereView::OnUpdatePlay(CCmdUI* pCmdUI) 
{
	pCmdUI->Enable(GetSelCount() || !IsCurEmpty());
}
コード例 #6
0
//-----------------------------------------------------------------------------
uint TCheckList::Transfer(void* buffer, TTransferDirection direction)
{  
  long            style          = GetStyle();
  TCheckListData* checkListData = (TCheckListData*)buffer;

  if (direction == tdGetData){
    // First, clear out Strings array and fill with contents of list box
    //
    checkListData->Clear(false);

    int count = GetCount();
    for(int i =0; i < count; i++)
      checkListData->AddItem(GetItem(i));

    // Update transfer data with new selected item(s)
    //
    checkListData->ResetSelections();

    if (!(style & MULTIPLESEL)) {
      // Single selection
      //
      checkListData->Select(GetSelIndex());
    }
    else {
      // Multiple selection
      //
      int selCount = GetSelCount();
      if (selCount > 0) {
        TAPointer<int> selections(new int[selCount]);

        GetSelIndexes(selections, selCount);

        // Select each item by index
        //
        for (int selIndex = 0; selIndex < selCount; selIndex++)
          checkListData->Select(selections[selIndex]);
      }
    }
  }
  else if (direction == tdSetData){
    ClearList();

    // Add each string, item data and selections in listBoxData to list box
    //
    const int noSelection = -1;
    uint selCount = checkListData->GetSelCount();  // for multi selection
    int  selIndex  = noSelection;               // for single selection
    for (uint i = 0; i < checkListData->ItemCount(); i++){
      // Index may be different from i when the listbox is sorted.
      //
       int index =  AddString((LPCTSTR)checkListData->GetItem(i));
      if (style & MULTIPLESEL) {
        for (uint j = 0; j < selCount; j++)
          if (checkListData->GetSelIndices()[j] == (int)i) {
            SetSel(index, true);
            break;
          }
      }
      else {
        if (selCount && (uint)checkListData->GetSelIndices()[0] == i)
          selIndex = index;
        else
          // Inserted something before item and the item to select has been
          // pushed further down in the list.
          //
          if (selIndex != noSelection && index <= selIndex)
            selIndex++;
      }
    }
    if (selIndex != noSelection && !(style & MULTIPLESEL))
      SetSelIndex(selIndex);
  }
  return sizeof(TCheckListData);
}