internal virtual void ProcessEvent(AWTEvent e) { if (e is MouseEvent) { switch (e.ID) { case MouseEvent.MOUSE_PRESSED: case MouseEvent.MOUSE_RELEASED: case MouseEvent.MOUSE_CLICKED: ProcessMouseEvent((MouseEvent)e); break; case MouseEvent.MOUSE_MOVED: ProcessMouseMotionEvent((MouseEvent)e); break; default: return; } } else if (e is ActionEvent) { ProcessActionEvent((ActionEvent)e); } }
public virtual EventFilter_FilterAction AcceptEvent(AWTEvent @event) { if (Disabled || !ModalDialog_Renamed.Visible) { return(EventFilter_FilterAction.ACCEPT); } int eventID = @event.ID; if ((eventID >= MouseEvent.MOUSE_FIRST && eventID <= MouseEvent.MOUSE_LAST) || (eventID >= ActionEvent.ACTION_FIRST && eventID <= ActionEvent.ACTION_LAST) || eventID == WindowEvent.WINDOW_CLOSING) { Object o = @event.Source; if (o is sun.awt.ModalExclude) { // Exclude this object from modality and // continue to pump it's events. } else if (o is Component) { Component c = (Component)o; while ((c != null) && !(c is Window)) { c = c.Parent_NoClientCode; } if (c != null) { return(AcceptWindow((Window)c)); } } } return(EventFilter_FilterAction.ACCEPT); }
/// <summary> /// Copies all private data from this event into that. /// Space is allocated for the copied data that will be /// freed when the that is finalized. Upon completion, /// this event is not changed. /// </summary> internal virtual void CopyPrivateDataInto(AWTEvent that) { that.Bdata = this.Bdata; // Copy canAccessSystemClipboard value from this into that. if (this is InputEvent && that is InputEvent) { Field field = Get_InputEvent_CanAccessSystemClipboard(); if (field != null) { try { bool b = field.getBoolean(this); field.setBoolean(that, b); } catch (IllegalAccessException e) { if (Log.isLoggable(PlatformLogger.Level.FINE)) { Log.fine("AWTEvent.copyPrivateDataInto() got IllegalAccessException ", e); } } } } that.IsSystemGenerated = this.IsSystemGenerated; }
/// <summary> /// Processes events on this menu item. If the event is an /// instance of <code>ActionEvent</code>, it invokes /// <code>processActionEvent</code>, another method /// defined by <code>MenuItem</code>. /// <para> /// Currently, menu items only support action events. /// </para> /// <para>Note that if the event parameter is <code>null</code> /// the behavior is unspecified and may result in an /// exception. /// /// </para> /// </summary> /// <param name="e"> the event </param> /// <seealso cref= java.awt.MenuItem#processActionEvent /// @since JDK1.1 </seealso> protected internal override void ProcessEvent(AWTEvent e) { if (e is ActionEvent) { ProcessActionEvent((ActionEvent)e); } }
internal virtual void DispatchEventImpl(AWTEvent e) { EventQueue.CurrentEventAndMostRecentTime = e; Toolkit.DefaultToolkit.NotifyAWTEventListeners(e); if (NewEventsOnly || (Parent_Renamed != null && Parent_Renamed is MenuComponent && ((MenuComponent)Parent_Renamed).NewEventsOnly)) { if (EventEnabled(e)) { ProcessEvent(e); } else if (e is ActionEvent && Parent_Renamed != null) { e.Source = Parent_Renamed; ((MenuComponent)Parent_Renamed).DispatchEvent(e); } } // backward compatibility else { Event olde = e.ConvertToOld(); if (olde != null) { PostEvent(olde); } } }
/// <summary> /// Processes events on this check box menu item. /// If the event is an instance of <code>ItemEvent</code>, /// this method invokes the <code>processItemEvent</code> method. /// If the event is not an item event, /// it invokes <code>processEvent</code> on the superclass. /// <para> /// Check box menu items currently support only item events. /// </para> /// <para>Note that if the event parameter is <code>null</code> /// the behavior is unspecified and may result in an /// exception. /// /// </para> /// </summary> /// <param name="e"> the event </param> /// <seealso cref= java.awt.event.ItemEvent </seealso> /// <seealso cref= #processItemEvent /// @since JDK1.1 </seealso> protected internal override void ProcessEvent(AWTEvent e) { if (e is ItemEvent) { ProcessItemEvent((ItemEvent)e); return; } base.ProcessEvent(e); }
/// <summary> /// Constructs a new SequencedEvent which will dispatch the specified /// nested event. /// </summary> /// <param name="nested"> the AWTEvent which this SequencedEvent's dispatch() /// method will dispatch </param> public SequencedEvent(AWTEvent nested) : base(nested.Source, ID) { this.Nested = nested; // All AWTEvents that are wrapped in SequencedEvents are (at // least currently) implicitly generated by the system SunToolkit.SystemGenerated = nested; lock (typeof(SequencedEvent)) { List.Add(this); } }
// REMIND: remove when filtering is done at lower level internal override bool EventEnabled(AWTEvent e) { if (e.Id == ActionEvent.ACTION_PERFORMED) { if ((EventMask & AWTEvent.ACTION_EVENT_MASK) != 0 || ActionListener != null) { return(true); } return(false); } return(base.EventEnabled(e)); }
// REMIND: remove when filtering is done at lower level internal override bool EventEnabled(AWTEvent e) { if (e.Id == ItemEvent.ITEM_STATE_CHANGED) { if ((EventMask & AWTEvent.ITEM_EVENT_MASK) != 0 || ItemListener != null) { return(true); } return(false); } return(base.EventEnabled(e)); }
/// <summary> /// Delivers an event to this component or one of its sub components. </summary> /// <param name="e"> the event </param> public void DispatchEvent(AWTEvent e) { DispatchEventImpl(e); }
public virtual EventFilter_FilterAction AcceptEvent(AWTEvent @event) { if (ModalComponent != null) { int eventID = @event.ID; bool mouseEvent = (eventID >= MouseEvent.MOUSE_FIRST) && (eventID <= MouseEvent.MOUSE_LAST); bool actionEvent = (eventID >= ActionEvent.ACTION_FIRST) && (eventID <= ActionEvent.ACTION_LAST); bool windowClosingEvent = (eventID == WindowEvent.WINDOW_CLOSING); /* * filter out MouseEvent and ActionEvent that's outside * the modalComponent hierarchy. * KeyEvent is handled by using enqueueKeyEvent * in Dialog.show */ if (Component.IsInstanceOf(ModalComponent, "javax.swing.JInternalFrame")) { /* * Modal internal frames are handled separately. If event is * for some component from another heavyweight than modalComp, * it is accepted. If heavyweight is the same - we still accept * event and perform further filtering in LightweightDispatcher */ return(windowClosingEvent ? EventFilter_FilterAction.REJECT : EventFilter_FilterAction.ACCEPT); } if (mouseEvent || actionEvent || windowClosingEvent) { Object o = @event.Source; if (o is sun.awt.ModalExclude) { // Exclude this object from modality and // continue to pump it's events. return(EventFilter_FilterAction.ACCEPT); } else if (o is Component) { Component c = (Component)o; // 5.0u3 modal exclusion bool modalExcluded = false; if (ModalComponent is Container) { while (c != ModalComponent && c != null) { if ((c is Window) && (sun.awt.SunToolkit.isModalExcluded((Window)c))) { // Exclude this window and all its children from // modality and continue to pump it's events. modalExcluded = true; break; } c = c.Parent; } } if (!modalExcluded && (c != ModalComponent)) { return(EventFilter_FilterAction.REJECT); } } } } return(EventFilter_FilterAction.ACCEPT); }
internal virtual void PumpOneEventForFilters(int id) { AWTEvent @event = null; bool eventOK = false; try { EventQueue eq = null; EventQueueDelegate.Delegate @delegate = null; do { // EventQueue may change during the dispatching eq = EventQueue; @delegate = EventQueueDelegate.Delegate; if (@delegate != null && id == ANY_EVENT) { @event = @delegate.getNextEvent(eq); } else { @event = (id == ANY_EVENT) ? eq.NextEvent : eq.GetNextEvent(id); } eventOK = true; lock (EventFilters) { for (int i = EventFilters.Count - 1; i >= 0; i--) { EventFilter f = EventFilters[i]; EventFilter_FilterAction accept = f.AcceptEvent(@event); if (accept == EventFilter_FilterAction.REJECT) { eventOK = false; break; } else if (accept == EventFilter_FilterAction.ACCEPT_IMMEDIATELY) { break; } } } eventOK = eventOK && SunDragSourceContextPeer.checkEvent(@event); if (!eventOK) { @event.Consume(); } } while (eventOK == false); if (EventLog.isLoggable(PlatformLogger.Level.FINEST)) { EventLog.finest("Dispatching: " + @event); } Object handle = null; if (@delegate != null) { handle = @delegate.beforeDispatch(@event); } eq.DispatchEvent(@event); if (@delegate != null) { @delegate.afterDispatch(@event, handle); } } catch (ThreadDeath death) { DoDispatch = false; throw death; } catch (InterruptedException) { DoDispatch = false; // AppContext.dispose() interrupts all // Threads in the AppContext } catch (Throwable e) { ProcessException(e); } }
internal SentEvent(AWTEvent nested, AppContext toNotify) : base((nested != null) ? nested.Source : Toolkit.DefaultToolkit, ID) { this.Nested = nested; this.ToNotify = toNotify; }
internal SentEvent(AWTEvent nested) : this(nested, null) { }
/// <summary> /// Processes events occurring on this menu component. /// </summary> protected void processEvent(AWTEvent @e) { }
public virtual bool IsSystemGenerated(AWTEvent ev) { return(ev.IsSystemGenerated); }
// REMIND: remove when filtering is done at lower level internal virtual bool EventEnabled(AWTEvent e) { return(false); }
public virtual bool IsSequencedEvent(AWTEvent @event) { return(@event is SequencedEvent); }
public virtual AWTEvent GetNested(AWTEvent sequencedEvent) { return(((SequencedEvent)sequencedEvent).Nested); }
public virtual AccessControlContext GetAccessControlContext(AWTEvent ev) { return(ev.AccessControlContext); }
public virtual void SetBData(AWTEvent ev, sbyte[] bdata) { ev.Bdata = bdata; }
public virtual sbyte[] GetBData(AWTEvent ev) { return(ev.Bdata); }
/// <summary> /// Processes events occurring on this menu component. /// <para>Note that if the event parameter is <code>null</code> /// the behavior is unspecified and may result in an /// exception. /// /// </para> /// </summary> /// <param name="e"> the event /// @since JDK1.1 </param> protected internal virtual void ProcessEvent(AWTEvent e) { }
/// <summary> /// Potentially coalesce an event being posted with an existing /// event. /// </summary> protected AWTEvent coalesceEvents(AWTEvent @existingEvent, AWTEvent @newEvent) { return(default(AWTEvent)); }
/// <summary> /// /// </summary> public void dispatchEvent(AWTEvent @e) { }
internal virtual void DispatchEvent(AWTEvent e) { EventQueue.CurrentEventAndMostRecentTime = e; Toolkit.DefaultToolkit.NotifyAWTEventListeners(e); ProcessEvent(e); }