Esempio n. 1
0
static int kde_color_dlg_handler(XEvent *event)
{
    if (event->type == ButtonRelease)
    {
        TQMouseEvent e( TQEvent::MouseButtonRelease, TQPoint(),
                       TQPoint(event->xmotion.x_root, event->xmotion.y_root) , 0, 0 );
        TQApplication::sendEvent( kde_color_dlg_widget, &e );
        return true;
    }
    return false;
}
Esempio n. 2
0
void NextClient::menuButtonPressed()
{
    // Probably don't need this null check, but we might as well.
    if (button[MENU_IDX]) {
	TQRect menuRect = button[MENU_IDX]->rect();
        TQPoint menuTop = button[MENU_IDX]->mapToGlobal(menuRect.topLeft());
        TQPoint menuBottom = button[MENU_IDX]->mapToGlobal(menuRect.bottomRight());
	menuTop += TQPoint(1, 1);
	menuBottom += TQPoint(1, 1);
        KDecorationFactory* f = factory();
        showWindowMenu(TQRect(menuTop, menuBottom));
        if( !f->exists( this )) // 'this' was deleted
            return;
	button[MENU_IDX]->setDown(false);
    }
}
Esempio n. 3
0
RegExpWidget* CharactersWidget::findWidgetToEdit( TQPoint globalPos )
{
    if ( TQRect(mapToGlobal(TQPoint(0,0)), size()).contains( globalPos ) )
        return this;
    else
        return 0;
}
Esempio n. 4
0
RegExpWidget* RegExpWidget::widgetUnderPoint( TQPoint globalPos, bool )
{
  if ( TQRect(mapToGlobal( TQPoint(0,0) ), size() ).contains( globalPos ) )
    return this;
  else
    return 0;
}
Esempio n. 5
0
TQPoint CityList::getPosition(double la, double lo, int w, int h, int offset)
{
  int x = (int)((double)w * (180.0 + lo) / 360.0);
  int y = (int)((double)h * (90.0 - la) / 180.0);
  x = (x + offset + w/2) % w;

  return TQPoint(x,y);
}
Esempio n. 6
0
//---------------------------------------------------------------------------
//
// The user clicked on the widget
//
void AmorWidget::mouseReleaseEvent(TQMouseEvent *me)
{
    if ( dragging )
	emit dragged( me->globalPos() - clickPos, true );
    else if ( me->state() == Qt::RightButton )
	emit mouseClicked(clickPos);

    clickPos = TQPoint();
    dragging = false;
}
Esempio n. 7
0
void
TDMShutdownBase::slotActivatePlugMenu()
{
	if (needRoot) {
		TQPopupMenu *cmnu = verify->getPlugMenu();
		if (!cmnu)
			return;
		TQSize sh( cmnu->sizeHint() / 2 );
		cmnu->exec( geometry().center() - TQPoint( sh.width(), sh.height() ) );
	}
}
Esempio n. 8
0
void ImagePreview::paintEvent(TQPaintEvent*){
	QImage	tmpImage = convertImage(image_,hue_,(bw_ ? 0 : saturation_),brightness_,gamma_);
	int	x = (width()-tmpImage.width())/2, y = (height()-tmpImage.height())/2;

	TQPixmap	buffer(width(), height());
	buffer.fill(parentWidget(), 0, 0);
	TQPainter	p(&buffer);
	p.drawImage(x,y,tmpImage);
	p.end();

	bitBlt(this, TQPoint(0, 0), &buffer, buffer.rect(), TQt::CopyROP);
}
Esempio n. 9
0
bool RegExpWidget::updateSelection(bool parentSelected)
{
  bool selected = ( parentSelected ||
                    _editorWindow->selectionOverlap( mapToGlobal( TQPoint(0,0) ), size() ) )
    && !_isToplevel;

  if ( _isSelected != selected ) {
    // Selection state changed
    _isSelected = selected;
    repaint();
    return true;
  }
  return false;
}
Esempio n. 10
0
bool KJanusWidget::setSwallowedWidget( TQWidget *widget )
{
  if( mFace != Swallow || !mValid )
  {
    return false;
  }

  //
  // Remove current layout and make a new.
  //
  delete mSwallowPage->layout();

  TQGridLayout *gbox = new TQGridLayout( mSwallowPage, 1, 1, 0 );

  //
  // Hide old children
  //
  TQObjectList l = mSwallowPage->childrenListObject(); // silence please
  for( uint i=0; i < l.count(); i++ )
  {
    TQObject *o = l.at(i);
    if( o->isWidgetType() )
    {
      ((TQWidget*)o)->hide();
    }
  }

  //
  // Add new child or make default size
  //
  if( !widget )
  {
    gbox->addRowSpacing(0,100);
    gbox->addColSpacing(0,100);
    mSwallowPage->setMinimumSize(100,100);
  }
  else
  {
    if( TQT_BASE_OBJECT(widget->parent()) != TQT_BASE_OBJECT(mSwallowPage) )
    {
      widget->reparent( mSwallowPage, 0, TQPoint(0,0) );
    }
    gbox->addWidget(widget, 0, 0 );
    gbox->activate();
    mSwallowPage->setMinimumSize( widget->minimumSize() );
  }

  return true;
}
Esempio n. 11
0
BaseContainer::BaseContainer( TQPopupMenu* appletOpMenu, TQWidget* parent, const char * name )
  : TQWidget( parent, name )
  , _dir(KPanelApplet::Up)
  , _orient(Qt::Horizontal)
  , _alignment(KPanelExtension::LeftTop)
  , _fspace(0)
  , _moveOffset(TQPoint(0,0))
  , _aid(TQString::null)
  , _actions(0)
  , m_immutable(false)
  , _opMnu(0)
  , _appletOpMnu(appletOpMenu)
{
    setCursor(tqarrowCursor);
}
Esempio n. 12
0
int CharactersWidget::edit()
{
    if ( _configWindow == 0 ) {
        TQApplication::setOverrideCursor( WaitCursor );
        // No parent here, as this window should continue to exists.
        _configWindow = new CharacterEdits( 0, "CharactersWidget::_configWindow" );
        TQApplication::restoreOverrideCursor();
    }

    _configWindow->move(TQCursor::pos() - TQPoint(_configWindow->sizeHint().width()/2,
                                                _configWindow->sizeHint().height()/2));
    int ret = _configWindow->exec(_regexp );
    if ( ret == TQDialog::Accepted ) {
        _editorWindow->updateContent( 0 );
        update();
    }
    return ret;
}
Esempio n. 13
0
void Systemtray::updateBackgroundPixmap ( const TQPixmap & pixmap) {
  QXEmbed *emb;
  setPaletteBackgroundPixmap (pixmap);
    for (emb = m_Wins.first(); emb != 0L; emb = m_Wins.next()) {

    //Stupid stupid stupid work around for annoying bug
    //QXEmbed ignores setBackgroundOrigin(AncestorOrigin)....
    TQPixmap bug = TQPixmap(emb->size());
    bitBlt(TQT_TQPAINTDEVICE(&bug), 0, 0, TQT_TQPAINTDEVICE(const_cast<TQPixmap*>(&pixmap)), emb->parentWidget()->x()+emb->x(),  emb->parentWidget()->y()+emb->y(), emb->width(), emb->height(),TQt::CopyROP, false);
    emb->setPaletteBackgroundPixmap (bug);

  }

    TQPoint topPoint = mapToGlobal(TQPoint(0,0));
    Window hack = XCreateSimpleWindow(tqt_xdisplay(), winId(), 0,0, width(), height(), 0, 0, 0);
    XRaiseWindow(tqt_xdisplay(), hack);
    XMapWindow(tqt_xdisplay(), hack);
    XUnmapWindow(tqt_xdisplay(), hack);
    XDestroyWindow(tqt_xdisplay(), hack);
}
Esempio n. 14
0
void CustomSmileyManager::slotMoveToSmiley( )
{
	if(!m_Config) return;

	TQListViewItem *item = lvGroups->selectedItem();
	if(item){
		if(m_MoveToMenu){
			disconnect(m_MoveToMenu, 0, 0, 0);
			delete m_MoveToMenu;
		}
		m_MoveToMenu = new TQPopupMenu(0,"moveto");

		int currIndex = m_Config->groupIndex( item->text( 0 ) );
		TQStringList groups = m_Config->groupNames();
		for( int i=0; i < (int)(groups.count()); i++){
			if(i != currIndex )  // ignore the group we are operating on
				m_MoveToMenu->insertItem(groups[i], i);
		}
		connect(m_MoveToMenu, SIGNAL(activated(int)), this, SLOT(slotMoveSmileyTo(int)));
		TQPoint p = btnMoveTo->mapToGlobal(TQPoint(btnMoveTo->width()+1,0));
		m_MoveToMenu->popup( p );
	}
}
Esempio n. 15
0
void
KdmRect::drawContents( TQPainter *p, const TQRect &r )
{
	// choose the correct rect class
	RectStruct::RectClass *rClass = &rect.normal;
	if (state == Sactive && rect.active.present) {
		rClass = &rect.active;
	}
	if (state == Sprelight && rect.prelight.present) {
		rClass = &rect.prelight;
	}

	if (rClass->alpha <= 0 || !rClass->color.isValid()) {
		return;
	}

	if (rClass->alpha == 1) {
		p->fillRect( area, TQBrush( rClass->color ) );
	}
	else {
// 		if (!argb_visual_available) {
			// Software blend only (no compositing support)
			TQRect backRect = r;
			backRect.moveBy( area.x(), area.y() );
			TQPixmap backPixmap( backRect.size() );
			bitBlt( &backPixmap, TQPoint( 0, 0 ), p->device(), backRect );
			TQImage backImage = backPixmap.convertToImage();
			KImageEffect::blend( rClass->color, backImage, rClass->alpha );
			p->drawImage( backRect.x(), backRect.y(), backImage );
			//  area.moveBy(1,1);
// 		}
// 		else {
// 			// We have compositing support!
// 		}
	}
}
Esempio n. 16
0
TQRect RegExpWidget::selectionRect() const
{
  return TQRect( mapToGlobal( TQPoint(0,0) ), size() );
}
Esempio n. 17
0
void TDEAboutContainer::addWidget( TQWidget *widget )
{
  widget->reparent( this, 0, TQPoint(0,0) );
}
Esempio n. 18
0
void MenuManager::kmenuAccelActivated()
{
    if (m_kmenu->isVisible())
    {
        m_kmenu->hide();
        return;
    }

    m_kmenu->initialize();

    if (m_kbuttons.isEmpty())
    {
        // no button to use, make it behave like a desktop menu
        TQPoint p;
        // Popup the K-menu at the center of the screen.
        TQDesktopWidget* desktop = TDEApplication::desktop();
        TQRect r;
        if (desktop->numScreens() < 2)
            r = desktop->geometry();
        else
            r = desktop->screenGeometry(desktop->screenNumber(TQCursor::pos()));
        // kMenu->rect() is not valid before showing, use sizeHint()
        p = r.center() - TQRect( TQPoint( 0, 0 ), m_kmenu->sizeHint()).center();
        m_kmenu->popup(p);

        // when the cursor is in the area where the menu pops up,
        // the item under the cursor gets selected. The single shot
        // avoids this from happening by allowing the item to be selected
        // when the event loop is enterred, and then resetting it.
        TQTimer::singleShot(0, this, TQT_SLOT(slotSetKMenuItemActive()));
    }
    else
    {
        // We need the kmenu's size to place it at the right position.
        // We cannot rely on the popup menu's current size(), if it wasn't
        // shown before, so we resize it here according to its sizeHint().
        const TQSize size = m_kmenu->sizeHint();
        m_kmenu->resize(size.width(),size.height());

        PanelPopupButton* button = findKButtonFor(m_kmenu->widget());

        // let's unhide the panel while we're at it. traverse the widget
        // hierarchy until we find the panel, if any
        TQObject* menuParent = button->parent();
        while (menuParent)
        {
            ExtensionContainer* ext = dynamic_cast<ExtensionContainer*>(menuParent);

            if (ext)
            {
                ext->unhideIfHidden();
                // make sure it's unhidden before we use it to figure out
                // where to popup
                tqApp->processEvents();
                break;
            }

            menuParent = menuParent->parent();
        }
        button->showMenu();
    }
}