Example #1
0
void SearchQueryView::getDetails( const QModelIndex & index, QString &textName, int &lineNumber, QList<Focus> & foci ) const
{
    bool ok;
    lineNumber= index.data(Qt::UserRole).toInt(&ok);
    if( !ok )
        lineNumber = -1;

    textName = index.parent().data(Qt::UserRole).toString();
    if( textName.isEmpty() )
        textName = index.data(Qt::UserRole).toString();

    QList<QVariant> types = index.data(Focus::TypeList).toList();
    QList<QVariant> indices = index.data(Focus::IndexList).toList();
    for( int i=0; i<types.count(); i++ )
    {
        Focus::Type t = (Focus::Type)types.at(i).toInt();
        if( t != Focus::WholeStringSearch && t != Focus::SubStringSearch )
        {
            foci << Focus( t , indices.at(i).toLongLong() );
        }
        else
        {
            foci << Focus( t , indices.at(i).toString() );
        }
    }
}
BOOL CXTPMarkupKeyboardNavigation::OnWndMsg(UINT /*message*/, WPARAM /*wParam*/, LPARAM /*lParam*/, LRESULT* /*pResult*/)
{
	// NotImplmeneted
	return FALSE;

#if 0
	if (message == WM_SETFOCUS)
	{
		if (m_pLastFocused && !m_pFocused)
		{
			Focus(m_pLastFocused);
			MARKUP_RELEASE(m_pLastFocused);
		}
	}

	if (message == WM_KILLFOCUS)
	{
		if (m_pFocused)
		{
			m_pLastFocused = m_pFocused;
			MARKUP_ADDREF(m_pLastFocused);

			Focus(NULL);
		}
	}

	if (message == WM_KEYDOWN)
	{
		ProcessInput((UINT)wParam);
	}

	return FALSE;
#endif
}
Example #3
0
void emDirEntryPanel::Input(
	emInputEvent & event, const emInputState & state, double mx, double my
)
{
	if (event.IsKeyboardEvent() && !IsActive()) {
		event.Eat();
	}

	switch (event.GetKey()) {
	case EM_KEY_LEFT_BUTTON:
		if (event.GetRepeat() && state.IsNoMod()) {
			SelectSolely();
			RunDefaultCommand();
			Focus();
			event.Eat();
		}
		else if (!state.GetAlt() && !state.GetMeta()) {
			Select(state.GetShift(),state.GetCtrl());
			Focus();
			event.Eat();
		}
		break;
/* ??? The good old context menu no longer exists...
	case EM_KEY_RIGHT_BUTTON:
		if (!state.GetAlt() && !state.GetMeta()) {
			if (!fm->IsSelectedAsTarget(DirEntry.GetPath())) {
				Select(state.GetShift(),state.GetCtrl());
			}
			ShowContextMenu();
			Focus();
			event.Eat();
		}
		break;
*/
	case EM_KEY_ENTER:
		if (state.IsNoMod()) {
			SelectSolely();
			RunDefaultCommand();
			event.Eat();
		}
		break;
	case EM_KEY_SPACE:
		if (!state.GetAlt() && !state.GetMeta()) {
			Select(state.GetShift(),state.GetCtrl());
			event.Eat();
		}
		break;
	default:
		break;
	}

	emPanel::Input(event,state,mx,my);

	if (event.IsKeyboardEvent()) {
		FileMan->HotkeyInput(GetView(),event,state);
	}
}
Example #4
0
bool MAPS::NewMap(u16 width, u16 height, u16 tileset, u32 terrain, u32 triggers, HWND hMaps)
{
	MapNode* newMap = new MapNode;
	
	if ( newMap->map.CreateNew(width, height, tileset, terrain, triggers) )
	{
		char title[256] = { "Untitled" };
		if ( UntitledNumber > 0 )
			sprintf_s(title, 256, "Untitled %d", UntitledNumber);

		if ( newMap->map.setHandle(AddMDIChild(hMaps, title)) )
		{
			curr = &newMap->map;
			UntitledNumber++;
			PushNode(newMap);
			Focus(newMap->map.getHandle());
			curr->Redraw(true);
			return true;
		}
		else
		{
			delete newMap;
			Error("Failed to create MDI Child Window!");
		}
	}
	else
	{
		CHKD_ERR("Failed to create scenario file!\n\nError in %s\n\n%s", LastErrorLoc, LastError);
		Error(LastError);
	}

	return false;
}
Example #5
0
/**
  * \param draggedChild current object's child which should be dragged
  * \param relmousepos  position relative to child's top-left on which the user clicked
  *
  * Starts dragging of an object that is the child of current object. This is done
  * so that the current object can manage how the drag is performed. This means that
  * for example window is no longer managing its own dragging.
  *
  * Example use is overriding the dragging behaviour. For example, we may want the
  * container of the child object to block horizontal or vertical dragging, or we may
  * want to render the dragging in a special way, such as an outline of the dragged
  * object instead of object being dragged itself.
  *
  * Samples: Windows 9x rendering outline of dragged window, Tibia (a mmo game) locking
  * dragging of some windows to vertical only and painting black box where the window
  * will be moved to if dropped right now.
  *
  */
void glictContainer::StartDraggingChild(glictContainer* draggedChild, const glictPos &relmousepos) {
    Focus(NULL);
    draggedchild = draggedChild;

    draggedchild->dragrelmouse = relmousepos;
    draggedchild->dragging = true;
}
void
nsHTMLLegendElement::PerformAccesskey(bool aKeyCausesActivation,
                                      bool aIsTrustedEvent)
{
  // just use the same behaviour as the focus method
  Focus();
}
Example #7
0
void CheckboxComponent::CheckMouseCollision()
{
	Vector2f diff = g_input->GetMousePosition() - m_object->GetGlobalPos();
	float alpha = -m_object->GetGlobalRotation() * (float)PI / 180.f;
	Vector2f rotatedDiff = Vector2f(diff.x * cos(alpha) - diff.y * sin(alpha), diff.x * sin(alpha) + diff.y * cos(alpha));

	if (rotatedDiff.x >= 0 &&
		rotatedDiff.y >= 0 &&

		rotatedDiff.x <= m_size.x &&
		rotatedDiff.y <= m_size.y)
	{
		Focus();
		if (g_input->WasPressedThisTurn(MOUSE_LEFT))
		{
			if (m_selected)
			{
				UnSelect();
			}
			else
			{
				Select();
			}
		}
	}
	else
	{
		Unfocus();
	}
}
Example #8
0
bool MAPS::OpenMap(HWND hMaps, const char* fileName)
{
	MapNode* newMap = new MapNode;

	if ( newMap->map.LoadFile(fileName) )
	{
		if ( newMap->map.setHandle( AddMDIChild(hMaps, fileName) ) )
		{
			SetWindowText(newMap->map.getHandle(), fileName);
			PushNode(newMap);
			Focus(newMap->map.getHandle());
			curr->Scroll(SCROLL_X|SCROLL_Y);
			curr->Redraw(true);
			return true;
		} 
		else
		{
			delete newMap;
			Error("Failed to create MDI Child Window!");
		}
	}
	else
	{
		delete newMap;
		Error(LastError);
	}

	return false;
}
Example #9
0
bool Maps::OpenMap(std::string fileName)
{
    auto newMap = AddEmptyMap();

    if ( newMap->LoadMapFile(fileName) )
    {
        if ( newMap->CreateThis(getHandle(), fileName) )
        {
            SetWindowText(newMap->getHandle(), fileName.c_str());
            EnableMapping();
            Focus(newMap);

            if ( newMap->isProtected() && newMap->hasPassword() )
                chkd.enterPasswordWindow.CreateThis(chkd.getHandle());
            else if ( newMap->isProtected() )
                mb("Map is protected and will be opened as view only");

            SetFocus(chkd.getHandle());
            currentlyActiveMap->Scroll(true, true, false);
            currentlyActiveMap->Redraw(true);
            currentlyActiveMap->refreshScenario();
            return true;
        } 
        else
            Error("Failed to create MDI Child Window!");
    }

    RemoveMap(newMap);
    return false;
}
Example #10
0
void WindowManager::HandleFocus()
{
	if (Controller::LastInput == PSP_CTRL_CROSS && ListStart && !IsBeingDragged)
	{
		Window* t = ListStart;
		while (t)
		{
			if (t->Enabled)
			{
				if (Interface::IsWithinWindow(Controller::AnalogX, Controller::AnalogY, t))
				{
					if (ListStart != t)
					{
						Focus(t);
						IsActive = 1;
						Controller::Handled = 1;
					}
					break;
				}
				else if (Controller::AnalogX < t->X || Controller::AnalogY < t->Y || Controller::AnalogX > (t->X + t->Width) || Controller::AnalogY > (t->Y + t->Height))
					IsActive = 0;
			}
			t = t->Next;
		}
	}
}
Example #11
0
static void ClearDefrules()
  {
   struct defmodule *theModule;

   theModule = (struct defmodule *) FindDefmodule("MAIN");
   Focus((void *) theModule);
  }
Example #12
0
HRESULT CUIObject::HandleMouse(TMouseEvent Event, TMouseButton Button) {
	// handle focus change
	if (Event == MOUSE_CLICK && Button == MOUSE_BUTTON_LEFT) {
		Focus();
	}
	return CBObject::HandleMouse(Event, Button);
}
void
HTMLLegendElement::PerformAccesskey(bool aKeyCausesActivation,
                                    bool aIsTrustedEvent)
{
  // just use the same behaviour as the focus method
  ErrorResult rv;
  Focus(rv);
}
void ENEMY_Red_Robot::Move()
{

	Focus();

	position = original_position + path.GetCurrentSpeed(&anim);

}
Example #15
0
// Change Password dialog
UINT EmPasswordDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param)
{
	RPC *r = (RPC *)param;
	char pass1[MAX_PATH];
	char pass2[MAX_PATH];
	UCHAR hash[SHA1_SIZE];
	RPC_SET_PASSWORD t;
	// Validate arguments
	if (hWnd == NULL)
	{
		return 0;
	}

	switch (msg)
	{
	case WM_INITDIALOG:
		Focus(hWnd, E_PASSWORD1);
		break;

	case WM_COMMAND:
		switch (wParam)
		{
		case IDOK:
			GetTxtA(hWnd, E_PASSWORD1, pass1, sizeof(pass1));
			Hash(hash, pass1, StrLen(pass1), true);
			Zero(&t, sizeof(t));
			Copy(t.HashedPassword, hash, SHA1_SIZE);
			if (CALL(hWnd, EcSetPassword(r, &t)) == false)
			{
				break;
			}
			MsgBox(hWnd, MB_ICONINFORMATION, _UU("CM_PASSWORD_SET"));
			EndDialog(hWnd, 1);
			break;

		case IDCANCEL:
			Close(hWnd);
			break;
		}

		switch (LOWORD(wParam))
		{
		case E_PASSWORD1:
		case E_PASSWORD2:
			GetTxtA(hWnd, E_PASSWORD1, pass1, sizeof(pass1));
			GetTxtA(hWnd, E_PASSWORD2, pass2, sizeof(pass2));
			SetEnable(hWnd, IDOK, StrCmp(pass1, pass2) == 0 ? true : false);
			break;
		}
		break;

	case WM_CLOSE:
		EndDialog(hWnd, 0);
		break;
	}

	return 0;
}
Example #16
0
bool Maps::Focus(HWND hGuiMap)
{
    for ( auto &pair : openMaps )
    {
        if ( hGuiMap == pair.second->getHandle() )
            return Focus(pair.second);
    }
    return false;
}
Example #17
0
bool
HTMLLegendElement::PerformAccesskey(bool aKeyCausesActivation,
                                    bool aIsTrustedEvent)
{
  // just use the same behaviour as the focus method
  ErrorResult rv;
  Focus(rv);
  return NS_SUCCEEDED(rv.StealNSResult());
}
Example #18
0
static void ResetDefrules()
  {
   struct defmodule *theModule;

   CurrentEntityTimeTag = 0L;
   ClearFocusStack();
   theModule = (struct defmodule *) FindDefmodule("MAIN");
   Focus((void *) theModule);
  }
Example #19
0
void Category::Deactivate()
{
    TargetAlpha = 0;

    Start();

    Focus(TaskList);

    Show->Down();
}
Example #20
0
void Window::PulseReceived( Pulse *pulse )
{
    Rect oldFrame;
    uint32 d1,d2,d3,d4,d5,d6;
    d1 = (*pulse)[0];
    d2 = (*pulse)[1];
    d3 = (*pulse)[2];
    d4 = (*pulse)[3];
    d5 = (*pulse)[4];
    d6 = (*pulse)[5];



    switch (d1)
    {
    case PULSE:
        if ( smk_getpid() != pulse->source_pid ) break; // Ignore the daemons.
        Pulsed();
        break;

    case FOCUS:
        m_focus = (d2 == 1);
        Focus( m_focus );
        break;

    case MOUSE_DOWN:
    case MOUSE_UP:
    case MOUSE_MOVED:
        MouseEvent( d1, d2, d3, d4 );
        break;

    case KEY_DOWN:
    case KEY_UP:
        KeyEvent( d1, d2, d3, d4 );
        break;

    case DRAW:
        Draw( Rect(d2,d3,d4,d5) );
        Sync();
        break;

    case MOVE:
        oldFrame = m_frame;
        m_frame.left   += d2;
        m_frame.right  += d2;
        m_frame.top    += d3;
        m_frame.bottom += d3;
        WindowMoved( Frame() );
        break;

    default:
        Looper::PulseReceived( pulse );
        break;
    }
}
Example #21
0
void Control::FocusChild(unsigned long index)
{
	if(index >= mChilds.GetSize())
		return;

	Focus();

	UnfocusChilds();

	mChilds[index]->SetFocused(true);
}
Example #22
0
void World::GetAll(const ushort x_to, const ushort y_to, const ushort z_to) {
	ushort x_from, y_from, z_from;
	if ( Focus(x_to, y_to, z_to, x_from, y_from, z_from) ) {
		return;
	}
	Inventory * const inv_to=GetBlock(x_to, y_to, z_to)->HasInventory();
	if ( inv_to ) {
		inv_to->GetAll(GetBlock(x_from, y_from, z_from)->
			HasInventory());
	}
}
Example #23
0
void Category::Activate()
{
    TargetAlpha = 150;

    Start();

    Redraw();

    if(DoFocus != 0)
        Focus(DoFocus);

    Show->Up();
}
void CheckBoxViewManager::DispatchCommand(XamlView viewToUpdate, int64_t commandId, const folly::dynamic& commandArgs)
{
  auto checkbox = viewToUpdate.as<winrt::CheckBox>();
  if (checkbox == nullptr)
    return;

  switch (commandId)
  {
    case static_cast<int64_t>(CheckboxCommands::SetFocus):
    {
      checkbox.Focus(winrt::FocusState::Programmatic);
      break;
    }
  }
}
void
JXInputField::HandleDNDDrop
	(
	const JPoint&		pt,
	const JArray<Atom>&	typeList,
	const Atom			action,
	const Time			time,
	const JXWidget*		source
	)
{
	if (Focus())
		{
		JXTEBase::HandleDNDDrop(pt, typeList, action, time, source);
		}
}
Example #26
0
bool Button::MouseLButton(bool bDown)
{
	if (bDown)
	{
		gui->SetFocus(id);
		Engine->Effect_Play(click);
	}
	else
	{
		Focus(false);
		return true;

	}

	return false;
}
Example #27
0
nuiPopupMenu::nuiPopupMenu(nuiWidget* pParent, nuiTreeNodePtr pTree, const nuiRect& rRect, bool OwnTree)
: nuiSimpleContainer(),
mPopupTreeSink(this),
mpSelectedNode(NULL),
mpNewSelectedNode(NULL),
mOwnTree(OwnTree),
mSelectionTimer(nglTime(TIMER_PERIOD)),
mScrollTimer(1.0f/15.0f),
mDelayTime(DELAY_TIME),
mpOldFocused(NULL)
{
  mTrashRemoval = false;
  SetObjectClass(_T("nuiPopupMenu"));
  nuiRect r = rRect;

  nuiTopLevel* pTop = NULL;
  if (pParent)
    pTop = pParent->GetTopLevel();
  if (pTop)
    pTop->AddChild(this);

  mpTree = pTree;
  mpTree->Acquire();
  ReparentTree(mpTree);
  mSelectedNodes.push_back(mpTree);
  mXdir = 1;
  mYdir = 1;
  if (pParent)
    pParent->LocalToGlobal(r);
  mInitialPos = r;

  mScrollUp = false;
  mPopupTreeSink.Connect(mScrollTimer.Tick, &nuiPopupMenu::OnScrollTimer);
  mPopupTreeSink.Connect(mSelectionTimer.Tick, &nuiPopupMenu::OnSelectionTimer);

  mScrolledFromKeyboard = false;
  mShowFirstNode = true;
  mWheelMoved = false;
  mFirstClick = false;

  //nuiTopLevel* pTopLevel = GetTopLevel();
  //if (pTopLevel)
  //mpOldFocused = pTopLevel->GetFocus();
  SetWantKeyboardFocus(true);
  Focus();
  //  Grab();
}
Example #28
0
// End User License Agreement dialog
UINT ViEulaDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param)
{
	wchar_t *text = (wchar_t *)param;
	// Validate arguments
	if (hWnd == NULL)
	{
		return 0;
	}

	switch (msg)
	{
	case WM_INITDIALOG:
		SetText(hWnd, 0, _U(IDS_DLG_TITLE+skip));
		SetText(hWnd, S_EULA_NOTICE1, _U(IDS_EULA_NOTICE1+skip));
		SetText(hWnd, S_BOLD, _U(IDS_EULA_NOTICE2+skip));
		SetText(hWnd, S_EULA_NOTICE3, _U(IDS_EULA_NOTICE3+skip));
		SetText(hWnd, IDOK, _U(IDS_EULA_AGREE+skip));
		SetText(hWnd, IDCANCEL, _U(IDS_EULA_DISAGREE+skip));

		DlgFont(hWnd, S_BOLD, 0, true);
		SetText(hWnd, E_EULA, text);
		Focus(hWnd, E_EULA);
		SendMsg(hWnd, E_EULA, EM_SETSEL, 0, 0);
		Center(hWnd);
		break;

	case WM_COMMAND:
		switch (wParam)
		{
		case IDOK:
			EndDialog(hWnd, 1);
			break;

		case IDCANCEL:
			Close(hWnd);
			break;
		}
		break;

	case WM_CLOSE:
		EndDialog(hWnd, 0);
		break;
	}

	return 0;
}
Example #29
0
void ComboBox::SelectItem(MenuItem* item, bool do_events)
{
    if (_selected_item == item)
    {
        return;
    }

    _selected_item = item;
    SetText(_selected_item->GetText());
    _menu->SetHidden(true);
    Invalidate();

    if (do_events)
    {
        _on_selected.Call(this);
        Focus();
    }
}
Example #30
0
void ElementDocument::Show(int focus_flags)
{
	// Store the modal attribute
	modal = (focus_flags & MODAL) > 0;

	// Set to visible and switch focus if necessary
	SetProperty(VISIBILITY, "visible");
	if (focus_flags & FOCUS || focus_flags & MODAL)
	{
		// If no element could be focused, focus the window
		if (!FocusNextTabElement(this, true))
		{
			Focus();
		}
	}

	DispatchEvent("show", Dictionary(), false);
}