コード例 #1
0
/** $(class), OnConnect:
 *  Detailed description.
 *  @return TODO
 */
void Screen::OnConnect(){
    //Hookable::Connect();
    m_conDraw = Master()->ConnectOnDraw( boost::bind( &Screen::OnDraw, boost::ref(*this) ) );
    m_conUpdate = Master()->ConnectOnUpdate( boost::bind( &Screen::OnUpdate, boost::ref(*this) ) );
    m_conEvt = Master()->ConnectOnEvent( boost::bind(&Screen::OnEvent, boost::ref(*this), _1) );
    OnFocus();
}
コード例 #2
0
ファイル: ButtonComponent.cpp プロジェクト: PaulPopa/Games
void ButtonComponent::CheckMouseCollision()
{
	m_wasPressed = false;
	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)
	{
		OnFocus();

		if (g_input->WasPressedThisTurn(MOUSE_LEFT))
		{
			OnClick();
		}
	}
	else
	{
		OnUnfocus();
	}
}
コード例 #3
0
ファイル: GUIControl.cpp プロジェクト: Karlson2k/xbmc
void CGUIControl::UpdateStates(ANIMATION_TYPE type, ANIMATION_PROCESS currentProcess, ANIMATION_STATE currentState)
{
  // Make sure control is hidden or visible at the appropriate times
  // while processing a visible or hidden animation it needs to be visible,
  // but when finished a hidden operation it needs to be hidden
  if (type == ANIM_TYPE_VISIBLE)
  {
    if (currentProcess == ANIM_PROCESS_REVERSE)
    {
      if (currentState == ANIM_STATE_APPLIED)
        m_visible = HIDDEN;
    }
    else if (currentProcess == ANIM_PROCESS_NORMAL)
    {
      if (currentState == ANIM_STATE_DELAYED)
        m_visible = DELAYED;
      else
        m_visible = m_visibleFromSkinCondition ? VISIBLE : HIDDEN;
    }
  }
  else if (type == ANIM_TYPE_HIDDEN)
  {
    if (currentProcess == ANIM_PROCESS_NORMAL)  // a hide animation
    {
      if (currentState == ANIM_STATE_APPLIED)
        m_visible = HIDDEN; // finished
      else
        m_visible = VISIBLE; // have to be visible until we are finished
    }
    else if (currentProcess == ANIM_PROCESS_REVERSE)  // a visible animation
    { // no delay involved here - just make sure it's visible
      m_visible = m_visibleFromSkinCondition ? VISIBLE : HIDDEN;
    }
  }
  else if (type == ANIM_TYPE_WINDOW_OPEN)
  {
    if (currentProcess == ANIM_PROCESS_NORMAL)
    {
      if (currentState == ANIM_STATE_DELAYED)
        m_visible = DELAYED; // delayed
      else
        m_visible = m_visibleFromSkinCondition ? VISIBLE : HIDDEN;
    }
  }
  else if (type == ANIM_TYPE_FOCUS)
  {
    // call the focus function if we have finished a focus animation
    // (buttons can "click" on focus)
    if (currentProcess == ANIM_PROCESS_NORMAL && currentState == ANIM_STATE_APPLIED)
      OnFocus();
  }
  else if (type == ANIM_TYPE_UNFOCUS)
  {
    // call the unfocus function if we have finished a focus animation
    // (buttons can "click" on focus)
    if (currentProcess == ANIM_PROCESS_NORMAL && currentState == ANIM_STATE_APPLIED)
      OnUnFocus();
  }
}
コード例 #4
0
void MkWindowBaseNode::SendNodeCommandTypeEvent(ePA_SceneNodeEvent eventType, MkDataNode* argument)
{
	switch (eventType)
	{
	case ePA_SNE_Activate: Activate(); break;
	case ePA_SNE_Deactivate: Deactivate(); break;
	case ePA_SNE_OnFocus: OnFocus(); break;
	case ePA_SNE_LostFocus: LostFocus(); break;
	}
	
	MkWindowThemedNode::SendNodeCommandTypeEvent(eventType, argument);
}
コード例 #5
0
ファイル: ScreenFailure.cpp プロジェクト: Arc0re/lithtech
void CScreenFailure::Escape()
{

	OnFocus(LTFALSE);

	//hack to rebuild our screen history
	m_pScreenMgr->ClearHistory();
	m_pScreenMgr->AddScreenToHistory(SCREEN_ID_MAIN);
	m_pScreenMgr->AddScreenToHistory(SCREEN_ID_SINGLE);

	g_pInterfaceMgr->RequestInterfaceSound(IS_PAGE);
	m_pScreenMgr->SetCurrentScreen(SCREEN_ID_LOAD);
}
コード例 #6
0
ファイル: ThinkWindow.cpp プロジェクト: jaylauffer/loadngo
LRESULT ThinkWindow::WindowProc(HWND wnd, unsigned int msg, WPARAM wparam, LPARAM lparam)
{
	LRESULT result = 0;
	switch(msg)
	{
	case WM_CREATE:
		result = OnCreate(wparam, lparam);
		break;
	case WM_SIZE:
		result = OnSize(wparam, lparam);
		break;
	case WM_SETFOCUS:
		result = OnFocus(wparam, lparam);
		break;
	case WM_CLOSE:
		DestroyWindow(wnd);
	case WM_DESTROY:
		PostQuitMessage(0);
		break;
	default:
		result = DefWindowProc(wnd, msg, wparam, lparam);
	}
	return result;
}
コード例 #7
0
ファイル: xwindow.cpp プロジェクト: iso9660/linux-sdk
int XWindow::RunModal()
{
    Prepare();

    // Trap XWindows "WM_DELETE_WINDOW" message
    Atom wmDeleteMessage = XInternAtom(windowDisplay, "WM_DELETE_WINDOW", false);
    XSetWMProtocols(windowDisplay, window, &wmDeleteMessage, 1);

    XkbEvent event;
    do {
        // Gets the new event
        int res = XNextEvent(windowDisplay, &event.core);
        if (window != event.core.xany.window) continue;

        // Processes the events
        if (event.type == ButtonPress) {
            WindowEventMouseButton e(&event.core.xbutton);
            OnMouseDown(&e);
        } else if (event.type == ButtonRelease) {
            WindowEventMouseButton e(&event.core.xbutton);
            OnMouseUp(&e);
        } else if (event.type == MotionNotify) {
            WindowEventMouseMove e(&event.core.xmotion);
            OnMouseMove(&e);
        } else if (event.type == EnterNotify) {
            WindowEventEnterLeave e(&event.core.xcrossing);
            OnMouseEnterLeave(&e);
        } else if (event.type == LeaveNotify) {
            WindowEventEnterLeave e(&event.core.xcrossing);
            OnMouseEnterLeave(&e);
        } else if (event.type == FocusIn) {
            WindowEventFocus e(&event.core.xfocus);
            OnFocus(&e);
        } else if (event.type == FocusOut) {
            WindowEventFocus e(&event.core.xfocus);
            OnFocus(&e);
        } else if (event.type == Expose && event.core.xexpose.count == 0) {
            WindowEventDraw e(gc, &event.core.xexpose);
            OnDraw(&e);
        } else if (event.type == VisibilityNotify) {
            WindowEventVisible e(&event.core.xvisibility);
            OnVisible(&e);
        } else if (event.type == UnmapNotify) {
            WindowEventShow e(false);
            OnShow(&e);
        } else if (event.type == MapNotify) {
            WindowEventShow e(true);
            OnShow(&e);
        } else if (event.type == ConfigureNotify) {
            bool generateWindowMoveEvent =
                area->GetX() != event.core.xconfigure.x ||
                area->GetY() != event.core.xconfigure.y;
            bool generateWindowResizeEvent =
                area->GetWidth() != event.core.xconfigure.width ||
                area->GetHeight() != event.core.xconfigure.height;

            *area = NRectangle(
                        event.core.xconfigure.x, event.core.xconfigure.y,
                        event.core.xconfigure.width, event.core.xconfigure.height);
            borderwidth = event.core.xconfigure.border_width;

            if (generateWindowMoveEvent) {
                WindowEventMove e(&event.core.xconfigure);
                OnMove(&e);
            }
            if (generateWindowResizeEvent) {
                gc->Resize(area->GetWidth(), area->GetHeight());	// Resize XWindowGraphics
                WindowEventResize e(&event.core.xconfigure);
                OnResize(&e);
            }
        } else if (event.type == ColormapNotify) {
            WindowEventColormap e(&event.core.xcolormap);
            OnColormap(&e);
        } else if (event.type == KeyPress) {
            WindowEventKey e(&event.core.xkey);
            OnKeyPress(&e);
        } else if (event.type == KeyRelease) {
            WindowEventKey e(&event.core.xkey);
            OnKeyRelease(&e);
        } else if (event.type == XDisplay::Default().XkbBaseEvent() + XkbEventCode) {
            // XkbEvents
            if (event.any.xkb_type == XkbMapNotify) {
                WindowEventKeymap e(&event.map);
                OnKeymap(&e);
            } else if (event.any.xkb_type == XkbNewKeyboardNotify) {
                WindowEventKeyboardMapping e(&event.new_kbd);
                OnKeyboardMapping(&e);
            } else if (event.any.xkb_type == XkbStateNotifyMask) {
                int kk = 1;
            }
        } else if (event.type == ClientMessage) {
            if (event.core.xclient.data.l[0] == wmDeleteMessage)
                break;
        } else if (event.type != 28 && event.type != 21) {
            int kk = 1;
        }

        // Locks the collection of delegations
        windowMutex->Lock();
        for (int i=0; i<delegationsToExecute->Count(); i++) {
            // Retrieve delegation and parameters
            void **item = (void **)(*delegationsToExecute)[i];
            NDelegation *d = (NDelegation *)item[0];
            void *params = item[1];

            // Execute delegation
            try {
                d->Execute(params);
            } catch (Exception *e) {
                delete e;
            }

            // Deletes delegation and item array
            delete d;
            delete item;
        }

        // Clear delegations collection and unlocks the mutex
        delegationsToExecute->Clear();
        windowMutex->Unlock();
    } while (true);

    Dispose();
}
コード例 #8
0
ファイル: client.cpp プロジェクト: HolySmoke86/blank
void InteractiveState::OnResume() {
	OnFocus();
}
コード例 #9
0
void OpDocumentEdit::OnKeyboardInputLost(OpInputContext* new_input_context, OpInputContext* old_input_context, FOCUS_REASON reason)
{
	DEBUG_CHECKER(TRUE);
	OnFocus(FALSE, reason);
}
コード例 #10
0
void NativeTabbedPaneWin::SetFocus()
{
    // Focus the associated HWND.
    OnFocus();
}