bool KNCollectionView::eventFilter(QObject *o, QEvent *e)
{
    if((e->type() == QEvent::KeyPress) && (static_cast<QKeyEvent *>(e)->key() == Key_Tab))
    {
        emit(focusChangeRequest(this));
        if(!hasFocus())   // focusChangeRequest was successful
            return true;
    }

    // header popup menu
    if(e->type() == QEvent::MouseButtonPress &&
            static_cast<QMouseEvent *>(e)->button() == RightButton &&
            o->isA("QHeader"))
    {
        mPopup->popup(static_cast<QMouseEvent *>(e)->globalPos());
        return true;
    }

    return KFolderTree::eventFilter(o, e);
}
Beispiel #2
0
/*!
   Qt paint event handler
   \param event Paint event
*/
void QwtSlider::paintEvent( QPaintEvent *event )
{
    QPainter painter( this );
    painter.setClipRegion( event->region() );

    QStyleOption opt;
    opt.init(this);
    style()->drawPrimitive(QStyle::PE_Widget, &opt, &painter, this);

    if ( d_data->scalePosition != QwtSlider::NoScale )
    {
        if ( !d_data->sliderRect.contains( event->rect() ) )
            scaleDraw()->draw( &painter, palette() );
    }

    drawSlider( &painter, d_data->sliderRect );

    if ( hasFocus() )
        QwtPainter::drawFocusRect( &painter, this, d_data->sliderRect );
}
Beispiel #3
0
void LocationBar::paintEvent(QPaintEvent *event)
{
    QPainter painter(this);

    QPalette p = palette();
    QColor backgroundColor = m_defaultBaseColor;
    if (m_webView && m_webView->url().scheme() == QLatin1String("https")
        && p.brush(QPalette::Text) == Qt::black) {
        QColor lightYellow(248, 248, 210);
        backgroundColor = lightYellow;
    }

    // paint the text background
    QStyleOptionFrameV2 panel;
    initStyleOption(&panel);
    QRect backgroundRect = style()->subElementRect(QStyle::SE_LineEditContents, &panel, this);
    int left = textMargin(LineEdit::LeftSide);
    int right = textMargin(LineEdit::RightSide);
    backgroundRect.adjust(-left, 0, right, 0);
    painter.setBrush(backgroundColor);
    painter.setPen(backgroundColor);
    painter.drawRect(backgroundRect);

    // paint the progressbar
    if (m_webView && !hasFocus()) {
        int progress = m_webView->progress();
        QColor loadingColor = QColor(116, 192, 250);
        if (p.brush(QPalette::Text) != Qt::black)
            loadingColor = m_defaultBaseColor.value() < 128 ? m_defaultBaseColor.lighter(200) : m_defaultBaseColor.darker(200);

        painter.setBrush(generateGradient(m_defaultBaseColor, loadingColor, height()));
        painter.setPen(Qt::transparent);

        int mid = backgroundRect.width() / 100 * progress;
        QRect progressRect = QRect(backgroundRect.x(), backgroundRect.y(), mid, backgroundRect.height());
        painter.drawRect(progressRect);
    }
    painter.end();

    LineEdit::paintEvent(event);
}
/*
    Pass the update straight on to the SpinBox unless the user is changing it.
    Note, it would not be common to have a user editing a regularly updating
    value. However, this scenario should be allowed for. A reasonable reason
    for a user modified value to update on a gui is if is is written to by
    another user on another gui.
    This is the slot used to recieve data updates from a QCaObject based class.
    This is the slot used to recieve data updates from a QCaObject based class.
*/
void QESpinBox::setValueIfNoFocus( const double& value, QCaAlarmInfo& alarmInfo, QCaDateTime&, const unsigned int& ) {

    // Set the limits and step size
    QEFloating* qca = (QEFloating*)getQcaItem(0);
    double upper = qca->getControlLimitUpper();
    double lower = qca->getControlLimitLower();
    if( upper != lower)
    {
        setMaximum( qca->getControlLimitUpper() );
        setMinimum( qca->getControlLimitLower() );
    }
    setDecimalsFromPrecision( qca );
    setSuffixEgu( qca );

    // Do nothing more if doing a single shot read (done when not subscribing to get range values)
    if( ignoreSingleShotRead )
    {
        ignoreSingleShotRead = false;
        return;
    }

    // Signal a database value change to any Link widgets
    emit dbValueChanged( value );

    // Save the last database value
    lastValue = value;

    // Update the spin box only if the user is not interacting with the object.
    if( !hasFocus() ) {
        // Update the spin box
        programaticValueChange = true;
        setValue( value );
        programaticValueChange = false;

        // Note the last value seen by the user
        lastUserValue = text();
    }

    // Invoke common alarm handling processing.
    processAlarmInfo( alarmInfo );
}
Beispiel #5
0
void HelpWindow::setSource(const QUrl &name)
{
    if (name.isValid()) {
        if (name.scheme() == QLatin1String("http") || name.scheme() == QLatin1String("ftp") 
            || name.scheme() == QLatin1String("mailto") || name.path().endsWith(QLatin1String("pdf"))) {
            bool launched = QDesktopServices::openUrl(name);
            if (!launched) {
                QMessageBox::information(mw, tr("Help"),
                             tr("Unable to launch web browser.\n"),
                             tr("OK"));
            }
            return;
        }

        QFileInfo fi(name.toLocalFile());
        if (name.scheme() == QLatin1String("file") && fi.exists()) {
            if (newWindow || (shiftPressed && hasFocus())) {
                shiftPressed = false;
                mw->saveSettings();
                MainWindow *nmw = new MainWindow;
                nmw->move(mw->geometry().topLeft());
                nmw->show();
                
                if (mw->isMaximized())
                    nmw->showMaximized();
                
                nmw->setup();
                nmw->showLink(name.toString());
            } else {
                QTextBrowser::setSource(name);
                QTextBrowser::scrollToAnchor(name.fragment());
            }
            return;
        }
    }

    mw->statusBar()->showMessage(tr("Failed to open link: '%1'").arg(name.toString()), 5000);
    setHtml(tr("<div align=\"center\"><h1>The page could not be found</h1><br>"
        "<h3>'%1'</h3></div>").arg(name.toString()));
    mw->browsers()->updateTitle(tr("Error..."));
}
bool GUIScrollbarGadget::update()
{
    if (hasFocus() && GlbGUIMngr->MouseWheel_)
        scroll(-GlbGUIMngr->MouseWheel_ * 30);
    
    if (!checkDefaultUpdate())
        return false;
    
    if (isEnabled_ && mouseOver(Rect_) && !foreignUsage())
    {
        if (mouseLeft())
        {
            focus();
            
            CursorPosBias_ = GlbGUIMngr->CursorPos_ - dim::point2di(Rect_.Left, Rect_.Top + 1) - dim::point2di(BarPos_);
            
            dim::rect2di BarRect, ButtonARect, ButtonBRect, PageARect, PageBRect;
            getButtonRects(BarRect, ButtonARect, ButtonBRect, PageARect, PageBRect);
            
            if (mouseOver(BarRect))
                useFocus(USAGE_DRAG);
            else if (mouseOver(ButtonARect))
                useFocus(USAGE_FORWARDS);
            else if (mouseOver(ButtonBRect))
                useFocus(USAGE_BACKWARDS);
            else if (mouseOver(PageARect))
                scroll(-PageSize_);
            else if (mouseOver(PageBRect))
                scroll(PageSize_);
        }
    }
    
    if (usage(USAGE_DRAG))
        updateDrag();
    else if (usage(USAGE_FORWARDS))
        scroll(-3);
    else if (usage(USAGE_BACKWARDS))
        scroll(3);
    
    return true;
}
/*!
  Redraw the canvas, and focus rect
  \param painter Painter
*/
void QwtPlotCanvas::drawContents( QPainter *painter )
{
    if ( d_data->paintAttributes & PaintCached && d_data->cache
        && d_data->cache->size() == contentsRect().size() )
    {
        painter->drawPixmap( contentsRect().topLeft(), *d_data->cache );
    }
    else
    {
        QwtPlot *plot = ( ( QwtPlot * )parent() );
        const bool doAutoReplot = plot->autoReplot();
        plot->setAutoReplot( false );

        drawCanvas( painter );

        plot->setAutoReplot( doAutoReplot );
    }

    if ( hasFocus() && focusIndicator() == CanvasFocusIndicator )
        drawFocusIndicator( painter );
}
Beispiel #8
0
void BcLabel::paintEvent(QPaintEvent * event)
{
    // draw underlining if clickable
    if (!m_last && m_hover) {
        QPainter p(this);
        p.setPen(QPen(QPalette().highlight().color(), 1));
        p.drawLine(0, height() - 2, width(), height() - 2);
    }

    // unbreak painting
    QLabel::paintEvent(event);

    // focus handling
    if (hasFocus()) {
        QPainter p(this);
        QStyleOptionFocusRect opt;
        opt.initFrom(this);
        opt.backgroundColor = Qt::white;
        style()->drawPrimitive(QStyle::PE_FrameFocusRect, &opt, &p, this);
    }
}
Beispiel #9
0
void Token::paintEvent(QPaintEvent *pe)
{
    Q_UNUSED( pe )

    QPainter p( this );
    p.setBrush( Qt::NoBrush );
    p.setRenderHint( QPainter::Antialiasing );
    QColor c;
    if ( hasFocus() )
    {
        c = KColorScheme( QPalette::Active ).decoration( KColorScheme::HoverColor ).color();
    }
    else
    {
        c = palette().color( foregroundRole() );
        c.setAlpha( c.alpha() * 0.5 );
    }
    p.setPen( QPen( c, 2 ) );
    p.drawRoundedRect( rect().adjusted(1,1,-1,-1), 4, 4 );
    p.end();
}
Beispiel #10
0
void Plotter::paintEvent(QPaintEvent *pEvent)
{
    //Q_UNUSED(pEvent);
    QStylePainter painter(this);
    QColor l_objColor;
    painter.drawPixmap(0,0,pixmap);
    if(rubberBandIsShown)
    {
        painter.setPen(palette().light().color());
        painter.setBackgroundMode(Qt::TransparentMode);
        painter.fillRect(rubberBandRect,Qt::NoBrush);
        painter.drawRect(rubberBandRect.normalized());
    }
    if(hasFocus())
    {
        QStyleOptionFocusRect option;
        option.initFrom(this);
        option.backgroundColor = palette().dark().color();
        painter.drawPrimitive(QStyle::PE_FrameFocusRect,option);
    }
}
Beispiel #11
0
bool ColorBar::ScrollableView::onProcessMessage(Message* msg)
{
  switch (msg->type) {

    case JM_DRAW:
      {
        Viewport* viewport = getViewport();
        Widget* child = reinterpret_cast<Widget*>(jlist_first_data(viewport->children));
        SkinTheme* theme = static_cast<SkinTheme*>(getTheme());

        theme->draw_bounds_nw(ji_screen,
                              rc->x1, rc->y1,
                              rc->x2-1, rc->y2-1,
                              hasFocus() ? PART_EDITOR_SELECTED_NW:
                                           PART_EDITOR_NORMAL_NW, false);
      }
      return true;

  }
  return View::onProcessMessage(msg);
}
Beispiel #12
0
void LocationBar::showUrl(const QUrl &url)
{
    if (hasFocus() || url.isEmpty()) {
        return;
    }

    const QString stringUrl = convertUrlToText(url);

    if (text() == stringUrl) {
        home(false);
        return;
    }

    // Set converted url as text
    setText(convertUrlToText(url));

    // Move cursor to the start
    home(false);

    m_bookmarkIcon->checkBookmark(url);
}
Beispiel #13
0
// This is not optimized in any way. This code is not an attempt
// to write a perfect editor, so there will be no optimizations
// done here.
// Generating resize events inside the paint event is a performance
// problem. And even worse, this will always paint the entire text.
void LibUI::EditWidget::paintEvent(QPaintEvent* event) {
	if (d->doc == 0) {
		return;
	}

	QPainter painter(this);
	painter.fillRect(rect(), Qt::white);
	painter.setPen(Qt::black);

	const QFontMetrics fm(font());
	const int margin = 2;
	int y = margin;
	int maxX = 0;
	for (int lineno = 0; lineno < d->doc->lineCount(); ++lineno) {
		QString line(d->doc->lineAt(lineno));
		const QString cursorLine = line + ' ';

		if (d->cursor.y() == lineno) {
			// Draw the cursor
			const int left = fm.width(cursorLine, d->cursor.x()) + margin;
			const int width = fm.width(cursorLine[d->cursor.x()]);
			if (hasFocus()) {
				painter.fillRect(left, y, width, fm.height(), Qt::red);
			} else {
				painter.setPen(Qt::red);
				painter.drawRect(left, y, width, fm.height());
				painter.setPen(Qt::black);
			}
		}

		maxX = qMax(maxX, fm.width(cursorLine));
		painter.drawText(margin, y + fm.ascent(), line);
		y += fm.lineSpacing();
	}

	const QSize newWidgetSize(maxX, y + margin);
	if (newWidgetSize != size()) {
		setMinimumSize(newWidgetSize);
	}
}
Beispiel #14
0
void FindBar::setVisible(bool visible)
{
    if (visible && m_mainWindow->currentTab()->page()->isOnRekonqPage() && m_mainWindow->currentTab()->part() != 0)
    {
        // findNext is the slot containing part integration code
        m_mainWindow->findNext();
        return;
    }
    
    QWidget::setVisible(visible);

    if (visible)
    {
        const QString selectedText = m_mainWindow->selectedText();
        if (!hasFocus() && !selectedText.isEmpty())
        {
            const QString previousText = m_lineEdit->text();
             m_lineEdit->setText(selectedText);

             if (m_lineEdit->text() != previousText)
                 m_mainWindow->findPrevious();
             else
                 m_mainWindow->updateHighlight();;
        }
        else if (selectedText.isEmpty())
        {
            emit searchString(m_lineEdit->text());
        }

        m_hideTimer->start(60000);

        m_lineEdit->setFocus();
        m_lineEdit->selectAll();
    }
    else
    {
        m_mainWindow->updateHighlight();;
        m_hideTimer->stop();
    }
}
Beispiel #15
0
BOOL LLComboBox::handleKeyHere(KEY key, MASK mask)
{
	BOOL result = FALSE;
	if (hasFocus())
	{
		if (mList->getVisible() 
			&& key == KEY_ESCAPE && mask == MASK_NONE)
		{
			hideList();
			return TRUE;
		}
		//give list a chance to pop up and handle key
		LLScrollListItem* last_selected_item = mList->getLastSelectedItem();
		if (last_selected_item)
		{
			// highlight the original selection before potentially selecting a new item
			mList->mouseOverHighlightNthItem(mList->getItemIndex(last_selected_item));
		}
		result = mList->handleKeyHere(key, mask);

		// will only see return key if it is originating from line editor
		// since the dropdown button eats the key
		if (key == KEY_RETURN)
		{
			// don't show list and don't eat key input when committing
			// free-form text entry with RETURN since user already knows
            // what they are trying to select
			return FALSE;
		}
		// if selection has changed, pop open list
		else if (mList->getLastSelectedItem() != last_selected_item 
					|| ((key == KEY_DOWN || key == KEY_UP)
						&& mList->getCanSelect()
						&& !mList->isEmpty()))
		{
			showList();
		}
	}
	return result;
}
void
RemapImage::mouseMoveEvent(QMouseEvent *event)
{
  if (!hasFocus())
    setFocus();

  //QPoint pp = mapFromParent(event->pos());
  QPoint pp = event->pos();
  float ypos = pp.y();
  float xpos = pp.x();

  m_cursorPos = pp;

  if (m_button == Qt::LeftButton)
    {
      if (m_rubberBandActive)
	{
	  updateRubberBand(xpos, ypos);
	  update();
	  return;
	}
    }
  else if (m_button == Qt::RightButton)
    {
      if (validPickPoint(xpos, ypos))
	{
	  emit getRawValue(m_pickDepth,
			   m_pickWidth,
			   m_pickHeight);
	  update();
	  return;
	}
    }
  
  if (m_pickPoint)
    {
      m_pickPoint = false;
      update();
    }
}
Beispiel #17
0
void PosEditor::paintEvent(QPaintEvent *)
      {
      if (pm->isNull())
            return;

      const QColorGroup & cg = colorGroup();
      QPainter p(pm);
      p.setPen(colorGroup().text());
      QBrush bg = cg.brush(QColorGroup::Base);

      int fw = frm ? style()->pixelMetric(QStyle::PM_DefaultFrameWidth) : 0;
      int x = 2 + fw;
      int y = 0;
      int w = width();
      int h = height();
      p.fillRect(0, 0, w, h, bg);

      for (int i = 0; i < sections.count(); ++i) {
            QRect bb;
            QString s = cw->sectionFormattedText(i);

            if (hasFocus() && (int(i) == focusSec)) {
                  QBrush bg = cg.brush(QColorGroup::Highlight);
                  QRect r = p.boundingRect(x, y, w, h, Qt::AlignVCenter|Qt::AlignLeft, s, -1);
                  p.setPen(colorGroup().highlightedText());
                  p.fillRect(r, bg);
                  }
            else
                  p.setPen(colorGroup().text());
            p.drawText(x, y, w, h, Qt::AlignVCenter|Qt::AlignLeft, s, -1, &bb);
            x = bb.x() + bb.width();
            if (i < sections.count()-1) {
                  QString s = sep;
                  p.drawText(x, y, w, h, Qt::AlignVCenter|Qt::AlignLeft, s, -1, &bb);
                  x = bb.x() + bb.width();
                  }
            }
      p.end();
      bitBlt(this, 0, 0, pm);
      }
Beispiel #18
0
/*!
   Paint the dial
   \param event Paint event
*/
void QwtDial::paintEvent( QPaintEvent *event )
{
    QPainter painter( this );
    painter.setClipRegion( event->region() );

    QStyleOption opt;
    opt.init(this);
    style()->drawPrimitive(QStyle::PE_Widget, &opt, &painter, this);

    painter.setRenderHint( QPainter::Antialiasing, true );

    painter.save();
    drawContents( &painter );
    painter.restore();

    painter.save();
    drawFrame( &painter );
    painter.restore();

    if ( hasFocus() )
        drawFocusIndicator( &painter );
}
void KisAbstractSliderSpinBox::paintEvent(QPaintEvent* e)
{
    Q_D(KisAbstractSliderSpinBox);
    Q_UNUSED(e)

    QPainter painter(this);

    //Create options to draw spin box parts
    QStyleOptionSpinBox spinOpts = spinBoxOptions();

    //Draw "SpinBox".Clip off the area of the lineEdit to avoid double
    //borders being drawn
    painter.save();
    painter.setClipping(true);
    QRect eraseRect(QPoint(rect().x(), rect().y()),
                    QPoint(progressRect(spinOpts).right(), rect().bottom()));
    painter.setClipRegion(QRegion(rect()).subtracted(eraseRect));
    style()->drawComplexControl(QStyle::CC_SpinBox, &spinOpts, &painter, d->dummySpinBox);
    painter.setClipping(false);
    painter.restore();


    //Create options to draw progress bar parts
    QStyleOptionProgressBar progressOpts = progressBarOptions();

    //Draw "ProgressBar" in SpinBox
    style()->drawControl(QStyle::CE_ProgressBar, &progressOpts, &painter, 0);

    //Draw focus if necessary
    if (hasFocus() &&
            d->edit->hasFocus()) {
        QStyleOptionFocusRect focusOpts;
        focusOpts.initFrom(this);
        focusOpts.rect = progressOpts.rect;
        focusOpts.backgroundColor = palette().color(QPalette::Window);
        style()->drawPrimitive(QStyle::PE_FrameFocusRect, &focusOpts, &painter, this);
    }

}
Beispiel #20
0
//------------------------------------------------------------------------------
bool
WTextInput::handleKeyEvent(KEY key, bool state)
{
	if(!hasFocus() || !state) return false;

	if(this->cursor > this->text.size()) this->cursor = this->text.size();

	if(key == KEY_BACKSPACE && this->cursor > 0)
	{
		this->text.erase(this->cursor-1, 1);
		this->cursor--;
	}
	else if(key == KEY_DELETE && this->cursor < this->text.size())
	{
		this->text.erase(this->cursor, 1);
	}
	else if(key == KEY_LEFT && this->cursor > 0)
		this->cursor--;
	else if(key == KEY_RIGHT && this->cursor < this->text.size())
		this->cursor++;
	else if(key == KEY_END)
		this->cursor = this->text.size();
	else if(key == KEY_HOME)
		this->cursor = 0;
	else if(isReadable(key))
	{
		string t = keyToString(key);

		if(kernel->inputMgr->isShiftOrCapsPressed())
			boost::to_upper(t);

		this->text.insert(this->cursor, t);
		this->cursor += t.size();
	}

	this->render();

	return true;
};
Beispiel #21
0
void LLSlider::draw()
{
	// since thumb image might still be decoding, need thumb to accomodate image size
	updateThumbRect();

	// Draw background and thumb.

	// drawing solids requires texturing be disabled
	gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);

	F32 opacity = getEnabled() ? 1.f : 0.3f;
	LLColor4 center_color = (mThumbCenterColor % opacity);
	LLColor4 track_color = (mTrackColor % opacity);

	// Track
	LLRect track_rect(mThumbImage->getWidth() / 2, 
						getLocalRect().getCenterY() + (mTrackImage->getHeight() / 2), 
						getRect().getWidth() - mThumbImage->getWidth() / 2, 
						getLocalRect().getCenterY() - (mTrackImage->getHeight() / 2) );
	LLRect highlight_rect(track_rect.mLeft, track_rect.mTop, mThumbRect.getCenterX(), track_rect.mBottom);
	mTrackImage->draw(track_rect);
	mTrackHighlightImage->draw(highlight_rect);

	// Thumb
	if( hasMouseCapture() )
	{
		// Show ghost where thumb was before dragging began.
		mThumbImage->draw(mDragStartThumbRect, mThumbCenterColor % 0.3f);
	}
	if (hasFocus())
	{
		// Draw focus highlighting.
		mThumbImage->drawBorder(mThumbRect, gFocusMgr.getFocusColor(), gFocusMgr.getFocusFlashWidth());
	}
	// Fill in the thumb.
	mThumbImage->draw(mThumbRect, hasMouseCapture() ? mThumbOutlineColor : center_color);

	LLUICtrl::draw();
}
Beispiel #22
0
// This function gets control whenever the text is edited.
void NTitleEditor::titleChanged(QString text) {
    this->blockSignals(true);

    // Check that we have some type of title.  If not we go with
    // the default
    text = cleanupTitle(text);
    this->setText(text);
    this->blockSignals(false);

    // Now check that the text has actually changed.  We need to do this because
    // we can also get here when focus is lost.
    if (!hasFocus()) {
        if (text.trimmed() != initialTitle.trimmed() || priorTitle.trimmed() != text.trimmed()) {
            NoteTable noteTable(global.db);
            noteTable.updateTitle(currentLid, text, true);
            emit(titleChanged());
            setText(text);
            priorTitle = text;
            initialTitle = text;
        }
    }
}
Beispiel #23
0
void LLUICtrl::setFocus(BOOL b)
{
	// focus NEVER goes to ui ctrls that are disabled!
	if (!getEnabled())
	{
		return;
	}
	if( b )
	{
		if (!hasFocus())
		{
			gFocusMgr.setKeyboardFocus( this );
		}
	}
	else
	{
		if( gFocusMgr.childHasKeyboardFocus(this))
		{
			gFocusMgr.setKeyboardFocus( NULL );
		}
	}
}
/*!
  Repaint the knob
  \param event Paint event
*/
void QwtKnob::paintEvent( QPaintEvent *event )
{
    QPainter painter( this );
    painter.setClipRegion( event->region() );

    QStyleOption opt;
    opt.init(this);
    style()->drawPrimitive(QStyle::PE_Widget, &opt, &painter, this);

    painter.setRenderHint( QPainter::Antialiasing, true );

    if ( !d_data->knobRect.contains( event->region().boundingRect() ) )
        scaleDraw()->draw( &painter, palette() );

    drawKnob( &painter, d_data->knobRect );
    drawMarker( &painter, d_data->knobRect, d_data->angle );

    painter.setRenderHint( QPainter::Antialiasing, false );

    if ( hasFocus() )
        QwtPainter::drawFocusRect( &painter, this );
}
Beispiel #25
0
void SpinBox::valueChange()
{
	if (!mSuppressSignals)
	{
		int val = value();
		if (mShiftMinBound  &&  val >= mMinValue)
		{
			// Reinstate the minimum bound now that the value has returned to the normal range.
			QSpinBox::setMinimum(mMinValue);
			mShiftMinBound = false;
		}
		if (mShiftMaxBound  &&  val <= mMaxValue)
		{
			// Reinstate the maximum bound now that the value has returned to the normal range.
			QSpinBox::setMaximum(mMaxValue);
			mShiftMaxBound = false;
		}

 		if (!mSelectOnStep && hasFocus())
			lineEdit()->deselect();   // prevent selection of the spin box text
	}
}
Beispiel #26
0
void Window::requestAttention(bool continuous)
{
#if defined(LOVE_WINDOWS) && !defined(LOVE_WINDOWS_UWP)

	if (hasFocus())
		return;

	SDL_SysWMinfo wminfo = {};
	SDL_VERSION(&wminfo.version);

	if (SDL_GetWindowWMInfo(window, &wminfo))
	{
		FLASHWINFO flashinfo = {};
		flashinfo.cbSize = sizeof(FLASHWINFO);
		flashinfo.hwnd = wminfo.info.win.window;
		flashinfo.uCount = 1;
		flashinfo.dwFlags = FLASHW_ALL;

		if (continuous)
		{
			flashinfo.uCount = 0;
			flashinfo.dwFlags |= FLASHW_TIMERNOFG;
		}

		FlashWindowEx(&flashinfo);
	}

#elif defined(LOVE_MACOSX)

	love::macosx::requestAttention(continuous);

#else

	LOVE_UNUSED(continuous);
	
#endif
	
	// TODO: Linux?
}
BOOL LLRadioGroup::setSelectedIndex(S32 index, BOOL from_event)
{
	if ((S32)mRadioButtons.size() <= index )
	{
		return FALSE;
	}

	if (mSelectedIndex >= 0)
	{
		LLRadioCtrl* old_radio_item = mRadioButtons[mSelectedIndex];
		old_radio_item->setTabStop(false);
		old_radio_item->setValue( FALSE );
	}
	else
	{
		mRadioButtons[0]->setTabStop(false);
	}

	mSelectedIndex = index;

	if (mSelectedIndex >= 0)
	{
		LLRadioCtrl* radio_item = mRadioButtons[mSelectedIndex];
		radio_item->setTabStop(true);
		radio_item->setValue( TRUE );

		if (hasFocus())
		{
			radio_item->focusFirstItem(FALSE, FALSE);
		}
	}

	if (!from_event)
	{
		setControlValue(getValue());
	}

	return TRUE;
}
    void FocusHandler::remove(Widget* widget)
    {
        if (widget == mFocusedWidget)
        {
            mFocusedWidget = NULL;
        }
        if (widget == mDraggedWidget)
        {
            mDraggedWidget = NULL;
        }
        if (widget == mToBeFocused)
        {
            mToBeFocused = NULL;
        }
        if (widget == mToBeDragged)
        {
            mToBeDragged = NULL;
        }

        if (hasFocus(widget))
        {
            mFocusedWidget = NULL;
            mToBeFocused = NULL;
        }
        
        int i = 0;
        WidgetIterator iter;
        
        for (iter = mWidgets.begin(); iter != mWidgets.end(); ++iter)
        {
            ++i;
            
            if ((*iter) == widget)
            {        
                mWidgets.erase(iter);                
                return;
            }      
        }        
    }
CompositionUnderline InputMethodContext::selectedSegment() const
{
    CompositionUnderline underline;
    if (!hasFocus())
        return underline;

    const InputMethodController& controller = inputMethodController();
    if (!controller.hasComposition())
        return underline;

    Vector<CompositionUnderline> underlines = controller.customCompositionUnderlines();
    for (size_t i = 0; i < underlines.size(); ++i) {
        if (underlines[i].thick)
            return underlines[i];
    }

    // When no underline information is available while composition exists,
    // build a CompositionUnderline whose element is the whole composition.
    underline.endOffset = controller.compositionEnd() - controller.compositionStart();
    return underline;

}
Beispiel #30
-1
void KTagComboBox::paintEvent( QPaintEvent * ev)
{
  QComboBox::paintEvent(ev);

  QPainter p (this);

  // Text
  QRect clip(2, 2, width() - 4, height() - 4);
#if 0
  if ( hasFocus() && style().guiStyle() != MotifStyle )
    p.setPen( colorGroup().highlightedText() );
#endif
  p.drawText(clip, AlignCenter | SingleLine, popup->text( current ));

  // Icon
  QIcon *icon = popup->iconSet( this->current );
  if (icon) {
    QPixmap pm = icon->pixmap();
    p.drawPixmap( 4, (height()-pm.height())/2, pm );
  }
}