void
CMArray2DTable::HandleKeyPress
	(
	const int				key,
	const JXKeyModifiers&	modifiers
	)
{
	if (key == kJReturnKey)
		{
		JPoint cell;
		if (!IsEditing() && (GetTableSelection()).GetSingleSelectedCell(&cell))
			{
			BeginEditing(cell);
			}
		else
			{
			EndEditing();
			}
		}

	else if (!IsEditing() && HandleSelectionKeyPress(key, modifiers))
		{
		// work has been done
		}

	else
		{
		JXStringTable::HandleKeyPress(key, modifiers);
		}
}
void
GMAccountList::HandleMouseDown
	(
	const JPoint&			pt,
	const JXMouseButton	button,
	const JSize			clickCount,
	const JXButtonStates&	buttonStates,
	const JXKeyModifiers&	modifiers
	)
{
	JPoint cell;
	if (button == kJXLeftButton && clickCount == 1 &&
		GetCell(pt, &cell))
		{
		JTableSelection& s = GetTableSelection();
		if (!s.IsSelected(cell) && itsDialog->OKToSwitchAccounts())
			{
			s.ClearSelection();
			s.SelectRow(cell.y);
			Broadcast(NameSelected(cell.y));
			BeginEditing(cell);
			}
		else if (s.IsSelected(cell) && !IsEditing())
			{
			BeginEditing(cell);
			}
		}
	else if (button > kJXRightButton)
		{
		ScrollForWheel(button, modifiers);
		}
}
JArray<CBPrefsManager::MacroSetInfo>*
CBMacroSetTable::GetMacroList
	(
	JIndex* firstNewID,
	JIndex* lastNewID
	)
	const
{
	assert( !IsEditing() &&
			!itsActionTable->IsEditing() &&
			!itsMacroTable->IsEditing() );

	JStringTableData* data = GetStringData();
	const JSize count      = data->GetRowCount();
	for (JIndex i=1; i<=count; i++)
		{
		CBPrefsManager::MacroSetInfo info = itsMacroList->GetElement(i);
		*(info.name) = data->GetString(i,1);
		}

	if (itsMacroIndex > 0)
		{
		CBPrefsManager::MacroSetInfo info = itsMacroList->GetElement(itsMacroIndex);
		itsActionTable->GetData(info.action);
		itsMacroTable->GetData(info.macro);
		}

	*firstNewID = itsFirstNewID;
	*lastNewID  = itsLastNewID;

	itsOwnsMacroListFlag = kJFalse;
	return itsMacroList;
}
void ApplicationListDlg::OnApply()
{
   int i = 0;
   TCHAR filename[MAX_PATH];
   DWORD length = MAX_PATH;

   //Validate current parameter, if any
   if (IsEditing())
      EndEdit();

   //Remove entries which have been removed (ie are not in the list box)
   while(length=MAX_PATH, m_appgroup->EnumEntry(i, filename, &length))
   {
      if (FindProgram(filename) != -1)
         i++;
      else
         m_appgroup->RemoveEntry(filename);
   }

   //Add/set value for all entries in the list box
   for(i=0; i<ListView_GetItemCount(m_hAppListWnd); i++)
   {
      ListView_GetItemText(m_hAppListWnd, i, 0, filename, length);
      m_appgroup->SaveDWord(filename, GetProgramParam(i));
   }
}
void ApplicationListDlg::OnProgramClick(LPNMITEMACTIVATE lpnmitem)
{
   if (IsEditing())
      EndEdit();

   if (lpnmitem->iItem != -1 && lpnmitem->iSubItem == 1)
      BeginEdit(lpnmitem->iItem);
}
void
JXTreeListWidget::HandleKeyPress
	(
	const int				key,
	const JXKeyModifiers&	modifiers
	)
{
	if (key == kJLeftArrow && !IsEditing())
		{
		CloseSelectedNodes(modifiers.shift(), modifiers.meta());
		}
	else if (key == kJRightArrow && !IsEditing())
		{
		OpenSelectedNodes(modifiers.shift(), modifiers.meta());
		}
	else
		{
		JXStyleTable::HandleKeyPress(key, modifiers);
		}
}
// Override draw so that when the cell is selected, a drop arrow is shown in the RHS.
BOOL CGridCellComboBox::Draw(CDC* pDC, int nRow, int nCol, CRect rect,  BOOL bEraseBkgnd /*=TRUE*/)
{
#ifdef _WIN32_WCE
    return CGridCell::Draw(pDC, nRow, nCol, rect,  bEraseBkgnd);
#else
    // Cell selected?
    //if ( !IsFixed() && IsFocused())
    if (GetGrid()->IsCellEditable(nRow, nCol) && !IsEditing())
    {
        // Get the size of the scroll box
        CSize sizeScroll(GetSystemMetrics(SM_CXVSCROLL), GetSystemMetrics(SM_CYHSCROLL));

        // enough room to draw?
        if (sizeScroll.cy < rect.Width() && sizeScroll.cy < rect.Height())
        {
            // Draw control at RHS of cell
            CRect ScrollRect = rect;
            ScrollRect.left   = rect.right - sizeScroll.cx;
            ScrollRect.bottom = rect.top + sizeScroll.cy;

            // Do the draw 
            pDC->DrawFrameControl(ScrollRect, DFC_SCROLL, DFCS_SCROLLDOWN);

            // Adjust the remaining space in the cell
            rect.right = ScrollRect.left;
        }
    }

    CString strTempText = GetText();
    if (IsEditing())
        SetText(_T(""));

    // drop through and complete the cell drawing using the base class' method
    BOOL bResult = CGridCell::Draw(pDC, nRow, nCol, rect,  bEraseBkgnd);

    if (IsEditing())
        SetText(strTempText);

	return bResult;
#endif
}
void
CBCommandTable::GetCommandList
	(
	CBCommandManager::CmdList* cmdList
	)
	const
{
	assert( !IsEditing() );

	cmdList->DeleteAll();
	*cmdList = *itsCmdList;
	FinishCmdListCopy(cmdList);
}
void ApplicationListDlg::OnRemoveApplBtn()
{
   //Stop editing item
   if (IsEditing())
      EndEdit();

   //Get selected item index
   int idx = ListView_GetNextItem(m_hAppListWnd, (WPARAM)-1, LVNI_SELECTED);

   //Remove it from the list
   if (idx != -1)
      ListView_DeleteItem(m_hAppListWnd, idx);
}
Example #10
0
InputWidget::InputWidget(WidgetOwner* widgetOwner) : StringWidget{widgetOwner}
{
	_inputHotspot.SetDistance([this](glm::vec2 position) {
		return _bounds.distance(GetViewport2D().ScreenToContent(position));
	});
	_inputHotspot.SetTolerance([this](Touch* touch) {
		return ClickHotspot::GetDefaultTolerance(touch, _bounds.size());
	});
	_inputHotspot.SetClickAction([this]() {
		SetEditing(!IsEditing());
	});
	_inputHotspot.SetImmediateClick(true);
}
void
JXStyleTable::SetAllCellStyles
	(
	const JFontStyle& style
	)
{
	itsStyleData->SetAllCellStyles(style);

	JXInputField* input = NULL;
	if (IsEditing() && GetXInputField(&input))
		{
		input->SetFontStyle(style);
		}
}
void ApplicationListDlg::OnInsertApplBtn()
{
   TCHAR path[MAX_PATH];

   //Stop editing item
   if (IsEditing())
      EndEdit();

   //No file at the moment
   *path = 0;

   //Browse for a new program name
   if (GetProgramName(path, MAX_PATH) && 
       (FindProgram(path)==-1 || (locMessageBox(m_hDlg, IDS_PROGRAMINLIST_ERROR, IDS_ERROR, MB_OK|MB_ICONEXCLAMATION), FALSE)))
      InsertProgram(path, m_defaultValue);
}
Example #13
0
void AnimationTimeline::Update( float delta )
{
	if(paused) return;
	if(IsEditing()) return;

	if(animtype==0)
	{
		cframe += delta * fps;
		while(cframe>maxframes) cframe -= (float)maxframes;
	}
	else if(animtype==1)
	{
		cframe -= delta * fps;
		while(cframe<0) cframe += (float)maxframes;
	}
	SetValue(cframe);
}
void
CBCommandTable::HandleKeyPress
	(
	const int				key,
	const JXKeyModifiers&	modifiers
	)
{
	JBoolean cleared = kJFalse;
	if (key == kJDeleteKey || key == kJForwardDeleteKey)
		{
		JTableSelection& s = GetTableSelection();
		JPoint cell;
		if (s.GetSingleSelectedCell(&cell))
			{
			CBCommandManager::CmdInfo info = itsCmdList->GetElement(cell.y);
			if (cell.x == kMenuTextColumn)
				{
				info.menuText->Clear();
				cleared = kJTrue;
				}
			else if (cell.x == kMenuShortcutColumn)
				{
				info.menuShortcut->Clear();
				cleared = kJTrue;
				}
			else if (cell.x == kScriptNameColumn)
				{
				info.name->Clear();
				cleared = kJTrue;
				}
			}
		}

	if (cleared)
		{
		Refresh();
		}
	else if (IsEditing())
		{
		JXEditTable::HandleKeyPress(key, modifiers);
		}
	else
		{
		HandleSelectionKeyPress(key, modifiers);
		}
}
void
GMFilterNameTable::HandleMouseDown
	(
	const JPoint&			pt,
	const JXMouseButton	button,
	const JSize			clickCount,
	const JXButtonStates&	buttonStates,
	const JXKeyModifiers&	modifiers
	)
{
	itsIsWaitingForDrag	= kJFalse;
	itsStartPt			= pt;
	itsDNDIsValid		= kJFalse;

	if (button > kJXRightButton)
		{
		ScrollForWheel(button, modifiers);
		return;
		}

	JPoint cell;
	if (!GetCell(pt, &cell))
		{
		return;
		}

	itsCurrentCell		= cell;

	JTableSelection& s	= GetTableSelection();

	JPoint oldCell;
	JBoolean hasSingleSel	= s.GetFirstSelectedCell(&oldCell);

	if (itsConditionTable->OKToSwitch() &&
		itsActionTable->OKToSwitch() &&
		(!IsEditing() || EndEditing()))
		{
		if ((hasSingleSel && cell.y != oldCell.y) ||
			(!hasSingleSel))
			{
			SelectFilter(cell.y);
			}
		itsIsWaitingForDrag	= kJTrue;
		}
}
void
CBMacroTable::GetData
	(
	CBMacroManager* mgr
	)
	const
{
	assert( !IsEditing() );

	mgr->RemoveAllMacros();

	const JStringTableData* data = GetStringData();
	const JSize count            = GetRowCount();
	for (JIndex i=1; i<=count; i++)
		{
		mgr->AddMacro(data->GetString(i, kMacroColumn),
					  data->GetString(i, kScriptColumn));
		}
}
JCoordinate
JXStyleTable::GetMin1DVisibleWidth
	(
	const JPoint& cell
	)
	const
{
	if (IsEditing())
		{
		return JXEditTable::GetMin1DVisibleWidth(cell);
		}
	else
		{
		JSize size;
		const JString& name = GetFont(&size);
		return kMin1DVisCharCount *
			(GetFontManager())->GetCharWidth(name, size, JFontStyle(), 'W');
		}
}
void ApplicationListDlg::OnEditApplBtn()
{
   TCHAR path[MAX_PATH];
   int idx;
	int newidx;

   //Stop editing item
   if (IsEditing())
      EndEdit();

   //Get selected item index
   idx = ListView_GetNextItem(m_hAppListWnd, (WPARAM)-1, LVNI_SELECTED);
   if (idx == -1)
      return;

   //Get current program name of the item
   ListView_GetItemText(m_hAppListWnd, idx, 0, path, MAX_PATH);

   //Browse for a new program name
   if (GetProgramName(path, MAX_PATH) && 
		 (newidx = FindProgram(path), TRUE) &&
       (newidx==-1 || newidx==idx || (locMessageBox(m_hDlg, IDS_PROGRAMINLIST_ERROR, IDS_ERROR, MB_OK|MB_ICONEXCLAMATION), FALSE)))
      InsertProgram(path, m_defaultValue, idx);
}
void ApplicationListDlg::OnProgramSetFocus()
{
   if (IsEditing())
      EndEdit();
}
Example #20
0
void InputWidget::OnTouchBegin(Touch* touch)
{
	if (_inputHotspot.IsTouchInside(touch) != IsEditing())
		_inputHotspot.SubscribeTouch(touch);
}