Beispiel #1
0
        public override System.Drawing.Point GetControlOffset()
        {
            string lbl = _listLabels != null?_listLabels.GetShortestLabel() : "A test labely";

            System.Drawing.SizeF s = Globals.MeasureString(lbl, _listView.Font);

            return(new System.Drawing.Point(0, (int)s.Height));
        }
Beispiel #2
0
        /// <summary>
        /// Chooses the most appropriate label based upon the space given
        /// by the interface generator.
        /// </summary>
        /// <param name="width">the width allowed for the tab label</param>
        public int ChooseLabel(int width)
        {
            try
            {
                GetControl().Text = _labels.GetLabelByPixelLength(GetControl().Parent.Font,
                                                                  width);
            }
            catch (Exception)
            {
                GetControl().Text = _labels.GetShortestLabel();
            }

            return((int)Globals.MeasureString(GetControl().Text, GetControl().Parent.Font).Width);
        }
Beispiel #3
0
        /*
         * Member Methods
         */

        protected void refreshDisplay()
        {
            ApplianceState state = (ApplianceState)GetApplObj();

            string lbl;

            if (!state.Defined)
            {
                lbl = "";
            }
            else if (state.Type.ValueLabels == null)
            {
                lbl = state.Value.ToString();
            }
            else
            {
                // find the right label library
                LabelDictionary labels = (LabelDictionary)state.Type.ValueLabels[state.Value];

                if (labels == null)
                {
                    lbl = state.Value.ToString();
                }
                else
                {
                    try
                    {
                        lbl = labels.GetLabelByPixelLength(GetControl().Font, GetControl().ClientSize.Width);
                    }
                    catch (Exception)
                    {
                        lbl = labels.GetShortestLabel();
                    }
                }
            }

            GetControl().Text = lbl;
        }
Beispiel #4
0
        /*
         * Member Methods
         */

        public void UseMinimumLabel()
        {
            ((Label)GetControl()).Text = _labels.GetShortestLabel();
        }
Beispiel #5
0
        /*
         * Constructor
         */
        public LabelCIO(LabelDictionary labels) : base(new Label())
        {
            _labels = labels;

            GetControl().Text = _labels.GetShortestLabel();
        }
Beispiel #6
0
        /*
         * Constructor
         */

        public TabbedPanelCIO(LabelDictionary labels) : base(new TabPage())
        {
            _labels = labels;

            GetControl().Text = _labels.GetShortestLabel();
        }
Beispiel #7
0
        /*
         * Constructor
         */

        public OneDimCategoricalList(ListGroupNode g)
            : base(new Panel())
        {
            Panel p = (Panel)this.GetControl();

            _listGroup  = g;
            _listLabels = _listGroup.Labels;

            // for efficiency, disconnect data windows to internal states
            _listGroup.DataWindow.Clear();

            System.Drawing.SizeF size;

            _listView               = new ListView();
            _listView.View          = View.Details;
            _listView.FullRowSelect = true;
            p.Controls.Add(_listView);

            if (_listLabels != null)
            {
                _listLabel          = new Label();
                _listLabel.Text     = _listLabels.GetShortestLabel();
                _listLabel.Location = new System.Drawing.Point(0, 0);
                size            = Globals.MeasureString(_listLabel.Text, _listLabel.Font);
                _listLabel.Size = new System.Drawing.Size((int)size.Width, (int)size.Height);
                p.Controls.Add(_listLabel);
                _listView.Location = new System.Drawing.Point(0, _listLabel.Height + 3);
            }
            else
            {
                _listView.Location = new System.Drawing.Point(0, 0);
            }

            p.Resize += new EventHandler(p_Resize);

            // determine if multiple selection is being used

#if POCKETPC
            // the CheckBoxes property allows multiple selection on a PocketPC
            _listView.CheckBoxes
#endif
#if DESKTOP
            _listView.MultiSelect
#endif
                = _listGroup.SelectionType == SelectionType.Multiple;

            // extract the states

            _states = new ArrayList();
            extractStates(_listGroup, true);

            // identify the columns and set them up

            IEnumerator states = _states.GetEnumerator();
            while (states.MoveNext())
            {
                ApplianceState s  = (ApplianceState)states.Current;
                ColumnHeader   ch = new ColumnHeader();
                ch.Text  = s.Labels.GetShortestLabel();
                ch.Width = 20;
                _listView.Columns.Add(ch);
            }

            // hook into appropriate events

            _listGroup.ListDataChanged += new ListEvent(_listGroup_ListDataChanged);
            _listGroup.SelectionState.ValueChangedEvent += new PUC.ApplianceState.ValueChangedHandler(SelectionState_ValueChangedEvent);
            _listView.SelectedIndexChanged += new EventHandler(_listView_SelectedIndexChanged);
        }