private void AddCustomCaption() { // Setup tray button CustomCaptionButton customButton = new CustomCaptionButton(); customButton.Key = "TrayButton"; customButton.Click += new EventHandler(trayButton_Click); CaptionButtons.Add(customButton); }
public CustomSkin(string skinConfigFile) { _skinSetting = new SkinSetting(skinConfigFile); CaptionButtons.Add(new CaptionButton(HitTest.HTCLOSE)); CaptionButtons.Add(new CaptionButton(HitTest.HTMAXBUTTON)); CaptionButtons.Add(new CaptionButton(HitTest.HTMINBUTTON)); foreach (CaptionButton button in CaptionButtons) { button.PropertyChanged += OnCommandButtonPropertyChanged; } }
void DaggerUISubNode_DaggerNodeAttached(DaggerNode node) { // store the sub node so we can make the UIGraph for it later _node = (DaggerSubNode)node; _node.SubNodeGraph.ImportedPins.PinAdded += new DaggerPinAdded(ImportedPins_PinAdded); _node.SubNodeGraph.ExportedPins.PinAdded += new DaggerPinAdded(ExportedPins_PinAdded); _editSubNodeButton = new SimpleImageButton(); _editSubNodeButton.ButtonImage = _subnodeEditButtonImageList.Images[0]; _editSubNodeButton.ButtonImage2 = _subnodeEditButtonImageList.Images[1]; _editSubNodeButton.MultiState = true; _editSubNodeButton.ToolTipText = "Edit SubNode"; _editSubNodeButton.ToolTipEnabled = true; _editSubNodeButton.StateChanged += new SimpleImageButton.StateChangedEventHandler(_editSubNodeButton_StateChanged); CaptionButtons.Add(_editSubNodeButton); }
public static void SetButtons(WindowX windowX, CaptionButtons value) { windowX.SetValue(ButtonsProperty, value); }
/// <summary> /// Event that is raised after a DaggerNode has been created and associated to the UI element /// </summary> /// <param name="node"></param> void DSFilterNodeUI_DaggerNodeAttached(DaggerLib.Core.DaggerNode node) { _dsfilternode = (DSFilterNode)node; CaptionText = node.ToString(); // hook the AfterNodeRemoved event to dispose of any directshow interfaces node.AfterNodeRemoved += new DaggerLib.Core.AfterNodeRemoveHandler(node_AfterNodeRemoved); // get the IBaseFilter from the DSFilterNode IBaseFilter filter = _dsfilternode._filter; // only grab the video window or EVR if it was manually added to the graph via the UI if (_dsfilternode._manualAdded || (_dsfilternode.ParentGraph.ParentUIGraph as DSDaggerUIGraph)._filterGraphCreated) { // if it supports IVideoWindow create a VideoInternalWindow for it IVideoWindow vw = filter as IVideoWindow; if (vw != null) { try { _videoWindow = new VideoInternalWindow(CaptionText, filter); _videoWindow.Dock = DockStyle.Fill; _videoWindow.Visible = true; InternalControl.Controls.Add(_videoWindow); // only nodes with video windows are resizeable Resizable = true; // hook the connection events to init/deinit the video window node.ParentGraph.AfterPinsConnected += new DaggerLib.Core.PinAfterConnectedHandler(ParentGraph_AfterPinsConnected); } catch (Exception ex) { #if DEBUG MessageBox.Show(ex.Message); #endif _videoWindow = null; } } // if it's an Enhaced Video Renderer create a VideoInternalWindow for it // (see docs for Windows Media Foundation) IMFGetService mfgs = filter as IMFGetService; if (mfgs != null) { // this is a video horse of a different color // create a video clipping window for the Media Foundation Enhanced Video Renderer try { // get the IMFVideoDisplayControl for the EVR filter object o = null; mfgs.GetService(MediaFoundation.MFServices.MR_VIDEO_RENDER_SERVICE, typeof(IMFVideoDisplayControl).GUID, out o ); m_pVideoDisplay = o as IMFVideoDisplayControl; // if the Video Size is 0,0 the EVR hasn't been initialized/connected yet MediaFoundation.Misc.SIZE videoSize = new MediaFoundation.Misc.SIZE(); MediaFoundation.Misc.SIZE ar = new MediaFoundation.Misc.SIZE(); m_pVideoDisplay.GetNativeVideoSize(videoSize, ar); if (videoSize.cx == 0 && videoSize.cy == 0) { // You only get one chance to set the number of pins in an EVR filter. PinsComboBoxForm pcf = new PinsComboBoxForm(); if (pcf.ShowDialog() == DialogResult.OK) { (filter as IEVRFilterConfig).SetNumberOfStreams(pcf.Value); } pcf.Dispose(); } _videoWindow = new VideoInternalWindow(CaptionText, m_pVideoDisplay); _videoWindow.Dock = DockStyle.Fill; _videoWindow.Visible = true; InternalControl.Controls.Add(_videoWindow); // only nodes with video windows are resizeable Resizable = true; // hook the connection events to init/deinit the video window node.ParentGraph.AfterPinsConnected += new DaggerLib.Core.PinAfterConnectedHandler(ParentGraph_AfterPinsConnected); } catch (InvalidCastException) { m_pVideoDisplay = null; } } } // if it's a DMO, create the DMO properties page for it if ((filter as IDMOWrapperFilter) != null) { // set the caption to show it's a DMO CaptionText = "DMO - " + CaptionText; CaptionColor = Color.Green; CaptionColorUnfocused = Color.LightGreen; } // remove clock button if it doesn't support IReferenceClock _referenceClock = filter as IReferenceClock; if (_referenceClock == null) { CaptionButtons.RemoveAt(CaptionButtons.AllButtons.IndexOf(_clockButton)); } else { // see if this filter is the reference clock for the graph IReferenceClock graphClock = null; filter.GetSyncSource(out graphClock); _clockButton.Tag = false; _clockButton.MouseOutsideTint = Color.DarkGray; if (graphClock != null) { if (graphClock == _referenceClock) { _clockButton.MouseOutsideTint = Color.Yellow; _clockButton.Tag = true; } Marshal.ReleaseComObject(graphClock); } } // remove video window button if it's not a video window if (_videoWindow == null) { CaptionButtons.RemoveAt(CaptionButtons.AllButtons.IndexOf(_detachVideoWindowButton)); } // Sync the pins to the Pin Property Pages SyncPinPropertyPages(null); // set it to the smallest possible size. DaggerLib uses InternalControlMinimumSize // to prevent the UI node from being smaller than designated this.Size = new Size(1, 1); }