コード例 #1
0
        internal static ControlBase XmlElementHandler(Xml.Parser parser, Type type, ControlBase parent)
        {
            ListBoxRow element = new ListBoxRow(parent);

            parser.ParseAttributes(element);
            if (parser.MoveToContent())
            {
                int colIndex = 1;
                foreach (string elementName in parser.NextElement())
                {
                    if (elementName == "Column")
                    {
                        if (parser.MoveToContent())
                        {
                            ControlBase column = parser.ParseElement(element);
                            element.SetCellContents(colIndex++, column, true);
                        }
                        else
                        {
                            string colText = parser.GetAttribute("Text");
                            element.SetCellText(colIndex++, colText != null ? colText : String.Empty);
                        }
                    }
                }
            }
            return(element);
        }
コード例 #2
0
ファイル: ListBox.cs プロジェクト: EReeves/gwen-net-ex
        /// <summary>
        /// Add row.
        /// </summary>
        /// <param name="row">Row.</param>
        public void AddRow(ListBoxRow row)
        {
            m_Table.AddRow(row);

            row.Selected      += OnRowSelected;
            row.DoubleClicked += OnRowDoubleClicked;
        }
コード例 #3
0
ファイル: ListBox.cs プロジェクト: EReeves/gwen-net-ex
        /// <summary>
        /// Insert a row to specified index.
        /// </summary>
        /// <param name="index">Index where to insert.</param>
        /// <param name="row">Row.</param>
        public void InsertRow(int index, ListBoxRow row)
        {
            m_Table.InsertRow(index, row);

            row.Selected      += OnRowSelected;
            row.DoubleClicked += OnRowDoubleClicked;
        }
コード例 #4
0
ファイル: ListBox.cs プロジェクト: slagusev/Gwen.CS
        /// <summary>
        /// Add row.
        /// </summary>
        /// <param name="row">Row.</param>
        public void AddRow(ListBoxRow row)
        {
            row.Parent = this;

            m_Table.AddRow(row);

            row.Selected += OnRowSelected;

            Invalidate();
        }
コード例 #5
0
ファイル: ListBox.cs プロジェクト: EReeves/gwen-net-ex
        /// <summary>
        /// Unselects the specified row.
        /// </summary>
        /// <param name="row">Row to unselect.</param>
        public void UnselectRow(ListBoxRow row)
        {
            row.IsSelected = false;
            m_SelectedRows.Remove(row);

            if (RowUnselected != null)
            {
                RowUnselected.Invoke(this, new ItemSelectedEventArgs(row));
            }
        }
コード例 #6
0
ファイル: ListBox.cs プロジェクト: EReeves/gwen-net-ex
            protected override TableRow CreateRow()
            {
                ListBoxRow row = new ListBoxRow(Table)
                {
                    ColumnCount = m_ListBox.ColumnCount
                };

                row.Selected      += m_ListBox.OnRowSelected;
                row.DoubleClicked += m_ListBox.OnRowDoubleClicked;
                return(row);
            }
コード例 #7
0
ファイル: ListBox.cs プロジェクト: EReeves/gwen-net-ex
        /// <summary>
        /// Handler for the row double click event.
        /// </summary>
        /// <param name="control">Event source.</param>
        protected virtual void OnRowDoubleClicked(ControlBase control, ClickedEventArgs args)
        {
            ListBoxRow row = control as ListBoxRow;

            if (row == null)
            {
                return;
            }

            if (RowDoubleClicked != null)
            {
                RowDoubleClicked.Invoke(this, new ItemSelectedEventArgs(row));
            }
        }
コード例 #8
0
ファイル: ListBox.cs プロジェクト: esdrubal/guieditor
        /// <summary>
        /// Adds a new row.
        /// </summary>
        /// <param name="label">Row text.</param>
        /// <param name="name">Internal control name.</param>
        /// <returns>Newly created control.</returns>
        public TableRow AddRow(String label, String name)
        {
            ListBoxRow row = new ListBoxRow(this);

            m_Table.AddRow(row);

            row.SetCellText(0, label);
            row.Name = name;

            row.Selected += OnRowSelected;

            m_Table.SizeToContents(Width);

            return(row);
        }
コード例 #9
0
        /// <summary>
        /// Adds a new row.
        /// </summary>
        /// <param name="label">Row text.</param>
        /// <param name="name">Internal control name.</param>
        /// <param name="UserData">User data for newly created row</param>
        /// <returns>Newly created control.</returns>
        public ListBoxRow AddRow(string label, string name, Object UserData)
        {
            ListBoxRow row = new ListBoxRow(this);

            table.AddRow(row);

            row.SetCellText(0, label);
            row.Name     = name;
            row.UserData = UserData;

            row.Selected += onRowSelected;

            table.SizeToContents(Width);

            return(row);
        }
コード例 #10
0
ファイル: ListBox.cs プロジェクト: slagusev/Gwen.CS
        /// <summary>
        /// Adds a new row.
        /// </summary>
        /// <param name="label">Row text.</param>
        /// <param name="name">Internal control name.</param>
        /// <param name="UserData">User data for newly created row</param>
        /// <returns>Newly created control.</returns>
        public ListBoxRow AddRow(string label, string name, Object UserData)
        {
            ListBoxRow row = new ListBoxRow(this);

            m_Table.AddRow(row);

            row.SetCellText(0, label);
            row.Name     = name;
            row.UserData = UserData;

            row.Selected      += OnRowSelected;
            row.DoubleClicked += OnRowDoubleClicked;

            Invalidate();

            return(row);
        }
コード例 #11
0
ファイル: ListBox.cs プロジェクト: EReeves/gwen-net-ex
        private void SelectRow(ControlBase control, bool clearOthers = false)
        {
            if (!AllowMultiSelect || clearOthers)
            {
                UnselectAll();
            }

            ListBoxRow row = control as ListBoxRow;

            if (row == null)
            {
                return;
            }

            row.IsSelected = true;
            m_SelectedRows.Add(row);
            if (RowSelected != null)
            {
                RowSelected.Invoke(this, new ItemSelectedEventArgs(row));
            }
        }
コード例 #12
0
ファイル: ListBox.cs プロジェクト: EReeves/gwen-net-ex
        /// <summary>
        /// Handler for the row selection event.
        /// </summary>
        /// <param name="control">Event source.</param>
        protected virtual void OnRowSelected(ControlBase control, ItemSelectedEventArgs args)
        {
            ListBoxRow row = args.SelectedItem as ListBoxRow;

            if (row == null)
            {
                return;
            }

            if (row.IsSelected)
            {
                if (IsToggle)
                {
                    UnselectRow(row);
                }
            }
            else
            {
                SelectRow(row, false);
            }
        }
コード例 #13
0
        /// <summary>
        /// Slelects the specified row.
        /// </summary>
        /// <param name="control">Row to select.</param>
        /// <param name="clearOthers">Determines whether to deselect previously selected rows.</param>
        public void SelectRow(ControlBase control, bool clearOthers = false)
        {
            if (!AllowMultiSelect || clearOthers)
            {
                UnselectAll();
            }

            ListBoxRow row = control as ListBoxRow;

            if (row == null)
            {
                return;
            }

            // TODO: make sure this is one of our rows!
            row.IsSelected = true;
            selectedRows.Add(row);
            if (RowSelected != null)
            {
                RowSelected.Invoke(this, new ItemSelectedEventArgs(row));
            }
        }
コード例 #14
0
        /// <summary>
        /// Handler for the row selection event.
        /// </summary>
        /// <param name="control">Event source.</param>
        protected virtual void onRowSelected(ControlBase control, ItemSelectedEventArgs args)
        {
            // [omeg] changed default behavior
            bool       clear = false;// !InputHandler.InputHandler.IsShiftDown;
            ListBoxRow row   = args.SelectedItem as ListBoxRow;

            if (row == null)
            {
                return;
            }

            if (row.IsSelected)
            {
                if (IsToggle)
                {
                    UnselectRow(row);
                }
            }
            else
            {
                SelectRow(row, clear);
            }
        }
コード例 #15
0
ファイル: ListBox.cs プロジェクト: esdrubal/guieditor
        /// <summary>
        /// Handler for the row selection event.
        /// </summary>
        /// <param name="control">Event source.</param>
        protected virtual void OnRowSelected(Base control)
        {
            // [omeg] changed default behavior
            bool       clear = false;// !InputHandler.Instance.InputHandler.Instance.IsShiftDown;
            ListBoxRow row   = control as ListBoxRow;

            if (row == null)
            {
                return;
            }

            if (row.IsSelected)
            {
                if (IsToggle)
                {
                    UnselectRow(row);
                }
            }
            else
            {
                SelectRow(control, clear);
            }
        }
コード例 #16
0
        internal static ControlBase XmlElementHandler(Xml.Parser parser, Type type, ControlBase parent)
        {
            ListBoxRow element = new ListBoxRow(parent);
            ListBox    listBox = parent as ListBox;

            if (listBox != null)
            {
                element.ColumnCount = listBox.ColumnCount;
            }
            else
            {
                throw new System.Xml.XmlException("Unknown parent for ListBox Row.");
            }
            parser.ParseAttributes(element);
            if (parser.MoveToContent())
            {
                int colIndex = 1;
                foreach (string elementName in parser.NextElement())
                {
                    if (elementName == "Column")
                    {
                        if (parser.MoveToContent())
                        {
                            ControlBase column = parser.ParseElement(element);
                            element.SetCellContents(colIndex++, column);
                        }
                        else
                        {
                            string colText = parser.GetAttribute("Text");
                            element.SetCellText(colIndex++, colText != null ? colText : String.Empty);
                        }
                    }
                }
            }
            return(element);
        }
コード例 #17
0
ファイル: ListBox.cs プロジェクト: EReeves/gwen-net-ex
 /// <summary>
 /// Gets the index of a specified row.
 /// </summary>
 /// <param name="row">Row to search for.</param>
 /// <returns>Row index if found, -1 otherwise.</returns>
 public int GetRowIndex(ListBoxRow row)
 {
     return(m_Table.GetRowIndex(row));
 }
コード例 #18
0
ファイル: ListBox.cs プロジェクト: WardBenjamin/gwen-dotnet
        /// <summary>
        /// Adds a new row.
        /// </summary>
        /// <param name="label">Row text.</param>
        /// <param name="name">Internal control name.</param>
        /// <returns>Newly created control.</returns>
        public TableRow AddRow(String label, String name)
        {
            ListBoxRow row = new ListBoxRow(this);
            m_Table.AddRow(row);

            row.SetCellText(0, label);
            row.Name = name;

            row.Selected += OnRowSelected;

            m_Table.SizeToContents(Width);

            return row;
        }
コード例 #19
0
ファイル: ListBox.cs プロジェクト: WardBenjamin/gwen-dotnet
        /// <summary>
        /// Unselects the specified row.
        /// </summary>
        /// <param name="row">Row to unselect.</param>
        public void UnselectRow(ListBoxRow row)
        {
            row.IsSelected = false;
            m_SelectedRows.Remove(row);

            if (RowUnselected != null)
                RowUnselected.Invoke(this);
        }
コード例 #20
0
        /// <summary>
        /// Unselects the specified row.
        /// </summary>
        /// <param name="row">Row to unselect.</param>
        public void UnselectRow(ListBoxRow row)
        {
            row.IsSelected = false;
            m_SelectedRows.Remove(row);

            if (RowUnselected != null)
                RowUnselected.Invoke(this, new ItemSelectedEventArgs(row));
        }
コード例 #21
0
        /// <summary>
        /// Adds a new row.
        /// </summary>
        /// <param name="label">Row text.</param>
        /// <param name="name">Internal control name.</param>
        /// <param name="UserData">User data for newly created row</param>
        /// <returns>Newly created control.</returns>
        public ListBoxRow AddRow(string label, string name, Object UserData)
        {
            ListBoxRow row = new ListBoxRow(this);
            m_Table.AddRow(row);

            row.SetCellText(0, label);
            row.Name = name;
            row.UserData = UserData;

            row.Selected += OnRowSelected;

            m_Table.SizeToContents(Width);

            return row;
        }