public override void DoCell(Rect rect, LogisticRequester entry, TableWidget <LogisticRequester> table)
 {
     if (Widgets.ButtonText(rect.ContractedBy(1f), "Edit"))
     {
         Find.WindowStack.Add(new Dialog_EditRequester(entry));
     }
 }
 public override void DoCell(Rect rect, LogisticProviderPassive entry, TableWidget <LogisticProviderPassive> table)
 {
     if (Widgets.ButtonText(rect.ContractedBy(1f), "Edit"))
     {
         Find.WindowStack.Add(new Dialog_EditProviderPassive(entry));
     }
 }
Example #3
0
 public override void DoCell(Rect rect, LogisticProviderPassive entry, TableWidget <LogisticProviderPassive> table)
 {
     if (Widgets.ButtonImage(rect, LogWidgets.DeleteXIcon))
     {
         entry.Remove();
         table.SetDirty();
     }
 }
Example #4
0
 public override void DoCell(Rect rect, T entry, TableWidget <T> table)
 {
     Text.Anchor   = TextAnchor.MiddleLeft;
     Text.WordWrap = false;
     Widgets.Label(rect, this.GetData(entry));
     Text.Anchor   = TextAnchor.UpperLeft;
     Text.WordWrap = true;
 }
Example #5
0
        public override void DoCell(Rect rect, LogisticRequester entry, TableWidget <LogisticRequester> table)
        {
            string buffer = entry.Count.ToString();

            int tempCount = entry.Count;

            Widgets.IntEntry(rect.ContractedBy(1f), ref tempCount, ref buffer);
            entry.Count = tempCount;
        }
Example #6
0
 public virtual int GetMinWidth(TableWidget <T> table)
 {
     if (!this.def.label.NullOrEmpty())
     {
         Text.Font = this.DefaultHeaderFont;
         int result = Mathf.CeilToInt(Text.CalcSize(this.def.label).x);
         Text.Font = GameFont.Small;
         return(result);
     }
     if (this.def.HeaderIcon != null)
     {
         return(Mathf.CeilToInt(this.def.HeaderIconSize.x));
     }
     return(1);
 }
Example #7
0
 public virtual void DoHeader(Rect rect, TableWidget <T> table)
 {
     if (!this.def.label.NullOrEmpty())
     {
         Text.Font   = this.DefaultHeaderFont;
         GUI.color   = this.DefaultHeaderColor;
         Text.Anchor = TextAnchor.LowerCenter;
         Rect rect2 = rect;
         rect2.y += 3f;
         Widgets.Label(rect2, this.def.label.Truncate(rect.width, null));
         Text.Anchor = TextAnchor.UpperLeft;
         GUI.color   = Color.white;
         Text.Font   = GameFont.Small;
     }
     else if (this.def.HeaderIcon != null)
     {
         Vector2 headerIconSize = this.def.HeaderIconSize;
         int     num            = (int)((rect.width - headerIconSize.x) / 2f);
         GUI.DrawTexture(new Rect(rect.x + (float)num, rect.yMax - headerIconSize.y, headerIconSize.x, headerIconSize.y).ContractedBy(2f), this.def.HeaderIcon);
     }
     if (table.SortingBy == this.def)
     {
         Texture2D texture2D = table.SortingDescending ? ColumnWorker <T> .SortingDescendingIcon : ColumnWorker <T> .SortingIcon;
         GUI.DrawTexture(new Rect(rect.xMax - (float)texture2D.width - 1f, rect.yMax - (float)texture2D.height - 1f, (float)texture2D.width, (float)texture2D.height), texture2D);
     }
     if (this.def.HeaderInteractable)
     {
         Rect interactableHeaderRect = this.GetInteractableHeaderRect(rect, table);
         if (Mouse.IsOver(interactableHeaderRect))
         {
             Widgets.DrawHighlight(interactableHeaderRect);
             string headerTip = this.GetHeaderTip(table);
             if (!headerTip.NullOrEmpty())
             {
                 TooltipHandler.TipRegion(interactableHeaderRect, headerTip);
             }
         }
         if (Widgets.ButtonInvisible(interactableHeaderRect, true))
         {
             this.HeaderClicked(rect, table);
         }
     }
 }
Example #8
0
        protected virtual string GetHeaderTip(TableWidget <T> table)
        {
            StringBuilder stringBuilder = new StringBuilder();

            if (!this.def.headerTip.NullOrEmpty())
            {
                stringBuilder.Append(this.def.headerTip);
            }
            if (this.def.sortable)
            {
                if (stringBuilder.Length != 0)
                {
                    stringBuilder.AppendLine();
                    stringBuilder.AppendLine();
                }
                stringBuilder.Append("ClickToSortByThisColumn".Translate());
            }
            return(stringBuilder.ToString());
        }
Example #9
0
 protected virtual void HeaderClicked(Rect headerRect, TableWidget <T> table)
 {
     if (this.def.sortable && !Event.current.shift)
     {
         if (Event.current.button == 0)
         {
             if (table.SortingBy != this.def)
             {
                 table.SortBy(this.def, true);
                 SoundDefOf.Tick_High.PlayOneShotOnCamera(null);
                 return;
             }
             if (table.SortingDescending)
             {
                 table.SortBy(this.def, false);
                 SoundDefOf.Tick_High.PlayOneShotOnCamera(null);
                 return;
             }
             table.SortBy(null, false);
             SoundDefOf.Tick_Low.PlayOneShotOnCamera(null);
             return;
         }
         else if (Event.current.button == 1)
         {
             if (table.SortingBy != this.def)
             {
                 table.SortBy(this.def, false);
                 SoundDefOf.Tick_High.PlayOneShotOnCamera(null);
                 return;
             }
             if (table.SortingDescending)
             {
                 table.SortBy(null, false);
                 SoundDefOf.Tick_Low.PlayOneShotOnCamera(null);
                 return;
             }
             table.SortBy(this.def, true);
             SoundDefOf.Tick_High.PlayOneShotOnCamera(null);
         }
     }
 }
Example #10
0
 public override int GetMaxWidth(TableWidget <LogisticProviderPassive> table)
 {
     return(Mathf.Min(base.GetMaxWidth(table), this.GetMinWidth(table)));
 }
Example #11
0
 public override int GetMaxWidth(TableWidget <LogisticRequester> table)
 {
     return(Mathf.Min(base.GetMaxWidth(table), this.GetMinWidth(table)));
 }
Example #12
0
 public virtual int GetOptimalWidth(TableWidget <T> table)
 {
     return(this.GetMinWidth(table));
 }
Example #13
0
 public virtual int GetMaxWidth(TableWidget <T> table)
 {
     return(1000000);
 }
Example #14
0
 public abstract void DoCell(Rect rect, T entry, TableWidget <T> table);
Example #15
0
        protected virtual Rect GetInteractableHeaderRect(Rect headerRect, TableWidget <T> table)
        {
            float num = Mathf.Min(25f, headerRect.height);

            return(new Rect(headerRect.x, headerRect.yMax - num, headerRect.width, num));
        }