Qt 4.8
Classes | Macros | Functions
qdnd_win.cpp File Reference
#include "qapplication.h"
#include "qapplication_p.h"
#include "qevent.h"
#include "qpainter.h"
#include "qwidget.h"
#include "qbuffer.h"
#include "qdatastream.h"
#include "qcursor.h"
#include "qt_windows.h"
#include <shlobj.h>
#include "qaccessible.h"
#include "qdnd_p.h"
#include "qdebug.h"
#include "qguifunctions_wince.h"

Go to the source code of this file.

Classes

class  QOleDropSource
 

Macros

#define KEY_STATE_BUTTON_MASK   (MK_LBUTTON | MK_MBUTTON | MK_RBUTTON)
 
#define MK_XBUTTON1   0x0020
 
#define MK_XBUTTON2   0x0040
 

Functions

static bool acceptsDrop (const QWidget *w)
 
static Qt::MouseButtons keystate_to_mousebutton (DWORD grfKeyState)
 
Qt::KeyboardModifiers toQtKeyboardModifiers (DWORD keyState)
 
Qt::MouseButtons toQtMouseButtons (DWORD keyState)
 
Qt::DropAction translateToQDragDropAction (DWORD pdwEffect)
 
Qt::DropActions translateToQDragDropActions (DWORD pdwEffects)
 
DWORD translateToWinDragEffects (Qt::DropActions action)
 

Macro Definition Documentation

◆ KEY_STATE_BUTTON_MASK

#define KEY_STATE_BUTTON_MASK   (MK_LBUTTON | MK_MBUTTON | MK_RBUTTON)

Definition at line 802 of file qdnd_win.cpp.

Referenced by QOleDropTarget::Drop().

◆ MK_XBUTTON1

#define MK_XBUTTON1   0x0020

Definition at line 65 of file qdnd_win.cpp.

Referenced by keystate_to_mousebutton().

◆ MK_XBUTTON2

#define MK_XBUTTON2   0x0040

Definition at line 66 of file qdnd_win.cpp.

Referenced by keystate_to_mousebutton().

Function Documentation

◆ acceptsDrop()

static bool acceptsDrop ( const QWidget w)
inlinestatic

Definition at line 693 of file qdnd_win.cpp.

Referenced by QOleDropTarget::DragOver().

694 {
696 }
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
bool acceptDrops
whether drop events are enabled for this widget
Definition: qwidget.h:197

◆ keystate_to_mousebutton()

static Qt::MouseButtons keystate_to_mousebutton ( DWORD  grfKeyState)
inlinestatic

Definition at line 499 of file qdnd_win.cpp.

Referenced by QOleDropSource::QueryContinueDrag().

500 {
501  Qt::MouseButtons result;
502  if (grfKeyState & MK_LBUTTON)
503  result |= Qt::LeftButton;
504  if (grfKeyState & MK_MBUTTON)
505  result |= Qt::MidButton;
506  if (grfKeyState & MK_RBUTTON)
507  result |= Qt::RightButton;
508  if (grfKeyState & MK_XBUTTON1)
509  result |= Qt::XButton1;
510  if (grfKeyState & MK_XBUTTON2)
511  result |= Qt::XButton2;
512  return result;
513 }
#define MK_XBUTTON2
Definition: qdnd_win.cpp:66
#define MK_XBUTTON1
Definition: qdnd_win.cpp:65

◆ toQtKeyboardModifiers()

Qt::KeyboardModifiers toQtKeyboardModifiers ( DWORD  keyState)

Definition at line 318 of file qdnd_win.cpp.

Referenced by QOleDropTarget::DragOver(), QOleDropTarget::Drop(), and QOleDropTarget::sendDragEnterEvent().

319 {
320  Qt::KeyboardModifiers modifiers = Qt::NoModifier;
321 
322  if (keyState & MK_SHIFT)
323  modifiers |= Qt::ShiftModifier;
324  if (keyState & MK_CONTROL)
325  modifiers |= Qt::ControlModifier;
326  if (keyState & MK_ALT)
327  modifiers |= Qt::AltModifier;
328 
329  return modifiers;
330 }

◆ toQtMouseButtons()

Qt::MouseButtons toQtMouseButtons ( DWORD  keyState)

Definition at line 332 of file qdnd_win.cpp.

Referenced by QOleDropTarget::DragOver(), QOleDropTarget::Drop(), and QOleDropTarget::sendDragEnterEvent().

333 {
334  Qt::MouseButtons buttons = Qt::NoButton;
335 
336  if (keyState & MK_LBUTTON)
337  buttons |= Qt::LeftButton;
338  if (keyState & MK_RBUTTON)
339  buttons |= Qt::RightButton;
340  if (keyState & MK_MBUTTON)
341  buttons |= Qt::MidButton;
342 
343  return buttons;
344 }
static Qt::MouseButtons buttons

◆ translateToQDragDropAction()

Qt::DropAction translateToQDragDropAction ( DWORD  pdwEffect)

Definition at line 295 of file qdnd_win.cpp.

Referenced by QOleDropTarget::DragOver(), QOleDropTarget::Drop(), and QOleDropSource::GiveFeedback().

296 {
297  if (pdwEffect & DROPEFFECT_LINK)
298  return Qt::LinkAction;
299  if (pdwEffect & DROPEFFECT_COPY)
300  return Qt::CopyAction;
301  if (pdwEffect & DROPEFFECT_MOVE)
302  return Qt::MoveAction;
303  return Qt::IgnoreAction;
304 }

◆ translateToQDragDropActions()

Qt::DropActions translateToQDragDropActions ( DWORD  pdwEffects)

Definition at line 283 of file qdnd_win.cpp.

Referenced by QOleDropTarget::DragOver(), QOleDropTarget::Drop(), and QOleDropTarget::sendDragEnterEvent().

284 {
285  Qt::DropActions actions = Qt::IgnoreAction;
286  if (pdwEffects & DROPEFFECT_LINK)
287  actions |= Qt::LinkAction;
288  if (pdwEffects & DROPEFFECT_COPY)
289  actions |= Qt::CopyAction;
290  if (pdwEffects & DROPEFFECT_MOVE)
291  actions |= Qt::MoveAction;
292  return actions;
293 }

◆ translateToWinDragEffects()

DWORD translateToWinDragEffects ( Qt::DropActions  action)

Definition at line 306 of file qdnd_win.cpp.

Referenced by QOleDropTarget::DragOver(), QOleDropTarget::Drop(), and QOleDropTarget::sendDragEnterEvent().

307 {
308  DWORD effect = DROPEFFECT_NONE;
309  if (action & Qt::LinkAction)
310  effect |= DROPEFFECT_LINK;
311  if (action & Qt::CopyAction)
312  effect |= DROPEFFECT_COPY;
313  if (action & Qt::MoveAction)
314  effect |= DROPEFFECT_MOVE;
315  return effect;
316 }