Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSilenio Quarti2001-09-14 20:09:55 +0000
committerSilenio Quarti2001-09-14 20:09:55 +0000
commitfbb3d8d6b3d402cd4ff1c23a30a007a8f16e5c1f (patch)
treeb5661fd933d45249008b343b0b43421c928f1968 /bundles
parent6dd2f4b91194e7cbb6a9f93cb427af30d3390001 (diff)
downloadeclipse.platform.swt-fbb3d8d6b3d402cd4ff1c23a30a007a8f16e5c1f.tar.gz
eclipse.platform.swt-fbb3d8d6b3d402cd4ff1c23a30a007a8f16e5c1f.tar.xz
eclipse.platform.swt-fbb3d8d6b3d402cd4ff1c23a30a007a8f16e5c1f.zip
*** empty log message ***
Diffstat (limited to 'bundles')
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Control.java49
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/MenuItem.java27
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Widget.java49
3 files changed, 75 insertions, 50 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Control.java
index 56397bb26e..2dcf7500bc 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Control.java
@@ -946,30 +946,6 @@ public void setForeground (Color color) {
OS.PtSetResources (handle, args.length / 3, args);
}
-void setKeyState(Event event, PhKeyEvent_t ke) {
- int key_mods = ke.key_mods;
- int button_state = ke.button_state;
- if ((key_mods & OS.Pk_KM_Alt) != 0) event.stateMask |= SWT.ALT;
- if ((key_mods & OS.Pk_KM_Shift) != 0) event.stateMask |= SWT.SHIFT;
- if ((key_mods & OS.Pk_KM_Ctrl) != 0) event.stateMask |= SWT.CONTROL;
- if ((button_state & OS.Ph_BUTTON_SELECT) != 0) event.stateMask |= SWT.BUTTON1;
- if ((button_state & OS.Ph_BUTTON_ADJUST) != 0) event.stateMask |= SWT.BUTTON2;
- if ((button_state & OS.Ph_BUTTON_MENU) != 0) event.stateMask |= SWT.BUTTON3;
- switch (event.type) {
- case SWT.KeyDown:
- case SWT.Traverse:
- if (event.keyCode == SWT.ALT) event.stateMask &= ~SWT.ALT;
- if (event.keyCode == SWT.SHIFT) event.stateMask &= ~SWT.SHIFT;
- if (event.keyCode == SWT.CONTROL) event.stateMask &= ~SWT.CONTROL;
- break;
- case SWT.KeyUp:
- if (event.keyCode == SWT.ALT) event.stateMask |= SWT.ALT;
- if (event.keyCode == SWT.SHIFT) event.stateMask |= SWT.SHIFT;
- if (event.keyCode == SWT.CONTROL) event.stateMask |= SWT.CONTROL;
- break;
- }
-}
-
public void setLayoutData (Object layoutData) {
checkWidget();
this.layoutData = layoutData;
@@ -1000,31 +976,6 @@ public void setMenu (Menu menu) {
this.menu = menu;
}
-void setMouseState(int type, Event event, PhPointerEvent_t pe) {
- int key_mods = pe.key_mods;
- int buttons = pe.buttons;
- int button_state = pe.button_state;
- if ((key_mods & OS.Pk_KM_Alt) != 0) event.stateMask |= SWT.ALT;
- if ((key_mods & OS.Pk_KM_Shift) != 0) event.stateMask |= SWT.SHIFT;
- if ((key_mods & OS.Pk_KM_Ctrl) != 0) event.stateMask |= SWT.CONTROL;
- if ((button_state & OS.Ph_BUTTON_SELECT) != 0) event.stateMask |= SWT.BUTTON1;
- if ((button_state & OS.Ph_BUTTON_ADJUST) != 0) event.stateMask |= SWT.BUTTON2;
- if ((button_state & OS.Ph_BUTTON_MENU) != 0) event.stateMask |= SWT.BUTTON3;
- switch (type) {
- case OS.Ph_EV_BUT_PRESS:
- if (buttons == OS.Ph_BUTTON_SELECT) event.stateMask &= ~SWT.BUTTON1;
- if (buttons == OS.Ph_BUTTON_ADJUST) event.stateMask &= ~SWT.BUTTON2;
- if (buttons == OS.Ph_BUTTON_MENU) event.stateMask &= ~SWT.BUTTON3;
- break;
- case OS.Ph_EV_BUT_RELEASE:
- case OS.Ph_EV_DRAG:
- if (buttons == OS.Ph_BUTTON_SELECT) event.stateMask |= SWT.BUTTON1;
- if (buttons == OS.Ph_BUTTON_ADJUST) event.stateMask |= SWT.BUTTON2;
- if (buttons == OS.Ph_BUTTON_MENU) event.stateMask |= SWT.BUTTON3;
- break;
- }
-}
-
public boolean setParent (Composite parent) {
checkWidget();
if (parent.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/MenuItem.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/MenuItem.java
index 3c41a800f1..4498d10c08 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/MenuItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/MenuItem.java
@@ -169,7 +169,32 @@ int processSelection (int info) {
return OS.Pt_CONTINUE;
}
}
- postEvent (SWT.Selection);
+ Event event = new Event ();
+ if (info != 0) {
+ PtCallbackInfo_t cbinfo = new PtCallbackInfo_t ();
+ OS.memmove (cbinfo, info, PtCallbackInfo_t.sizeof);
+ if (cbinfo.event != 0) {
+ PhEvent_t ev = new PhEvent_t ();
+ OS.memmove (ev, cbinfo.event, PhEvent_t.sizeof);
+ int data = OS.PhGetData (cbinfo.event);
+ if (data != 0) {
+ switch (ev.type) {
+ case OS.Ph_EV_KEY:
+ PhKeyEvent_t ke = new PhKeyEvent_t ();
+ OS.memmove (ke, data, PhKeyEvent_t.sizeof);
+ setKeyState (event, ke);
+ break;
+ case OS.Ph_EV_BUT_PRESS:
+ case OS.Ph_EV_BUT_RELEASE:
+ PhPointerEvent_t pe = new PhPointerEvent_t ();
+ OS.memmove (pe, data, PhPointerEvent_t.sizeof);
+ setMouseState (ev.type, event, pe);
+ break;
+ }
+ }
+ }
+ }
+ postEvent (SWT.Selection, event);
return OS.Pt_CONTINUE;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Widget.java
index 307bcf91ea..7ea8277cac 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Widget.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Widget.java
@@ -508,6 +508,55 @@ public void setData (String key, Object value) {
values = newValues;
}
+void setKeyState(Event event, PhKeyEvent_t ke) {
+ int key_mods = ke.key_mods;
+ int button_state = ke.button_state;
+ if ((key_mods & OS.Pk_KM_Alt) != 0) event.stateMask |= SWT.ALT;
+ if ((key_mods & OS.Pk_KM_Shift) != 0) event.stateMask |= SWT.SHIFT;
+ if ((key_mods & OS.Pk_KM_Ctrl) != 0) event.stateMask |= SWT.CONTROL;
+ if ((button_state & OS.Ph_BUTTON_SELECT) != 0) event.stateMask |= SWT.BUTTON1;
+ if ((button_state & OS.Ph_BUTTON_ADJUST) != 0) event.stateMask |= SWT.BUTTON2;
+ if ((button_state & OS.Ph_BUTTON_MENU) != 0) event.stateMask |= SWT.BUTTON3;
+ switch (event.type) {
+ case SWT.KeyDown:
+ case SWT.Traverse:
+ if (event.keyCode == SWT.ALT) event.stateMask &= ~SWT.ALT;
+ if (event.keyCode == SWT.SHIFT) event.stateMask &= ~SWT.SHIFT;
+ if (event.keyCode == SWT.CONTROL) event.stateMask &= ~SWT.CONTROL;
+ break;
+ case SWT.KeyUp:
+ if (event.keyCode == SWT.ALT) event.stateMask |= SWT.ALT;
+ if (event.keyCode == SWT.SHIFT) event.stateMask |= SWT.SHIFT;
+ if (event.keyCode == SWT.CONTROL) event.stateMask |= SWT.CONTROL;
+ break;
+ }
+}
+
+void setMouseState(int type, Event event, PhPointerEvent_t pe) {
+ int key_mods = pe.key_mods;
+ int buttons = pe.buttons;
+ int button_state = pe.button_state;
+ if ((key_mods & OS.Pk_KM_Alt) != 0) event.stateMask |= SWT.ALT;
+ if ((key_mods & OS.Pk_KM_Shift) != 0) event.stateMask |= SWT.SHIFT;
+ if ((key_mods & OS.Pk_KM_Ctrl) != 0) event.stateMask |= SWT.CONTROL;
+ if ((button_state & OS.Ph_BUTTON_SELECT) != 0) event.stateMask |= SWT.BUTTON1;
+ if ((button_state & OS.Ph_BUTTON_ADJUST) != 0) event.stateMask |= SWT.BUTTON2;
+ if ((button_state & OS.Ph_BUTTON_MENU) != 0) event.stateMask |= SWT.BUTTON3;
+ switch (type) {
+ case OS.Ph_EV_BUT_PRESS:
+ if (buttons == OS.Ph_BUTTON_SELECT) event.stateMask &= ~SWT.BUTTON1;
+ if (buttons == OS.Ph_BUTTON_ADJUST) event.stateMask &= ~SWT.BUTTON2;
+ if (buttons == OS.Ph_BUTTON_MENU) event.stateMask &= ~SWT.BUTTON3;
+ break;
+ case OS.Ph_EV_BUT_RELEASE:
+ case OS.Ph_EV_DRAG:
+ if (buttons == OS.Ph_BUTTON_SELECT) event.stateMask |= SWT.BUTTON1;
+ if (buttons == OS.Ph_BUTTON_ADJUST) event.stateMask |= SWT.BUTTON2;
+ if (buttons == OS.Ph_BUTTON_MENU) event.stateMask |= SWT.BUTTON3;
+ break;
+ }
+}
+
public String toString () {
String string = "*Disposed*";
if (!isDisposed ()) {

Back to the top