/// <summary> /// Overrides method to add itmes to the selected main itme in the sidebar. /// </summary> /// <param name="group">The group that defines this part of the sidebar.</param> public override void CreateUIForChoiceGroup(ChoiceGroup group) { #if USE_DOTNETBAR SideBarPanelItem panelItem = (SideBarPanelItem)group.ReferenceWidget; if (panelItem.SubItems.Count > 0 && panelItem.SubItems[0] is ControlContainerItem) { ControlContainerItem item = (ControlContainerItem)panelItem.SubItems[0]; TreeView tree = (TreeView)item.Control; if (tree.Nodes.Count == 0) { FillTreeNodes(tree.Nodes, group); } // It keeps growing with this. tree.Size = item.Size; } else if (group.ReferenceWidget is SideBarPanelItem) { panelItem.SubItems.Clear(); foreach (ChoiceRelatedClass item in group) { Debug.Assert(item is ChoiceBase, "Only things that can be made into buttons should be appearing here, else we should have a tree."); MakeButton(panelItem, (ChoiceBase)item); } } #endif }
private void ContainerLoadControl(object sender, System.EventArgs e) { BaseItem item = sender as BaseItem; if (item == null) { return; } if (item.Name == "cTaskShowatstartup") { ControlContainerItem containerItem = item as ControlContainerItem; CheckBox box = new CheckBox(); box.Text = "Show at startup"; box.FlatStyle = FlatStyle.Flat; box.Size = new System.Drawing.Size(95, 17); box.TabStop = false; box.Checked = true; box.CheckedChanged += new EventHandler(this.TaskPaneShowAtStartup); containerItem.Control = box; } else if (item.Name == "dockTaskList") { } else if (item.Name == "dockSearchResults") { // Just add the list box as a example... DockContainerItem dockItem = item as DockContainerItem; ListBox listbox = new ListBox(); // This will set the minimum size for the DockContainerItem listbox.Size = new Size(32, 32); // Must let the DockContainerItem resize it at will... listbox.IntegralHeight = false; dockItem.Control = listbox; } }
public UndoRedoDropDown(Designer designer, ButtonItem parent) { FDesigner = designer; FParent = parent; LayoutOrientation = eOrientation.Vertical; parent.PopupType = ePopupType.ToolBar; parent.SubItems.Add(this); parent.PopupOpen += new DotNetBarManager.PopupOpenEventHandler(parent_PopupOpen); lbxActions = new ListBox(); lbxActions.Size = new Size(150, 200); lbxActions.BorderStyle = BorderStyle.None; lbxActions.SelectionMode = SelectionMode.MultiSimple; lbxActions.MouseMove += new MouseEventHandler(lbxActions_MouseMove); lbxActions.MouseDown += new MouseEventHandler(lbxActions_MouseDown); FActionsHost = new ControlContainerItem(); FActionsHost.Control = lbxActions; SubItems.Add(FActionsHost); lblUndoRedo = new Label(); lblUndoRedo.AutoSize = false; lblUndoRedo.Size = new Size(150, 30); lblUndoRedo.TextAlign = ContentAlignment.MiddleCenter; lblUndoRedo.BackColor = Color.Transparent; FLabelHost = new ControlContainerItem(); FLabelHost.Control = lblUndoRedo; SubItems.Add(FLabelHost); }
public ColorButtonItem() { PopupType = ePopupType.ToolBar; FColorSelector = new ColorSelector(); FColorSelector.ColorSelected += new EventHandler(FColorSelector_ColorSelected); FHost = new ControlContainerItem(); FHost.Control = FColorSelector; SubItems.Add(FHost); }
public ChildBandMenu(Designer designer) : base(designer) { miFillUnusedSpace = CreateMenuItem(Res.Get("ComponentMenu,ChildBand,FillUnusedSpace"), new EventHandler(miFillUnusedSpace_Click)); miFillUnusedSpace.BeginGroup = true; miFillUnusedSpace.AutoCheckOnClick = true; miStartNewPage.BeginGroup = false; int insertPos = Items.IndexOf(miStartNewPage); Items.Insert(insertPos, miFillUnusedSpace); ChildBand childBand = Designer.SelectedObjects[0] as ChildBand; if (childBand.Parent is DataBand) { Panel panel = new Panel(); panel.BackColor = Color.Transparent; panel.Padding = new System.Windows.Forms.Padding(6, 0, 0, 0); Label label1 = new Label(); label1.Text = Res.Get("ComponentMenu,ChildBand,CompleteToNRows"); label1.AutoSize = true; label1.Parent = panel; int width = label1.Width + 8; label1.AutoSize = false; label1.Width = width; label1.Dock = DockStyle.Left; label1.TextAlign = ContentAlignment.MiddleLeft; NumericUpDown ud = new NumericUpDown(); ud.Parent = panel; ud.Left = width + 6; ud.Top = 2; ud.Width = 50; ud.Value = childBand.CompleteToNRows; ud.ValueChanged += new EventHandler(ud_ValueChanged); panel.Width = ud.Right + 8; panel.Height = ud.Height + 4; ControlContainerItem host = new ControlContainerItem(); host.Control = panel; Items.Insert(insertPos + 1, host); } ChildBand band = Designer.SelectedObjects[0] as ChildBand; miFillUnusedSpace.Enabled = !band.HasRestriction(Restrictions.DontModify); miFillUnusedSpace.Checked = band.FillUnusedSpace; }
/// <summary> /// Create a tree view for the sidebar. /// </summary> /// <param name="group">The definition for the tree view.</param> /// <param name="label"></param> /// <param name="panelItem"></param> protected void MakeTree(ChoiceGroup group, string label, ref SideBarPanelItem panelItem) { // TODO: This tree isn't the right size, when the window opens. // Figure out how to make it right. TreeView tree = new TreeView(); tree.Tag = group; tree.AfterSelect += new TreeViewEventHandler(OnTreeNodeSelected); ControlContainerItem containerItem = new ControlContainerItem(group.Id, label); containerItem.AllowItemResize = true; containerItem.Control = tree; panelItem.SubItems.Add(containerItem); }
// F e a t u r e s private BaseItem GetItem(DisplaylistProps props) { var editorControl = new CustomDisplaylistEntryEditor(props) { BackColor = Color.Transparent }; editorControl.RemoveButtonClicked += RemoveProps; var containerItem = new ControlContainerItem() { Control = editorControl, Stretch = true }; return(containerItem); }
private void ContainerLoadControl(object sender, System.EventArgs e) { BaseItem item = sender as BaseItem; if (item == null) { return; } if (item.Name == "cTaskShowatstartup") { ControlContainerItem containerItem = item as ControlContainerItem; CheckBox box = new CheckBox(); box.Text = "Show at startup"; box.FlatStyle = FlatStyle.Flat; box.Size = new System.Drawing.Size(95, 17); box.TabStop = false; box.Checked = true; box.CheckedChanged += new EventHandler(this.TaskPaneShowAtStartup); containerItem.Control = box; } else if (item.Name == "dockTaskList") { // See DefinitionLoaded event handler for Customize menu assignment for the bar that is containing this dock item DockContainerItem dockItem = item as DockContainerItem; dockItem.Control = new TaskList(); // Setting Displayed property for DockContainerItem will make sure that its tab is displayed first dockItem.Displayed = true; } else if (item.Name == "dockSearchResults") { // Just add the list box as a example... DockContainerItem dockItem = item as DockContainerItem; ListBox listbox = new ListBox(); // This will set the minimum size for the DockContainerItem listbox.Size = new Size(32, 32); // Must let the DockContainerItem resize it at will... listbox.IntegralHeight = false; dockItem.Control = listbox; } }
/// <summary> /// Shows drop-down popup. Note that popup will be shown only if there is a DropDownControl assigned or DropDownItems collection has at least one item. /// </summary> public void ShowDropDown() { if (_DropDownControl == null && _PopupItem.SubItems.Count == 0 || _ShowingPopup || _PopupItem.Expanded) return; _ShowingPopup = true; try { ControlContainerItem cc = null; ItemContainer ic = null; if (_DropDownControl != null) { ic = new ItemContainer(); ic.Name = _DropDownItemContainerName; cc = new ControlContainerItem(_DropDownControlContainerName); ic.SubItems.Add(cc); _PopupItem.SubItems.Insert(0, ic); } CancelEventArgs cancelArgs = new CancelEventArgs(); OnButtonDropDownClick(cancelArgs); if (cancelArgs.Cancel || _PopupItem.SubItems.Count == 0) { if (ic != null) _PopupItem.SubItems.Remove(ic); ic.Dispose(); return; } UpdateTreeSize(); _PreviousDropDownControlParent = _DropDownControl.Parent; cc.Control = _DropDownControl; _PopupItem.SetDisplayRectangle(this.ClientRectangle); if (_PopupLocation != null) _PopupItem.PopupLocation = _PopupLocation.Value; else if (this.RightToLeft == RightToLeft.No) { Point pl = new Point(this.Width - _PopupItem.PopupSize.Width, this.Height); ScreenInformation screen = BarFunctions.ScreenFromControl(this); Point ps = PointToScreen(pl); if (screen != null && screen.WorkingArea.X > ps.X) { pl.X = 0; } _PopupItem.PopupLocation = pl; } if (!IsPopupOpen && this.SelectedNode != null) this.SelectedNode.EnsureVisible(); _PopupItem.Expanded = !_PopupItem.Expanded; } finally { _ShowingPopup = false; } this.Invalidate(); }
private void Form1_Load(object sender, System.EventArgs e) { ExplorerBarGroupItem group = new ExplorerBarGroupItem("group1", "Search"); group.SetDefaultAppearance(); explorerBar1.Groups.Add(group); LabelItem label = new LabelItem("searchLabel", "Search by any or all of the criteria below."); label.Stretch = true; label.WordWrap = true; label.Font = new Font(explorerBar1.Font, FontStyle.Bold); group.SubItems.Add(label); label = new LabelItem("searchLabel1", "All or part of the file name:"); label.Stretch = true; label.WordWrap = true; group.SubItems.Add(label); // Hosting Text Box on Explorer Bar TextBoxItem textItem = new TextBoxItem("txtFileName"); textItem.Stretch = true; group.SubItems.Add(textItem); // Hosting Label on Explorer Bar label = new LabelItem("searchLabel2", "Look in:"); label.Stretch = true; label.WordWrap = true; group.SubItems.Add(label); // Hosting Combo Box on Explorer Bar ComboBoxItem combo = new ComboBoxItem("cboLookIn"); combo.Stretch = true; DevComponents.Editors.ComboItem cboItem = new DevComponents.Editors.ComboItem(); cboItem.Text = "My Computer"; combo.Items.Add(cboItem); combo.SelectedIndex = 0; group.SubItems.Add(combo); group.Expanded = true; group = new ExplorerBarGroupItem("group2", "When was it modified?"); group.SetDefaultAppearance(); explorerBar1.Groups.Add(group); // Hosting any .NET controls on Explorer Bar in this case RadioButton // Don't remember Option ControlContainerItem cont = new ControlContainerItem("chk1", "Don't Remember"); RadioButton option = new RadioButton(); option.Name = "chkDontRemember"; option.Text = "Don't Remember"; option.Font = new Font(explorerBar1.Font, FontStyle.Bold); option.Checked = true; option.BackColor = Color.Transparent; cont.Control = option; group.SubItems.Add(cont); // Within last week cont = new ControlContainerItem("chk1", "Within last week"); option = new RadioButton(); option.Name = "chkLastweek"; option.Text = "Within last week"; option.BackColor = Color.Transparent; cont.Control = option; group.SubItems.Add(cont); // Past month cont = new ControlContainerItem("chk1", "Past month"); option = new RadioButton(); option.Name = "chkLastMonth"; option.Text = "Past month"; option.BackColor = Color.Transparent; cont.Control = option; group.SubItems.Add(cont); // Within the past year cont = new ControlContainerItem("chk1", "Within the past year"); option = new RadioButton(); option.Name = "chkLastYear"; option.Text = "Within the past year"; option.BackColor = Color.Transparent; cont.Control = option; group.SubItems.Add(cont); group = new ExplorerBarGroupItem("group3", "Additional Options"); group.SetDefaultAppearance(); explorerBar1.Groups.Add(group); group.Expanded = true; // Other Search Options ButtonItem btn = new ButtonItem("bSearchOptions", "Other search options"); btn.HotFontUnderline = true; btn.HotTrackingStyle = eHotTrackingStyle.None; btn.Image = new Bitmap(this.GetType(), "Options.png"); btn.ImagePosition = eImagePosition.Left; btn.ButtonStyle = eButtonStyle.ImageAndText; btn.Cursor = Cursors.Hand; group.SubItems.Add(btn); // Change Preferences btn = new ButtonItem("bPreferences", "Change Preferences"); btn.HotFontUnderline = true; btn.HotTrackingStyle = eHotTrackingStyle.None; btn.Image = new Bitmap(this.GetType(), "Preferences.png"); btn.ImagePosition = eImagePosition.Left; btn.ButtonStyle = eButtonStyle.ImageAndText; btn.Cursor = Cursors.Hand; group.SubItems.Add(btn); // Applies all layout changes and refreshes display explorerBar1.RecalcLayout(); }
protected override void OnDragOver(DragEventArgs de) { if(m_DragInProgress) { Point p=this.Control.PointToClient(new Point(de.X,de.Y)); MouseDragOver(p.X,p.Y); de.Effect=DragDropEffects.Move; return; } if(m_EnableItemDragDrop && m_AcceptExternalControls && !this.IsDockableWindow) { ISelectionService sel=(ISelectionService)this.GetService(typeof(ISelectionService)); if(sel!=null && sel.PrimarySelection!=this.Component) { if(sel.PrimarySelection is Control && this.Control.Controls.Contains((Control)sel.PrimarySelection)) { BaseItem item=GetControlItem(sel.PrimarySelection as Control); if(item!=null) { m_MouseDownPoint=this.Control.PointToClient(new Point(de.X,de.Y)); m_SuspendInternalCursor=true; StartItemDrag(item); if(m_TimerDragDrop==null) { m_TimerDragDrop=new Timer(); m_TimerDragDrop.Tick+=new EventHandler(this.TimerTickDragDrop); m_TimerDragDrop.Interval=100; m_TimerDragDrop.Enabled=true; m_TimerDragDrop.Start(); } } return; } else if(sel.SelectionCount>1) { de.Effect=DragDropEffects.None; return; } else if(sel.PrimarySelection is Control && ((Control)sel.PrimarySelection).Parent!=null) { // New control being added to the container BaseItem dragItem=null; if(this.IsDockableWindow) { DockContainerItem dc=new DockContainerItem(); dc.Name=TEMP_NAME; //dc.Control=sel.PrimarySelection as System.Windows.Forms.Control; dragItem=dc; } else { ControlContainerItem cc=new ControlContainerItem(); cc.AllowItemResize = false; cc.Name=TEMP_NAME; //cc.Control=sel.PrimarySelection as System.Windows.Forms.Control; dragItem=cc; } m_MouseDownPoint=this.Control.PointToClient(new Point(de.X,de.Y)); m_SuspendInternalCursor=true; StartItemDrag(dragItem); if (m_TimerDragDrop == null) { m_TimerDragDrop = new Timer(); m_TimerDragDrop.Tick += new EventHandler(this.TimerTickDragDrop); m_TimerDragDrop.Interval = 100; m_TimerDragDrop.Enabled = true; m_TimerDragDrop.Start(); } } } } base.OnDragOver (de); }
/// <summary> /// Shows drop-down popup. Note that popup will be shown only if there is a DropDownControl assigned or DropDownItems collection has at least one item. /// </summary> public void ShowDropDown() { if (_DropDownControl == null && _PopupItem.SubItems.Count == 0 || _ShowingPopup || _PopupItem.Expanded) return; _ShowingPopup = true; try { ControlContainerItem cc = null; ItemContainer ic = null; if (_DropDownControl != null) { ic = new ItemContainer(); ic.Name = _DropDownItemContainerName; cc = new ControlContainerItem(_DropDownControlContainerName); ic.SubItems.Add(cc); _PopupItem.SubItems.Insert(0, ic); } if (_PopupItem.SubItems.Count == 0) { if (ic != null) _PopupItem.SubItems.Remove(ic); return; } if (_DropDownControl != null) { _PreviousDropDownControlParent = _DropDownControl.Parent; cc.Control = _DropDownControl; if (!_DropDownControl.IsHandleCreated) { IntPtr handle = _DropDownControl.Handle; // Forces creation of the control so its size etc. can be accessed reliably } } _PopupItem.SetDisplayRectangle(this.ClientRectangle); if (this.RightToLeft == RightToLeft.No) { Point pl = new Point(this.Width - _PopupItem.PopupSize.Width, this.Height); ScreenInformation screen = BarFunctions.ScreenFromControl(this); Point ps = PointToScreen(pl); if (screen != null && screen.WorkingArea.X > ps.X) { pl.X = 0; } _PopupItem.PopupLocation = pl; } _PopupItem.Expanded = !_PopupItem.Expanded; } finally { _ShowingPopup = false; } if (_DropDownControl != null && _AutoFocusDropDownControl && _DropDownControl.CanFocus) BarUtilities.InvokeDelayed(new MethodInvoker(delegate { _DropDownControl.Focus(); })); }