예제 #1
0
        /// <summary>
        /// Construtor
        /// </summary>
        public LegendView(ViewBase owner) : base(owner)
        {
            Builder builder = BuilderFromResource("ApsimNG.Resources.Glade.LegendView.glade");

            hbox1 = (HBox)builder.GetObject("hbox1");
            ComboBox combobox1        = (ComboBox)builder.GetObject("combobox1");
            ComboBox orientationCombo = (ComboBox)builder.GetObject("combobox2");

            listview   = (Gtk.TreeView)builder.GetObject("listview");
            mainWidget = hbox1;

            OrientationDropDown = new DropDownView(this, orientationCombo);
            PositionDropDown    = new DropDownView(this, combobox1);

            chkLegendInsideGraph          = (CheckButton)builder.GetObject("chkLegendInsideGraph");
            chkLegendInsideGraph.Toggled += OnToggleLegendInsideGraph;

            listview.Model = listModel;
            TreeViewColumn column = new TreeViewColumn();

            column.Title = "Series name";
            column.PackStart(listToggle, false);
            listRender.Editable = false;
            column.PackStart(listRender, true);
            column.SetAttributes(listToggle, "active", 0);
            column.SetAttributes(listRender, "text", 1);
            listview.AppendColumn(column);
            listToggle.Activatable = true;
            listToggle.Toggled    += OnItemChecked;
            mainWidget.Destroyed  += _mainWidget_Destroyed;
        }
예제 #2
0
        public static void SelectComboBoxItem(IDropDownView view, string item, bool wait = true)
        {
            ComboBox combo = ReflectionUtilities.GetValueOfFieldOrProperty("combobox1", view) as ComboBox;

            if (combo == null)
            {
                throw new Exception("Unable to get combo box from drop down view - has its property name changed?");
            }

            SelectComboBoxItem(combo, item, wait);
        }