protected override NWidget CreateExampleControls() { NStackPanel stack = new NStackPanel(); stack.FillMode = ENStackFillMode.Last; stack.FitMode = ENStackFitMode.Last; // Create the tool bar button type radio group NStackPanel buttonTypeStack = new NStackPanel(); ENToolBarButtonType[] buttonTypes = NEnum.GetValues <ENToolBarButtonType>(); for (int i = 0, count = buttonTypes.Length; i < count; i++) { // Get the current button type and its string representation ENToolBarButtonType buttonType = buttonTypes[i]; string text = NStringHelpers.InsertSpacesBeforeUppersAndDigits(buttonType.ToString()); // Create a radio button for the current button type NRadioButton radioButton = new NRadioButton(text); buttonTypeStack.Add(radioButton); } NRadioButtonGroup buttonTypeGroup = new NRadioButtonGroup(buttonTypeStack); buttonTypeGroup.SelectedIndexChanged += OnButtonTypeGroupSelectedIndexChanged; buttonTypeGroup.SelectedIndex = 2; stack.Add(new NGroupBox("Button Type", buttonTypeGroup)); // Create the events log m_EventsLog = new NExampleEventsLog(); stack.Add(m_EventsLog); return(stack); }
private void RecreateToolBarButtons(ENToolBarButtonType buttonType) { m_ToolBar.Items.Clear(); for (int i = 0, buttonCount = ButtonTexts.Length; i < buttonCount; i++) { string buttonText = ButtonTexts[i]; if (buttonText == null || buttonText.Length == 0) { m_ToolBar.Items.Add(new NCommandBarSeparator()); } else { m_ToolBar.Items.Add(CreateButton(buttonType, buttonText)); } } }
private NButton CreateButton(ENToolBarButtonType buttonType, string text) { NButton button = null; NImage image = null; switch (buttonType) { case ENToolBarButtonType.Text: button = new NButton(text); break; case ENToolBarButtonType.SmallIcon: image = GetSmallImage(text); button = new NButton(image); break; case ENToolBarButtonType.SmallIconAndText: image = GetSmallImage(text); button = new NButton(CreatePairBox(image, text)); break; case ENToolBarButtonType.LargeIcon: image = GetLargeImage(text); button = new NButton(image); break; case ENToolBarButtonType.LargeIconAndText: image = GetLargeImage(text); button = new NButton(CreatePairBox(image, text)); break; default: throw new Exception("New ENToolBarButtonType?"); } NCommandBar.SetText(button, text); NCommandBar.SetImage(button, image); button.Click += new Function <NEventArgs>(OnToolBarButtonClick); return(button); }