Пример #1
0
static void handleKeyboard(void)
{
	if (app.keyboard[SDL_SCANCODE_ESCAPE] && !app.awaitingWidgetInput)
	{
		switch (show)
		{
			case SHOW_CHALLENGES:
				selectWidget("resume", "challengesMenu");
				show = SHOW_MENU;
				playSound(SND_GUI_CLOSE);
				break;

			case SHOW_MENU:
				show = SHOW_CHALLENGES;
				break;

			case SHOW_OPTIONS:
			case SHOW_STATS:
			case SHOW_TROPHIES:
				show = SHOW_MENU;
				selectWidget("resume", "challengesMenu");
				break;
		}

		playSound(SND_GUI_CLOSE);

		clearInput();
	}
}
Пример #2
0
void DDockInternalWidget::addWidget(const QString &title, QWidget *widget)
{
	QPixmap pm = widget->windowIcon().pixmap(16,16);
	Ideal::Button *button;
	if (!pm.isNull())
	{
		button = new Ideal::Button(m_bar, title, pm);
	}
	else
	{
		button = new Ideal::Button(m_bar, title);
	}

	m_bar->addButton(button);

	QDesktopWidget *desktop = new QDesktopWidget();
	
	if (widget->height() > desktop->screen(desktop->primaryScreen ())->height()-230)
	{
		QScrollArea *area = new QScrollArea(m_widgetStack);
		widget->adjustSize();
		area->setWidget(widget);
		area->setWidgetResizable(true);
		m_widgetStack->addWidget(area);
		m_widgets[button] = area;
		m_buttons[area] = button;
// 		area->setVerticalScrollBarPolicy ( Qt::ScrollBarAlwaysOn );
	}
	else
	{
		m_widgets[button] = widget;
		widget->setParent(m_widgetStack);
		m_widgetStack->addWidget(widget);
		m_buttons[widget] = button;
	}
    
	connect(button, SIGNAL(clicked()), this, SLOT(selectWidget()));
    
    //if the widget was selected last time the dock is deleted 
    //we need to show it

	QSettings config;
	config.beginGroup("DLSLib-"+objectName());
    
	if ( config.value("ViewLastWidget").toString() == title)
	{
		button->setChecked(true);
		selectWidget(button);
	}

	widget->show();
}
Пример #3
0
void
QvisCMap2Display::mousePressEvent(QMouseEvent *e)
{
    int doColor = (e->button() == Qt::MidButton) ? 1 : 0;

    for(size_t c = 0; c < cmap2.size(); ++c)
    {
        std::vector<SLIVR::CM2Widget*> &widgets = cmap2[c]->widgets();
        for(size_t w = 0; w < widgets.size(); ++w)
        {
            int obj = widgets[w]->pick1(e->x(), height() - e->y(), width(), height());
            if(obj <= 0)
                obj = widgets[w]->pick2(e->x(), height() - e->y(), width(), height(), doColor);
            if(obj > 0)
            {
                activeW = widgets[w];
                activeW->select(obj);

                ren->set_colormap2(cmap2);
                updateGL();

                // Change the cursor.
                ChangeCursor(QString(activeW->tk_cursorname(obj).c_str()));

                // Signal selection?
                emit selectWidget(LookupWidgetId(activeW));

                return;
            }          
        }
    }
}
Пример #4
0
void RegExpWidget::mousePressEvent ( TQMouseEvent* event )
{
  if ( _editorWindow->isPasteing() || _editorWindow->isInserting() )
    return;

  if ( event->button() == Qt::LeftButton ) {
    if ( ! _editorWindow->pointSelected( TQCursor::pos() ) ) {
      _editorWindow->clearSelection( true );
      if ( dynamic_cast<DragAccepter*>(this) == 0 && dynamic_cast<ConcWidget*>(this) == 0 ) {
        selectWidget( true );
      }
    }

    TQMouseEvent ev( event->type(), mapTo(_editorWindow, event->pos()),
                    event->button(), event->state());
    TQApplication::sendEvent( _editorWindow, &ev );
  }
  else if ( event->button() == Qt::RightButton ) {
    _editorWindow->showRMBMenu( true );
  }

  // currently (TQt3.0) it seems like qt do not accept that the accept flag is set,
  // and thus sends the event to the parent - given that the following line is in.
  // It doesn't make any change to leave it out.
  // 25 Oct. 2001 19:03 -- Jesper K. Pedersen
  //  TQWidget::mousePressEvent( event );
}
Пример #5
0
void DDockInternalWidget::selectWidget()
{
	Ideal::Button* bTmp = qobject_cast<Ideal::Button *>(sender());
	if  (bTmp )
	{
		selectWidget(bTmp);
	}
}
Пример #6
0
static void trophies(void)
{
	selectWidget("ok", "trophies");

	show = SHOW_TROPHIES;

	initTrophiesDisplay();
}
Пример #7
0
static void stats(void)
{
	selectWidget("ok", "stats");

	show = SHOW_STATS;

	initStatsDisplay();
}
Пример #8
0
static void options(void)
{
	selectWidget("ok", "options");
	
	show = SHOW_OPTIONS;
	
	initOptions(returnFromOptions);
}
Пример #9
0
void DDockInternalWidget::raiseWidget(QWidget *widget)
{
	Ideal::Button *button = m_buttons[widget];
	if ((button != 0) && (!button->isChecked()))
	{
		button->setChecked(true);
		selectWidget(button);
	}
}
Пример #10
0
void initOptions(void (*rtn)(void))
{
	char optionStr[MAX_NAME_LENGTH];

	selectWidget("windowSize", "options");

	getWidget("windowSize", "options")->onChange = changeWindowSize;
	getWidget("soundVolume", "options")->onChange = changeSoundVolume;
	getWidget("musicVolume", "options")->onChange = changeMusicVolume;
	getWidget("fullscreen", "options")->onChange = changeFullscreen;
	getWidget("controls", "options")->action = controls;
	getWidget("ok", "options")->action = ok;
	getWidget("ok", "controls")->action = controlsOK;

	sprintf(optionStr, "%d x %d", app.winWidth, app.winHeight);
	setWidgetOption("windowSize", "options", optionStr);

	sprintf(optionStr, "%d", app.soundVolume);
	setWidgetOption("soundVolume", "options", optionStr);

	sprintf(optionStr, "%d", app.musicVolume);
	setWidgetOption("musicVolume", "options", optionStr);

	setWidgetOption("fullscreen", "options", app.fullscreen ? "On" : "Off");
	
	OPTIONS_TEXT = _("Options");
	RESOLUTION_TEXT = _("Note: you must restart the game for window size and fullscreen options to take effect.");

	#if FIXED_RESOLUTION
	getWidget("windowSize", "options")->enabled = 0;
	getWidget("fullscreen", "options")->enabled = 0;
	RESOLUTION_TEXT = _("Note: this device does not support changing the screen resolution.");
	#endif

	returnFromOptions = rtn;
	
	show = SHOW_MAIN;
}
Пример #11
0
static void returnFromOptions(void)
{
	show = SHOW_MENU;

	selectWidget("resume", "challengesMenu");
}
Пример #12
0
static void ok(void)
{
	selectWidget("resume", "challengesMenu");

	show = SHOW_MENU;
}
Пример #13
0
static void statsOK(void)
{
	selectWidget("stats", "title");
	
	show = SHOW_TITLE;
}