示例#1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Sharpend.Xwt.XwtTreeList"/> class.
        /// </summary>
        /// <param name='tree'>
        /// Tree.
        /// </param>
        /// <param name='xml'>
        /// xml definition for the grid or the resource name for the xml
        /// </param>
        /// <param name='isResource'>
        /// if true param xml is a resourcename
        /// </param>
        public XwtTreeList(TreeView tree,String xml, bool isResource=true)
            : this(tree)
        {
            Fields = createDataFields(xml,isResource);
            navigators = new Dictionary<TreeNavigator, VirtualGridRow>(100);
            //create the treestore
            IDataField[] df = new IDataField[Fields.Length+1];
            for (int i=0;i<Fields.Length;i++)
            {
                df[i] = Fields[i].Field;
            }
            df[Fields.Length] = new DataField<VirtualTreeRow>();
            DataStore = new TreeStore(df);

            //add columns to the tree
            //foreach (DatafieldContainer dc in Fields)
            for (int i=0;i<(Fields.Length-1);i++)
            {
                DatafieldContainer dc = Fields[i];
                Tree.Columns.Add(dc.Title,dc.Field);
                //tree.
                //Tree.Columns.Add(itm);
                //Tree.ButtonPressed += HandleButtonPressed;
            }

            Tree.DataSource = DataStore;
        }
		public ExecutionModeSelectorDialog ()
		{
			Title = GettextCatalog.GetString ("Execution Mode Selector");
			
			Width = 500;
			Height = 400;

			var box = new VBox ();
			Content = box;

			box.PackStart (new Label (GettextCatalog.GetString ("Run Configurations:")));
		
			listConfigs = new RunConfigurationsList ();
			box.PackStart (listConfigs, true);

			box.PackStart (new Label (GettextCatalog.GetString ("Execution Modes:")));

			storeModes = new TreeStore (modeNameField, modeField, modeSetField);
			treeModes = new TreeView (storeModes);
			treeModes.HeadersVisible = false;
			treeModes.Columns.Add (GettextCatalog.GetString ("Name"), modeNameField);
			box.PackStart (treeModes, true);

			runButton = new DialogButton (new Command ("run", GettextCatalog.GetString ("Run")));

			Buttons.Add (Command.Cancel);
			Buttons.Add (runButton);

			listConfigs.SelectionChanged += (sender, e) => LoadModes ();
			treeModes.SelectionChanged += OnModeChanged;
		}
示例#3
0
        public MainWindow()
        {
            this.Examples = ExampleLibrary.Examples.GetList().OrderBy(e => e.Category).ToList();

            this.plotView = new PlotView();
            this.plotView.MinHeight = 554;
            this.plotView.MinWidth = 625;
            this.plotView.DefaultTrackerSettings.Enabled = true;
            this.plotView.DefaultTrackerSettings.Background = Xwt.Drawing.Colors.AliceBlue.WithAlpha (0.9).ToOxyColor();

            this.treeView = new TreeView();
            this.treeView.MinWidth = 314;
            this.treeView.Visible = true;

            var treeModel = new TreeStore(nameCol);
            TreePosition categoryNode = null;
            string categoryName = null;
            foreach (var ex in this.Examples)
            {
                if (categoryName == null || categoryName != ex.Category)
                {
                    categoryNode = treeModel.AddNode ().SetValue (nameCol, ex.Category).CurrentPosition;
                    categoryName = ex.Category;
                }

                treeModel.AddNode (categoryNode).SetValue (nameCol, ex.Title);
            }

            treeView.Columns.Add ("Example", nameCol);
            this.treeView.DataSource = treeModel;

            this.treeView.SelectionChanged += (s, e) =>
            {

                if (treeView.SelectedRow != null) {
                    var sample = treeModel.GetNavigatorAt (treeView.SelectedRow).GetValue (nameCol);

                    var info = this.Examples.FirstOrDefault(ex => ex.Title == sample);
                    if (info != null)
                    {
                        this.SelectedExample = info;
                    }
                }
            };

            var hbox = new HBox();
            hbox.Spacing = 6;
            hbox.MinHeight = 554;
            hbox.MinWidth = 943;

            hbox.PackStart(this.treeView);
            hbox.PackStart(this.plotView, true);

            Content = hbox;

            this.SelectedExample = this.Examples.FirstOrDefault();

            this.Title = "OxyPlot.Xwt Example Browser";
            this.CloseRequested += (s, a) => Application.Exit ();
        }
示例#4
0
        private void InitializeComponent()
        {
            Width = 550;
            Height = 600;
            //Location = WindowLocation.CenterScreen;

            vbox2 = new VBox();
            vbox2.Visible = true;
            vbox2.Spacing = 3;

            notebook1 = new Notebook();
            notebook1.Visible = true;
            notebook1.CanGetFocus = true;

            image1 = new ImageView();
            string file = FileHelper.FindSupportFile("bygfoot_splash.png", false);
            image1.Image = Image.FromFile(file);

            treeview_splash_contributors = new TreeView();

            scrolledwindow2 = new ScrollView();
            scrolledwindow2.Content = treeview_splash_contributors;

            notebook1.Add(image1, "");
            notebook1.Add(scrolledwindow2, "");
            vbox2.PackStart(notebook1);

            Content = vbox2;
        }
示例#5
0
        public MainWindow()
        {
            Menu menu = new Menu ();

            var file = new MenuItem ("File");
            file.SubMenu = new Menu ();
            file.SubMenu.Items.Add (new MenuItem ("Open"));
            file.SubMenu.Items.Add (new MenuItem ("New"));
            file.SubMenu.Items.Add (new MenuItem ("Close"));
            menu.Items.Add (file);

            var edit = new MenuItem ("Edit");
            edit.SubMenu = new Menu ();
            edit.SubMenu.Items.Add (new MenuItem ("Copy"));
            edit.SubMenu.Items.Add (new MenuItem ("Cut"));
            edit.SubMenu.Items.Add (new MenuItem ("Paste"));
            menu.Items.Add (edit);

            MainMenu = menu;

            HBox box = new HBox ();

            icon = Image.FromResource (typeof(App), "class.png");

            store = new TreeStore (nameCol, iconCol, widgetCol);
            samplesTree = new TreeView ();
            samplesTree.Columns.Add ("Name", iconCol, nameCol);

            AddSample (null, "Boxes", typeof(Boxes));
            AddSample (null, "Buttons", typeof(ButtonSample));
            AddSample (null, "ComboBox", typeof(ComboBoxes));
            //			AddSample (null, "Designer", typeof(Designer));
            AddSample (null, "Drag & Drop", typeof(DragDrop));
            var n = AddSample (null, "Drawing", null);
            AddSample (n, "Canvas with Widget", typeof(CanvasWithWidget));
            AddSample (n, "Chart", typeof(ChartSample));
            AddSample (n, "Transformations", typeof(DrawingTransforms));
            AddSample (null, "Images", typeof(Images));
            AddSample (null, "List View", typeof(ListView1));
            AddSample (null, "Notebook", typeof(NotebookSample));
            //			AddSample (null, "Scroll View", typeof(ScrollWindowSample));
            AddSample (null, "Text Entry", typeof(TextEntries));
            AddSample (null, "Windows", typeof(Windows));

            samplesTree.DataSource = store;

            box.PackStart (samplesTree);

            sampleBox = new VBox ();
            title = new Label ("Sample:");
            sampleBox.PackStart (title, BoxMode.None);

            box.PackStart (sampleBox, BoxMode.FillAndExpand);

            Content = box;

            samplesTree.SelectionChanged += HandleSamplesTreeSelectionChanged;
        }
示例#6
0
		public override IScrollableWidget CreateScrollableWidget ()
		{
			DataField<string> text = new DataField<string> ();
			TreeStore s = new TreeStore (text);
			var list = new TreeView (s);
			list.Columns.Add ("Hi", text);

			for (int n = 0; n < 100; n++) {
				var r = s.AddNode ();
				r.SetValue (text, n + new string ('.',100));
			}
			return list;
		}
示例#7
0
文件: TreeViews.cs 项目: chkn/xwt
        public TreeViews()
        {
            TreeView view = new TreeView ();
            TreeStore store = new TreeStore (text, desc);

            view.Columns.Add ("Item", text);
            view.Columns.Add ("Desc", desc);

            store.AddNode ().SetValue (text, "One").SetValue (desc, "First");
            store.AddNode ().SetValue (text, "Two").SetValue (desc, "Second").AddChild ()
                .SetValue (text, "Sub two").SetValue (desc, "Sub second");
            store.AddNode ().SetValue (text, "Three").SetValue (desc, "Third").AddChild ()
                .SetValue (text, "Sub three").SetValue (desc, "Sub third");
            PackStart (view);

            view.DataSource = store;

            Label la = new Label ();
            PackStart (la);

            view.SetDragDropTarget (DragDropAction.All, TransferDataType.Text);
            view.SetDragSource (DragDropAction.All, TransferDataType.Text);

            view.DragDrop += delegate(object sender, DragEventArgs e) {
                TreePosition node;
                RowDropPosition pos;
                view.GetDropTargetRow (e.Position.X, e.Position.Y, out pos, out node);
                var nav = store.GetNavigatorAt (node);
                la.Text += "Dropped \"" + e.Data.Text + "\" into \"" + nav.GetValue (text) + "\" " + pos + "\n";
                e.Success = true;
            };
            view.DragOver += delegate(object sender, DragOverEventArgs e) {
                TreePosition node;
                RowDropPosition pos;
                view.GetDropTargetRow (e.Position.X, e.Position.Y, out pos, out node);
                if (pos == RowDropPosition.Into)
                    e.AllowedAction = DragDropAction.None;
                else
                    e.AllowedAction = e.Action;
            };
            view.DragStarted += delegate(object sender, DragStartedEventArgs e) {
                var val = store.GetNavigatorAt (view.SelectedRow).GetValue (text);
                e.DragOperation.Data.AddValue (val);
                e.DragOperation.Finished += delegate(object s, DragFinishedEventArgs args) {
                    Console.WriteLine ("D:" + args.DeleteSource);
                };
            };
        }
示例#8
0
        public CoursesController(TreeView treeView, Button btnAddSubject,
            Button btnAddLesson)
        {
            this.treeView = treeView;
            imageCol   = new DataField<Xwt.Drawing.Image>();
            nameCol    = new DataField<string>();
            subjectCol = new DataField<Subject>();
            lessonCol  = new DataField<Lesson>();
            store = new TreeStore(imageCol, nameCol, subjectCol, lessonCol);
            treeView.DataSource = store;
            treeView.Columns.Add("", imageCol, nameCol);

            UpdateView();
            treeView.SelectionChanged += OnTreeSelectionChanged;

            this.btnAddLesson = btnAddLesson;
            btnAddSubject.Clicked += CreateSubject;
            btnAddLesson.Clicked += CreateLesson;
        }
示例#9
0
 public override Xwt.Widget Makeup(IXwtWrapper Parent)
 {
     Xwt.TreeView Target = new Xwt.TreeView()
     {
         HeadersVisible = this.HeadersVisible,
         SelectionMode = this.SelectionMode,
         VerticalScrollPolicy = this.VScrollPolicy,
         HorizontalScrollPolicy = this.HScrollPolicy
     };
     if (this.Source != "")
     {
         TreeStoreWrapper Source = ((Bindings.TreeStoreWrapper)(Parent.GetType().GetField(this.Source).GetValue(Parent)));
         Target.DataSource = Source.TreeStore;
         if (ColumnDefinition != null && ColumnDefinition.Count() > 0)
         {
             foreach (XwtColumnDefinitionNode N in ColumnDefinition)
             {
                 if (Source.Fields.ContainsKey(N.Source))
                 {
                     IDataField X = Source.Fields[N.Source];
                     IDataField S = X;
                     if (X.FieldType == typeof(DateTime))
                     {
                         S = Source.Fields[N.Source + "_sort"];
                         X = Source.Fields[N.Source + "_text"];
                     }
                     ListViewColumn C = new ListViewColumn(N.Title, CellViewFactory.Make(X, N.Editable))
                     {
                         SortDataField = S,
                         SortIndicatorVisible = N.Sortable,
                         CanResize = N.Resizable
                     };
                     Target.Columns.Add(C);
                 }
             }
         }
     }
     WindowController.TryAttachEvent(Target, "SelectionChanged", Parent, Changed);
     WindowController.TryAttachEvent(Target, "RowActivated", Parent, Clicked);
     InitWidget(Target, Parent);
     return Target;
 }
示例#10
0
		public void HiddenTree ()
		{
			var f = new DataField<string> ();
			TreeStore ts = new TreeStore (f);
			var node = ts.AddNode ().SetValue (f, "1").AddChild ().SetValue (f, "2").AddChild ().SetValue (f, "3");
			var tree = new TreeView (ts);

			Window w = new Window ();
			Notebook nb = new Notebook ();
			nb.Add (new Label ("Hi"), "One");
			nb.Add (tree, "Two");
			w.Content = nb;
			ShowWindow (w);

			tree.ScrollToRow (node.CurrentPosition);

			tree.Columns.Add ("Hi", f);

			tree.ScrollToRow (node.CurrentPosition);
		}
示例#11
0
        public ProjectControl()
        {
            Title = "Project";

            _treeView = new Xwt.TreeView();
            _treeView.HeadersVisible = false;
            _treeView.SelectionMode  = SelectionMode.Multiple;

            _iconRoot = Image.FromResource("TreeView.Root.png");

            _dataImage = new DataField <Image>();
            _dataText  = new DataField <string>();
            _dataTag   = new DataField <IProjectItem>();

            _treeStore = new TreeStore(_dataImage, _dataText, _dataTag);

            _treeView.DataSource = _treeStore;
            _treeView.Columns.Add("", _dataImage, _dataText);

            var nativeWidget = Toolkit.CurrentEngine.GetNativeWidget(_treeView);

#if WINDOWS
            var widget = nativeWidget as System.Windows.Controls.Control;
#else
            var widget = nativeWidget as Gtk.Widget;
#endif
            _etoView = widget.ToEto();
            CreateContent(_etoView);

#if LINUX
            (nativeWidget as Gtk.ScrolledWindow).Child.ButtonPressEvent += Styles.TreeView_ButtonPressEvent;
#endif

            _treeView.RowActivated     += TreeView_RowActivated;
            _treeView.ButtonReleased   += Handle_ButtonReleased;
            _treeView.SelectionChanged += ProjectControl_SelectionChanged;

            _treeView.SetDragDropTarget(TransferDataType.Text, TransferDataType.Uri);
            _treeView.DragOver += TreeView_DragOver;
            _treeView.DragDrop += TreeView_DragDrop;
        }
示例#12
0
		public TreeViewCellBounds ()
		{
			MinHeight = 120;
			MinWidth = 100;

			container = new VBox ();
			TreeView = new TreeView ();
			TreeStore = new TreeStore (triState, check, text, desc);
			TreeView.GridLinesVisible = GridLines.Both;

			TreeView.Columns.Add ("TriCheck", triState);
			TreeView.Columns.Add ("Check", check);
			TreeView.Columns.Add ("Item", text);
			TreeView.Columns.Add ("Desc", desc, check, text);

			TreeView.DataSource = TreeStore;

			TreeStore.AddNode ().SetValue (text, "One").SetValue (desc, "First").SetValue (triState, CheckBoxState.Mixed);
			TreeStore.AddNode ().SetValue (text, "Two").SetValue (desc, "Second").AddChild ()
				.SetValue (text, "Sub two").SetValue (desc, "Sub second");
			TreeStore.AddNode ().SetValue (text, "Three").SetValue (desc, "Third").AddChild ()
				.SetValue (text, "Sub three").SetValue (desc, "Sub third");

			TreeView.ExpandAll ();


			TreeView.SelectionChanged += (sender, e) => UpdateTracker (TreeView.SelectedRow);
			TreeView.MouseMoved += (sender, e) => UpdateTracker (TreeView.GetRowAtPosition (e.X, e.Y));

			drawer = new TreeTrackingCanvas (this);

			container.PackStart (TreeView, true);
			container.PackStart (drawer);
			AddChild (container);

			if (currentRow == null)
				currentRow = TreeStore.GetFirstNode ();
		}
示例#13
0
文件: MainWindow.cs 项目: silwol/xwt
        public MainWindow()
        {
            try {
                statusIcon = Application.CreateStatusIcon ();
                statusIcon.Menu = new Menu ();
                statusIcon.Menu.Items.Add (new MenuItem ("Test"));
                statusIcon.Image = Image.FromResource (GetType (), "package.png");
            } catch {
                Console.WriteLine ("Status icon could not be shown");
            }

            Menu menu = new Menu ();

            var file = new MenuItem ("File");
            file.SubMenu = new Menu ();
            file.SubMenu.Items.Add (new MenuItem ("Open"));
            file.SubMenu.Items.Add (new MenuItem ("New"));
            MenuItem mi = new MenuItem ("Close");
            mi.Clicked += delegate {
                Application.Exit();
            };
            file.SubMenu.Items.Add (mi);
            menu.Items.Add (file);

            var edit = new MenuItem ("Edit");
            edit.SubMenu = new Menu ();
            edit.SubMenu.Items.Add (new MenuItem ("Copy"));
            edit.SubMenu.Items.Add (new MenuItem ("Cut"));
            edit.SubMenu.Items.Add (new MenuItem ("Paste"));
            menu.Items.Add (edit);

            MainMenu = menu;

            HPaned box = new HPaned ();

            icon = Image.FromResource (typeof(App), "class.png");

            store = new TreeStore (nameCol, iconCol, widgetCol);
            samplesTree = new TreeView ();
            samplesTree.Columns.Add ("Name", iconCol, nameCol);

            AddSample (null, "Boxes", typeof(Boxes));
            AddSample (null, "Buttons", typeof(ButtonSample));
            AddSample (null, "CheckBox", typeof(Checkboxes));
            AddSample (null, "Clipboard", typeof(ClipboardSample));
            AddSample (null, "ColorSelector", typeof(ColorSelectorSample));
            AddSample (null, "ComboBox", typeof(ComboBoxes));
            //			AddSample (null, "Designer", typeof(Designer));
            AddSample (null, "Drag & Drop", typeof(DragDrop));

            var n = AddSample (null, "Drawing", null);
            AddSample (n, "Canvas with Widget", typeof(CanvasWithWidget));
            AddSample (n, "Chart", typeof(ChartSample));
            AddSample (n, "Colors", typeof(ColorsSample));
            AddSample (n, "Figures", typeof(DrawingFigures));
            AddSample (n, "Transformations", typeof(DrawingTransforms));
            AddSample (n, "Images and Patterns", typeof(DrawingPatternsAndImages));
            AddSample (n, "Text", typeof(DrawingText));
            AddSample (n, "Partial Images", typeof (PartialImages));

            AddSample (null, "Expander", typeof (ExpanderSample));
            AddSample (null, "Progress bars", typeof(ProgressBarSample));
            AddSample (null, "Frames", typeof(Frames));
            AddSample (null, "Images", typeof(Images));
            AddSample (null, "Labels", typeof(Labels));
            AddSample (null, "ListBox", typeof(ListBoxSample));
            AddSample (null, "ListView", typeof(ListView1));
            AddSample (null, "Menu", typeof(MenuSamples));
            AddSample (null, "Notebook", typeof(NotebookSample));
            AddSample (null, "Paneds", typeof(PanedViews));
            AddSample (null, "Scroll View", typeof(ScrollWindowSample));
            AddSample (null, "Tables", typeof(Tables));
            AddSample (null, "Text Entry", typeof(TextEntries));
            AddSample (null, "Tooltips", typeof(Tooltips));
            AddSample (null, "TreeView", typeof(TreeViews));
            AddSample (null, "WidgetEvents", typeof(WidgetEvents));
            AddSample (null, "Windows", typeof(Windows));

            samplesTree.DataSource = store;

            box.Panel1.Content = samplesTree;

            sampleBox = new VBox ();
            title = new Label ("Sample:");
            sampleBox.PackStart (title, BoxMode.None);

            box.Panel2.Content = sampleBox;
            box.Panel2.Resize = true;
            box.Position = 160;

            Content = box;

            samplesTree.SelectionChanged += HandleSamplesTreeSelectionChanged;
        }
示例#14
0
        public MainWindow()
        {
            Title = "Xwt Demo Application";
            Width = 500;
            Height = 400;

            try {
                statusIcon = Application.CreateStatusIcon ();
                statusIcon.Menu = new Menu ();
                statusIcon.Menu.Items.Add (new MenuItem ("Test"));
                statusIcon.Image = Image.FromResource (GetType (), "package.png");
            } catch {
                Console.WriteLine ("Status icon could not be shown");
            }

            Menu menu = new Menu ();

            var file = new MenuItem ("_File");
            file.SubMenu = new Menu ();
            file.SubMenu.Items.Add (new MenuItem ("_Open"));
            file.SubMenu.Items.Add (new MenuItem ("_New"));
            MenuItem mi = new MenuItem ("_Close");
            mi.Clicked += delegate {
                Application.Exit();
            };
            file.SubMenu.Items.Add (mi);
            menu.Items.Add (file);

            var edit = new MenuItem ("_Edit");
            edit.SubMenu = new Menu ();
            edit.SubMenu.Items.Add (new MenuItem ("_Copy"));
            edit.SubMenu.Items.Add (new MenuItem ("Cu_t"));
            edit.SubMenu.Items.Add (new MenuItem ("_Paste"));
            menu.Items.Add (edit);

            MainMenu = menu;

            HPaned box = new HPaned ();

            icon = Image.FromResource (typeof(App), "document-generic.png");

            store = new TreeStore (nameCol, iconCol, widgetCol);
            samplesTree = new TreeView ();
            samplesTree.Columns.Add ("Name", iconCol, nameCol);

            var w = AddSample (null, "Widgets", null);
            AddSample (w, "Boxes", typeof(Boxes));
            AddSample (w, "Buttons", typeof(ButtonSample));
            AddSample (w, "CheckBox", typeof(Checkboxes));
            AddSample (w, "Clipboard", typeof(ClipboardSample));
            AddSample (w, "ColorSelector", typeof(ColorSelectorSample));
            AddSample (w, "ComboBox", typeof(ComboBoxes));
            AddSample (w, "DatePicker", typeof(DatePickerSample));
            //			AddSample (null, "Designer", typeof(Designer));
            AddSample (w, "Expander", typeof (ExpanderSample));
            AddSample (w, "Progress bars", typeof(ProgressBarSample));
            AddSample (w, "Frames", typeof(Frames));
            AddSample (w, "Images", typeof(Images));
            AddSample (w, "Labels", typeof(Labels));
            AddSample (w, "ListBox", typeof(ListBoxSample));
            AddSample (w, "LinkLabels", typeof(LinkLabels));
            var listView = AddSample (w, "ListView", typeof(ListView1));
            AddSample (listView, "Editable checkboxes", typeof(ListView2));
            AddSample (w, "Markdown", typeof (MarkDownSample));
            AddSample (w, "Menu", typeof(MenuSamples));
            var mn = AddSample (w, "Mnemonics", typeof (Mnemonics));
            AddSample (w, "Notebook", typeof(NotebookSample));
            AddSample (w, "Paneds", typeof(PanedViews));
            AddSample (w, "Popover", typeof(PopoverSample));
            AddSample (w, "RadioButton", typeof (RadioButtonSample));
            AddSample (w, "Scroll View", typeof(ScrollWindowSample));
            AddSample (w, "Scrollbar", typeof(ScrollbarSample));
            AddSample (w, "Slider", typeof (SliderSample));
            AddSample (w, "Spinners", typeof (Spinners));
            AddSample (w, "Tables", typeof (Tables));
            AddSample (w, "Text Entry", typeof (TextEntries));
            AddSample (w, "Password Entry", typeof (PasswordEntries));
            AddSample (w, "TreeView", typeof(TreeViews));

            var n = AddSample (null, "Drawing", null);
            AddSample (n, "Canvas with Widget (Linear)", typeof (CanvasWithWidget_Linear));
            AddSample (n, "Canvas with Widget (Radial)", typeof (CanvasWithWidget_Radial));
            AddSample (n, "Chart", typeof (ChartSample));
            AddSample (n, "Colors", typeof(ColorsSample));
            AddSample (n, "Figures", typeof(DrawingFigures));
            AddSample (n, "Transformations", typeof(DrawingTransforms));
            AddSample (n, "Images and Patterns", typeof(DrawingPatternsAndImages));
            AddSample (n, "Text", typeof(DrawingText));
            AddSample (n, "Partial Images", typeof (PartialImages));
            AddSample (n, "Custom Drawn Image", typeof (ImageScaling));
            AddSample (n, "Widget Rendering", typeof (WidgetRendering));

            var wf = AddSample (null, "Widget Features", null);
            AddSample (wf, "Drag & Drop", typeof(DragDrop));
            AddSample (wf, "Widget Events", typeof(WidgetEvents));
            AddSample (wf, "Opacity", typeof(OpacitySample));
            AddSample (wf, "Tooltips", typeof(Tooltips));

            AddSample (null, "Windows", typeof(Windows));

            AddSample (null, "Screens", typeof (ScreensSample));

            samplesTree.DataSource = store;

            box.Panel1.Content = samplesTree;

            sampleBox = new VBox ();
            title = new Label ("Sample:");
            sampleBox.PackStart (title);

            box.Panel2.Content = sampleBox;
            box.Panel2.Resize = true;
            box.Position = 160;

            Content = box;

            samplesTree.SelectionChanged += HandleSamplesTreeSelectionChanged;

            CloseRequested += HandleCloseRequested;
        }
示例#15
0
        public MainWindow()
        {
            Title = "NPlot.Xwt Samples Application";
            Width = 800;
            Height = 600;

            Menu menu = new Menu ();

            var file = new MenuItem ("File");
            file.SubMenu = new Menu ();
            file.SubMenu.Items.Add (new MenuItem ("Open"));
            file.SubMenu.Items.Add (new MenuItem ("New"));
            MenuItem mi = new MenuItem ("Close");
            mi.Clicked += delegate {
                Application.Exit();
            };
            file.SubMenu.Items.Add (mi);
            menu.Items.Add (file);

            var edit = new MenuItem ("Edit");
            edit.SubMenu = new Menu ();
            edit.SubMenu.Items.Add (new MenuItem ("Copy"));
            edit.SubMenu.Items.Add (new MenuItem ("Cut"));
            edit.SubMenu.Items.Add (new MenuItem ("Paste"));
            menu.Items.Add (edit);

            MainMenu = menu;

            HPaned box = new HPaned ();

            icon = Image.FromResource (typeof(App), "class.png");

            store = new TreeStore (nameCol, iconCol, widgetCol);
            samplesTree = new TreeView ();
            samplesTree.Columns.Add ("Name", iconCol, nameCol);

            var staticPlots = AddSample (null, "Static Plots", null);
            AddSample (staticPlots, "Plot Markers", typeof (PlotMarkerSample));
            AddSample (staticPlots, "Waveform Step Plot", typeof (StepPlotSample));
            AddSample (staticPlots, "Point Plot", typeof (PointPlotSample));
            AddSample (staticPlots, "Histogram Plot", typeof (HistogramSample));
            AddSample (staticPlots, "Candle Plot", typeof (CandlePlotSample));
            AddSample (staticPlots, "Trading Plot", typeof (TradingSample));

            var interactivePlots = AddSample (null, "Interactive Plots", null);
            AddSample (interactivePlots, "Waveform Plot", typeof (StepPlotSample));

            var tests = AddSample (null, "Tests", null);
            AddSample (tests, "Linear Axis", typeof (LinearAxisTest));
            AddSample (tests, "Log Axis", typeof (LogAxisTest));
            AddSample (tests, "DateTime Axis", typeof (DateTimeAxisTest));

            samplesTree.DataSource = store;

            box.Panel1.Content = samplesTree;

            sampleBox = new VBox ();

            box.Panel2.Content = sampleBox;
            box.Panel2.Resize = true;
            box.Position = 200;

            Content = box;

            samplesTree.SelectionChanged += HandleSamplesTreeSelectionChanged;

            CloseRequested += HandleCloseRequested;
        }
示例#16
0
        public TreeViews()
        {
            TreeView view = new TreeView();
            TreeStore store = new TreeStore(triState, check, text, desc);
            view.GridLinesVisible = GridLines.Both;

            var triStateCellView = new CheckBoxCellView(triState) { Editable = true, AllowMixed = true };
            triStateCellView.Toggled += (object sender, WidgetEventArgs e) =>
            {
                if (view.CurrentEventRow == null)
                {
                    MessageDialog.ShowError("CurrentEventRow is null. This is not supposed to happen");
                }
                else
                {
                    store.GetNavigatorAt(view.CurrentEventRow).SetValue(text, "TriState Toggled");
                }
            };
            var checkCellView = new CheckBoxCellView(check) { Editable = true };
            checkCellView.Toggled += (object sender, WidgetEventArgs e) =>
            {
                if (view.CurrentEventRow == null)
                {
                    MessageDialog.ShowError("CurrentEventRow is null. This is not supposed to happen");
                }
                else
                {
                    store.GetNavigatorAt(view.CurrentEventRow).SetValue(text, "Toggled");
                }
            };
            view.Columns.Add("TriCheck", triStateCellView);
            view.Columns.Add("Check", checkCellView);
            view.Columns.Add("Item", text);
            view.Columns.Add("Desc", desc);

            store.AddNode().SetValue(text, "One").SetValue(desc, "First").SetValue(triState, CheckBoxState.Mixed);
            store.AddNode().SetValue(text, "Two").SetValue(desc, "Second").AddChild()
                .SetValue(text, "Sub two").SetValue(desc, "Sub second");
            store.AddNode().SetValue(text, "Three").SetValue(desc, "Third").AddChild()
                .SetValue(text, "Sub three").SetValue(desc, "Sub third");
            PackStart(view, true);

            Menu contextMenu = new Menu();
            contextMenu.Items.Add(new MenuItem("Test menu"));
            view.ButtonPressed += delegate(object sender, ButtonEventArgs e)
            {
                TreePosition tmpTreePos;
                RowDropPosition tmpRowDrop;
                if ((e.Button == PointerButton.Right) && view.GetDropTargetRow(e.X, e.Y, out tmpRowDrop, out tmpTreePos))
                {
                    // Set actual row to selected
                    view.SelectRow(tmpTreePos);
                    contextMenu.Popup(view, e.X, e.Y);
                }
            };

            view.DataSource = store;

            Label la = new Label();
            PackStart(la);

            view.SetDragDropTarget(DragDropAction.All, TransferDataType.Text);
            view.SetDragSource(DragDropAction.All, TransferDataType.Text);

            view.DragDrop += delegate(object sender, DragEventArgs e)
            {
                TreePosition node;
                RowDropPosition pos;
                view.GetDropTargetRow(e.Position.X, e.Position.Y, out pos, out node);
                var nav = store.GetNavigatorAt(node);
                la.Text += "Dropped \"" + e.Data.Text + "\" into \"" + nav.GetValue(text) + "\" " + pos + "\n";
                e.Success = true;
            };
            view.DragOver += delegate(object sender, DragOverEventArgs e)
            {
                TreePosition node;
                RowDropPosition pos;
                view.GetDropTargetRow(e.Position.X, e.Position.Y, out pos, out node);
                if (pos == RowDropPosition.Into)
                    e.AllowedAction = DragDropAction.None;
                else
                    e.AllowedAction = e.Action;
            };
            view.DragStarted += delegate(object sender, DragStartedEventArgs e)
            {
                var val = store.GetNavigatorAt(view.SelectedRow).GetValue(text);
                e.DragOperation.Data.AddValue(val);
                e.DragOperation.Finished += delegate(object s, DragFinishedEventArgs args)
                {
                    Console.WriteLine("D:" + args.DeleteSource);
                };
            };
            view.RowExpanding += delegate(object sender, TreeViewRowEventArgs e)
            {
                var val = store.GetNavigatorAt(e.Position).GetValue(text);
                Console.WriteLine("Expanding: " + val);
            };
            view.RowExpanded += delegate(object sender, TreeViewRowEventArgs e)
            {
                var val = store.GetNavigatorAt(e.Position).GetValue(text);
                Console.WriteLine("Expanded: " + val);
            };
            view.RowCollapsing += delegate(object sender, TreeViewRowEventArgs e)
            {
                var val = store.GetNavigatorAt(e.Position).GetValue(text);
                Console.WriteLine("Collapsing: " + val);
            };
            view.RowCollapsed += delegate(object sender, TreeViewRowEventArgs e)
            {
                var val = store.GetNavigatorAt(e.Position).GetValue(text);
                Console.WriteLine("Collapsed: " + val);
            };

            int addCounter = 0;
            view.KeyPressed += (sender, e) =>
            {
                if (e.Key == Key.Insert)
                {
                    TreeNavigator n;
                    if (view.SelectedRow != null)
                        n = store.InsertNodeAfter(view.SelectedRow).SetValue(text, "Inserted").SetValue(desc, "Desc");
                    else
                        n = store.AddNode().SetValue(text, "Inserted").SetValue(desc, "Desc");
                    view.ExpandToRow(n.CurrentPosition);
                    view.ScrollToRow(n.CurrentPosition);
                    view.UnselectAll();
                    view.SelectRow(n.CurrentPosition);
                    view.FocusedRow = n.CurrentPosition;
                }
            };
            Button addButton = new Button("Add");
            addButton.Clicked += delegate(object sender, EventArgs e)
            {
                addCounter++;
                TreeNavigator n;
                if (view.SelectedRow != null)
                    n = store.AddNode(view.SelectedRow).SetValue(text, "Added " + addCounter).SetValue(desc, "Desc");
                else
                    n = store.AddNode().SetValue(text, "Added " + addCounter).SetValue(desc, "Desc");
                view.ExpandToRow(n.CurrentPosition);
                view.ScrollToRow(n.CurrentPosition);
                view.SelectRow(n.CurrentPosition);
            };
            PackStart(addButton);

            Button removeButton = new Button("Remove Selection");
            removeButton.Clicked += delegate(object sender, EventArgs e)
            {
                foreach (TreePosition row in view.SelectedRows)
                {
                    store.GetNavigatorAt(row).Remove();
                }
            };
            PackStart(removeButton);

            var label = new Label();
            PackStart(label);

            view.RowExpanded += (sender, e) => label.Text = "Row expanded: " + store.GetNavigatorAt(e.Position).GetValue(text);
        }
示例#17
0
	  /******************************************
			THIS IS AUTO GENERATED CODE BY GLADEBUILDER
			DO NOT EDIT
			USE THE IMPLEMENTATION CLASS INSTEAD
	  *******************************************/
	  namespace GladeBuilder
示例#18
0
		internal void Load (TreeView tree)
		{
			if (this.tree != tree)
				throw new InvalidOperationException ("Invalid tree instance. The status can only be restored on the tree that generated the status object.");
			Load (state, null);
		}
示例#19
0
        /// <summary>
        /// Initialize whole layout!
        /// </summary>
        private void _intializeBoxes()
        {
            // Create HPaned main box
            MainBox = new HBox();
            MainBox.ExpandVertical = true;
            MainBox.ExpandHorizontal = true;
            MainBox.Spacing = 3;

            // Create tree view
            CurrentServer = new TreeView();
            CurrentServer.WidthRequest = 230;
            CurrentServer.SelectionMode = SelectionMode.Single;
            CurrentServer.SelectionChanged += UpdateControlView;

            // Create tree view!
            ServerStore = new TreeStore(ColumnName, ColumnImage, ColumnType);
            CurrentServer.Columns.Add("Server", ColumnImage, ColumnName); // Dummy column, not sure why?
            CurrentServer.HeadersVisible = false;

            // Net item parsing
            CurrentServer.ButtonPressed += HandleMouseOnTreeView;

            // Set data source
            CurrentServer.DataSource = ServerStore;

            // Add server to main box
            MainBox.PackStart(CurrentServer);

            // Prepare content box
            ContentBox = new VBox()
            {
                MarginLeft = 10
            };
            SetContentBoxControl(DirectorHomepage);

            // Add to panel
            MainBox.PackStart(ContentBox, expand: true, fill: true);

            // Control box with bottom info panel
            VBox MainContent = new VBox();
            MainContent.PackStart(MainBox, expand: true, fill: true);

            // Create Info label with link
            LinkLabel _info = new LinkLabel("Copyright 2014 NetBrick, s.r.o.")
            {
                Uri = new Uri("http://director.strnadj.eu/")
            };
            MainContent.PackStart(_info, vpos: WidgetPlacement.End, hpos: WidgetPlacement.End);

            // Clear tree view!
            ClearCurrentServerTree();

            // Set content to main box
            Content = MainContent;
        }
        void CreateView()
        {
            store = new TreeStore(itemField, descriptionField, propertyNameField, propertiesField, notificationPreferenceField, notificationPreferencesField);

            treeView = new TreeView(store);
            treeView.SelectionChanged += (object sender, EventArgs e) => {
                if (treeView.SelectedRow != null)
                {
                    var item = store.GetNavigatorAt(treeView.SelectedRow)?.GetValue(itemField) as AbstractCodeStyleOptionViewModel;
                    if (item != null)
                    {
                        this.viewModel.SetOptionAndUpdatePreview(item.SelectedPreference.IsChecked, item.Option, item.GetPreview());
                        return;
                    }
                }
                return;
            };
            var col = treeView.Columns.Add(GettextCatalog.GetString("Description"), descriptionField);

            col.Expands = true;

            var propertyCellView = new ComboBoxCellView(propertyNameField);

            propertyCellView.Editable          = true;
            propertyCellView.ItemsField        = propertiesField;
            propertyCellView.SelectionChanged += delegate(object sender, WidgetEventArgs e) {
                var treeNavigator = store.GetNavigatorAt(treeView.CurrentEventRow);
                if (treeNavigator == null)
                {
                    return;
                }
                var item = treeNavigator.GetValue(itemField);
                if (item == null)
                {
                    return;
                }
                var text2 = treeNavigator.GetValue(propertyNameField);

                GLib.Timeout.Add(10, delegate {
                    var text = treeNavigator.GetValue(propertyNameField);
                    foreach (var pref in item.Preferences)
                    {
                        if (pref.Name == text)
                        {
                            item.SelectedPreference = pref;
                            this.viewModel.SetOptionAndUpdatePreview(pref.IsChecked, item.Option, item.GetPreview());
                        }
                    }
                    return(false);
                });
            };
            col         = new ListViewColumn(GettextCatalog.GetString("Property"), propertyCellView);
            col.Expands = true;
            treeView.Columns.Add(col);

            var severityCellView = new ComboBoxCellView(notificationPreferenceField);

            severityCellView.Editable   = true;
            severityCellView.ItemsField = notificationPreferencesField;
            col = new ListViewColumn(GettextCatalog.GetString("Severity"), severityCellView);
            treeView.Columns.Add(col);

            this.PackStart(treeView, true, true);
            var wrappedEditor = Xwt.Toolkit.CurrentEngine.WrapWidget((Gtk.Widget)viewModel.TextViewHost, Xwt.NativeWidgetSizing.DefaultPreferredSize);

            this.PackEnd(wrappedEditor, true, true);
            FillTreeStore();
        }
示例#21
0
		internal TreeViewStatus (TreeView tree, int idColumn)
		{
			this.tree = tree;
			this.idColumn = idColumn;
			Save ();
		}
示例#22
0
        /// <summary>
        /// Initializes a new instance of the Samples.MainWindow class, creating a 2-panel
        /// layout with a TreeStore for Sample selection and a VBox for the sample itself.
        /// </summary>
        public MainWindow()
        {
            // Show a status icon in taskbar if possible
            try {
                statusIcon = Application.CreateStatusIcon ();
                statusIcon.Menu = new Menu ();
                statusIcon.Menu.Items.Add (new MenuItem ("Test"));
                statusIcon.Image = Image.FromResource (GetType (), "package.png");
            } catch {
                Console.WriteLine ("Status icon could not be shown");
            }

            Menu menu = new Menu ();

            var file = new MenuItem ("File");
            file.SubMenu = new Menu ();
            file.SubMenu.Items.Add (new MenuItem ("Open"));
            file.SubMenu.Items.Add (new MenuItem ("New"));
            MenuItem mi = new MenuItem ("Close");
            mi.Clicked += delegate {
                Application.Exit();
            };
            file.SubMenu.Items.Add (mi);
            menu.Items.Add (file);

            var edit = new MenuItem ("Edit");
            edit.SubMenu = new Menu ();
            edit.SubMenu.Items.Add (new MenuItem ("Copy"));
            edit.SubMenu.Items.Add (new MenuItem ("Cut"));
            edit.SubMenu.Items.Add (new MenuItem ("Paste"));
            menu.Items.Add (edit);

            MainMenu = menu;

            HPaned box = new HPaned ();

            icon = Image.FromResource (typeof(App), "class.png");

            store = new TreeStore (nameCol, iconCol, widgetCol);
            samplesTree = new TreeView ();
            samplesTree.Columns.Add ("Name", iconCol, nameCol);

            AddSample (null, "Boxes", typeof(Boxes));

            var n = AddSample (null, "Charts", null);
            AddSample (n, "SimplePlotCanvas", typeof (SimplePlotCanvas));

            samplesTree.DataSource = store;

            box.Panel1.Content = samplesTree;

            sampleBox = new VBox ();
            title = new Label ("Sample:");
            sampleBox.PackStart (title, BoxMode.None);

            box.Panel2.Content = sampleBox;
            box.Panel2.Resize = true;
            box.Position = 160;

            Content = box;

            samplesTree.SelectionChanged += HandleSamplesTreeSelectionChanged;

            CloseRequested += HandleCloseRequested;
        }
示例#23
0
        public MainWindow()
        {
            Title = string.Format (Catalog.GetString ("{0} Demo Application"), "Hamekoz Xwt");
            InitialLocation = WindowLocation.CenterScreen;
            Icon = Image.FromResource (Resources.Icon);
            WindowState = WindowState.Maximized;
            try {
                statusIcon = Application.CreateStatusIcon ();
                statusIcon.Menu = new Menu ();
                var about = new MenuItem {
                    Label = Catalog.GetString ("About"),
                    Image = Icons.Starred.WithSize (IconSize.Small),
                };
                var exit = new MenuItem {
                    Label = Catalog.GetString ("Exit"),
                    Image = Icons.Delete.WithSize (IconSize.Small),
                };
                statusIcon.Menu.Items.Add (about);
                statusIcon.Menu.Items.Add (exit);
                about.Clicked += AboutClicked;
                exit.Clicked += ExitClicked;
                statusIcon.Image = Icon;
            } catch {
                Console.WriteLine (Catalog.GetString ("Status icon could not be shown"));
            }

            panel = new HPaned ();

            store = new TreeStore (nameCol, iconCol, widgetCol);
            menuTree = new TreeView ();
            menuTree.Columns.Add ("", iconCol, nameCol);

            menuTree.DataSource = store;
            menuTree.SelectionChanged += HandleMenuTreeSelectionChanged;
            menuTree.MinWidth = 220;

            panel.Panel1.Content = menuTree;
            panel.Panel1.Content.MarginRight = 5;

            panel.Panel2.Resize = true;

            Content = panel;

            CloseRequested += HandleCloseRequested;

            InitialLocation = WindowLocation.CenterScreen;
        }
示例#24
0
        public MainWindow()
        {
            Title = "XwPlot Samples Demonstration";
            Width = 800;
            Height = 600;

            Menu menu = new Menu ();

            var file = new MenuItem ("File");
            file.SubMenu = new Menu ();
            file.SubMenu.Items.Add (new MenuItem ("Open"));
            file.SubMenu.Items.Add (new MenuItem ("New"));
            MenuItem mi = new MenuItem ("Close");
            mi.Clicked += delegate {
                Application.Exit();
            };
            file.SubMenu.Items.Add (mi);
            menu.Items.Add (file);

            var edit = new MenuItem ("Edit");
            edit.SubMenu = new Menu ();
            edit.SubMenu.Items.Add (new MenuItem ("Copy"));
            edit.SubMenu.Items.Add (new MenuItem ("Cut"));
            edit.SubMenu.Items.Add (new MenuItem ("Paste"));
            menu.Items.Add (edit);

            MainMenu = menu;

            HPaned box = new HPaned ();

            icon = Image.FromResource (typeof(App), "class.png");

            store = new TreeStore (nameCol, iconCol, sampleCol);
            samplesTree = new TreeView ();
            samplesTree.Columns.Add ("Name", iconCol, nameCol);

            plotCategory = AddSample (null, "Sample Plots", null);
            interactionCategory = AddSample (null, "Interactions", null);
            testCategory = AddSample (null, "Tests", null);

            AddSample (plotCategory, "Plot Markers", typeof (PlotMarkerSample));
            AddSample (plotCategory, "LabelPoint Plot", typeof (LabelPointPlotSample));
            AddSample (plotCategory, "Line and Point Plot", typeof (PointPlotSample));
            AddSample (plotCategory, "Waveform Step Plot", typeof (StepPlotSample));
            AddSample (plotCategory, "GradientPlot", typeof (GradientPlotSample));
            AddSample (plotCategory, "Histogram Plot", typeof (HistogramSample));
            AddSample (plotCategory, "Stacked Histogram Plot", typeof (StackedHistogram));
            AddSample (plotCategory, "Candle Plot", typeof (CandlePlotSample));
            AddSample (plotCategory, "Trading Plot", typeof (TradingSample));
            AddSample (plotCategory, "Plot Particles", typeof (PlotParticles));
            AddSample (plotCategory, "Plot Logo", typeof (PlotLogo));

            AddInteraction (interactionCategory, "AxisDrag", new AxisDrag ());
            AddInteraction (interactionCategory, "AxisScale", new AxisScale ());
            AddInteraction (interactionCategory, "PlotDrag (horizontal)", new PlotDrag (true,false));
            AddInteraction (interactionCategory, "PlotDrag (vertical)", new PlotDrag (false, true));
            AddInteraction (interactionCategory, "PlotScale", new PlotScale (true, true));
            AddInteraction (interactionCategory, "PlotZoom", new PlotZoom ());
            AddInteraction (interactionCategory, "PlotSelection", new PlotSelection ());

            AddSample (testCategory, "Linear Axis", typeof (LinearAxisTest));
            AddSample (testCategory, "Log Axis", typeof (LogAxisTest));
            AddSample (testCategory, "DateTime Axis", typeof (DateTimeAxisTest));
            AddSample (testCategory, "TradingDateTime Axis", typeof (TradingDateTimeAxisTest));
            AddSample (testCategory, "Rendering Performance", typeof (RenderingTest));
            AddSample (testCategory, "Overlay Canvas Test", typeof (OverlayTest));

            samplesTree.DataSource = store;

            box.Panel1.Content = samplesTree;

            sampleBox = new VBox ();

            box.Panel2.Content = sampleBox;
            box.Panel2.Resize = true;
            box.Position = 150;

            Content = box;

            samplesTree.SelectionChanged += HandleSamplesTreeSelectionChanged;

            CloseRequested += HandleCloseRequested;
        }
示例#25
0
        public TreeViews()
        {
            TreeView view = new TreeView ();
            TreeStore store = new TreeStore (text, desc);

            view.Columns.Add ("Item", text);
            view.Columns.Add ("Desc", desc);

            store.AddNode ().SetValue (text, "One").SetValue (desc, "First");
            store.AddNode ().SetValue (text, "Two").SetValue (desc, "Second").AddChild ()
                .SetValue (text, "Sub two").SetValue (desc, "Sub second");
            store.AddNode ().SetValue (text, "Three").SetValue (desc, "Third").AddChild ()
                .SetValue (text, "Sub three").SetValue (desc, "Sub third");
            PackStart (view, BoxMode.FillAndExpand);

            view.DataSource = store;

            Label la = new Label ();
            PackStart (la);

            view.SetDragDropTarget (DragDropAction.All, TransferDataType.Text);
            view.SetDragSource (DragDropAction.All, TransferDataType.Text);

            view.DragDrop += delegate(object sender, DragEventArgs e) {
                TreePosition node;
                RowDropPosition pos;
                view.GetDropTargetRow (e.Position.X, e.Position.Y, out pos, out node);
                var nav = store.GetNavigatorAt (node);
                la.Text += "Dropped \"" + e.Data.Text + "\" into \"" + nav.GetValue (text) + "\" " + pos + "\n";
                e.Success = true;
            };
            view.DragOver += delegate(object sender, DragOverEventArgs e) {
                TreePosition node;
                RowDropPosition pos;
                view.GetDropTargetRow (e.Position.X, e.Position.Y, out pos, out node);
                if (pos == RowDropPosition.Into)
                    e.AllowedAction = DragDropAction.None;
                else
                    e.AllowedAction = e.Action;
            };
            view.DragStarted += delegate(object sender, DragStartedEventArgs e) {
                var val = store.GetNavigatorAt (view.SelectedRow).GetValue (text);
                e.DragOperation.Data.AddValue (val);
                e.DragOperation.Finished += delegate(object s, DragFinishedEventArgs args) {
                    Console.WriteLine ("D:" + args.DeleteSource);
                };
            };

            Button addButton = new Button ("Add");
            addButton.Clicked += delegate(object sender, EventArgs e) {
                store.AddNode ().SetValue (text, "Added").SetValue (desc, "Desc");
            };
            PackStart (addButton);

            Button removeButton = new Button ("Remove Selection");
            removeButton.Clicked += delegate(object sender, EventArgs e) {
                foreach (TreePosition row in view.SelectedRows) {
                    store.GetNavigatorAt (row).Remove ();
                }
            };
            PackStart (removeButton);

            var label = new Label ();
            PackStart (label);

            view.RowExpanded += (sender, e) => label.Text = "Row expanded: " + store.GetNavigatorAt (e.Position).GetValue (text);
        }
		public XwtColorSchemeEditor (HighlightingPanel panel)
		{
			this.panel = panel;

			this.Buttons.Add (new DialogButton (Command.Cancel));
			this.Buttons.Add (new DialogButton (Command.Ok));

			colorStore = new TreeStore (nameField, styleField, propertyField);

			var mainTable = new Table ();

			var headerTable = new Table ();
			headerTable.Add (new Label () { Text="Name:" }, 0, 0);
			headerTable.Add (entryName, 1, 0);
			headerTable.Add (new Label () { Text="Description:" }, 2, 0);
			headerTable.Add (entryDescription, 3, 0, 1, 1, true);
			mainTable.Add (headerTable, 0, 0, 1, 1, true, false, WidgetPlacement.Fill, WidgetPlacement.Start);

			var table = new Table ();

			var commandHBox = new HBox ();
			commandHBox.PackStart (new Button ("Undo"));
			commandHBox.PackStart (new Button ("Redo"));
			commandHBox.PackStart (new Button ("AutoSet"));
			table.Add (commandHBox, 0, 0);

			var adjustHBox = new HBox ();
			adjustHBox.PackStart (colorbuttonPrimary);
			adjustHBox.PackStart (colorbuttonSecondary);
			adjustHBox.PackStart (colorbuttonBorder);
			adjustHBox.PackStart (togglebuttonBold, false, WidgetPlacement.End);
			adjustHBox.PackStart (togglebuttonItalic, false, WidgetPlacement.End);
			adjustHBox.PackStart (buttonFormat, false, WidgetPlacement.End);
			table.Add (adjustHBox, 0, 1);

			this.colorbuttonPrimary.ColorSet += StyleChanged;
			this.colorbuttonSecondary.ColorSet += StyleChanged;
			this.colorbuttonBorder.ColorSet += StyleChanged;
			this.togglebuttonBold.Toggled += StyleChanged;
			this.togglebuttonItalic.Toggled += StyleChanged;

			this.textEditor = new TextEditor ();
			this.textEditor.Options = DefaultSourceEditorOptions.Instance;
			this.textEditor.ShowAll ();
			var toolkit = Toolkit.CurrentEngine;
			var wrappedTextEditor = toolkit.WrapWidget (textEditor);
			var scrollView = new ScrollView (wrappedTextEditor) {
				HorizontalScrollPolicy=ScrollPolicy.Always,
				VerticalScrollPolicy=ScrollPolicy.Always
			};
			table.Add (scrollView, 0, 2, 1, 1, true, true);

			this.treeviewColors = new TreeView ();
			this.treeviewColors.Columns.Add (GettextCatalog.GetString ("Name"), nameField);
			this.treeviewColors.HeadersVisible = false;
			this.treeviewColors.DataSource = colorStore;
			this.treeviewColors.SelectionChanged += HandleTreeviewColorsSelectionChanged;

			var box = new HPaned ();

			var treeBox = new VBox ();
			treeBox.PackStart (searchEntry);
			treeBox.PackStart (treeviewColors, true);
			box.Panel1.Content = treeBox;
			box.Panel2.Content = table;
			box.Panel2.Resize = true;
			box.Position = 400;
			
			mainTable.Add (box, 0, 1, 1, 1, true, true);
			this.Content = mainTable;

			this.Height = 400;

			HandleTreeviewColorsSelectionChanged (null, null);
		}
示例#27
0
文件: TreeViews.cs 项目: nite2006/xwt
        public TreeViews()
        {
            TreeView view = new TreeView ();
            TreeStore store = new TreeStore (triState, check, text, desc);

            var triStateCellView = new CheckBoxCellView (triState) { Editable = true, AllowMixed = true };
            triStateCellView.Toggled += (object sender, WidgetEventArgs e) => {
                if (view.CurrentEventRow == null) {
                    MessageDialog.ShowError("CurrentEventRow is null. This is not supposed to happen");
                }
                else {
                    store.GetNavigatorAt(view.CurrentEventRow).SetValue(text, "TriState Toggled");
                }
            };
            var checkCellView = new CheckBoxCellView (check) { Editable = true };
            checkCellView.Toggled += (object sender, WidgetEventArgs e) => {
                if (view.CurrentEventRow == null) {
                    MessageDialog.ShowError("CurrentEventRow is null. This is not supposed to happen");
                }
                else {
                    store.GetNavigatorAt(view.CurrentEventRow).SetValue(text, "Toggled");
                }
            };
            view.Columns.Add ("TriCheck", triStateCellView);
            view.Columns.Add ("Check", checkCellView);
            view.Columns.Add ("Item", text);
            view.Columns.Add ("Desc", desc);

            store.AddNode ().SetValue (text, "One").SetValue (desc, "First").SetValue (triState, CheckBoxState.Mixed);
            store.AddNode ().SetValue (text, "Two").SetValue (desc, "Second").AddChild ()
                .SetValue (text, "Sub two").SetValue (desc, "Sub second");
            store.AddNode ().SetValue (text, "Three").SetValue (desc, "Third").AddChild ()
                .SetValue (text, "Sub three").SetValue (desc, "Sub third");
            PackStart (view, true);

            view.DataSource = store;

            Label la = new Label ();
            PackStart (la);

            view.SetDragDropTarget (DragDropAction.All, TransferDataType.Text);
            view.SetDragSource (DragDropAction.All, TransferDataType.Text);

            view.DragDrop += delegate(object sender, DragEventArgs e) {
                TreePosition node;
                RowDropPosition pos;
                view.GetDropTargetRow (e.Position.X, e.Position.Y, out pos, out node);
                var nav = store.GetNavigatorAt (node);
                la.Text += "Dropped \"" + e.Data.Text + "\" into \"" + nav.GetValue (text) + "\" " + pos + "\n";
                e.Success = true;
            };
            view.DragOver += delegate(object sender, DragOverEventArgs e) {
                TreePosition node;
                RowDropPosition pos;
                view.GetDropTargetRow (e.Position.X, e.Position.Y, out pos, out node);
                if (pos == RowDropPosition.Into)
                    e.AllowedAction = DragDropAction.None;
                else
                    e.AllowedAction = e.Action;
            };
            view.DragStarted += delegate(object sender, DragStartedEventArgs e) {
                var val = store.GetNavigatorAt (view.SelectedRow).GetValue (text);
                e.DragOperation.Data.AddValue (val);
                e.DragOperation.Finished += delegate(object s, DragFinishedEventArgs args) {
                    Console.WriteLine ("D:" + args.DeleteSource);
                };
            };

            Button addButton = new Button ("Add");
            addButton.Clicked += delegate(object sender, EventArgs e) {
                store.AddNode ().SetValue (text, "Added").SetValue (desc, "Desc");
            };
            PackStart (addButton);

            Button removeButton = new Button ("Remove Selection");
            removeButton.Clicked += delegate(object sender, EventArgs e) {
                foreach (TreePosition row in view.SelectedRows) {
                    store.GetNavigatorAt (row).Remove ();
                }
            };
            PackStart (removeButton);

            var label = new Label ();
            PackStart (label);

            view.RowExpanded += (sender, e) => label.Text = "Row expanded: " + store.GetNavigatorAt (e.Position).GetValue (text);
        }
示例#28
0
        private Widget MakeSidebar()
        {
            coursesView = new TreeView();
            coursesView.BackgroundColor = Colors.White;
            coursesView.HeadersVisible = false;
            coursesView.WidthRequest = 250;

            btnAddSubject = new Button(ResourcesManager.GetImage("book_add.png"), "Subject");
            btnAddLesson  = new Button(ResourcesManager.GetImage("report_add.png"), "Lesson");
            btnAddLesson.Sensitive = false;
            btnAddCard = new Button(ResourcesManager.GetImage("note_add.png"), "Card");
            btnAddCard.Sensitive = false;

            var topMenu = new HBox();
            topMenu.BackgroundColor = LightBlue;
            topMenu.MarginTop  = 5;
            topMenu.MarginLeft = 15;
            topMenu.PackStart(btnAddSubject);
            topMenu.PackStart(btnAddLesson);
            topMenu.PackStart(btnAddCard);

            var vbox = new VBox();
            vbox.BackgroundColor = LightBlue;
            vbox.PackStart(topMenu);
            vbox.PackStart(coursesView, true, true);
            return vbox;
        }
示例#29
0
 public XwtTreeList(TreeView tree)
     : base()
 {
     Tree = tree;
 }
示例#30
0
 void CreateTreeView(HPaned panel)
 {
     store = new TreeStore (nameCol);
     tree = new TreeView (store);
     tree.Columns.Add ("Name", nameCol);
     panel.Panel1.Content = tree;
     var conns = store.AddNode (null).SetValue (nameCol, "Nodes").CurrentPosition;
     vm.ConnectionAdded += (a, b) =>
         store.AddNode (conns).SetValue (nameCol, a + "-" + b.Id);
     tree.SelectionChanged +=
         HandleSelectionChanged;
 }