コード例 #1
0
int DesktopManager::BottomMod(int pos, int /*param*/)
{
   if (pos >= GetNbDesktops() - GetNbColumns())
   {
      //last row
      pos = pos%GetNbColumns();
   }
   else
      //other
      pos += GetNbColumns();
   return pos;
}
コード例 #2
0
int DesktopManager::RightMod(int pos, int /*param*/)
{
   if (pos == GetNbDesktops() - GetNbDesktops() % GetNbColumns())
      //first col on last line
      pos += GetNbDesktops() % GetNbColumns() - 1;
   else if (pos % GetNbColumns() == 0)
      //first column
      pos += GetNbColumns() - 1;
   else
      //other
      pos --;
   return pos;
}
コード例 #3
0
int DesktopManager::LeftMod(int pos, int /*param*/)
{
   if (pos == GetNbDesktops()-1)
      //last desktop
      pos -= GetNbDesktops() % GetNbColumns() - 1;
   else if ((pos + 1) % GetNbColumns() == 0)
      //last column
      pos -= GetNbColumns() - 1;
   else
      //other
      pos ++;
   return pos;
}
コード例 #4
0
int DesktopManager::TopMod(int pos, int /*param*/)
{
   if (pos / GetNbColumns() == 0)
   {
      //first row
      if (pos >= GetNbDesktops()%GetNbColumns())
         pos -= GetNbColumns();
      pos += GetNbDesktops() - GetNbDesktops()%GetNbColumns();
   }
   else
      //other
      pos -= GetNbColumns();
   return pos;
}
コード例 #5
0
ファイル: nuiMatrixView.cpp プロジェクト: YetToCome/nui3
bool nuiMatrixView::SelectAll()
{
  if (mAllSelected)
    return DeselectAll();
    
  uint row, col;
  uint firstRow = 0;
  uint firstCol = 0;
  if (mColumnHeader)
    firstRow=1;
  if (mRowHeader)
    firstCol = 1;
  
  mAllSelected = true;
  

  bool eventDisabled = false;
  
  if (!SelectionChanged.IsEnabled())
    eventDisabled = true;
  
  if (!eventDisabled)
    SelectionChanged.Disable();

 
  // entire rows and cols have a special selection process
  for (row=firstRow; row < GetNbRows(); row++)
    mRowSelected[row] = true;
  for (col=firstCol; col < GetNbColumns(); col++)
    mColumnSelected[col] = true;
  
  for (row=firstRow; row < GetNbRows(); row++)
  {
    for (col=firstCol; col < GetNbColumns(); col++)
    {
      SelectCell(col, row, true, false);
    }
  }

  
  if (!eventDisabled)
    SelectionChanged.Enable();
 
	SelectionChanged();
  
  return true;  
}
コード例 #6
0
ファイル: nuiMatrixView.cpp プロジェクト: YetToCome/nui3
bool nuiMatrixView::DeselectAll()
{
  uint row, col;
  uint firstRow = 0;
  uint firstCol = 0;
  if (mColumnHeader)
    firstRow=1;
  if (mRowHeader)
    firstCol = 1;
  
  mAllSelected = false;
  
  bool eventDisabled = false;
  
  if (!SelectionChanged.IsEnabled())
    eventDisabled = true;
  
  if (!eventDisabled)
    SelectionChanged.Disable();
 
  // entire rows and cols have a special selection process
  for (row=firstRow; row < GetNbRows (); row++)
    mRowSelected[row] = false;
  for (col=firstCol; col < GetNbColumns (); col++)
    mColumnSelected[col] = false;
    
  // list the selected items and deselect'em
//  std::map<nuiMatrixViewItem*, bool>::iterator itr;
//  for (itr = mSelectedItems.begin(); itr != mSelectedItems.end(); ++itr)
//  {
//    nuiMatrixViewItem* item = itr->first;
//    SelectCell(item->GetCol(), item->GetRow(), false);
//  }

  std::map<nuiMatrixViewItem*, bool>::iterator it     = mSelectedItems.begin();
  std::map<nuiMatrixViewItem*, bool>::iterator itEnd  = mSelectedItems.end();
  while (it != itEnd)
  {
    nuiMatrixViewItem* item = it->first;
    item->SetSelected(false);
    ++it;
  }


  
  // no selected items left
  mSelectedItems.clear ();
  
  if (!eventDisabled)
    SelectionChanged.Enable();
 
	SelectionChanged();
  
  return true;
}
コード例 #7
0
ファイル: nuiMatrixView.cpp プロジェクト: YetToCome/nui3
bool nuiMatrixView::ForceSelectRow(uint row, bool set)
{
  bool eventDisabled = false;
  
  if (!SelectionChanged.IsEnabled())
    eventDisabled = true;
  
  if (!eventDisabled)
    SelectionChanged.Disable();

  
  uint firstCol=0;
  if (mRowHeader)
    firstCol=1;
  
  // unselect
  if (!set)
  {
    for (uint k=firstCol; k < GetNbColumns(); k++)
      SelectCell(k, row, false, false);

    mRowSelected[row] = false;
  }

      
  // select
  else
  {
    for (uint k=firstCol; k < GetNbColumns(); k++)
      SelectCell(k, row, true, false);
      
    mRowSelected[row] = true;
  }
          

  if (!eventDisabled)
    SelectionChanged.Enable();
    
	SelectionChanged();

  return true;
}
コード例 #8
0
ファイル: nuiMatrixView.cpp プロジェクト: YetToCome/nui3
bool nuiMatrixView::IsAllRowCellsSelected(uint row, bool select)
{
  uint firstCol=0;
  if (mRowHeader)
    firstCol=1;
    
  for (uint col=firstCol; col < GetNbColumns(); col++)
  {
      nuiWidget* pWidget = nuiGrid::GetCell(col, row);
      nuiMatrixViewItem* item = dynamic_cast<nuiMatrixViewItem*>(pWidget);
      if (!item)
        continue;

    if (item->IsSelected() != select)
      return false;
  }
  
  return true;
}