예제 #1
0
bool GUIinput::EventAction(const std::string& event)
{
	if(event=="activate")
		TakeFocus();
	else if(event=="deactivate")
		ReleaseFocus();
	else if(event=="togglefocus")
	{
		if(HasFocus())
		{
			ReleaseFocus();
		}
		else
		{
			TakeFocus();
		}
	}
	else if(event=="togglehidden")
	{
		if(isHidden())
			TakeFocus();
		GUIframe::EventAction(event);
	}
	else GUIframe::EventAction(event);

	return false;
}
예제 #2
0
파일: YWidget.cpp 프로젝트: jwk000/YSLib
void
Hide(IWidget& wgt)
{
	SetVisibleOf(wgt, false);
	ReleaseFocus(wgt);
	Invalidate(wgt);
}
예제 #3
0
LRESULT EditorTacMap::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) 
{
	/* if the left mouse button is not down, then we don't want focus */
	CWnd *pCWnd = GetFocus();
	HWND hwnd = ::GetFocus();
	SHORT val = GetAsyncKeyState(VK_LBUTTON);
	if (/*(GetFocus() == this) &&*/ !(0x8000 && GetAsyncKeyState(VK_LBUTTON)))
	{
		ReleaseFocus();
	}

	switch (message)
	{
	case WM_COMMAND:
		{
			if (IDC_TGA != wParam)
			{
				/* default processing would've closed the dialog */
				return 0;
			}
		}
		break;
	}
	
	return CDialog::WindowProc(message, wParam, lParam);
}
예제 #4
0
Panel::~Panel()
{
	ReleaseFocus(this);
	listPanel.FindAndDelete(this);

#ifndef ACTOR_USES_VIRTUAL_FUNCTIONS
	Actor::~Actor();
#endif
}
예제 #5
0
void CCWidget::OnShow(bool bVisible){
	for(int i=m_Children.GetCount()-1; i>=0; i--){
		CCWidget* pCurWnd = m_Children.Get(i);
		if(pCurWnd->m_bVisible==true) pCurWnd->OnShow(bVisible);
	}

	if(bVisible==true) OnShow();
	else OnHide();

	if(bVisible==false && CCWidget::m_pFocusedWidget==this) ReleaseFocus();
}
예제 #6
0
void GUIHandler::SetFocus (int controlid)
{
  if (focusid)
    ReleaseFocus (focusid);
  Control *control = GetControl (controlid);

  if (!control)
    return;

  control->SetFocus (true);
  focusid = controlid;

}
예제 #7
0
void CCWidget::Show(bool bVisible, bool bModal){
	if(m_bVisible==bVisible){
		if(bModal==true){
			if(m_pParent!=NULL && m_pParent->GetLatestExclusive()==this)
				return;
		}
		else return;
	}

	m_bVisible = bVisible;

	if(bVisible==true && bModal==true) SetExclusive();
	else if(bVisible==false) {
		ReleaseExclusive();
		if(CCWidget::m_pFocusedWidget==this) ReleaseFocus();
	}

	OnShow(bVisible);
}
예제 #8
0
MHandler::~MHandler()
{
	SetSuper(nil);
	ReleaseFocus();
}
예제 #9
0
void GUIHandler::HandleMessageQueues (void)
{
  Control *control;
  Container *container;

  gui_message msg;

  std::list < Uint32 >::iterator refresh_iter;
  Uint32 currenttime = SDL_GetTicks ();
  bool do_refresh = false;
  for (refresh_iter = refresh_times.begin ();
       refresh_iter != refresh_times.end ();)
      {
        if (*refresh_iter < currenttime)
            {
              std::list < Uint32 >::iterator nextiter = refresh_iter;
              nextiter++;
              refresh_times.erase (refresh_iter);
              refresh_iter = nextiter;
              do_refresh = true;
            }
        else
          refresh_iter++;
      }

  if (do_refresh)
      {
        msg.type = MESSAGE_DOREFRESH;
        msg.refresh.time = currenttime;
        stack.Push (msg);
      }

  ControlList_t::iterator iter;
  for (iter = control_root.begin (); iter != control_root.end (); iter++)
    while (iter->second->stack.Pop (&msg))
      stack.Push (msg);

  while (stack.Pop (&msg))
    switch (msg.type)
        {
        case MESSAGE_CLOSEGUMP:
          CloseWindow (msg.windowaction.controlid);
          break;
        case MESSAGE_SETFOCUS:
          SetFocus (msg.windowaction.controlid);
          break;
        case MESSAGE_RELEASEFOCUS:
          ReleaseFocus (msg.windowaction.controlid);
          break;
        case MESSAGE_BRINGTOFRONT:
          BringToFront (msg.windowaction.controlid);
          break;
        case MESSAGE_QUIT:
			SDLEvent::KillApplication();
			break;
        case MESSAGE_STARTGAME:
          startflag = -1;
          break;
        case MESSAGE_CALLBACK:
          if (msg.callback.containerid)
              {
                control = GetControl (msg.callback.containerid);
                if (control)
                    {
                      if (control->getType () == CONTROLTYPE_CONTAINER)
                          {
                            container = (Container *) control;
                            control = container->GetControl (msg.callback.id);
                          }
                      else
                        control = NULL;
                    }
              }
          else
            control = GetControl (msg.callback.id);
          if (control)
            switch (msg.callback.callback_type)
                {
                case CALLBACK_ONCLICK:
                  if (control->getType () == CONTROLTYPE_BUTTON)
                    ((Button *) control)->DoOnClick ();
                  break;
                case CALLBACK_ONKEYPRESS:
                  if (control->getType () == CONTROLTYPE_INPUTFIELD)
                    ((InputField *) control)->DoOnKeyPress (msg.callback.key);
                  break;
                case CALLBACK_ONCLOSE:
                  control->DoOnClose ();
                  break;
                case CALLBACK_ONMOUSEUP:
                  control->DoOnMouseUp ();
                  break;
                case CALLBACK_ONMOUSEDOWN:
                  control->DoOnMouseDown ();
                  break;
                }
          break;
        case MESSAGE_ONDRAGITEM:
          if (callback_OnDrag)
            callback_OnDrag (msg.dragitem.itemid, msg.dragitem.model);
          drag_id = msg.dragitem.itemid;
          drag_model = msg.dragitem.model;

          break;
        case MESSAGE_ONCLICKITEM:
          if (callback_OnItemClick)
            callback_OnItemClick (msg.onclickitem.itemid,
                                  msg.onclickitem.doubleclick);
          break;
        case MESSAGE_REFRESHREQUEST:
          refresh_times.push_back (msg.refresh.time);
          break;
        default:
          HandleMessage (&msg);
        }

}