Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorMaarten Gribnau <mail@maartengribnau.com>2003-01-24 00:39:29 +0300
committerMaarten Gribnau <mail@maartengribnau.com>2003-01-24 00:39:29 +0300
commit5b845badefe74553a5e919052b80961bd212b77e (patch)
tree3fe94017c264f78e26b703f85a6d9c8bf86d55d9 /intern
parentcb4f2e1a4eb22ef6c1732851a0341fd4015635fd (diff)
First light of mouse wheel support.
Only working (soso) on osx. Maarten
Diffstat (limited to 'intern')
-rw-r--r--intern/ghost/GHOST_Types.h12
-rw-r--r--intern/ghost/intern/GHOST_EventPrinter.cpp15
-rw-r--r--intern/ghost/intern/GHOST_EventWheel.h69
-rw-r--r--intern/ghost/intern/GHOST_SystemCarbon.cpp27
4 files changed, 111 insertions, 12 deletions
diff --git a/intern/ghost/GHOST_Types.h b/intern/ghost/GHOST_Types.h
index cf148adea10..a7c89c7e0a6 100644
--- a/intern/ghost/GHOST_Types.h
+++ b/intern/ghost/GHOST_Types.h
@@ -110,9 +110,10 @@ typedef enum {
typedef enum {
GHOST_kEventUnknown = 0,
- GHOST_kEventCursorMove,
- GHOST_kEventButtonDown,
- GHOST_kEventButtonUp,
+ GHOST_kEventCursorMove, /// Mouse move event
+ GHOST_kEventButtonDown, /// Mouse button event
+ GHOST_kEventButtonUp, /// Mouse button event
+ GHOST_kEventWheel, /// Mouse wheel event
GHOST_kEventKeyDown,
GHOST_kEventKeyUp,
@@ -311,6 +312,11 @@ typedef struct {
} GHOST_TEventButtonData;
typedef struct {
+ /** Displacement of a mouse wheel. */
+ GHOST_TInt32 z;
+} GHOST_TEventWheelData;
+
+typedef struct {
/** The key code. */
GHOST_TKey key;
/** The ascii code for the key event ('\0' if none). */
diff --git a/intern/ghost/intern/GHOST_EventPrinter.cpp b/intern/ghost/intern/GHOST_EventPrinter.cpp
index 362b40fe504..953fecbd88f 100644
--- a/intern/ghost/intern/GHOST_EventPrinter.cpp
+++ b/intern/ghost/intern/GHOST_EventPrinter.cpp
@@ -28,13 +28,9 @@
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
-
/**
-
- * $Id$
- * Copyright (C) 2001 NaN Technologies B.V.
- * @author Maarten Gribnau
- * @date May 15, 2001
+ * @file GHOST_EventPrinter.h
+ * Declaration of GHOST_EventPrinter class.
*/
#include "GHOST_EventPrinter.h"
@@ -73,6 +69,13 @@ bool GHOST_EventPrinter::processEvent(GHOST_IEvent* event)
}
break;
+ case GHOST_kEventWheel:
+ {
+ GHOST_TEventWheelData* wheelData = (GHOST_TEventWheelData*)((GHOST_IEvent*)event)->getData();
+ std::cout << "GHOST_kEventWheel, z: " << wheelData->z;
+ }
+ break;
+
case GHOST_kEventCursorMove:
{
GHOST_TEventCursorData* cursorData = (GHOST_TEventCursorData*)((GHOST_IEvent*)event)->getData();
diff --git a/intern/ghost/intern/GHOST_EventWheel.h b/intern/ghost/intern/GHOST_EventWheel.h
new file mode 100644
index 00000000000..3a5b0130345
--- /dev/null
+++ b/intern/ghost/intern/GHOST_EventWheel.h
@@ -0,0 +1,69 @@
+/**
+ * $Id$
+ * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+/**
+ * @file GHOST_EventWheel.h
+ * Declaration of GHOST_EventWheel class.
+ */
+
+#ifndef _GHOST_EVENT_WHEEL_H_
+#define _GHOST_EVENT_WHEEL_H_
+
+#include "GHOST_Event.h"
+
+/**
+ * Mouse wheel event.
+ * @author Maarten Gribnau
+ * @date May 11, 2001
+ */
+class GHOST_EventWheel : public GHOST_Event
+{
+public:
+ /**
+ * Constructor.
+ * @param msec The time this event was generated.
+ * @param type The type of this event.
+ * @param z The displacement of the mouse wheel.
+ */
+ GHOST_EventWheel(GHOST_TUns64 msec, GHOST_TEventType type, GHOST_IWindow* window, GHOST_TInt32 z)
+ : GHOST_Event(msec, type, window)
+ {
+ m_wheelEventData.z = z;
+ m_data = &m_wheelEventData;
+ }
+
+protected:
+ /** The z-displacement of the mouse wheel. */
+ GHOST_TEventWheelData m_wheelEventData;
+};
+
+
+#endif // _GHOST_EVENT_WHEEL_H_
+
diff --git a/intern/ghost/intern/GHOST_SystemCarbon.cpp b/intern/ghost/intern/GHOST_SystemCarbon.cpp
index 9ae9c2d4006..acf3e75f860 100644
--- a/intern/ghost/intern/GHOST_SystemCarbon.cpp
+++ b/intern/ghost/intern/GHOST_SystemCarbon.cpp
@@ -47,6 +47,7 @@
#include "GHOST_EventKey.h"
#include "GHOST_EventButton.h"
#include "GHOST_EventCursor.h"
+#include "GHOST_EventWheel.h"
#include "GHOST_TimerManager.h"
#include "GHOST_TimerTask.h"
#include "GHOST_WindowManager.h"
@@ -72,7 +73,8 @@ const EventTypeSpec kEvents[] =
{ kEventClassMouse, kEventMouseUp },
{ kEventClassMouse, kEventMouseMoved },
{ kEventClassMouse, kEventMouseDragged },
-
+ { kEventClassMouse, kEventMouseWheelMoved },
+
{ kEventClassWindow, kEventWindowClose },
{ kEventClassWindow, kEventWindowActivated },
{ kEventClassWindow, kEventWindowDeactivated },
@@ -525,7 +527,7 @@ OSStatus GHOST_SystemCarbon::handleMouseEvent(EventRef event)
GHOST_IWindow* window = m_windowManager->getActiveWindow();
UInt32 kind = ::GetEventKind(event);
- switch (kind)
+ switch (kind)
{
case kEventMouseDown:
case kEventMouseUp:
@@ -552,7 +554,26 @@ OSStatus GHOST_SystemCarbon::handleMouseEvent(EventRef event)
pushEvent(new GHOST_EventCursor(getMilliSeconds(), GHOST_kEventCursorMove, window, mousePos.h, mousePos.v));
}
break;
- }
+
+ case kEventMouseWheelMoved:
+ {
+ OSStatus status;
+ //UInt32 modifiers;
+ EventMouseWheelAxis axis;
+ SInt32 delta;
+ //status = ::GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(modifiers), NULL, &modifiers);
+ //GHOST_ASSERT(status == noErr, "GHOST_SystemCarbon::handleMouseEvent(): GetEventParameter() failed");
+ status = ::GetEventParameter(event, kEventParamMouseWheelAxis, typeMouseWheelAxis, NULL, sizeof(axis), NULL, &axis);
+ GHOST_ASSERT(status == noErr, "GHOST_SystemCarbon::handleMouseEvent(): GetEventParameter() failed");
+ status = ::GetEventParameter(event, kEventParamMouseWheelDelta, typeLongInteger, NULL, sizeof(delta), NULL, &delta);
+ GHOST_ASSERT(status == noErr, "GHOST_SystemCarbon::handleMouseEvent(): GetEventParameter() failed");
+ if (axis == kEventMouseWheelAxisY)
+ {
+ pushEvent(new GHOST_EventWheel(getMilliSeconds(), GHOST_kEventWheel, window, delta));
+ }
+ }
+ break;
+ }
return noErr;
}