示例#1
0
QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP
QWindowsOleDropSource::GiveFeedback(DWORD dwEffect)
{
    const Qt::DropAction action = translateToQDragDropAction(dwEffect);
    m_drag->updateAction(action);

    const qint64 currentCacheKey = m_drag->currentDrag()->dragCursor(action).cacheKey();
    auto it = m_cursors.constFind(action);
    // If a custom drag cursor is set, check its cache key to detect changes.
    if (it == m_cursors.constEnd() || (currentCacheKey && currentCacheKey != it.value().cacheKey)) {
        createCursors();
        it = m_cursors.constFind(action);
    }

    if (it != m_cursors.constEnd()) {
        const CursorEntry &e = it.value();
        switch (m_mode) {
        case MouseDrag:
            SetCursor(e.cursor->handle());
            break;
        case TouchDrag:
            if (!m_touchDragWindow)
                m_touchDragWindow = new QWindowsDragCursorWindow;
            m_touchDragWindow->setPixmap(e.pixmap);
            m_touchDragWindow->setFramePosition(QCursor::pos() - e.hotSpot);
            if (!m_touchDragWindow->isVisible())
                m_touchDragWindow->show();
            break;
        }
        return ResultFromScode(S_OK);
    }

    return ResultFromScode(DRAGDROP_S_USEDEFAULTCURSORS);
}
示例#2
0
ClsSubDiagram::ClsSubDiagram(QFrame *parent, ClsBlockDiagram* _clsBlockDiagramParent, int _iID, int _iSpacerHeight) : 
    QFrame(parent, Qt::WDestructiveClose), clsBlockDiagramParent(_clsBlockDiagramParent), iID(_iID), iSpacerHeight(_iSpacerHeight)  {
#ifdef DEBUG_CLSSUBDIAGRAM
    cout << "ClsSubDiagram::ClsSubDiagram(ClsBlockDiagram* clsBlockDiagramParent,const char* name)" << endl;
#endif



    setFrameStyle(  QFrame::WinPanel | QFrame::Raised );
//    setLineWidth (10);
    
    bFocus = false;
    iAddState = -99;
    createCursors();


    clsSceneView = new ClsSceneView(this);
    clsSceneView->setCursor(Qt::ArrowCursor);
    clsSceneView->setTransformationAnchor( QGraphicsView::NoAnchor );
    clsSceneView->setResizeAnchor( QGraphicsView::NoAnchor );


    qtabbar = new QTabBar( this );
    connect(qtabbar, SIGNAL(/*selected(int)*/currentChanged(int) ), SLOT(slotTabChanged(int) ));


    clsclsScenepanner = new ClsPanner(this, clsSceneView);


    qboxlayout= new QVBoxLayout( this );
    qboxlayout->setContentsMargins ( 0, 0, 0, 0 );
    qboxlayout->setSpacing ( 0);

    
    /* it's getting better and better... not the qwgtSpacer needs to exist to ensure
       the tabbar doesn't dissapear, but it needs not have any minimum height specified... */
    qwgtSpacer = new QWidget(this);
    qwgtSpacer->show();
    qwgtSpacer->setMinimumHeight( iSpacerHeight);
    
    qboxlayout->addWidget ( qwgtSpacer, 0,0 );

    qboxlayout->addWidget ( qtabbar, 0,0 );
    qboxlayout->addWidget ( clsSceneView, 10,0 );


    connect(clsSceneView, SIGNAL(sigGotFocus(int,string)), this, SLOT(slotGotFocus(int,string)));


    connect(clsclsScenepanner, SIGNAL(sigScroll(int, int)), this, SLOT(pannerScroll(int, int)));

    qtabbar->show();
    clsSceneView->show();
    clsclsScenepanner->show();
    this->show();


}
MapArea::MapArea(const GP<GMapArea> & area) : gmap_area(area)
{
   pane=0;
   mapper=0;
   in_motion=false;
   enable_edit_controls=false;
   active_outline_mode=inactive_outline_mode=false;
   active=gmap_area->border_always_visible;
   force_always_active=false;
   
   createCursors();
   GUTF8String str=area->check_object();
   if (str.length()) G_THROW(str);
}
示例#4
0
KIconEditGrid::KIconEditGrid(QImage *image, QWidget *parent, const char *name)
 : KColorGrid(parent, name, 1)
{
  initMetaObject();
  img = image;
  selected = 0;

  //setBackgroundMode(NoBackground);
  //kdeColor(1);

  for(uint i = 0; i < 42; i++)
    iconcolors.append(iconpalette[i]);

  setupImageHandlers();
  debug("Formats: %d", formats->count());
  btndown = isselecting = ispasting = modified = false;
  //modified = false;
  img->create(32, 32, 32);
  img->fill(TRANSPARENT);
  //numcolors = 0;
  currentcolor = qRgb(0,0,0)|OPAQUE_MASK;

  setMouseTracking(true);

  setNumRows(32);
  setNumCols(32);
  fill(TRANSPARENT);

  connect( kapp->clipboard(), SIGNAL(dataChanged()), SLOT(checkClipboard()));

  // this is kind of a hack but the application global clipboard object
  // doesn't always send the signals.
  QTimer *cbtimer = new QTimer(this);
  connect( cbtimer, SIGNAL(timeout()), SLOT(checkClipboard()));
  cbtimer->start(2500);

  createCursors();
}
示例#5
0
PageRuler::PageRuler(ERulerType position,MainView *pMainView)
 : QWidget(),m_pMainView(pMainView),m_position(position)
{
	setAutoFillBackground(true);

	QPalette pal = palette();
	pal.setColor(QPalette::Window,QColor(Qt::white));
	setPalette( pal );

	if (position==leftPosition)
	{
		//set width for left ruler
		setFixedWidth(10);
	}
	else if (position==topPostion)
	{
		//set height for top ruler
		setFixedHeight(10);
	}

	createCursors();
	
}
QDBase::QDBase(QWidget * parent, const char * name) : QWidget(parent, name)
{
   DEBUG_MSG("QDBase::QDBase(): Initializing class...\n");
   DEBUG_MAKE_INDENT(3);

   being_destroyed=false;
   
   map_area_tip=0;
   cur_map_area=0;
   display_all_hlinks=false;
   image_size_known=0;
   toolbar=0;
   mode_tbar=0;
   rotate_tbar=0;
   toolbar_shown=0;
   toolbar_enabled=0;
   toolbar_asked=0;
   showing_toolbar=0;
   splitter=0;
   main_widget=0;
   thumb_widget=0;
   cmd_mode=cmd_mode_force=cmd_zoom=-1;
   zoom_src=SRC_DEFAULT;
   mode_src=SRC_DEFAULT;
   rotate_src=SRC_DEFAULT;
   in_hand_scroll=in_paint=in_layout=in_zoom_select=0;
   lastrect=0;
   acc_scroll_dh=acc_scroll_dv=0;
   left_butt_down=0;
   ignore_ant_mode_zoom=0;
   for(int i=0;i<MODE_SOURCE_MAX;i++) 
     mode_prio[i]=i;

   pane_mode=IDC_PANE;
   
   djvu_logo_bmp = GBitmap::create(*CINData::get("ppm_djvu_logo"));
   
   depth=QPaintDeviceMetrics(this).depth();

   new QDTBHider(this);
   
   // Get the display resolution
   QPaintDeviceMetrics m(QApplication::desktop());
   displ_dpi=(int) (m.width()*25.4/m.widthMM());
   displ_dpi=100;  // Override displ_dpi as Leon demands
   DEBUG_MSG("display dpi=" << displ_dpi << "\n");

      // Adjusting margin caches
   pm_cache.setMaxSize(prefs.mcacheSize*1024*1024);
   bm_cache.setMaxSize(prefs.mcacheSize*1024*1024);
   connect(&cache_timer, SIGNAL(timeout(void)), this, SLOT(slotCheckCache(void)));

   main_widget=new QWidget(this, "main_widget");
   main_widget->installEventFilter(this);
   
   pane=new QDPane(main_widget, "djvu_pane");
   pane->installEventFilter(this);
   pane->setFocusPolicy(QWidget::StrongFocus);
   pane->setMouseTracking(TRUE);

      // Creating main area and scroll bars
   hscroll=new QScrollBar(QScrollBar::Horizontal, main_widget, "hscroll");
   vscroll=new QScrollBar(QScrollBar::Vertical, main_widget, "vscroll");
   connect(hscroll, SIGNAL(valueChanged(int)),
           this, SLOT(slotSliderMoved(int)));
   connect(vscroll, SIGNAL(valueChanged(int)), 
           this, SLOT(slotSliderMoved(int)));
   connect(hscroll, SIGNAL(sliderPressed(void)), 
           this, SLOT(slotSliderPressed(void)));
   connect(vscroll, SIGNAL(sliderPressed(void)), 
           this, SLOT(slotSliderPressed(void)));
   connect(hscroll, SIGNAL(sliderReleased(void)), 
           this, SLOT(slotSliderReleased(void)));
   connect(vscroll, SIGNAL(sliderReleased(void)), 
           this, SLOT(slotSliderReleased(void)));
   
   hscroll->resize(hscroll->sizeHint());
   vscroll->resize(vscroll->sizeHint());

   createCursors();
   setBackgroundColor(0xffffff, false);	// Don't redraw
   
      // Setting desired video modes
   setMode(IDC_DISPLAY_COLOR, 0, SRC_DEFAULT);	// Don't redraw
   setZoom(prefs.nDefaultZoom, 0, SRC_DEFAULT);	// Don't relayout
   setRotate(IDC_ROTATE_0, 0, SRC_DEFAULT);	// Don't relayout

   layout(0);			// Disallow redraw
}