private void OnViewResponseHeadersButtonClick(NEventArgs args) { // get the response form the button tag (see UpdateRequestListBoxItem) and display its headers object[] array = (object[])args.TargetNode.Tag; NHttpRequest request = (NHttpRequest)array[0]; NHttpResponse response = (NHttpResponse)array[1]; // create a top level window, setup as a dialog NTopLevelWindow window = NApplication.CreateTopLevelWindow(); window.SetupDialogWindow(request.Uri.ToString(), true); // create a list box for the headers NListBox listBox = new NListBox(); window.Content = listBox; // fill with header fields INIterator <NHttpHeaderField> it = response.HeaderFields.GetIterator(); while (it.MoveNext()) { listBox.Items.Add(new NListBoxItem(it.Current.ToString())); } // open the window window.Open(); }
public NExampleEventsLog() { Header.Content = NWidget.FromObject("Events"); NStackPanel stack = new NStackPanel(); stack.FillMode = ENStackFillMode.Last; stack.FitMode = ENStackFitMode.Last; // log events m_LogEventCheck = new NCheckBox("Log Events"); m_LogEventCheck.Checked = true; stack.Add(m_LogEventCheck); // clear button NButton button = new NButton("Clear Events Log"); button.Content.HorizontalPlacement = ENHorizontalPlacement.Center; button.Click += new Function <NEventArgs>(OnClearEventsLogButtonClicked); stack.Add(button); // list m_EventsListBox = new NListBox(); stack.Add(m_EventsListBox); Content = stack; }
private NGroupBox CreatePredefinedDocumentGroupBox() { const string DocxSuffix = "_docx"; NListBox testListBox = new NListBox(); string[] resourceName = NResources.Instance.GetResourceNames(); for (int i = 0, count = resourceName.Length; i < count; i++) { string resName = resourceName[i]; if (resName.EndsWith(DocxSuffix, StringComparison.Ordinal)) { // The current resource is a DOCX document, so add it to the list box string testName = resName.Substring(0, resName.Length - DocxSuffix.Length); testName = testName.Substring(testName.LastIndexOf('_') + 1); NListBoxItem item = new NListBoxItem(NStringHelpers.InsertSpacesBeforeUppersAndDigits(testName)); item.Tag = resName; testListBox.Items.Add(item); } } testListBox.Selection.Selected += OnListBoxItemSelected; testListBox.Selection.SingleSelect(testListBox.Items[1]); return(new NGroupBox("Predefined DOCX documents", testListBox)); }
protected override void PopulateList(NListBox list) { Random rand = new Random(); int end = rand.Next(21, 101); for (int i = 1; i < end; i++) { list.Items.Add("Undo/Redo Action " + i); } }
private NListBox CreateListBox() { NListBox listBox = new NListBox(); for (int i = 1; i <= 20; i++) { listBox.Items.Add(new NListBoxItem("Item " + i)); } return(listBox); }
protected override void HandleListSelectedIndexChanged(NListBox list) { int count = list.SelectedItems.Count; string actions = " Actions"; if (count == 1) { actions = " Action"; } Description = LabelText + " " + count + actions; }
protected override NWidget CreateExampleControls() { NStackPanel stack = new NStackPanel(); stack.VerticalSpacing = 10; // Create the predefined tests list box NListBox testListBox = new NListBox(); testListBox.Items.Add(CreateTestListBoxItem(new NRichTextBorders())); testListBox.Items.Add(CreateTestListBoxItem(new NRichTextLists())); testListBox.Items.Add(CreateTestListBoxItem(new NRichTextTables())); testListBox.Items.Add(CreateTestListBoxItem(new NRichTextTextStyles())); testListBox.Items.Add(CreateTestListBoxItem(new NRichTextElementPositioning())); testListBox.Selection.Selected += OnTestListBoxItemSelected; // Add the list box in a group box stack.Add(new NGroupBox("Predefined text documents", testListBox)); // Create the Load from file group box NDockPanel dockPanel = new NDockPanel(); dockPanel.HorizontalSpacing = 3; dockPanel.VerticalSpacing = 3; NButton loadButton = new NButton("Load"); loadButton.Click += OnLoadButtonClick; NDockLayout.SetDockArea(loadButton, ENDockArea.Bottom); dockPanel.Add(loadButton); m_FileNameTextBox = new NTextBox(); m_FileNameTextBox.VerticalPlacement = ENVerticalPlacement.Center; NDockLayout.SetDockArea(m_FileNameTextBox, ENDockArea.Center); dockPanel.Add(m_FileNameTextBox); NButton browseButton = new NButton("..."); browseButton.Click += OnBrowseButtonClick; NDockLayout.SetDockArea(browseButton, ENDockArea.Right); dockPanel.Add(browseButton); stack.Add(new NGroupBox("Load from file", dockPanel)); m_ElapsedTimeLabel = new NLabel(); stack.Add(m_ElapsedTimeLabel); // Select the initial test testListBox.Selection.SingleSelect(testListBox.Items[0]); return(stack); }
private void OnInspectorDragEnter(NDragOverChangeEventArgs args) { NDataFormat[] formats = args.DataObject.GetFormats(); NListBox inspector = args.CurrentTargetNode as NListBox; inspector.Items.Clear(); for (int i = 0; i < formats.Length; i++) { inspector.Items.Add(new NListBoxItem(formats[i].ToString())); } }
private void OnRemoveAttributeButtonClick(NEventArgs arg) { NTopLevelWindow dialog = NApplication.CreateTopLevelWindow(); dialog.SetupDialogWindow("Select an Attribute to Remove", false); NListBox listBox = new NListBox(); NElementInfo elementInfo = (NElementInfo)m_TreeView.SelectedItem.Tag; INIterator <NKeyValuePair <string, string> > iter = elementInfo.Attributes.GetIterator(); while (iter.MoveNext()) { listBox.Items.Add(new NListBoxItem(iter.Current.Key)); } NButtonStrip buttonStrip = new NButtonStrip(); buttonStrip.InitOKCancelButtonStrip(); NPairBox pairBox = new NPairBox(listBox, buttonStrip, ENPairBoxRelation.Box1AboveBox2); pairBox.Spacing = NDesign.VerticalSpacing; dialog.Content = pairBox; dialog.Opened += delegate(NEventArgs args) { listBox.Focus(); }; dialog.Closed += delegate(NEventArgs args) { if (dialog.Result == ENWindowResult.OK) { // Remove the selected attribute NListBoxItem selectedItem = listBox.Selection.FirstSelected; if (selectedItem != null) { string name = ((NLabel)selectedItem.Content).Text; elementInfo.Attributes.Remove(name); UpdateTreeViewItemText(m_TreeView.SelectedItem); if (elementInfo.Attributes.Count == 0) { m_RemoveAttributeButton.Enabled = false; } } } }; dialog.Open(); }
private void DumpHistoryToListBoxes(NListBox undoList, NListBox redoList) { undoList.Items.Clear(); redoList.Items.Clear(); foreach (NOperation undo in document.HistoryService.UndoStack) { undoList.Items.Add(undo.Description); } foreach (NOperation redo in document.HistoryService.RedoStack) { redoList.Items.Add(redo.Description); } }
private void indeterminateBtn_Click(object sender, EventArgs e) { NLightUIItem[] checkedItems = nTreeViewEx1.Nodes.GetItemsByCheckState(ItemCheckState.Indeterminate, true); NForm form = new NForm(); NListBox lb = new NListBox(); lb.Dock = DockStyle.Fill; lb.Parent = form; lb.Items.AddRange(checkedItems); form.StartPosition = FormStartPosition.CenterParent; form.ShowDialog(nTreeViewEx1); form.Dispose(); }
protected override NWidget CreateExampleContent() { // Create a list box m_ListBox = new NListBox(); m_ListBox.HorizontalPlacement = ENHorizontalPlacement.Left; m_ListBox.PreferredSize = new NSize(200, 400); // Fill the image Box FillWithImageCheckBoxAndTitle(); // Hook to list box selection events m_ListBox.Selection.Selected += new Function <NSelectEventArgs <NListBoxItem> >(OnListBoxItemSelected); m_ListBox.Selection.Deselected += new Function <NSelectEventArgs <NListBoxItem> >(OnListBoxItemDeselected); return(m_ListBox); }
private LabelFitMode[] GetLabelFitModesFromListBox(NListBox listBox) { ArrayList arrFitModes = new ArrayList(); for (int i = 0; i < listBox.Items.Count; i++) { NListBoxItem item = listBox.Items[i]; if (item.Checked) { arrFitModes.Add((LabelFitMode)i); } } return((LabelFitMode[])arrFitModes.ToArray(typeof(LabelFitMode))); }
protected override NWidget CreateExampleControls() { NStackPanel stack = new NStackPanel(); stack.Add(new NLabel("Language:")); NListBox listBox = new NListBox(); listBox.Items.Add(CreateListBoxItem(NResources.Image_CountryFlags_us_png, EnglishLanguageName)); listBox.Items.Add(CreateListBoxItem(NResources.Image_CountryFlags_bg_png, BulgarianLanguageName)); listBox.Items.Add(CreateListBoxItem(NResources.Image_CountryFlags_de_png, GermanLanguageName)); listBox.Selection.SingleSelect(listBox.Items[0]); listBox.Selection.Selected += OnListBoxItemSelected; stack.Add(listBox); return(stack); }
protected override NWidget CreateExampleContent() { // Create a list box m_ListBox = new NListBox(); m_ListBox.HorizontalPlacement = ENHorizontalPlacement.Left; m_ListBox.PreferredSize = new NSize(200, 400); // Add some items for (int i = 0; i < 100; i++) { m_ListBox.Items.Add(new NListBoxItem("Item " + i.ToString())); } // Hook to list box selection events m_ListBox.Selection.Selected += new Function <NSelectEventArgs <NListBoxItem> >(OnListBoxItemSelected); m_ListBox.Selection.Deselected += new Function <NSelectEventArgs <NListBoxItem> >(OnListBoxItemDeselected); return(m_ListBox); }
protected override NWidget CreateExampleControls() { NStackPanel stack = new NStackPanel(); stack.FillMode = ENStackFillMode.Last; stack.FitMode = ENStackFitMode.Last; // clear button NButton button = new NButton("Clear Requests"); button.Content.HorizontalPlacement = ENHorizontalPlacement.Center; button.Click += new Function <NEventArgs>(OnClearRequestsListBoxButtonClick); stack.Add(button); // create the requests list box in which we add the submitted requests. m_RequestsListBox = new NListBox(); stack.Add(m_RequestsListBox); return(new NGroupBox("Requests", stack)); }
protected override NWidget CreateExampleContent() { NStackPanel stack = new NStackPanel(); stack.Direction = ENHVDirection.LeftToRight; stack.HorizontalSpacing = 10; // Load the contry data NList <NCountry> countries = LoadCountryData(); // Create the simple list box m_ListBox = new NListBox(); m_ListBox.Selection.Selected += new Function <NSelectEventArgs <NListBoxItem> >(OnListBoxItemSelected); stack.Add(new NGroupBox("Data source items -> Labels", m_ListBox)); // Create the simple data binding NNodeCollectionDataBinding <NListBoxItemCollection, NListBoxItem, NCountry> countryNameDataBinding = new NNodeCollectionDataBinding <NListBoxItemCollection, NListBoxItem, NCountry>(); NDataBinding.SetDataBinding(m_ListBox.Items, countryNameDataBinding); countryNameDataBinding.DataSource = countries; countryNameDataBinding.CreateItemNode += new Function <NCreateItemNodeEventArgs <NListBoxItem, NCountry> >(OnCountryNameDataBindingCreateItemNode); countryNameDataBinding.RebuildTarget(); // Create the advanced list box m_AdvancedListBox = new NListBox(); m_AdvancedListBox.Selection.Selected += new Function <NSelectEventArgs <NListBoxItem> >(OnListBoxItemSelected); stack.Add(new NGroupBox("Data source items -> Custom widgets", m_AdvancedListBox)); // Create the advanced data binding NNodeCollectionDataBinding <NListBoxItemCollection, NListBoxItem, NCountry> countryDataBinding = new NNodeCollectionDataBinding <NListBoxItemCollection, NListBoxItem, NCountry>(); NDataBinding.SetDataBinding(m_AdvancedListBox.Items, countryDataBinding); countryDataBinding.DataSource = countries; countryDataBinding.CreateItemNode += new Function <NCreateItemNodeEventArgs <NListBoxItem, NCountry> >(OnCountryDataBindingCreateItemNode); countryDataBinding.RebuildTarget(); return(stack); }
private NGroupBox CreatePredefinedPageGroupBox() { const string HtmlSuitePrefix = "RSTR_HtmlSuite_"; NListBox testListBox = new NListBox(); string[] resourceName = NResources.Instance.GetResourceNames(); for (int i = 0, count = resourceName.Length; i < count; i++) { string resName = resourceName[i]; if (resName.StartsWith(HtmlSuitePrefix, StringComparison.Ordinal)) { // The current resource is an HTML page, so add it to the list box string testName = resName.Substring(HtmlSuitePrefix.Length, resName.Length - HtmlSuitePrefix.Length - 5); NListBoxItem item = new NListBoxItem(NStringHelpers.InsertSpacesBeforeUppersAndDigits(testName)); item.Tag = resName; testListBox.Items.Add(item); } } testListBox.Selection.Selected += OnListBoxItemSelected; testListBox.Selection.SingleSelect(testListBox.Items[0]); return(new NGroupBox("Predefined HTML pages", testListBox)); }
private void OnListBoxItemSelected(NSelectEventArgs <NListBoxItem> args) { if (m_bSelectionUpdating) { m_bSelectionUpdating = false; return; } // Get the list box and the other list box NListBox listBox = (NListBox)args.Item.OwnerListBox; NListBox otherListBox = listBox == m_ListBox ? m_AdvancedListBox : m_ListBox; // Log the selection NListBoxItem selectedItem = listBox.Selection.FirstSelected; NCountry country = NNodeCollectionDataBinding <NListBoxItemCollection, NListBoxItem, NCountry> .GetDataBoundItem(selectedItem); m_EventsLog.LogEvent("'" + country.Name + "' selected"); // Synchronize the selection between the two list boxes m_bSelectionUpdating = true; int selectedIndex = listBox.Items.IndexOf(selectedItem); otherListBox.Selection.SingleSelect(otherListBox.Items[selectedIndex]); }
/// <summary> /// /// </summary> /// <returns></returns> protected override NWidget CreateExampleControls() { NStackPanel stack = new NStackPanel(); NUniSizeBoxGroup boxGroup = new NUniSizeBoxGroup(stack); stack.Add(new NLabel("Allowed Date Time Units")); NDateTimeUnit[] dateTimeUnits = new NDateTimeUnit[] { NDateTimeUnit.Century, NDateTimeUnit.Decade, NDateTimeUnit.Year, NDateTimeUnit.HalfYear, NDateTimeUnit.Quarter, NDateTimeUnit.Month, NDateTimeUnit.Week, NDateTimeUnit.Day, NDateTimeUnit.HalfDay, NDateTimeUnit.Hour, NDateTimeUnit.Minute, NDateTimeUnit.Second, NDateTimeUnit.Millisecond, NDateTimeUnit.Tick }; m_DateTimeUnitListBox = new NListBox(); for (int i = 0; i < dateTimeUnits.Length; i++) { NDateTimeUnit dateTimeUnit = dateTimeUnits[i]; NCheckBox dateTimeUnitCheckBox = new NCheckBox(NStringHelpers.InsertSpacesBeforeUppersAndDigits(dateTimeUnit.DateTimeUnit.ToString())); dateTimeUnitCheckBox.Checked = true; dateTimeUnitCheckBox.CheckedChanged += new Function <NValueChangeEventArgs>(OnDateTimeUnitCheckBoxCheckedChanged); dateTimeUnitCheckBox.Tag = dateTimeUnit; m_DateTimeUnitListBox.Items.Add(new NListBoxItem(dateTimeUnitCheckBox)); } stack.Add(m_DateTimeUnitListBox); OnDateTimeUnitCheckBoxCheckedChanged(null); NCheckBox enableUnitSensitiveFormattingCheckBox = new NCheckBox("Enable Unit Sensitive Formatting"); enableUnitSensitiveFormattingCheckBox.CheckedChanged += new Function <NValueChangeEventArgs>(OnEnableUnitSensitiveFormattingCheckBoxCheckedChanged); stack.Add(enableUnitSensitiveFormattingCheckBox); enableUnitSensitiveFormattingCheckBox.Checked = true; stack.Add(new NLabel("Start Date:")); m_StartDateTimeBox = new NDateTimeBox(); m_StartDateTimeBox.SelectedDateChanged += new Function <NValueChangeEventArgs>(OnStartDateTimeBoxSelectedDateChanged); stack.Add(m_StartDateTimeBox); stack.Add(new NLabel("End Date:")); m_EndDateTimeBox = new NDateTimeBox(); m_EndDateTimeBox.SelectedDateChanged += new Function <NValueChangeEventArgs>(OnEndDateTimeBoxSelectedDateChanged); stack.Add(m_EndDateTimeBox); NButton generateRandomDataButton = new NButton("Generate Random Data"); generateRandomDataButton.Click += new Function <NEventArgs>(OnGenerateRandomDataButtonClick); stack.Add(generateRandomDataButton); m_StartDateTimeBox.SelectedDate = DateTime.Now; m_EndDateTimeBox.SelectedDate = CultureInfo.CurrentCulture.Calendar.AddYears(m_StartDateTimeBox.SelectedDate, 2); return(boxGroup); }
internal void PopulateEventsList(NListBox list, bool track) { list.BeginUpdate(); list.CheckBoxes = true; list.CheckOnClick = true; NListBoxItem item; item = new NListBoxItem(NTreeViewEx.ItemMouseStateChangingNotifyCode); item.Text = "ItemMouseStateChangingNotifyCode"; list.Items.Add(item); item = new NListBoxItem(NTreeViewEx.ItemMouseStateChangedNotifyCode); item.Text = "ItemMouseStateChangedNotifyCode"; list.Items.Add(item); item = new NListBoxItem(NTreeViewEx.ItemLabelClickNotifyCode); item.Checked = track; item.Text = "ItemLabelClickNotifyCode"; list.Items.Add(item); item = new NListBoxItem(NTreeViewEx.ItemLabelDoubleClickNotifyCode); item.Checked = track; item.Text = "ItemLabelDoubleClickNotifyCode"; list.Items.Add(item); item = new NListBoxItem(NTreeViewEx.ItemCheckBoxClickNotifyCode); item.Checked = track; item.Text = "ItemCheckBoxClickNotifyCode"; list.Items.Add(item); item = new NListBoxItem(NTreeViewEx.ItemCheckStateChangedNotifyCode); item.Checked = track; item.Text = "ItemCheckStateChangedNotifyCode"; list.Items.Add(item); item = new NListBoxItem(NTreeViewEx.ItemCheckStateChangingNotifyCode); item.Checked = track; item.Text = "ItemCheckStateChangingNotifyCode"; list.Items.Add(item); item = new NListBoxItem(NTreeViewEx.ItemBeginEditNotifyCode); item.Checked = track; item.Text = "ItemBeginEditNotifyCode"; list.Items.Add(item); item = new NListBoxItem(NTreeViewEx.ItemEndEditNotifyCode); item.Checked = track; item.Text = "ItemEndEditNotifyCode"; list.Items.Add(item); item = new NListBoxItem(NTreeViewEx.ItemSelectionRequestNotifyCode); item.Text = "ItemSelectionRequestNotifyCode"; list.Items.Add(item); item = new NListBoxItem(NTreeViewEx.ItemSelectionChangingNotifyCode); item.Checked = track; item.Text = "ItemSelectionChangingNotifyCode"; list.Items.Add(item); item = new NListBoxItem(NTreeViewEx.ItemSelectionChangedNotifyCode); item.Checked = track; item.Text = "ItemSelectionChangedNotifyCode"; list.Items.Add(item); item = new NListBoxItem(NTreeViewEx.NodeCollapsedNotifyCode); item.Checked = track; item.Text = "NodeCollapsedNotifyCode"; list.Items.Add(item); item = new NListBoxItem(NTreeViewEx.NodeCollapsingNotifyCode); item.Checked = track; item.Text = "NodeCollapsingNotifyCode"; list.Items.Add(item); item = new NListBoxItem(NTreeViewEx.NodeExpandedNotifyCode); item.Checked = track; item.Text = "NodeExpandedNotifyCode"; list.Items.Add(item); item = new NListBoxItem(NTreeViewEx.NodeExpandingNotifyCode); item.Checked = track; item.Text = "NodeExpandingNotifyCode"; list.Items.Add(item); list.EndUpdate(); }
private void InitializeComponent() { /* * Window setup * */ this.Text = "Dagobar"; this.Size = new System.Drawing.Size(16 * windowCoeff, 9 * windowCoeff); this.MinimumSize = new System.Drawing.Size(this.Width / 2, this.Height / 2); #region "Controls Setup & Layout Setup" textBoxSend = new NTextBox(); textBoxSend.Font = new Nevron.Nov.Graphics.NFont("Lucidia Console", 12); textBoxSend.VerticalPlacement = Nevron.Nov.Layout.ENVerticalPlacement.Center; textBoxSend.Margins = new Nevron.Nov.Graphics.NMargins(1, 3, 0, 3); textBoxSend.KeyUp += textBoxSend_KeyUp; buttonSend = new NButton("Envoyer"); buttonSend.PreferredWidth = 100; buttonSend.Content.HorizontalPlacement = Nevron.Nov.Layout.ENHorizontalPlacement.Center; buttonSend.Margins = new Nevron.Nov.Graphics.NMargins(3.0); buttonSend.Click += buttonSend_Click; panelSend = new NStackPanel(); panelSend.Direction = Nevron.Nov.Layout.ENHVDirection.LeftToRight; panelSend.FillMode = Nevron.Nov.Layout.ENStackFillMode.First; panelSend.Add(textBoxSend); panelSend.Add(buttonSend); listBoxChat = new NListBox(); listBoxChat.Margins = new Nevron.Nov.Graphics.NMargins(1.0); panelChat = new NStackPanel(); panelChat.Direction = Nevron.Nov.Layout.ENHVDirection.TopToBottom; panelChat.FillMode = Nevron.Nov.Layout.ENStackFillMode.First; panelChat.Add(listBoxChat); panelChat.Add(panelSend); labelChannel = new NLabel("/--/"); labelChannel.HorizontalPlacement = Nevron.Nov.Layout.ENHorizontalPlacement.Center; labelChannel.Font = new Nevron.Nov.Graphics.NFont("Lucidia Console", 14); listBoxUsers = new NListBox(); listBoxUsers.Margins = new Nevron.Nov.Graphics.NMargins(1.0); panelUsers = new NStackPanel(); panelUsers.Direction = Nevron.Nov.Layout.ENHVDirection.TopToBottom; panelUsers.FillMode = Nevron.Nov.Layout.ENStackFillMode.Last; panelUsers.Add(labelChannel); panelUsers.Add(listBoxUsers); panelUsers.PreferredWidth = 150; panelTabChat = new NStackPanel(); panelTabChat.FillMode = Nevron.Nov.Layout.ENStackFillMode.First; panelTabChat.Direction = Nevron.Nov.Layout.ENHVDirection.LeftToRight; panelTabChat.Add(panelChat); panelTabChat.Add(panelUsers); panelMain = new NStackPanel(); panelMain.Direction = Nevron.Nov.Layout.ENHVDirection.LeftToRight; panelMain.FillMode = Nevron.Nov.Layout.ENStackFillMode.Last; panelMain.Add(panelTabChat); panelRibbonInformations = new NStackPanel(); panelRibbonInformations.FillMode = Nevron.Nov.Layout.ENStackFillMode.Equal; labelRibbonChannel = new NLabel("Chaîne : /--/"); labelRibbonChannel.HorizontalPlacement = Nevron.Nov.Layout.ENHorizontalPlacement.Center; labelRibbonViewers = new NLabel("Nombre de spectateurs : /--/"); labelRibbonViewers.HorizontalPlacement = Nevron.Nov.Layout.ENHorizontalPlacement.Center; labelRibbonVersion = new NLabel("Version : " + Properties.Settings.Default.Version); labelRibbonVersion.HorizontalPlacement = Nevron.Nov.Layout.ENHorizontalPlacement.Center; panelRibbonInformations.Add(labelRibbonChannel); panelRibbonInformations.Add(labelRibbonViewers); panelRibbonInformations.Add(labelRibbonVersion); ribbonGroupInformations = new NRibbonGroup("Informations"); ribbonGroupInformations.Header.DialogLauncherButton.Visibility = ENVisibility.Hidden; ribbonGroupInformations.PreferredHeight = 64; ribbonGroupInformations.Items.Add(panelRibbonInformations); listBoxPlugins = new NListBox(); listBoxPlugins.VScrollMode = ENScrollMode.Always; listBoxPlugins.PreferredHeight = 64; listBoxPlugins.PreferredWidth = 256; ribbonGroupPlugins = new NRibbonGroup("Plugins"); ribbonGroupPlugins.Header.DialogLauncherButton.Visibility = ENVisibility.Hidden; ribbonGroupPlugins.Items.Add(listBoxPlugins); ribbonButtonConfiguration = new NRibbonButton("Configuration", NImage.FromFile(Application.StartupPath + @"\Resources\settings.png"), NImage.FromFile(Application.StartupPath + @"\Resources\settings.png")); ribbonButtonConfiguration.PreferredWidth = 86; ribbonButtonConfiguration.Click += ribbonButtonConfiguration_Click; ribbonButtonChannel = new NRibbonButton("Changer de chaîne", NImage.FromFile(Application.StartupPath + @"\Resources\move_shit_around.png"), NImage.FromFile(Application.StartupPath + @"\Resources\move_shit_around.png")); ribbonButtonChannel.PreferredWidth = 86; ribbonButtonChannel.Click += ribbonButtonChannel_Click; ribbonButtonQuit = new NRibbonButton("Quitter", NImage.FromFile(Application.StartupPath + @"\Resources\quit.png"), NImage.FromFile(Application.StartupPath + @"\Resources\quit.png")); ribbonButtonQuit.PreferredWidth = 86; ribbonButtonQuit.Click += ribbonButtonQuit_Click; ribbonGroupActions = new NRibbonGroup("Actions"); ribbonGroupActions.Header.DialogLauncherButton.Visibility = ENVisibility.Hidden; ribbonGroupActions.Items.Add(ribbonButtonConfiguration); ribbonGroupActions.Items.Add(ribbonButtonChannel); ribbonGroupActions.Items.Add(ribbonButtonQuit); ribbonTagPageMain = new NRibbonTabPage("Dagobar"); ribbonTagPageMain.Groups.Add(ribbonGroupInformations); ribbonTagPageMain.Groups.Add(ribbonGroupPlugins); ribbonTagPageMain.Groups.Add(ribbonGroupActions); ribbon = new NRibbon(); ribbon.Tab.TabPages.Add(ribbonTagPageMain); panelRibbon = new NStackPanel(); panelRibbon.FillMode = Nevron.Nov.Layout.ENStackFillMode.Last; panelRibbon.Add(ribbon); panelRibbon.Add(panelMain); #endregion // Create main control controlMain = new NNovWidgetHost <NStackPanel>(panelRibbon); controlMain.Dock = DockStyle.Fill; }
private void InitializeComponent() { /* * Window setup * */ this.Text = "Dagobar"; this.Size = new System.Drawing.Size(16 * windowCoeff, 9 * windowCoeff); this.MinimumSize = new System.Drawing.Size(this.Width / 2, this.Height / 2); #region "Controls Setup & Layout Setup" textBoxSend = new NTextBox(); textBoxSend.Font = new Nevron.Nov.Graphics.NFont("Lucidia Console", 12); textBoxSend.VerticalPlacement = Nevron.Nov.Layout.ENVerticalPlacement.Center; textBoxSend.Margins = new Nevron.Nov.Graphics.NMargins(1, 3, 0, 3); textBoxSend.KeyUp += textBoxSend_KeyUp; buttonSend = new NButton("Envoyer"); buttonSend.PreferredWidth = 100; buttonSend.Content.HorizontalPlacement = Nevron.Nov.Layout.ENHorizontalPlacement.Center; buttonSend.Margins = new Nevron.Nov.Graphics.NMargins(3.0); buttonSend.Click += buttonSend_Click; panelSend = new NStackPanel(); panelSend.Direction = Nevron.Nov.Layout.ENHVDirection.LeftToRight; panelSend.FillMode = Nevron.Nov.Layout.ENStackFillMode.First; panelSend.Add(textBoxSend); panelSend.Add(buttonSend); listBoxChat = new NListBox(); listBoxChat.Margins = new Nevron.Nov.Graphics.NMargins(1.0); panelChat = new NStackPanel(); panelChat.Direction = Nevron.Nov.Layout.ENHVDirection.TopToBottom; panelChat.FillMode = Nevron.Nov.Layout.ENStackFillMode.First; panelChat.Add(listBoxChat); panelChat.Add(panelSend); labelChannel = new NLabel("/--/"); labelChannel.HorizontalPlacement = Nevron.Nov.Layout.ENHorizontalPlacement.Center; labelChannel.Font = new Nevron.Nov.Graphics.NFont("Lucidia Console", 14); listBoxUsers = new NListBox(); listBoxUsers.Margins = new Nevron.Nov.Graphics.NMargins(1.0); panelUsers = new NStackPanel(); panelUsers.Direction = Nevron.Nov.Layout.ENHVDirection.TopToBottom; panelUsers.FillMode = Nevron.Nov.Layout.ENStackFillMode.Last; panelUsers.Add(labelChannel); panelUsers.Add(listBoxUsers); panelUsers.PreferredWidth = 150; panelTabChat = new NStackPanel(); panelTabChat.FillMode = Nevron.Nov.Layout.ENStackFillMode.First; panelTabChat.Direction = Nevron.Nov.Layout.ENHVDirection.LeftToRight; panelTabChat.Add(panelChat); panelTabChat.Add(panelUsers); panelMain = new NStackPanel(); panelMain.Direction = Nevron.Nov.Layout.ENHVDirection.LeftToRight; panelMain.FillMode = Nevron.Nov.Layout.ENStackFillMode.Last; panelMain.Add(panelTabChat); panelRibbonInformations = new NStackPanel(); panelRibbonInformations.FillMode = Nevron.Nov.Layout.ENStackFillMode.Equal; labelRibbonChannel = new NLabel("Chaîne : /--/"); labelRibbonChannel.HorizontalPlacement = Nevron.Nov.Layout.ENHorizontalPlacement.Center; labelRibbonViewers = new NLabel("Nombre de spectateurs : /--/"); labelRibbonViewers.HorizontalPlacement = Nevron.Nov.Layout.ENHorizontalPlacement.Center; labelRibbonVersion = new NLabel("Version : " + Properties.Settings.Default.Version); labelRibbonVersion.HorizontalPlacement = Nevron.Nov.Layout.ENHorizontalPlacement.Center; panelRibbonInformations.Add(labelRibbonChannel); panelRibbonInformations.Add(labelRibbonViewers); panelRibbonInformations.Add(labelRibbonVersion); ribbonGroupInformations = new NRibbonGroup("Informations"); ribbonGroupInformations.Header.DialogLauncherButton.Visibility = ENVisibility.Hidden; ribbonGroupInformations.PreferredHeight = 64; ribbonGroupInformations.Items.Add(panelRibbonInformations); listBoxPlugins = new NListBox(); listBoxPlugins.VScrollMode = ENScrollMode.Always; listBoxPlugins.PreferredHeight = 64; listBoxPlugins.PreferredWidth = 256; ribbonGroupPlugins = new NRibbonGroup("Plugins"); ribbonGroupPlugins.Header.DialogLauncherButton.Visibility = ENVisibility.Hidden; ribbonGroupPlugins.Items.Add(listBoxPlugins); ribbonButtonConfiguration = new NRibbonButton("Configuration", NImage.FromFile(Application.StartupPath + @"\Resources\settings.png"), NImage.FromFile(Application.StartupPath + @"\Resources\settings.png")); ribbonButtonConfiguration.PreferredWidth = 86; ribbonButtonConfiguration.Click += ribbonButtonConfiguration_Click; ribbonButtonChannel = new NRibbonButton("Changer de chaîne", NImage.FromFile(Application.StartupPath + @"\Resources\move_shit_around.png"), NImage.FromFile(Application.StartupPath + @"\Resources\move_shit_around.png")); ribbonButtonChannel.PreferredWidth = 86; ribbonButtonChannel.Click += ribbonButtonChannel_Click; ribbonButtonQuit = new NRibbonButton("Quitter", NImage.FromFile(Application.StartupPath + @"\Resources\quit.png"), NImage.FromFile(Application.StartupPath + @"\Resources\quit.png")); ribbonButtonQuit.PreferredWidth = 86; ribbonButtonQuit.Click += ribbonButtonQuit_Click; ribbonGroupActions = new NRibbonGroup("Actions"); ribbonGroupActions.Header.DialogLauncherButton.Visibility = ENVisibility.Hidden; ribbonGroupActions.Items.Add(ribbonButtonConfiguration); ribbonGroupActions.Items.Add(ribbonButtonChannel); ribbonGroupActions.Items.Add(ribbonButtonQuit); ribbonTagPageMain = new NRibbonTabPage("Dagobar"); ribbonTagPageMain.Groups.Add(ribbonGroupInformations); ribbonTagPageMain.Groups.Add(ribbonGroupPlugins); ribbonTagPageMain.Groups.Add(ribbonGroupActions); ribbon = new NRibbon(); ribbon.Tab.TabPages.Add(ribbonTagPageMain); panelRibbon = new NStackPanel(); panelRibbon.FillMode = Nevron.Nov.Layout.ENStackFillMode.Last; panelRibbon.Add(ribbon); panelRibbon.Add(panelMain); #endregion // Create main control controlMain = new NNovWidgetHost<NStackPanel>(panelRibbon); controlMain.Dock = DockStyle.Fill; }
private void OnInspectorDragLeave(NDragOverChangeEventArgs args) { NListBox inspector = args.CurrentTargetNode as NListBox; inspector.Items.Clear(); }
protected override NWidget CreateExampleContent() { // sources NGroupBox sourcesGroup = new NGroupBox("Drag Drop Sources"); { NStackPanel sourcesStack = new NStackPanel(); sourcesGroup.Content = sourcesStack; NContentHolder textSource1 = CreateDemoElement("Drag Source Text 1"); NDataObject dataObject1 = new NDataObject(); dataObject1.SetData(NDataFormat.TextFormat, "Text string 1"); textSource1.Tag = dataObject1; sourcesStack.Add(textSource1); textSource1.MouseDown += new Function <NMouseButtonEventArgs>(OnSourceMouseDown); NContentHolder textSource2 = CreateDemoElement("Drag Source Text 2"); NDataObject dataObject2 = new NDataObject(); dataObject2.SetData(NDataFormat.TextFormat, "Text string 2"); textSource2.Tag = dataObject2; sourcesStack.Add(textSource2); textSource2.MouseDown += new Function <NMouseButtonEventArgs>(OnSourceMouseDown); //NContentHolder widgetSource1 = CreateDemoElement("Drag Button"); //widgetSource1.Tag = new NContentDataObject(new NButton("Widget In Drag and Drop")); //sourcesStack.Add(widgetSource1); //widgetSource1.MouseDown += new Function<NMouseEventArgs>(OnSourceMouseDown); //NContentHolder compositeSource1 = CreateDemoElement("Composite Data Object"); //compositeSource1.Tag = new NCompositeDataObject( // new NContentDataObject(new NButton("Widget In Drag and Drop")), // new NContentDataObject("Hello there")); //sourcesStack.Add(compositeSource1); //compositeSource1.MouseDown += new Function<NMouseEventArgs>(OnSourceMouseDown); } // targets NGroupBox targetsGroup = new NGroupBox("Drop Targets"); { NStackPanel targetsStack = new NStackPanel(); targetsGroup.Content = targetsStack; NContentHolder dropTextTarget = CreateDemoElement("Drop Text On Me"); targetsStack.Add(dropTextTarget); dropTextTarget.DragOver += new Function <NDragActionEventArgs>(OnDragOverTextTarget); dropTextTarget.DragDrop += new Function <NDragActionEventArgs>(OnDragDropTextTarget); } // create the source and targets splitter NSplitter splitter = new NSplitter(); splitter.SplitMode = ENSplitterSplitMode.Proportional; splitter.SplitFactor = 0.5d; splitter.Pane1.Content = sourcesGroup; splitter.Pane2.Content = targetsGroup; // create the inspector on the bottom NGroupBox inspectorGroup = new NGroupBox("Data Object Ispector"); NListBox inspector = new NListBox(); inspectorGroup.Content = inspector; inspector.DragEnter += new Function <NDragOverChangeEventArgs>(OnInspectorDragEnter); inspector.DragLeave += new Function <NDragOverChangeEventArgs>(OnInspectorDragLeave); NStackPanel stack = new NStackPanel(); stack.HorizontalPlacement = ENHorizontalPlacement.Fit; stack.VerticalPlacement = ENVerticalPlacement.Fit; stack.FillMode = ENStackFillMode.Last; stack.Add(splitter); stack.Add(inspectorGroup); return(stack); }