/// <summary> /// Display diagram specified by given definition /// </summary> /// <param name="diagramDefinition">Diagram definition to be displayed</param> /// <returns>Context of displayed diagram</returns> public DiagramContext Display(DiagramDefinition diagramDefinition) { _currentDiagram = diagramDefinition; Engine.Clear(); if (diagramDefinition == null) { return(null); } var context = new DiagramContext(this, diagramDefinition); displayItems(diagramDefinition, context); var menu = createContextMenu(diagramDefinition, context); //context menu handling Engine.Output.ContextMenu = menu; if (_lastContextMenuHandler != null) { Engine.Output.ContextMenuOpening -= _lastContextMenuHandler; } _lastContextMenuHandler = (s, e) => menu_ContextMenuOpening(menu, context); Engine.Output.ContextMenuOpening += _lastContextMenuHandler; Engine.Output.SetContext(context); Engine.Display(); return(context); }
static MouseManager() { onMouseLeftButtonDown = (s, e) => { var p = Mouse.GetPosition((IInputElement)s); SetOnMouseLeftButtonDown((DependencyObject)s, p); }; onMouseRightButtonDown = (s, e) => { var p = Mouse.GetPosition((IInputElement)s); SetOnMouseRightButtonDown((DependencyObject)s, p); }; onMouseDoubleClick = (s, e) => { var p = Mouse.GetPosition((IInputElement)s); SetOnMouseDoubleClick((DependencyObject)s, p); }; onContextMenuOpening = (s, e) => { var p = Mouse.GetPosition((IInputElement)s); SetOnContextMenuOpening((DependencyObject)s, p); }; }
internal static new void InvokeHandler(Delegate handler, IntPtr sender, IntPtr args) { ContextMenuEventHandler handler_ = (ContextMenuEventHandler)handler; if (handler_ != null) { handler_(Extend.GetProxy(sender, false), new ContextMenuEventArgs(args, false)); } }
public AutoHideMenuItem() { MouseMove += new MouseEventHandler(AutoHideMenuItem_MouseMove); ContextMenuOpening += new ContextMenuEventHandler(AutoHideMenuItem_ContextMenuOpening); SubmenuClosed += new RoutedEventHandler(AutoHideMenuItem_SubmenuClosed); timer = new DispatcherTimer(DispatcherPriority.Normal, Dispatcher); timer.Interval = TimeSpan.FromSeconds(AutoHideDelay); timer.Stop(); timer.Tick += new EventHandler(timer_Tick); }
public SpellCheckTextBox() : base() { this.ContextMenu = contextMenu; this.SpellCheck.IsEnabled = true; this.SpellCheck.SpellingReform = SpellingReform.Postreform; if (System.IO.File.Exists("Wörterbuch.lex")) this.SpellCheck.CustomDictionaries.Add(new Uri("Wörterbuch.lex", UriKind.Relative)); this.Language = System.Windows.Markup.XmlLanguage.GetLanguage("DE"); this.Initialized += (s, e) => ContextMenuOpening += new ContextMenuEventHandler(SpellCheckTextBox_ContextMenuOpening); }
public void OnShowContextMenu(UInt32 contextFlags, [MarshalAs(UnmanagedType.Interface)] nsIDOMEvent eve, [MarshalAs(UnmanagedType.Interface)] nsIDOMNode node) { #if debug OnGeneric("OnShowContextMenu"); Console.Error.WriteLine("OnShowContextMenu"); #endif ContextMenuEventHandler eh = (ContextMenuEventHandler)(owner.Events[WebBrowser.ContextMenuEvent]); if (eh != null) { nsIDOMMouseEvent mouseEvent = (nsIDOMMouseEvent)eve; int x, y; mouseEvent.getClientX(out x); mouseEvent.getClientY(out y); ContextMenuEventArgs args = new ContextMenuEventArgs(x, y); eh(owner, args); } }
public EditableTextBox() : base() { Background = System.Windows.Media.Brushes.Transparent; TextAlignment = System.Windows.TextAlignment.Left; BorderThickness = new System.Windows.Thickness(0.0); IsReadOnly = true; Focusable = false; IsTabStop = false; IsHitTestVisible = true; Cursor = System.Windows.Input.Cursors.Arrow; Margin = new System.Windows.Thickness(5, 0, 5, 0); KeyDown += new System.Windows.Input.KeyEventHandler(ClassTextBox_KeyDown); KeyUp += new KeyEventHandler(EditableTextBox_KeyUp); LostFocus += new System.Windows.RoutedEventHandler(ClassTextBox_LostFocus); LostKeyboardFocus += new KeyboardFocusChangedEventHandler(ClassTextBox_LostKeyboardFocus); MouseEnter += new MouseEventHandler(ClassTextBox_MouseEnter); MouseLeave += new MouseEventHandler(ClassTextBox_MouseLeave); ContextMenuOpening += new ContextMenuEventHandler(ClassTextBox_ContextMenuOpening); ContextMenuClosing += new ContextMenuEventHandler(ClassTextBox_ContextMenuClosing); FocusVisualStyle = null; ResetContextMenu(); }
/// <summary> /// Support DynamicInvoke for ContextMenuEvent /// </summary> /// <param name="genericHandler"></param> /// <param name="genericTarget"></param> protected override void InvokeEventHandler(Delegate genericHandler, object genericTarget) { ContextMenuEventHandler handler = (ContextMenuEventHandler)genericHandler; handler(genericTarget, this); }
/// <summary> /// Removes a handler for the ContextMenuClosing attached event /// </summary> /// <param name="element">UIElement or ContentElement that listens to this event</param> /// <param name="handler">Event Handler to be removed</param> public static void RemoveContextMenuClosingHandler(DependencyObject element, ContextMenuEventHandler handler) { UIElement.RemoveHandler(element, ContextMenuClosingEvent, handler); }
/// <summary> /// Adds a handler for the ContextMenuOpening attached event /// </summary> /// <param name="element">UIElement or ContentElement that listens to this event</param> /// <param name="handler">Event Handler to be added</param> public static void AddContextMenuOpeningHandler(DependencyObject element, ContextMenuEventHandler handler) { UIElement.AddHandler(element, ContextMenuOpeningEvent, handler); }
public void RedrawFrameGeometry (Object Sender) { CloseRequested PosWindow_CloseRequestedEntry = new CloseRequested (PosWindow_CloseRequestedCall); // String EntryToRefresh = LoadPicturePartsButton.Tag as String; if (PicturesTabControl.SelectedItem == null) return; TabItem SelectedItem = PicturesTabControl.SelectedItem as TabItem; String PageID = SelectedItem.Tag as String; Grid RootGrid = SelectedItem.Content as Grid; bool Found = false; foreach (UIElement Entry in RootGrid.Children) { if ((Entry is Canvas) == false) continue; if ((Entry as Canvas) == GraphicsSingleton.Instance.GraphicsHandler.RootCanvasForDrawingActivities) { Found = true; break; } } if (!Found) { GraphicsSingleton.Instance.GraphicsHandler.ClearRootCanvas (); GraphicsSingleton.Instance.GraphicsHandler.RootCanvasForDrawingActivities = null; RootGrid.Children.Add (GraphicsSingleton.Instance.GraphicsHandler.RootCanvasForDrawingActivities); } Border TargetBorder = RootGrid.Children [0] as Border; Image TargetImage = TargetBorder.Child as Image; RedrawInformation RedrawData = TargetImage.Tag as RedrawInformation; if (Sender is CVM.PositioningEntry) { if (WMB.Basics.IsTestRun) WMB.Basics.ReportInformationToEventViewer ("TableProcessing.ShowFrameGeometryButton_Click", "CVM.PositioningEntry.ShowFrameGeometry von CVM.PositioningEntry " + (Sender as CVM.PositioningEntry).AddOnText); CVM.PositioningEntry.ShowFrameGeometry (DrawingWidth, GraphicsSingleton.Instance.GraphicsHandler, RedrawData, SelectedItem.Content as Grid, PageID, new CVM.PositioningEntry.RedrawMeEvent (RedrawMe), new GraphicsSingleton.DoThisAfterContextProcessingEvent (DoThisAfterContextProcessingCall), new SetUIElementsEnabelingToEvent (SetUIElementsEnabelingToEventHandler), new ActivatePageIDEvent (ActivatePageIDEventHandler), new GetBeitragsDatenFromBeitragsIDEvent (GetBeitragsDatenFromBeitragsIDHandler), PosWindow_CloseRequestedEntry, new RedrawFrameGeometryEvent(RedrawFrameGeometry)); return; } this.IsEnabled = false; if (ShowFrameGeometryButton.Content.ToString () == "Layout/Geometrie") { if (WMB.Basics.IsTestRun) WMB.Basics.ReportInformationToEventViewer ("TableProcessing.ShowFrameGeometryButton_Click", "CVM.PositioningEntry.ShowFrameGeometry mit ShowFrameGeometryButton.Content== Layout/Geometrie"); CVM.PositioningEntry.ShowFrameGeometry (DrawingWidth, GraphicsSingleton.Instance.GraphicsHandler, RedrawData, SelectedItem.Content as Grid, PageID, new CVM.PositioningEntry.RedrawMeEvent (RedrawMe), new GraphicsSingleton.DoThisAfterContextProcessingEvent (DoThisAfterContextProcessingCall), new SetUIElementsEnabelingToEvent (SetUIElementsEnabelingToEventHandler), new ActivatePageIDEvent (ActivatePageIDEventHandler), new GetBeitragsDatenFromBeitragsIDEvent (GetBeitragsDatenFromBeitragsIDHandler), PosWindow_CloseRequestedEntry, new RedrawFrameGeometryEvent (RedrawFrameGeometry)); ShowFrameGeometryButton.Content = "Normalsicht"; ShowFrameGeometryButton.ToolTip = "Neue Text- oder Bildrahmen können durch die rechte Maustaste angefordert werden"; if (m_FrameProcessingContextMenuHandler == null) m_FrameProcessingContextMenuHandler = new ContextMenuEventHandler (SelectedItem_ContextMenuOpening); ShowFrameGeometryButton.ContextMenuOpening += m_FrameProcessingContextMenuHandler; } else { if (WMB.Basics.IsTestRun) WMB.Basics.ReportInformationToEventViewer ("TableProcessing.ShowFrameGeometryButton_Click", "CVM.PositioningEntry.ShowFrameGeometry mit ShowFrameGeometryButton.Content == " + ShowFrameGeometryButton.Content.ToString ()); if (ShowFrameGeometryButton.Content.ToString () == "Speichern") { DoThisAfterContextProcessingCall (this, "Refresh"); } GraphicsSingleton.Instance.GraphicsHandler.ModificationRequired = true; GraphicsSingleton.Instance.CloseAndSaveAllPositioningWindows (); // CVM.PositioningEntry.DeleteExistingFrames (); GraphicsSingleton.Instance.GraphicsHandler.ClearRootCanvas (); RedrawMe (PageID); ShowFrameGeometryButton.Content = "Layout/Geometrie"; ShowFrameGeometryButton.ContextMenuOpening -= m_FrameProcessingContextMenuHandler; m_FrameProcessingContextMenuHandler = null; ShowFrameGeometryButton.ContextMenu = null; ShowFrameGeometryButton.ToolTip = ""; FormatModified = false; } this.IsEnabled = true; }
private void LoadFunctionTree (System.Windows.Controls.TreeView FunctionTree, DataTable FuntionDescriptionsParameter) { FuntionDescriptions = FuntionDescriptionsParameter; FunctionTree.Items.Clear (); foreach (DataRow RootEntry in FuntionDescriptions.Rows) { ContextMenuEventHandler ContextHandler = new ContextMenuEventHandler (ItemToInsert_ContextMenuOpening); System.Windows.Input.MouseButtonEventHandler MouseDouble = new System.Windows.Input.MouseButtonEventHandler (ItemToInsert_MouseDoubleClick); if ((RootEntry ["ParentID"] == Convert.DBNull) || (((System.Guid) RootEntry ["ParentID"]) == System.Guid.Empty)) { TreeViewItem RootItem = new TreeViewItem (); RootItem.Header = RootEntry ["Description"].ToString (); RootItem.Tag = RootEntry; RootItem.ToolTip = RootEntry ["ToolTip"].ToString (); RootItem.ContextMenuOpening += new ContextMenuEventHandler (ItemToInsert_ContextMenuOpening); RootItem.MouseDoubleClick += new System.Windows.Input.MouseButtonEventHandler (ItemToInsert_MouseDoubleClick); FunctionTree.Items.Add (RootItem); LoadFunctionTreeLoop (RootItem, ContextHandler, MouseDouble); } } }
private void LoadFunctionTreeLoop (TreeViewItem ParentItem, ContextMenuEventHandler ContextHandler, System.Windows.Input.MouseButtonEventHandler MouseDouble) { DataRow ParentRow = ParentItem.Tag as DataRow; System.Guid ParentID = (System.Guid) ParentRow ["ID"]; foreach (DataRow EntryRow in DataWrapper.Instance.Auswertungen.Rows) { if ((EntryRow ["ParentID"] != Convert.DBNull) && (((System.Guid) EntryRow ["ParentID"]) == ParentID)) { TreeViewItem ItemToInsert = new TreeViewItem (); ItemToInsert.Header = EntryRow ["Description"].ToString (); ItemToInsert.Tag = EntryRow; ItemToInsert.ToolTip = EntryRow ["ToolTip"].ToString (); ParentItem.Items.Add (ItemToInsert); ItemToInsert.ContextMenuOpening += ContextHandler; ItemToInsert.MouseDoubleClick += MouseDouble; LoadFunctionTreeLoop (ItemToInsert, ContextHandler, MouseDouble); } } }
/// <summary> /// Removes a handler for the ContextMenuClosing attached event /// </summary> /// <param name="element">UIElement or ContentElement that listens to this event</param> /// <param name="handler">Event Handler to be removed</param> public static void RemoveContextMenuClosingHandler(DependencyObject element, ContextMenuEventHandler handler) { UIElement.RemoveHandler(element, ContextMenuClosingEvent, handler); }
/// <summary> /// Adds a handler for the ContextMenuOpening attached event /// </summary> /// <param name="element">UIElement or ContentElement that listens to this event</param> /// <param name="handler">Event Handler to be added</param> public static void AddContextMenuOpeningHandler(DependencyObject element, ContextMenuEventHandler handler) { UIElement.AddHandler(element, ContextMenuOpeningEvent, handler); }
private void FillEntriesTreeView () { ContextMenuEventHandler ExpandEvent = new ContextMenuEventHandler (RootItem_ContextMenuOpening); MouseButtonEventHandler ExpandPerDoubleClickEvent = new MouseButtonEventHandler (Table_MouseDoubleClick); foreach (DataRow TableRow in DataWrapper.Instance.AllTabellen.Rows) { TreeViewItem RootItem = new TreeViewItem (); RootItem.Tag = TableRow; RootItem.Header = TableRow ["TableName"].ToString (); RootItem.ContextMenuOpening += ExpandEvent; RootItem.MouseDoubleClick += ExpandPerDoubleClickEvent; EntriesTreeView.Items.Add (RootItem); } }