Exemple #1
0
void Dialog::close() {
	_visible = false;

	if (_mouseWidget) {
		_mouseWidget->handleMouseLeft(0);
		_mouseWidget = 0;
	}
	releaseFocus();
	g_gui.closeTopDialog();
}
Exemple #2
0
void Dialog::setFocusWidget(Widget *widget) {
	// The focus will change. Tell the old focused widget (if any)
	// that it lost the focus.
	releaseFocus();

	// Tell the new focused widget (if any) that it just gained the focus.
	if (widget)
		widget->receivedFocus();

	_focusedWidget = widget;
}
Exemple #3
0
void PediaMainForm::setControlsState(bool enabled)
{
//    backButton_.setEnabled(enabled);
//    forwardButton_.setEnabled(enabled);
    searchButton_.setEnabled(enabled);
    if (enabled)
        enableInputFieldAfterUpdate_  = true;
    else
    {
        releaseFocus();
        termInputField_.hide();
    }
}
Exemple #4
0
void TabWidget::setActiveTab(int tabID) {
	assert(0 <= tabID && tabID < (int)_tabs.size());
	if (_activeTab != tabID) {
		// Exchange the widget lists, and switch to the new tab
		if (_activeTab != -1) {
			_tabs[_activeTab].firstWidget = _firstWidget;
			releaseFocus();
		}
		_activeTab = tabID;
		_firstWidget = _tabs[tabID].firstWidget;

		_boss->draw();
	}
}
BOOL LLFloaterMessageBuilder::handleKeyHere(KEY key, MASK mask)
{
	if(key == KEY_RETURN && (mask & MASK_CONTROL))
	{
		onClickSend(this);
		return TRUE;
	}
	if(key == KEY_ESCAPE)
	{
		releaseFocus();
		return TRUE;
	}
	return FALSE;
}
Exemple #6
0
MSBoolean MSWidget::traverseFocus(MSWidget *pWidget_)
{
  if (pWidget_==inputFocus()) return MSTrue;
  else if (pWidget_!=0)
   {
     if (pWidget_->_owner==0)
      {
	pWidget_->warpTo();
	return MSTrue;
      }
     else if (pWidget_->sensitive()==MSTrue&&pWidget_->acceptFocus()==MSTrue)
      {
	return setFocus(pWidget_);
      }
   }
  else if (pWidget_==0) return releaseFocus();
  return MSFalse;
}
Exemple #7
0
void Dialog::handleMouseUp(int x, int y, int button, int clickCount) {
	Widget *w;

	if (_focusedWidget) {
		//w = _focusedWidget;

		// Lose focus on mouseup unless the widget requested to retain the focus
		if (! (_focusedWidget->getFlags() & WIDGET_RETAIN_FOCUS )) {
			releaseFocus();
		}
	}

	if (_dragWidget)
		w = _dragWidget;
	else
		w = findWidget(x, y);

	if (w)
		w->handleMouseUp(x - (w->getAbsX() - _x), y - (w->getAbsY() - _y), button, clickCount);

	_dragWidget = 0;
}
void OCamlSource::keyPressEvent ( QKeyEvent * e )
{
    switch (e->key())
    {
        case Qt::Key_Enter:
            if ( lineSearchArea->isEnabled() )
            {
                nextTextSearch();
            }
            break;
        case Qt::Key_Escape:
            if ( lineSearchArea->isEnabled() )
            {
                lineSearchArea->hide();
                lineSearchArea->setEnabled(false);
                highlighter->searchWord( QRegExp() );
            }
            else
                emit releaseFocus();
            break;

        default:
            {
                QString input_text = e->text() ;
                input_text = input_text.simplified();
                if ( !input_text.isEmpty() )
                {
                    lineSearchArea->show();
                    lineSearchArea->setEnabled(true);
                    lineSearchArea->setFocus();
                    lineSearchArea->setText( e->text() );
                }
            }
            break;
    }
    e->accept();
}
Exemple #9
0
void EditTextWidget::abortEditMode() {
	setEditString(_backupString);
	sendCommand(_cmd, 0);
	releaseFocus();
}
Exemple #10
0
void EditTextWidget::endEditMode() {
	releaseFocus();

	sendCommand(_finishCmd, 0);
}
//----[  hide  ]---------------------------------------------------------------
void EvidyonGUIHelpDialog::hide() {
  GUIModule::hide();
  releaseFocus();
}
Exemple #12
0
int TabWidget::addTab(const String &title) {
	// Add a new tab page
	Tab newTab;
	newTab.title = title;
	newTab.firstWidget = 0;

	_tabs.push_back(newTab);

	int numTabs = _tabs.size();

	// HACK: Nintendo DS uses a custom config dialog. This dialog does not work with
	// our default "Globals.TabWidget.Tab.Width" setting.
	//
	// TODO: Add proper handling in the theme layout for such cases.
	//
	// There are different solutions to this problem:
	//  - offer a "Tab.Width" setting per tab widget and thus let the Ninteno DS
	//    backend set a default value for its special dialog.
	//
	//  - change our themes to use auto width calculaction by default
	//
	//  - change "Globals.TabWidget.Tab.Width" to be the minimal tab width setting and
	//    rename it accordingly.
	//    Actually this solution is pretty similar to our HACK for the Nintendo DS
	//    backend. This hack enables auto width calculation by default with the
	//    "Globals.TabWidget.Tab.Width" value as minimal width for the tab buttons.
	//
	//  - we might also consider letting every tab button having its own width.
	//
	//  - other solutions you can think of, which are hopefully less evil ;-).
	//
	// Of course also the Ninteno DS' dialog should be in our layouting engine, instead
	// of being hard coded like it is right now.
	//
	// There are checks for __DS__ all over this source file to take care of the
	// aforemnetioned problem.
#ifdef __DS__
	if (true) {
#else
	if (g_gui.xmlEval()->getVar("Globals.TabWidget.Tab.Width") == 0) {
#endif
		if (_tabWidth == 0)
			_tabWidth = 40;
		// Determine the new tab width
		int newWidth = g_gui.getStringWidth(title) + 2 * 3;
		if (_tabWidth < newWidth)
			_tabWidth = newWidth;
		int maxWidth = _w / numTabs;
		if (_tabWidth > maxWidth)
			_tabWidth = maxWidth;
	}

	// Activate the new tab
	setActiveTab(numTabs - 1);

	return _activeTab;
}

void TabWidget::removeTab(int tabID) {
	assert(0 <= tabID && tabID < (int)_tabs.size());

	// Deactive the tab if it's currently the active one
	if (tabID == _activeTab) {
		_tabs[tabID].firstWidget = _firstWidget;
		releaseFocus();
		_firstWidget = 0;
	}

	// Dispose the widgets in that tab and then the tab itself
	delete _tabs[tabID].firstWidget;
	_tabs.remove_at(tabID);

	// Adjust _firstVisibleTab if necessary
	if (_firstVisibleTab >= (int)_tabs.size()) {
		_firstVisibleTab = MAX(0, (int)_tabs.size() - 1);
	}

	// The active tab was removed, so select a new active one (if any remains)
	if (tabID == _activeTab) {
		_activeTab = -1;
		if (tabID >= (int)_tabs.size())
			tabID = _tabs.size() - 1;
		if (tabID >= 0)
			setActiveTab(tabID);
	}

	// Finally trigger a redraw
	_boss->draw();
}
Exemple #13
0
void EditTextWidget::endEditMode() {
    releaseFocus();
}