/************************************************************************* * ModernUO * * Copyright 2019-2026 - ModernUO Development Team * * Email: hi@modernuo.com * * File: GridEntryStyle.cs * * * * This program is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see . * *************************************************************************/ namespace Server.Gumps; /// /// Defines the visual style for grid-based entry layouts. /// Mirrors the virtual properties from BaseGridGump for easy migration. /// public readonly struct GridEntryStyle { /// /// Default style matching BaseGridGump defaults. /// public static readonly GridEntryStyle Default = new( entryGumpID: 0x0BBC, headerGumpID: 0x0E14, offsetGumpID: 0x0A40, backGumpID: 0x13BE, textHue: 0, textOffsetX: 2, entryHeight: 20, borderSize: 10, offsetSize: 1 ); /// /// Background gump ID for data entry cells. /// public readonly int EntryGumpID; /// /// Background gump ID for header/button cells. /// public readonly int HeaderGumpID; /// /// Gump ID for the offset/separator region. /// public readonly int OffsetGumpID; /// /// Gump ID for the main background. /// public readonly int BackGumpID; /// /// Text hue for labels. /// public readonly int TextHue; /// /// Horizontal offset for text within cells. /// public readonly int TextOffsetX; /// /// Height of each entry row. /// public readonly int EntryHeight; /// /// Size of the outer border. /// public readonly int BorderSize; /// /// Size of the offset/gap between cells. /// public readonly int OffsetSize; // Arrow button constants (matching BaseGridGump) public const int ArrowLeftID1 = 0x15E3; public const int ArrowLeftID2 = 0x15E7; public const int ArrowRightID1 = 0x15E1; public const int ArrowRightID2 = 0x15E5; public const int ArrowWidth = 16; public const int ArrowHeight = 16; public GridEntryStyle( int entryGumpID, int headerGumpID, int offsetGumpID, int backGumpID, int textHue, int textOffsetX, int entryHeight, int borderSize, int offsetSize ) { EntryGumpID = entryGumpID; HeaderGumpID = headerGumpID; OffsetGumpID = offsetGumpID; BackGumpID = backGumpID; TextHue = textHue; TextOffsetX = textOffsetX; EntryHeight = entryHeight; BorderSize = borderSize; OffsetSize = offsetSize; } /// /// Creates a copy with modified values. /// public GridEntryStyle With( int entryGumpID = -1, int headerGumpID = -1, int offsetGumpID = -1, int backGumpID = -1, int textHue = -1, int textOffsetX = -1, int entryHeight = -1, int borderSize = -1, int offsetSize = -1 ) => new( entryGumpID < 0 ? EntryGumpID : entryGumpID, headerGumpID < 0 ? HeaderGumpID : headerGumpID, offsetGumpID < 0 ? OffsetGumpID : offsetGumpID, backGumpID < 0 ? BackGumpID : backGumpID, textHue < 0 ? TextHue : textHue, textOffsetX < 0 ? TextOffsetX : textOffsetX, entryHeight < 0 ? EntryHeight : entryHeight, borderSize < 0 ? BorderSize : borderSize, offsetSize < 0 ? OffsetSize : offsetSize ); /// /// Calculates the content origin X (inside borders). /// public int ContentOriginX => BorderSize + OffsetSize; /// /// Calculates the content origin Y (inside borders). /// public int ContentOriginY => BorderSize + OffsetSize; /// /// Calculates total width given content width. /// public int GetTotalWidth(int contentWidth) => contentWidth + BorderSize * 2 + OffsetSize * 2; /// /// Calculates total height given number of rows. /// public int GetTotalHeight(int rowCount) => BorderSize * 2 + OffsetSize * 2 + rowCount * EntryHeight + (rowCount - 1) * OffsetSize; /// /// Calculates content height given number of rows. /// public int GetContentHeight(int rowCount) => rowCount * EntryHeight + (rowCount - 1) * OffsetSize; }