Esempio n. 1
0
 internal void AddCheckBoxColumn()
 {
     Column item = new Column(this.tabList);
     item.ID = 0;
     item.Name = this.tabList.checkboxName;
     item.IsNumber = false;
     item.SmallToBig = false;
     item.DisplayName = this.tabList.checkboxDisplayName;
     item.MinWidth = this.tabList.checkboxWidth;
     item.Editable = true;
     item.ColumnTextList = new FreeTextList();
     item.ColumnTextList.Align = TextAlign.Middle;
     item.Text.Text = this.tabList.checkboxDisplayName;
     item.Text.Position = new Microsoft.Xna.Framework.Rectangle(item.Text.Position.X, item.Text.Position.Y, this.tabList.checkboxWidth, item.Text.Position.Height);
     this.AllColumns.Add(item);
     foreach (Tab tab in this.Tabs)
     {
         if (!tab.Columns[0].Editable)
         {
             tab.Columns.Insert(0, item);
             //tab.ReCalculate(tab.CurrentYOffset);
         }
     }
 }
Esempio n. 2
0
 public void LoadFromXMLNode(XmlNode rootNode)
 {
     XmlNode node = rootNode.ChildNodes.Item(0);
     foreach (XmlNode node2 in node.ChildNodes)
     {
         Font font;
         Microsoft.Xna.Framework.Graphics.Color color;
         Column item = new Column(this.tabList);
         item.ID = int.Parse(node2.Attributes.GetNamedItem("ID").Value);
         item.Name = node2.Attributes.GetNamedItem("Name").Value;
         item.IsNumber = bool.Parse(node2.Attributes.GetNamedItem("IsNumber").Value);
         item.DisplayName = node2.Attributes.GetNamedItem("DisplayName").Value;
         item.MinWidth = int.Parse(node2.Attributes.GetNamedItem("MinWidth").Value);
         item.DetailLevel = int.Parse(node2.Attributes.GetNamedItem("DetailLevel").Value);
         if (node2.Attributes.GetNamedItem("CountToDisplay") != null)
         {
             item.CountToDisplay = bool.Parse(node2.Attributes.GetNamedItem("CountToDisplay").Value);
         }
         if (node2.Attributes.GetNamedItem("ItemID") != null)
         {
             item.ItemID = int.Parse(node2.Attributes.GetNamedItem("ItemID").Value);
         }
         item.SmallToBig = !item.IsNumber;
         StaticMethods.LoadFontAndColorFromXMLNode(node2, out font, out color);
         item.ColumnTextList = new FreeTextList(this.tabList.graphicsDevice, font);
         item.ColumnTextList.TextColor = color;
         item.ColumnTextList.Align = (TextAlign) Enum.Parse(typeof(TextAlign), node2.Attributes.GetNamedItem("Align").Value);
         item.Text.Text = item.DisplayName;
         this.AllColumns.Add(item);
     }
     node = rootNode.ChildNodes.Item(1);
     this.tabMargin = int.Parse(node.Attributes.GetNamedItem("Margin").Value);
     foreach (XmlNode node2 in node.ChildNodes)
     {
         Tab tab = new Tab(this.tabList, this);
         tab.ID = int.Parse(node2.Attributes.GetNamedItem("ID").Value);
         tab.Name = node2.Attributes.GetNamedItem("Name").Value;
         tab.DisplayName = node2.Attributes.GetNamedItem("DisplayName").Value;
         if (node2.Attributes.GetNamedItem("ListKind") != null)
         {
             tab.ListKind = node2.Attributes.GetNamedItem("ListKind").Value;
         }
         if (node2.Attributes.GetNamedItem("ListMethod") != null)
         {
             tab.ListMethod = node2.Attributes.GetNamedItem("ListMethod").Value;
         }
         tab.LoadColumnsFromString(node2.Attributes.GetNamedItem("Columns").Value);
         if (node2.Attributes.GetNamedItem("SortColumnID") != null)
         {
             tab.SortColumnID = int.Parse(node2.Attributes.GetNamedItem("SortColumnID").Value);
         }
         if (node2.Attributes.GetNamedItem("SmallToBig") != null)
         {
             tab.SmallToBig = bool.Parse(node2.Attributes.GetNamedItem("SmallToBig").Value);
         }
         tab.Text.Text = tab.DisplayName;
         this.Tabs.Add(tab);
     }
 }
Esempio n. 3
0
        private void screen_OnMouseLeftUp(Point position)
        {
            if ((this.screen.PeekUndoneWork().Kind == UndoneWorkKind.Frame) && StaticMethods.PointInRectangle(position, base.RealClient))
            {
                if (position.Y < this.listKindToDisplay.ColumnsTop)
                {
                    Tab tab = this.FindTabByPosition(position);
                    if (tab != null)
                    {
                        tab.Selected = true;
                    }
                }
                else if (position.Y < (this.listKindToDisplay.ColumnsTop + this.columnheaderHeight))
                {
                    Column columnByPosition = this.GetColumnByPosition(position);
                    if (columnByPosition != null)
                    {
                        PropertyComparer comparer = new PropertyComparer(columnByPosition.Name, columnByPosition.IsNumber, columnByPosition.SmallToBig, columnByPosition.ItemID);
                        this.gameObjectList.StableSort(comparer);
                        this.listKindToDisplay.ResetAllTextures();
                        columnByPosition.SmallToBig = !columnByPosition.SmallToBig;
                    }
                }
                else
                {
                    GameObject gameObjectByPosition;
                    if (this.ShowCheckBox)
                    {
                        gameObjectByPosition = this.GetGameObjectByPosition(position);
                        if (gameObjectByPosition != null)
                        {
                            if (this.listKindToDisplay.IsInEditableColumn(position))
                            {
                                if ((gameObjectByPosition.Selected || (this.SelectedItemMaxCount <= 0)) || (this.gameObjectList.GetSelectedList().Count < this.SelectedItemMaxCount))
                                {
                                    if (this.MultiSelecting)
                                    {
                                        /*
                                        this.SelectingRows = true;
                                        this.SelectingBool = gameObjectByPosition.Selected;
                                        this.SelectedItemList = this.gameObjectList.GetSelectedList();
                                         */

                                    }
                                    else
                                    {
                                        gameObjectByPosition.Selected = !gameObjectByPosition.Selected;

                                        this.gameObjectList.SetOtherUnSelected(gameObjectByPosition);
                                    }
                                    base.OKButtonEnabled = this.gameObjectList.HasSelectedItem() || (gameObjectByPosition is Faction);
                                    this.ResetEditableTextures();
                                    if (gameObjectByPosition.Selected)
                                    {
                                        this.SelectedItem = gameObjectByPosition;
                                        if (!(this.MultiSelecting || !GlobalVariables.SingleSelectionOneClick))
                                        {
                                            this.iGameFrame.OK();
                                        }
                                        else
                                        {
                                            //this.screen.PlayNormalSound(this.SelectSoundFile);
                                        }
                                    }
                                    else
                                    {
                                        this.SelectedItem = null;
                                    }
                                }
                            }
                            else
                            {
                                if (gameObjectByPosition is Troop)
                                {
                                    if ((this.iTroopDetail != null) && (base.Function != FrameFunction.Jump))
                                    {
                                        this.iTroopDetail.SetPosition(ShowPosition.Center);
                                        this.iTroopDetail.SetTroop(gameObjectByPosition);
                                        this.iTroopDetail.IsShowing = true;
                                    }
                                    this.screen.JumpTo((gameObjectByPosition as Troop).Position);
                                }
                                else if (gameObjectByPosition is Person)
                                {
                                    if ((this.iPersonDetail != null) && (base.Function != FrameFunction.Jump))
                                    {
                                        this.iPersonDetail.SetPosition(ShowPosition.Center);
                                        this.iPersonDetail.SetPerson(gameObjectByPosition);
                                        this.iPersonDetail.IsShowing = true;
                                    }
                                    if (!(gameObjectByPosition as Person).IsCaptive)
                                    {
                                        this.screen.JumpTo((gameObjectByPosition as Person).Position);
                                    }
                                }
                                else if (gameObjectByPosition is Architecture)
                                {
                                    if ((this.iArchitectureDetail != null) && (base.Function != FrameFunction.Jump))
                                    {
                                        this.iArchitectureDetail.SetPosition(ShowPosition.Center);
                                        this.iArchitectureDetail.SetArchitecture(gameObjectByPosition);
                                        this.iArchitectureDetail.IsShowing = true;
                                    }
                                    this.screen.JumpTo((gameObjectByPosition as Architecture).Position);
                                }
                                else if (gameObjectByPosition is Military)
                                {
                                    this.screen.JumpTo((gameObjectByPosition as Military).Position);
                                }
                                else if (gameObjectByPosition is Faction)
                                {
                                    if ((this.iFactionTechniques != null) && (base.Function != FrameFunction.Jump))
                                    {
                                        this.iFactionTechniques.SetArchitecture(null);
                                        this.iFactionTechniques.SetFaction(gameObjectByPosition, false);
                                        this.iFactionTechniques.SetPosition(ShowPosition.Center);
                                        this.iFactionTechniques.IsShowing = true;
                                    }
                                    this.screen.JumpTo((gameObjectByPosition as Faction).Leader.Position);
                                }
                                else if (gameObjectByPosition is Captive)
                                {
                                    if ((this.iPersonDetail != null) && (base.Function != FrameFunction.Jump))
                                    {
                                        this.iPersonDetail.SetPosition(ShowPosition.Center);
                                        this.iPersonDetail.SetPerson((gameObjectByPosition as Captive).CaptivePerson);
                                        this.iPersonDetail.IsShowing = true;
                                    }
                                }
                                else if (gameObjectByPosition is Treasure)
                                {
                                    if ((this.iTreasureDetail != null) && (base.Function != FrameFunction.Jump))
                                    {
                                        this.iTreasureDetail.SetPosition(ShowPosition.Center);
                                        this.iTreasureDetail.SetTreasure(gameObjectByPosition);
                                        this.iTreasureDetail.IsShowing = true;
                                    }
                                    if ((gameObjectByPosition as Treasure).BelongedPerson != null)
                                    {
                                        this.screen.JumpTo((gameObjectByPosition as Treasure).BelongedPerson.Position);
                                    }
                                }
                                else if (gameObjectByPosition is Information)
                                {
                                    if (base.Function != FrameFunction.Jump)
                                    {
                                        this.screen.JumpTo((gameObjectByPosition as Information).Position);
                                    }
                                }
                                else if (this.listKindToDisplay.SelectedTab.ListMethod != null)
                                {
                                    this.PushSubKindByName(this.listKindToDisplay.SelectedTab.ListKind, StaticMethods.GetListMethodValue(gameObjectByPosition, this.listKindToDisplay.SelectedTab.ListMethod) as GameObjectList);
                                }
                                if (gameObjectByPosition != null)
                                {
                                    base.TriggerItemClick();
                                }
                            }
                        }
                    }
                    else
                    {
                        gameObjectByPosition = this.GetGameObjectByPosition(position);
                        if (gameObjectByPosition != null)
                        {
                            if (this.listKindToDisplay.SelectedTab.ListMethod != null)
                            {
                                this.PushSubKindByName(this.listKindToDisplay.SelectedTab.ListKind, StaticMethods.GetListMethodValue(gameObjectByPosition, this.listKindToDisplay.SelectedTab.ListMethod) as GameObjectList);
                            }
                            else
                            {
                                if (gameObjectByPosition is Troop)
                                {
                                    if ((this.iTroopDetail != null) && (base.Function != FrameFunction.Jump))
                                    {
                                        this.iTroopDetail.SetPosition(ShowPosition.Center);
                                        this.iTroopDetail.SetTroop(gameObjectByPosition);
                                        this.iTroopDetail.IsShowing = true;
                                    }
                                    this.screen.JumpTo((gameObjectByPosition as Troop).Position);
                                }
                                else if (gameObjectByPosition is Person)
                                {
                                    if ((this.iPersonDetail != null) && (base.Function != FrameFunction.Jump))
                                    {
                                        this.iPersonDetail.SetPosition(ShowPosition.Center);
                                        this.iPersonDetail.SetPerson(gameObjectByPosition);
                                        this.iPersonDetail.IsShowing = true;
                                    }
                                    if (!(gameObjectByPosition as Person).IsCaptive)
                                    {
                                        this.screen.JumpTo((gameObjectByPosition as Person).Position);
                                    }
                                }
                                else if (gameObjectByPosition is Architecture)
                                {
                                    if ((this.iArchitectureDetail != null) && (base.Function != FrameFunction.Jump))
                                    {
                                        this.iArchitectureDetail.SetPosition(ShowPosition.Center);
                                        this.iArchitectureDetail.SetArchitecture(gameObjectByPosition);
                                        this.iArchitectureDetail.IsShowing = true;
                                    }
                                    this.screen.JumpTo((gameObjectByPosition as Architecture).Position);
                                }
                                else if (gameObjectByPosition is Military)
                                {
                                    this.screen.JumpTo((gameObjectByPosition as Military).Position);
                                }
                                else if (gameObjectByPosition is Faction)
                                {
                                    if ((this.iFactionTechniques != null) && (base.Function != FrameFunction.Jump))
                                    {
                                        this.iFactionTechniques.SetArchitecture(null);
                                        this.iFactionTechniques.SetFaction(gameObjectByPosition, false);
                                        this.iFactionTechniques.SetPosition(ShowPosition.Center);
                                        this.iFactionTechniques.IsShowing = true;
                                    }
                                    this.screen.JumpTo((gameObjectByPosition as Faction).Leader.Position);
                                }
                                else if (gameObjectByPosition is Captive)
                                {
                                    if ((this.iPersonDetail != null) && (base.Function != FrameFunction.Jump))
                                    {
                                        this.iPersonDetail.SetPosition(ShowPosition.Center);
                                        this.iPersonDetail.SetPerson((gameObjectByPosition as Captive).CaptivePerson);
                                        this.iPersonDetail.IsShowing = true;
                                    }
                                }
                                else if (gameObjectByPosition is Treasure)
                                {
                                    if ((this.iTreasureDetail != null) && (base.Function != FrameFunction.Jump))
                                    {
                                        this.iTreasureDetail.SetPosition(ShowPosition.Center);
                                        this.iTreasureDetail.SetTreasure(gameObjectByPosition);
                                        this.iTreasureDetail.IsShowing = true;
                                    }
                                    if ((gameObjectByPosition as Treasure).BelongedPerson != null)
                                    {
                                        this.screen.JumpTo((gameObjectByPosition as Treasure).BelongedPerson.Position);
                                    }
                                }
                                else if (gameObjectByPosition is Information)
                                {
                                    if (base.Function != FrameFunction.Jump)
                                    {
                                        this.screen.JumpTo((gameObjectByPosition as Information).Position);
                                    }
                                }
                                if (gameObjectByPosition != null)
                                {
                                    base.TriggerItemClick();
                                }
                            }
                        }
                    }
                }
            }


            /////////////////////////////////////////////////

            if (this.screen.PeekUndoneWork().Kind == UndoneWorkKind.Frame)
            {
                this.MovingHorizontalScrollBar = false;
                this.MovingVerticalScrollBar = false;
                this.SelectingRows = false;
            }
        }