Beispiel #1
0
bool kGUIMenuObj::UpdateInput(void)
{
	int i;
	kGUICorners c;
	kGUICorners tc;
	bool over;

	GetCorners(&c);

	/* is the mouse over the title area? */
	over=kGUI::MouseOver(&c);
	if(over)
	{
		/* if i'm not active then activate me */
		/* I need to be active so I can track the mouse when it moves */
		/* off of the header area so I can unhilight the last header under the cursor */
		if(m_track==false)
		{
			m_track=true;
			kGUI::AddUpdateTask(this,CALLBACKNAME(Track));
		}
		/* yes they have mouse over the tabs on the top */
		/* which tab is the mouse over? (if any) */
		for(i=0;i<m_numentries;++i)
		{
			tc.lx=c.lx+m_titlex.GetEntry(i);
			tc.rx=tc.lx+m_titlew.GetEntry(i);
			tc.ty=c.ty;
			tc.by=c.by;

			if(kGUI::MouseOver(&tc))
			{
				/* yes mouse is over this column */
				if(i!=m_colhover)
				{
					Dirty();
					m_colhover=i;
					if(m_depth)
					{
						CloseMenu();
						OpenMenu(m_entry.GetEntry(i),tc.lx,tc.by);
					}
				}

				/* are they clicking on the menu header? */
				if(kGUI::GetMouseClickLeft()==true)
				{
					kGUI::SetForceUsed(true);
					if(!m_depth)
						OpenMenu(m_entry.GetEntry(i),tc.lx,tc.by);
					else
						CloseMenu();
				}
				return(true);
			}
		}
	}
	return(false);
}
Beispiel #2
0
	bool cWidgetComboBox::ButtonPress(iWidget* apWidget,cGuiMessageData& aData)
	{
		if(mbMenuOpen)	CloseMenu();
		else			OpenMenu();

		return true;
	}
Beispiel #3
0
	bool cWidgetComboBox::SliderLostFocus(iWidget *a_pWidget, cGuiMessageData &a_Data)
	{
		if (m_bMenuOpen && GetMouseIsOver() == false)
			CloseMenu();

		return false;
	}
Beispiel #4
0
void CellTasksScreen::OnStartTaskCallback(cocos2d::Ref *sender, cocos2d::ui::Widget::TouchEventType eventType)
{
	if (eventType == cocos2d::ui::Widget::TouchEventType::ENDED)
	{
		if (_cell.lock()->GetInfo().state == Cell::State::READY)
		{
			if (World::Instance().GetTutorialManager().IsTutorialStateAvailable("ReadyToFinishFirstRealWork"))
			{
				World::Instance().GetTutorialManager().RemoveCurrentTutorial();
			}
			else if (World::Instance().GetTutorialManager().IsTutorialStateAvailable("WaitingForFinishFirstTask"))
			{
				World::Instance().GetTutorialManager().RemoveCurrentTutorial();
			}

			cocos2d::ui::Button *btn = dynamic_cast<cocos2d::ui::Button *>(sender);
			if (!btn) {
				WRITE_WARN("Failed to cast from sender to button type in StartTaskCallback.");
				return;
			}
			const Task::Info *task_info = (const Task::Info *)btn->getUserData();
			if (!task_info) {
				WRITE_WARN("Failed to get pointer to a task info from sender object in StartTaskCallback");
				return;
			}

			World::Instance().GetTaskManager().RunTask(_cell, task_info, Utils::GetGameTime());
			CloseMenu();
			_cellMenu->DisappearWithAnimation();

			CocosDenshion::SimpleAudioEngine::getInstance()->playEffect("task-get.wav");
		}
	}
}
Beispiel #5
0
void UserWidget::LaunchItem(QString cmd){
  if(!cmd.isEmpty()){
    qDebug() << "Launch Application:" << cmd;
    LSession::LaunchApplication(cmd);
    emit CloseMenu(); //so the menu container will close
  }
}
Beispiel #6
0
static void
OpenMenu(AG_HSVPal *pal, int x, int y)
{
	if (pal->menu != NULL)
		CloseMenu(pal);

	pal->menu = AG_MenuNew(NULL, 0);
	pal->menu_item = AG_MenuNode(pal->menu->root, NULL, NULL);
	{
#if 0
		AG_MenuAction(pal->menu_item, _("Edit numerically"), NULL,
		    EditNumValues, "%p", pal);
#endif
		AG_MenuAction(pal->menu_item, _("Copy color"), agIconSave.s,
		    CopyColor, "%p", pal);
		AG_MenuAction(pal->menu_item, _("Paste color"), agIconLoad.s,
		    PasteColor, "%p", pal);
		AG_MenuAction(pal->menu_item, _("Complementary color"), NULL,
		    SetComplementaryColor, "%p", pal);
		AG_MenuSeparator(pal->menu_item);
		AG_MenuFlags(pal->menu_item, _("Show RGB value"), agIconMagnifier.s,
		    &pal->flags, AG_HSVPAL_SHOW_RGB, 0);
		AG_MenuFlags(pal->menu_item, _("Show HSV value"), agIconMagnifier.s,
		    &pal->flags, AG_HSVPAL_SHOW_HSV, 0);
	}
	pal->menu->itemSel = pal->menu_item;
	pal->menu_win = AG_MenuExpand(pal, pal->menu_item, x, y);
}
Beispiel #7
0
LUserButtonPlugin::LUserButtonPlugin(QWidget *parent, QString id, bool horizontal) : LPPlugin(parent, id, horizontal){
  button = new QToolButton(this);
    button->setAutoRaise(true);
    button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    button->setPopupMode(QToolButton::DelayedPopup); //make sure it runs the update routine first
    connect(button, SIGNAL(clicked()), this, SLOT(openMenu()));
    this->layout()->setContentsMargins(0,0,0,0);
    this->layout()->addWidget(button);
  menu = new QMenu(this);
    menu->setContentsMargins(1,1,1,1);
    connect(menu, SIGNAL(aboutToHide()), this, SIGNAL(MenuClosed()));
  usermenu = new UserWidget(this);
    connect(usermenu, SIGNAL(CloseMenu()), this, SLOT(closeMenu()) );
  mact = new QWidgetAction(this);
    mact->setDefaultWidget(usermenu);
    menu->addAction(mact);
	
  button->setMenu(menu);
  connect(menu, SIGNAL(aboutToHide()), this, SLOT(updateButtonVisuals()) );
  //Setup the global shortcut handling for opening the start menu
  connect(QApplication::instance(), SIGNAL(StartButtonActivated()), this, SLOT(shortcutActivated()) );
  LSession::handle()->registerStartButton(this->type());

  QTimer::singleShot(0,this, SLOT(OrientationChange())); //Update icons/sizes
}
bool C4Object::Exit(int32_t iX, int32_t iY, int32_t iR, C4Real iXDir, C4Real iYDir, C4Real iRDir, bool fCalls)
{
	// 1. Exit the current container.
	// 2. Update Contents of container object and set Contained to nullptr.
	// 3. Set offset position/motion if desired.
	// 4. Call Ejection for container and Departure for object.

	// Not contained
	C4Object *pContainer=Contained;
	if (!pContainer) return false;
	// Remove object from container
	pContainer->Contents.Remove(this);
	pContainer->UpdateMass();
	pContainer->SetOCF();
	// No container
	Contained=nullptr;
	// Position/motion
	fix_x=itofix(iX); fix_y=itofix(iY);
	fix_r=itofix(iR);
	BoundsCheck(fix_x, fix_y);
	xdir=iXDir; ydir=iYDir; rdir=iRDir;
	// Misc updates
	Mobile=true;
	InLiquid=false;
	CloseMenu(true);
	UpdateFace(true);
	SetOCF();
	// Object list callback (before script callbacks, because script callbacks may enter again)
	ObjectListChangeListener.OnObjectContainerChanged(this, pContainer, nullptr);
	// Engine calls
	if (fCalls) pContainer->Call(PSF_Ejection,&C4AulParSet(this));
	if (fCalls) Call(PSF_Departure,&C4AulParSet(pContainer));
	// Success (if the obj wasn't "re-entered" by script)
	return !Contained;
}
Beispiel #9
0
bool MenuBar::HotKey(dword key)
{
	if(Ctrl::HotKey(key))
		return true;
	if(IsChild()) {
		if((key == (K_ALT_KEY|K_KEYUP) || key == K_F10) && (submenu || HasFocusDeep())) {
			LLOG("CloseMenu()");
			CloseMenu();
			if(restorefocus)
				restorefocus->SetFocus();
			s_doaltkey = false;
			return true;
		}
		if(key == K_ALT_KEY) {
			LLOG("K_ALT_KEY");
			s_doaltkey = true;
			return true;
		}
		if((key == K_F10 || key == (K_ALT_KEY|K_KEYUP) && s_doaltkey)
		   && !submenu && !HasFocusDeep() && GetTopWindow() && GetTopWindow()->IsForeground()) {
			LLOG("Open menu by F10 or ALT-UP");
			SetupRestoreFocus();
			for(Ctrl *q = pane.GetFirstChild(); q; q = q->GetNext())
				if(q->SetFocus()) return true;
		}
	}
	LLOG("MenuBar::HotKey");
	return (key == K_LEFT || key == K_RIGHT) && parentmenu ? parentmenu->Key(key, 1) : false;
}
Beispiel #10
0
//Locale
void StartMenu::on_combo_locale_currentIndexChanged(int){
  //Get the currently selected Locale
  if(ui->stackedWidget->currentWidget()!=ui->page_settings){ return; }
  QString locale = ui->combo_locale->currentData().toString();
  emit CloseMenu();
  LSession::handle()->switchLocale(locale);
}
Beispiel #11
0
void UserWidget::LaunchItem(QString path, bool fix){
  if(!path.isEmpty()){
    qDebug() << "Launch Application:" << path;
    if(fix){ LSession::LaunchApplication("lumina-open \""+path+"\""); }
    else{ LSession::LaunchApplication(path); }
    emit CloseMenu(); //so the menu container will close
  }
}
Beispiel #12
0
void CellTasksScreen::KeyReleased(cocos2d::EventKeyboard::KeyCode key, cocos2d::Event *event)
{
	if (key == cocos2d::EventKeyboard::KeyCode::KEY_ESCAPE)
	{
		CloseMenu();
		CocosDenshion::SimpleAudioEngine::getInstance()->playEffect("tap-double.wav");
	}
}
Beispiel #13
0
void CellTasksScreen::OnCloseCallback(cocos2d::Ref *sender, cocos2d::ui::Widget::TouchEventType eventType)
{
	if (eventType == cocos2d::ui::Widget::TouchEventType::ENDED)
	{
		CloseMenu();
		CocosDenshion::SimpleAudioEngine::getInstance()->playEffect("tap-double.wav");
	}
}
Beispiel #14
0
void DeviceWidget::OpenTrayClicked(){  
  //Open the CD tray
  if(isMounted){ mountButtonClicked(); } //unmount the device before opening the tray
  if(isMounted){ return; } //Could not unmount device: don't open the tray
  QProcess::startDetached("cdcontrol eject /dev/"+node());
  emit CloseMenu();
  emit RefreshDeviceList();
}
Beispiel #15
0
void
nsMenuFrame::ToggleMenuState()
{
  if (IsOpen())
    CloseMenu(PR_FALSE);
  else
    OpenMenu(PR_FALSE);
}
bool C4FullScreen::ViewportCheck()
{
	int iPlrNum; C4Player *pPlr;
	// Not active
	if (!Active) return false;
	// Determine film mode
	bool fFilm = (Game.C4S.Head.Replay && Game.C4S.Head.Film);
	// Check viewports
	switch (::Viewports.GetViewportCount())
	{
		// No viewports: create no-owner viewport
	case 0:
		iPlrNum = NO_OWNER;
		// Film mode: create viewport for first player (instead of no-owner)
		if (fFilm)
			if ((pPlr = ::Players.First))
				iPlrNum = pPlr->Number;
		// Create viewport
		::Viewports.CreateViewport(iPlrNum, iPlrNum==NO_OWNER);
		// Non-film (observer mode)
		if (!fFilm)
		{
			// Activate mouse control
			::MouseControl.Init(iPlrNum);
			// Display message for how to open observer menu (this message will be cleared if any owned viewport opens)
			StdStrBuf sKey;
			sKey.Format("<c ffff00><%s></c>", Game.KeyboardInput.GetKeyCodeNameByKeyName("FullscreenMenuOpen", false).getData());
			::GraphicsSystem.FlashMessage(FormatString(LoadResStr("IDS_MSG_PRESSORPUSHANYGAMEPADBUTT"), sKey.getData()).getData());
		}
		break;
		// One viewport: do nothing
	case 1:
		break;
		// More than one viewport: remove all no-owner viewports
	default:
		::Viewports.CloseViewport(NO_OWNER, true);
		break;
	}
	// Look for no-owner viewport
	C4Viewport *pNoOwnerVp = ::Viewports.GetViewport(NO_OWNER);
	// No no-owner viewport found
	if (!pNoOwnerVp)
	{
		// Close any open fullscreen menu
		CloseMenu();
	}
	// No-owner viewport present
	else
	{
		// movie mode: player present, and no valid viewport assigned?
		if (Game.C4S.Head.Replay && Game.C4S.Head.Film && (pPlr = ::Players.First))
			// assign viewport to joined player
			pNoOwnerVp->Init(pPlr->Number, true);
	}
	// Done
	return true;
}
Beispiel #17
0
	bool cWidgetComboBox::OnLostFocus(cGuiMessageData &a_Data)
	{
		cVector3f vLocal = WorldToLocalPosition(a_Data.m_vPos);

		if (m_bMenuOpen &&m_pSlider->IsEnabled()==false)
			CloseMenu();

		return false;
	}
Beispiel #18
0
// ========================
//        PRIVATE SLOTS
// ========================
void StartMenu::LaunchItem(QString path, bool fix){
  qDebug() << "Launching Item:" << path << fix;
  if(!path.isEmpty()){
    qDebug() << "Launch Application:" << path;
    if( fix && !path.startsWith("lumina-open") ){ LSession::LaunchApplication("lumina-open \""+path+"\""); }
    else{ LSession::LaunchApplication(path); }
    emit CloseMenu(); //so the menu container will close
  }
}
bool C4FullScreen::ActivateMenuMain()
{
	// Not during game over dialog
	if (C4GameOverDlg::IsShown()) return false;
	// Close previous
	CloseMenu();
	// Open menu
	pMenu = new C4MainMenu();
	return pMenu->ActivateMain(NO_OWNER);
}
BOOL C_PopupMgr::OpenWindowMenu(C_Window *win,long x,long y)
{
	POPUPMENU *cur;
	long i;

	if(!win) return(FALSE);
	if(win->IsMenu())
		return(FALSE);

	CloseMenu();

	if(!AMenuOpened())
	{
		for(i=0;i<WIN_MAX_CLIENTS;i++)
		{
			if((x-win->GetX()) >= win->ClientArea_[i].left && (y-win->GetY()) >= win->ClientArea_[i].top &&
				(x-win->GetX()) < win->ClientArea_[i].right && (y-win->GetY()) < win->ClientArea_[i].bottom &&
				win->GetClientMenu(i) && (win->GetClientFlags(i) & C_BIT_ENABLED))
			{
				cur=Root_;
				while(cur)
				{
					if(cur->Menu->GetID() == win->GetClientMenu(i))
					{
						Current_=cur;
						Current_->Menu->OpenWindow(static_cast<short>(x-20),static_cast<short>(y-5),C_TYPE_RIGHT);//! 
						CurrentType_=C_TYPE_WINDOW;
						CurrentClient_=static_cast<short>(i);//! 
						LastX_=static_cast<short>(x);//! 
						LastY_=static_cast<short>(y);//! 
						return(TRUE);
					}
					cur=cur->Next;
				}
			}
		}
		cur=Root_;
		while(cur)
		{
			if(cur->Menu->GetID() == win->GetMenu())
			{
				CurrentType_=C_TYPE_WINDOW;
				CurrentClient_=-1;
				Current_=cur;
				Current_->Menu->OpenWindow(static_cast<short>(x-20),static_cast<short>(y-5),C_TYPE_RIGHT);//! 
				LastX_=static_cast<short>(x);//! 
				LastY_=static_cast<short>(y);//! 
				return(TRUE);
			}
			cur=cur->Next;
		}
	}
	return(FALSE);
}
Beispiel #21
0
	bool cWidgetComboBox::OnMouseDown(cGuiMessageData &a_Data)
	{
		if (m_bMenuOpen==false) return false;

		cVector3f vLocal = WorldToLocalPosition(a_Data.m_vPos);

		if (vLocal.y < m_pText->GetSize().y)
			CloseMenu();

		return true;
	}
Beispiel #22
0
void MenuBar::Execute(Ctrl *owner, Point p)
{
	static Vector<Ctrl *> ows; // Used to prevent another open local menu for single owner to be opened (repeated right-click)
	int level = ows.GetCount();
	if(IsEmpty() || FindIndex(ows, owner) >= 0)
		return;
	ows.Add(owner);
	PopUp(owner, p);
	EventLoop(this);
	CloseMenu();
	ows.SetCount(level);
}
Beispiel #23
0
func Geld(iGeld)
{
	CanClose = 1;
	CloseMenu(GetCursor());
	Log("<c ffcc00>%d Clunker Geld</c>",iGeld);
	var i;
	while(i < GetPlayerCount())
	{
		SetWealth(i,iGeld);
		i++;
	}
}
Beispiel #24
0
	bool cWidgetComboBox::OnMouseUp(cGuiMessageData &aData)
	{
		if(mbMenuOpen == false) return false;

		cVector3f vLocal = WorldToLocalPosition(aData.mvPos);

		if(vLocal.y > mpText->GetSize().y)
		{
			SetSelectedItem(mlMouseOverSelection);
			CloseMenu();
		}

		return true;
	}
Beispiel #25
0
func Zeit(int iZeit)
{
	CanClose = 1;
	CloseMenu(GetCursor());
	Log("<c ffcc00>%d Minuten Aufbauzeit</c>",iZeit);
	SetTime(iZeit,0);
	CreateMenu(MEPU, GetCursor(), 0, 0,"Geldeinstellungen", 0, 1,1,17);
	CanClose = 0;
	AddMenuItem("100 Clunker", Format("Geld(%d)",100),MEPU, GetCursor());
	AddMenuItem("200 Clunker", Format("Geld(%d)",200),MEPU, GetCursor());
	AddMenuItem("500 Clunker", Format("Geld(%d)",500),MEPU, GetCursor());
	AddMenuItem("1000 Clunker", Format("Geld(%d)",1000),MEPU, GetCursor());
	AddMenuItem("2000 Clunker", Format("Geld(%d)",2000),MEPU, GetCursor());
}
Beispiel #26
0
void DeviceWidget::runButtonClicked(){
  //Run the device (audio/video CD, browse filesystem)
  if(isMounted){ 
    //Open the mountpoint directory
    QProcess::startDetached("xdg-open \""+mountpoint()+"\"");
  }else if(type()=="CD-AUDIO"){
    if(QFile::exists("/usr/local/bin/vlc")){ QProcess::startDetached("vlc cdda://1");}
    else if(QFile::exists("/usr/local/bin/smplayer")){ QProcess::startDetached("smplayer cdda://1"); }
    else{ QProcess::startDetached("xdg-open cdda://1"); }
  }else if(type()=="CD-VIDEO"){
    if(QFile::exists("/usr/local/bin/vlc")){ QProcess::startDetached("vlc dvd://1");}
    else if(QFile::exists("/usr/local/bin/smplayer")){ QProcess::startDetached("smplayer dvd://1"); }
    else{ QProcess::startDetached("xdg-open dvd://1"); }
  }
  emit CloseMenu();
}
int TryMenu(int button, int pressed)
{
   if(ActiveMenu && !pressed) {
      ActiveMenu = 0;
      CloseMenu();
      Redisplay = 1;
      return 1;
   }

   if(AttachedMenus[button] && pressed) {
      ActiveMenu = AttachedMenus[button];
      OpenMenu();
      Redisplay = 1;
      return 1;
   }
   return 0;
}
Beispiel #28
0
void Game::Update() {

	int sessions = _activeSessions.size();
	for (int i = 0; i < sessions; i++){
		_activeSessions[i]->Update();
	}

	int menus = _activeMenus.size();
	if (menus > 0 && _input->JustPressed(InputHandler::CloseMenu)) {
		CloseMenu();
		menus = _activeMenus.size();
	}
	else if (menus == 0 && sessions > 0 && _input->JustPressed(InputHandler::OpenIngameMenu)) {
		_activeMenus.push_back(_ingameMenu);
		menus = _activeMenus.size();
	}
	
	if (!_activeMenus.empty()) _activeMenus[menus - 1]->Update();
}
void TLMenu::TMenuController::Update()
{
	if(m_QueuedCommand.GetRef().IsValid())
	{
		if(m_QueuedCommand.GetRef() == "Open")
		{
			// Open new menu
			OpenMenu( m_QueuedCommand.GetTypeRef() );
		}
		else if(m_QueuedCommand.GetRef() == "close")
		{
			CloseMenu();
		}
		
		// Invalidate
		m_QueuedCommand.SetRef(TRef());
		m_QueuedCommand.SetTypeRef(TRef());
	}
}
Beispiel #30
0
LStartButtonPlugin::LStartButtonPlugin(QWidget *parent, QString id, bool horizontal) : LPPlugin(parent, id, horizontal){
  button = new QToolButton(this);
    button->setAutoRaise(true);
    button->setToolButtonStyle(Qt::ToolButtonIconOnly);
    button->setPopupMode(QToolButton::DelayedPopup); //make sure it runs the update routine first
    connect(button, SIGNAL(clicked()), this, SLOT(openMenu()));
    this->layout()->setContentsMargins(0,0,0,0);
    this->layout()->addWidget(button);
  menu = new QMenu(this);
    menu->setContentsMargins(1,1,1,1);
  startmenu = new StartMenu(this);
    connect(startmenu, SIGNAL(CloseMenu()), this, SLOT(closeMenu()) );
  mact = new QWidgetAction(this);
    mact->setDefaultWidget(startmenu);
    menu->addAction(mact);
	
  button->setMenu(menu);
  connect(menu, SIGNAL(aboutToHide()), this, SLOT(updateButtonVisuals()) );
  QTimer::singleShot(0,this, SLOT(OrientationChange())); //Update icons/sizes
}