protected override NWidget CreateExampleControls() { NStackPanel stack = new NStackPanel(); // create the columns combo box { stack.Add(new NLabel("Select Column:")); m_ColumnsComboBox = new NComboBox(); stack.Add(m_ColumnsComboBox); for (int i = 0; i < m_GridView.Grid.Columns.Count; i++) { NColumn column = m_GridView.Grid.Columns[i]; NComboBoxItem item = new NComboBoxItem(column.Title); item.Tag = column; m_ColumnsComboBox.Items.Add(item); } m_ColumnsComboBox.SelectedIndexChanged += OnColumnsComboBoxSelectedIndexChanged; // create the columns m_ColumnPropertiesHolder = new NContentHolder(); stack.Add(new NGroupBox("Selected Column Properties", m_ColumnPropertiesHolder)); } return(stack); }
protected override NWidget CreateExampleContent() { CreateDictionaries(); m_CalculatorHost = new NContentHolder(); m_CalculatorHost.Content = CreateLoanCalculator(); return(m_CalculatorHost); }
private void OnDragDropTextTarget(NDragEventArgs args) { object data = args.DataObject.GetData(NDataFormat.TextFormat); if (data != null) { NContentHolder contentHolder = args.CurrentTargetNode as NContentHolder; contentHolder.Content = new NLabel("Dropped Text:{" + (string)data + "}. Drop another text..."); } }
private NContentHolder CreateDemoElement(string text) { NContentHolder element = new NContentHolder(text); element.Border = NBorder.CreateFilledBorder(NColor.Black, 2, 5); element.BorderThickness = new NMargins(1); element.BackgroundFill = new NColorFill(NColor.PapayaWhip); element.TextFill = new NColorFill(NColor.Black); element.Padding = new NMargins(1); return(element); }
protected override NWidget CreateExampleContent() { NStackPanel stack = new NStackPanel(); stack.FitMode = ENStackFitMode.Last; stack.FillMode = ENStackFillMode.Last; stack.Add(CreatePredefinedRequestsWidget()); stack.Add(CreateCustomRequestWidget()); m_ResponseContentHolder = new NContentHolder(); stack.Add(m_ResponseContentHolder); return(stack); }
/// <summary> /// Creates the default docked widget for this example, that is docked to the specified area. /// </summary> /// <param name="dockArea"></param> /// <returns></returns> private NWidget CreateDockedWidget(ENDockArea dockArea) { NLabel label = new NLabel(dockArea.ToString() + "(" + m_DockPanel.Count.ToString() + ")"); label.HorizontalPlacement = ENHorizontalPlacement.Center; label.VerticalPlacement = ENVerticalPlacement.Center; NWidget widget = new NContentHolder(label); widget.Border = NBorder.CreateFilledBorder(NColor.Black); widget.BorderThickness = new NMargins(1); SetDockArea(widget, dockArea); return(widget); }
private NWidget CreateBoxContent(string text, NColor borderColor) { NLabel label = new NLabel(text); label.HorizontalPlacement = ENHorizontalPlacement.Center; label.VerticalPlacement = ENVerticalPlacement.Center; NContentHolder contentElement = new NContentHolder(label); contentElement.Border = NBorder.CreateFilledBorder(borderColor); contentElement.BorderThickness = new NMargins(1); contentElement.Padding = new NMargins(2); return(contentElement); }
/// <summary> /// Creates the example content, controls and description. /// </summary> public virtual void Initialize() { m_SourceCodeHolder = new NContentHolder(); NWidget content = CreateExampleContent(); NWidget controls = CreateExampleControls(); NSplitter mainSplitter = new NSplitter(); mainSplitter.Orientation = ENHVOrientation.Vertical; mainSplitter.SplitMode = ENSplitterSplitMode.OffsetFromFarSide; mainSplitter.SplitOffset = 150; // create the description group, which is the master in the first split mainSplitter.Pane2.Content = CreateExampleDescription(); // create the example tab control NTab exampleTab = new NTab(); exampleTab.SelectedIndexChanged += OnExampleTabSelectedIndexChanged; m_ExampleTabPage = new NTabPage("Example", content); exampleTab.TabPages.Add(m_ExampleTabPage); exampleTab.TabPages.Add(new NTabPage("Source", m_SourceCodeHolder)); if (controls != null) { // create the second split, which is the slave of the first slit NSplitter exampleSplitter = new NSplitter(); exampleSplitter.SplitOffset = 300; exampleSplitter.SplitMode = ENSplitterSplitMode.OffsetFromFarSide; mainSplitter.Pane1.Content = exampleSplitter; // create the control group, which is the slave in the second split NGroupBox controlGroup = new NGroupBox("Controls", controls); exampleSplitter.Pane2.Content = controlGroup; // set the example tab control as the slave in the second split exampleSplitter.Pane1.Content = exampleTab; } else { mainSplitter.Pane1.Content = exampleTab; } Content = mainSplitter; }
protected override NWidget CreateExampleContent() { m_Label = new NLabel("Click me with the right mouse button"); m_Label.HorizontalPlacement = ENHorizontalPlacement.Center; m_Label.VerticalPlacement = ENVerticalPlacement.Center; m_Label.Font = new NFont(NFontDescriptor.DefaultSansFamilyName, 10, ENFontStyle.Regular); m_Label.TextFill = new NColorFill(NColor.Black); NContentHolder widget = new NContentHolder(m_Label); widget.HorizontalPlacement = ENHorizontalPlacement.Left; widget.VerticalPlacement = ENVerticalPlacement.Top; widget.BackgroundFill = new NColorFill(NColor.PapayaWhip); widget.Border = NBorder.CreateFilledBorder(NColor.Black); widget.BorderThickness = new NMargins(1); widget.PreferredSize = new NSize(300, 100); widget.MouseDown += new Function <NMouseButtonEventArgs>(OnTargetWidgetMouseDown); return(widget); }
private NWidget CreateWidget(string text, CreateMenuDelegate createMenuDelegate) { NLabel label = new NLabel(text); label.HorizontalPlacement = ENHorizontalPlacement.Center; label.VerticalPlacement = ENVerticalPlacement.Center; label.TextFill = new NColorFill(NColor.Black); NContentHolder widget = new NContentHolder(label); widget.HorizontalPlacement = ENHorizontalPlacement.Left; widget.VerticalPlacement = ENVerticalPlacement.Top; widget.BackgroundFill = new NColorFill(NColor.PapayaWhip); widget.Border = NBorder.CreateFilledBorder(NColor.Black); widget.BorderThickness = new NMargins(1); widget.PreferredSize = new NSize(200, 100); widget.Tag = createMenuDelegate; widget.MouseDown += new Function <NMouseButtonEventArgs>(OnTargetWidgetMouseDown); return(widget); }
protected override Nov.UI.NWidget CreateExampleControls() { m_PropertyEditorHolder = new NContentHolder(); return(m_PropertyEditorHolder); }
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); }
/// <summary> /// Creates the book store interface /// </summary> /// <param name="activePage"></param> void CreateBookStore(NPage activePage) { const double x1 = 50; const double x2 = x1 + 200; const double x3 = x2 + 50; const double x4 = x3 + 400; const double y1 = 50; const double y2 = y1 + 50; const double y3 = y2 + 50; const double y4 = y3 + 20; const double y5 = y4 + 200; const double y6 = y5 + 20; const double y7 = y6 + 50; // prev button NShape prevButtonShape = CreateButtonShape("Show Prev Book"); SetLeftTop(prevButtonShape, new NPoint(x1, y1)); ((NButton)prevButtonShape.Widget).Click += delegate(NEventArgs args) { LoadBook(m_nSelectedBook - 1); }; activePage.Items.Add(prevButtonShape); // next button NShape nextButtonShape = CreateButtonShape("Show Next Book"); SetRightTop(nextButtonShape, new NPoint(x2, y1)); ((NButton)nextButtonShape.Widget).Click += delegate(NEventArgs args) { LoadBook(m_nSelectedBook + 1); }; activePage.Items.Add(nextButtonShape); // add to cart NShape addToCartButton = CreateButtonShape("Add to Cart"); SetRightTop(addToCartButton, new NPoint(x2, y6)); ((NButton)addToCartButton.Widget).Click += delegate(NEventArgs args) { m_ShoppingCart.AddItem(m_Books[m_nSelectedBook], this); }; activePage.Items.Add(addToCartButton); // create selected book shapes NBasicShapeFactory basicShapes = new NBasicShapeFactory(); // selected image m_SelectedBookImage = basicShapes.CreateShape(ENBasicShape.Rectangle); SetLeftTop(m_SelectedBookImage, new NPoint(x1, y2)); NSize minBookSize = GetMinBookImageSize(); m_SelectedBookImage.Width = x2 - x1; m_SelectedBookImage.Height = y5 - y2; activePage.Items.Add(m_SelectedBookImage); // selected title m_SelectedBookTitle = basicShapes.CreateShape(ENBasicShape.Text); m_SelectedBookTitle.TextBlock.InitXForm(ENTextBlockXForm.ShapeBox); m_SelectedBookTitle.TextBlock.FontSize = 25; m_SelectedBookTitle.TextBlock.Fill = new NColorFill(NColor.DarkBlue); SetLeftTop(m_SelectedBookTitle, new NPoint(x3, y2)); m_SelectedBookTitle.Width = x4 - x3; m_SelectedBookTitle.Height = y3 - y2; activePage.Items.Add(m_SelectedBookTitle); // selected description m_SelectedBookDescription = basicShapes.CreateShape(ENBasicShape.Text); m_SelectedBookDescription.TextBlock.InitXForm(ENTextBlockXForm.ShapeBox); SetLeftTop(m_SelectedBookDescription, new NPoint(x3, y4)); m_SelectedBookDescription.Width = x4 - x3; m_SelectedBookDescription.Height = y5 - y4; activePage.Items.Add(m_SelectedBookDescription); // load the first book LoadBook(0); // create the shape that hosts the shopping cart widget NShape shoppingCartShape = new NShape(); shoppingCartShape.Init2DShape(); m_ShoppingCartWidget = new NContentHolder(); m_ShoppingCartWidget.Content = m_ShoppingCart.CreateWidget(this); shoppingCartShape.Widget = m_ShoppingCartWidget; SetLeftTop(shoppingCartShape, new NPoint(x1, y7)); BindSizeToDesiredSize(shoppingCartShape); activePage.Items.Add(shoppingCartShape); }