mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-10 08:00:05 +00:00
Codechange: Use named initialization for unscaled WidgetDimensions. (#11859)
Remove now-unused WD_* enums.
This commit is contained in:
parent
0c81579363
commit
691c628b07
210
src/window_gui.h
210
src/window_gui.h
@ -33,27 +33,27 @@ DECLARE_ENUM_AS_BIT_SET(FrameFlags)
|
|||||||
|
|
||||||
class WidgetDimensions {
|
class WidgetDimensions {
|
||||||
public:
|
public:
|
||||||
RectPadding imgbtn;
|
RectPadding imgbtn; ///< Padding around image button image.
|
||||||
RectPadding inset;
|
RectPadding inset; ///< Padding inside inset container.
|
||||||
RectPadding vscrollbar;
|
RectPadding vscrollbar; ///< Padding inside vertical scrollbar buttons.
|
||||||
RectPadding hscrollbar;
|
RectPadding hscrollbar; ///< Padding inside horizontal scrollbar buttons.
|
||||||
RectPadding bevel; ///< Widths of bevel border.
|
RectPadding bevel; ///< Bevel thickness, affected by "scaled bevels" game option.
|
||||||
RectPadding fullbevel; ///< Always-scaled bevel border.
|
RectPadding fullbevel; ///< Always-scaled bevel thickness.
|
||||||
RectPadding framerect; ///< Offsets within frame area.
|
RectPadding framerect; ///< Standard padding inside many panels.
|
||||||
RectPadding frametext; ///< Offsets within a text frame area.
|
RectPadding frametext; ///< Padding inside frame with text.
|
||||||
RectPadding matrix; ///< Offsets within a matrix cell.
|
RectPadding matrix; ///< Padding of WWT_MATRIX items.
|
||||||
RectPadding shadebox;
|
RectPadding shadebox; ///< Padding around image in shadebox widget.
|
||||||
RectPadding stickybox;
|
RectPadding stickybox; ///< Padding around image in stickybox widget.
|
||||||
RectPadding debugbox;
|
RectPadding debugbox; ///< Padding around image in debugbox widget.
|
||||||
RectPadding defsizebox;
|
RectPadding defsizebox; ///< Padding around image in defsizebox widget.
|
||||||
RectPadding resizebox;
|
RectPadding resizebox; ///< Padding around image in resizebox widget.
|
||||||
RectPadding closebox;
|
RectPadding closebox; ///< Padding around image in closebox widget.
|
||||||
RectPadding captiontext; ///< Offsets of text within a caption.
|
RectPadding captiontext; ///< Padding for text within caption widget.
|
||||||
RectPadding dropdowntext; ///< Offsets of text within a dropdown widget.
|
RectPadding dropdowntext; ///< Padding of drop down list item.
|
||||||
RectPadding dropdownlist; ///< Offsets used by a dropdown list itself.
|
RectPadding dropdownlist; ///< Padding of complete drop down list.
|
||||||
RectPadding modalpopup; ///< Padding for a modal popup.
|
RectPadding modalpopup; ///< Spacing for popup warning/information windows.
|
||||||
RectPadding picker; ///< Padding for a picker (dock, station, etc) window.
|
RectPadding picker; ///< Padding for a picker (dock, station, etc) window.
|
||||||
RectPadding sparse; ///< Padding used for 'sparse' widget window, usually containing multiple frames.
|
RectPadding sparse; ///< Padding used for 'sparse' widget window, usually containing multiple frames.
|
||||||
RectPadding sparse_resize; ///< Padding used for a resizeable 'sparse' widget window, usually containing multiple frames.
|
RectPadding sparse_resize; ///< Padding used for a resizeable 'sparse' widget window, usually containing multiple frames.
|
||||||
|
|
||||||
int vsep_picker; ///< Vertical spacing of picker-window widgets.
|
int vsep_picker; ///< Vertical spacing of picker-window widgets.
|
||||||
@ -73,144 +73,50 @@ private:
|
|||||||
* These constants should not be used elsewhere, use scaled/unscaled WidgetDimensions instead.
|
* These constants should not be used elsewhere, use scaled/unscaled WidgetDimensions instead.
|
||||||
*/
|
*/
|
||||||
enum WidgetDrawDistances {
|
enum WidgetDrawDistances {
|
||||||
/* WWT_IMGBTN(_2) */
|
WD_SHADEBOX_WIDTH = 12, ///< Minimum width of a standard shade box widget.
|
||||||
WD_IMGBTN_LEFT = 1, ///< Left offset of the image in the button.
|
WD_STICKYBOX_WIDTH = 12, ///< Minimum width of a standard sticky box widget.
|
||||||
WD_IMGBTN_RIGHT = 2, ///< Right offset of the image in the button.
|
WD_DEBUGBOX_WIDTH = 12, ///< Minimum width of a standard debug box widget.
|
||||||
WD_IMGBTN_TOP = 1, ///< Top offset of image in the button.
|
WD_DEFSIZEBOX_WIDTH = 12, ///< Minimum width of a standard defsize box widget.
|
||||||
WD_IMGBTN_BOTTOM = 2, ///< Bottom offset of image in the button.
|
WD_RESIZEBOX_WIDTH = 12, ///< Minimum width of a resize box widget.
|
||||||
|
WD_CLOSEBOX_WIDTH = 11, ///< Minimum width of a close box widget.
|
||||||
|
|
||||||
/* WWT_INSET */
|
WD_CAPTION_HEIGHT = 14, ///< Minimum height of a title bar.
|
||||||
WD_INSET_LEFT = 2, ///< Left offset of string.
|
WD_DROPDOWN_HEIGHT = 12, ///< Minimum height of a drop down widget.
|
||||||
WD_INSET_RIGHT = 2, ///< Right offset of string.
|
|
||||||
WD_INSET_TOP = 1, ///< Top offset of string.
|
|
||||||
|
|
||||||
WD_VSCROLLBAR_LEFT = 2, ///< Left offset of vertical scrollbar.
|
|
||||||
WD_VSCROLLBAR_RIGHT = 2, ///< Right offset of vertical scrollbar.
|
|
||||||
WD_VSCROLLBAR_TOP = 3, ///< Top offset of vertical scrollbar.
|
|
||||||
WD_VSCROLLBAR_BOTTOM = 3, ///< Bottom offset of vertical scrollbar.
|
|
||||||
|
|
||||||
WD_HSCROLLBAR_LEFT = 3, ///< Left offset of horizontal scrollbar.
|
|
||||||
WD_HSCROLLBAR_RIGHT = 3, ///< Right offset of horizontal scrollbar.
|
|
||||||
WD_HSCROLLBAR_TOP = 2, ///< Top offset of horizontal scrollbar.
|
|
||||||
WD_HSCROLLBAR_BOTTOM = 2, ///< Bottom offset of horizontal scrollbar.
|
|
||||||
|
|
||||||
/* Size of the pure frame bevel without any padding. */
|
|
||||||
WD_BEVEL_LEFT = 1, ///< Width of left bevel border.
|
|
||||||
WD_BEVEL_RIGHT = 1, ///< Width of right bevel border.
|
|
||||||
WD_BEVEL_TOP = 1, ///< Height of top bevel border.
|
|
||||||
WD_BEVEL_BOTTOM = 1, ///< Height of bottom bevel border.
|
|
||||||
|
|
||||||
/* FrameRect widgets, all text buttons, panel, editbox */
|
|
||||||
WD_FRAMERECT_LEFT = 2, ///< Offset at left to draw the frame rectangular area
|
|
||||||
WD_FRAMERECT_RIGHT = 2, ///< Offset at right to draw the frame rectangular area
|
|
||||||
WD_FRAMERECT_TOP = 1, ///< Offset at top to draw the frame rectangular area
|
|
||||||
WD_FRAMERECT_BOTTOM = 1, ///< Offset at bottom to draw the frame rectangular area
|
|
||||||
|
|
||||||
/* WWT_FRAME */
|
|
||||||
WD_FRAMETEXT_LEFT = 6, ///< Left offset of the text of the frame.
|
|
||||||
WD_FRAMETEXT_RIGHT = 6, ///< Right offset of the text of the frame.
|
|
||||||
WD_FRAMETEXT_TOP = 6, ///< Top offset of the text of the frame
|
|
||||||
WD_FRAMETEXT_BOTTOM = 6, ///< Bottom offset of the text of the frame
|
|
||||||
|
|
||||||
/* WWT_MATRIX */
|
|
||||||
WD_MATRIX_LEFT = 2, ///< Offset at left of a matrix cell.
|
|
||||||
WD_MATRIX_RIGHT = 2, ///< Offset at right of a matrix cell.
|
|
||||||
WD_MATRIX_TOP = 3, ///< Offset at top of a matrix cell.
|
|
||||||
WD_MATRIX_BOTTOM = 1, ///< Offset at bottom of a matrix cell.
|
|
||||||
|
|
||||||
/* WWT_SHADEBOX */
|
|
||||||
WD_SHADEBOX_WIDTH = 12, ///< Width of a standard shade box widget.
|
|
||||||
WD_SHADEBOX_LEFT = 2, ///< Left offset of shade sprite.
|
|
||||||
WD_SHADEBOX_RIGHT = 2, ///< Right offset of shade sprite.
|
|
||||||
WD_SHADEBOX_TOP = 3, ///< Top offset of shade sprite.
|
|
||||||
WD_SHADEBOX_BOTTOM = 3, ///< Bottom offset of shade sprite.
|
|
||||||
|
|
||||||
/* WWT_STICKYBOX */
|
|
||||||
WD_STICKYBOX_WIDTH = 12, ///< Width of a standard sticky box widget.
|
|
||||||
WD_STICKYBOX_LEFT = 2, ///< Left offset of sticky sprite.
|
|
||||||
WD_STICKYBOX_RIGHT = 2, ///< Right offset of sticky sprite.
|
|
||||||
WD_STICKYBOX_TOP = 3, ///< Top offset of sticky sprite.
|
|
||||||
WD_STICKYBOX_BOTTOM = 3, ///< Bottom offset of sticky sprite.
|
|
||||||
|
|
||||||
/* WWT_DEBUGBOX */
|
|
||||||
WD_DEBUGBOX_WIDTH = 12, ///< Width of a standard debug box widget.
|
|
||||||
WD_DEBUGBOX_LEFT = 2, ///< Left offset of debug sprite.
|
|
||||||
WD_DEBUGBOX_RIGHT = 2, ///< Right offset of debug sprite.
|
|
||||||
WD_DEBUGBOX_TOP = 3, ///< Top offset of debug sprite.
|
|
||||||
WD_DEBUGBOX_BOTTOM = 3, ///< Bottom offset of debug sprite.
|
|
||||||
|
|
||||||
/* WWT_DEFSIZEBOX */
|
|
||||||
WD_DEFSIZEBOX_WIDTH = 12, ///< Width of a standard defsize box widget.
|
|
||||||
WD_DEFSIZEBOX_LEFT = 2, ///< Left offset of defsize sprite.
|
|
||||||
WD_DEFSIZEBOX_RIGHT = 2, ///< Right offset of defsize sprite.
|
|
||||||
WD_DEFSIZEBOX_TOP = 3, ///< Top offset of defsize sprite.
|
|
||||||
WD_DEFSIZEBOX_BOTTOM = 3, ///< Bottom offset of defsize sprite.
|
|
||||||
|
|
||||||
/* WWT_RESIZEBOX */
|
|
||||||
WD_RESIZEBOX_WIDTH = 12, ///< Width of a resize box widget.
|
|
||||||
WD_RESIZEBOX_LEFT = 2, ///< Left offset of resize sprite.
|
|
||||||
WD_RESIZEBOX_RIGHT = 2, ///< Right offset of resize sprite.
|
|
||||||
WD_RESIZEBOX_TOP = 2, ///< Top offset of resize sprite.
|
|
||||||
WD_RESIZEBOX_BOTTOM = 2, ///< Bottom offset of resize sprite.
|
|
||||||
|
|
||||||
/* WWT_CLOSEBOX */
|
|
||||||
WD_CLOSEBOX_WIDTH = 11, ///< Width of a close box widget.
|
|
||||||
WD_CLOSEBOX_LEFT = 2, ///< Left offset of closebox string.
|
|
||||||
WD_CLOSEBOX_RIGHT = 1, ///< Right offset of closebox string.
|
|
||||||
WD_CLOSEBOX_TOP = 2, ///< Top offset of closebox string.
|
|
||||||
WD_CLOSEBOX_BOTTOM = 2, ///< Bottom offset of closebox string.
|
|
||||||
|
|
||||||
/* WWT_CAPTION */
|
|
||||||
WD_CAPTION_HEIGHT = 14, ///< Height of a title bar.
|
|
||||||
WD_CAPTIONTEXT_LEFT = 2, ///< Offset of the caption text at the left.
|
|
||||||
WD_CAPTIONTEXT_RIGHT = 2, ///< Offset of the caption text at the right.
|
|
||||||
WD_CAPTIONTEXT_TOP = 2, ///< Offset of the caption text at the top.
|
|
||||||
WD_CAPTIONTEXT_BOTTOM = 2, ///< Offset of the caption text at the bottom.
|
|
||||||
|
|
||||||
/* Dropdown widget. */
|
|
||||||
WD_DROPDOWN_HEIGHT = 12, ///< Height of a drop down widget.
|
|
||||||
WD_DROPDOWNTEXT_LEFT = 2, ///< Left offset of the dropdown widget string.
|
|
||||||
WD_DROPDOWNTEXT_RIGHT = 2, ///< Right offset of the dropdown widget string.
|
|
||||||
WD_DROPDOWNTEXT_TOP = 1, ///< Top offset of the dropdown widget string.
|
|
||||||
WD_DROPDOWNTEXT_BOTTOM = 1, ///< Bottom offset of the dropdown widget string.
|
|
||||||
|
|
||||||
WD_PAR_VSEP_NORMAL = 2, ///< Normal amount of vertical space between two paragraphs of text.
|
|
||||||
WD_PAR_VSEP_WIDE = 8, ///< Large amount of vertical space between two paragraphs of text.
|
|
||||||
};
|
};
|
||||||
|
|
||||||
friend NWidgetLeaf;
|
friend NWidgetLeaf;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline constexpr WidgetDimensions WidgetDimensions::unscaled = {
|
inline constexpr WidgetDimensions WidgetDimensions::unscaled = {
|
||||||
{WD_IMGBTN_LEFT, WD_IMGBTN_TOP, WD_IMGBTN_RIGHT, WD_IMGBTN_BOTTOM}, ///< imgbtn
|
.imgbtn = { .left = 1, .top = 1, .right = 1, .bottom = 1},
|
||||||
{WD_INSET_LEFT, WD_INSET_TOP, WD_INSET_RIGHT, WD_BEVEL_BOTTOM}, ///< inset
|
.inset = { .left = 2, .top = 1, .right = 2, .bottom = 1},
|
||||||
{WD_VSCROLLBAR_LEFT, WD_VSCROLLBAR_TOP, WD_VSCROLLBAR_RIGHT, WD_VSCROLLBAR_BOTTOM}, ///< vscrollbar
|
.vscrollbar = { .left = 2, .top = 3, .right = 2, .bottom = 3},
|
||||||
{WD_HSCROLLBAR_LEFT, WD_HSCROLLBAR_TOP, WD_HSCROLLBAR_RIGHT, WD_HSCROLLBAR_BOTTOM}, ///< hscrollbar
|
.hscrollbar = { .left = 3, .top = 2, .right = 3, .bottom = 2},
|
||||||
{WD_BEVEL_LEFT, WD_BEVEL_TOP, WD_BEVEL_RIGHT, WD_BEVEL_BOTTOM}, ///< bevel
|
.bevel = { .left = 1, .top = 1, .right = 1, .bottom = 1},
|
||||||
{WD_BEVEL_LEFT, WD_BEVEL_TOP, WD_BEVEL_RIGHT, WD_BEVEL_BOTTOM}, ///< fullbevel
|
.fullbevel = { .left = 1, .top = 1, .right = 1, .bottom = 1},
|
||||||
{WD_FRAMERECT_LEFT, WD_FRAMERECT_TOP, WD_FRAMERECT_RIGHT, WD_FRAMERECT_BOTTOM}, ///< framerect
|
.framerect = { .left = 2, .top = 1, .right = 2, .bottom = 1},
|
||||||
{WD_FRAMETEXT_LEFT, WD_FRAMETEXT_TOP, WD_FRAMETEXT_RIGHT, WD_FRAMETEXT_BOTTOM}, ///< frametext
|
.frametext = { .left = 6, .top = 6, .right = 6, .bottom = 6},
|
||||||
{WD_MATRIX_LEFT, WD_MATRIX_TOP, WD_MATRIX_RIGHT, WD_MATRIX_BOTTOM}, ///< matrix
|
.matrix = { .left = 2, .top = 3, .right = 2, .bottom = 1},
|
||||||
{WD_SHADEBOX_LEFT, WD_SHADEBOX_TOP, WD_SHADEBOX_RIGHT, WD_SHADEBOX_BOTTOM}, ///< shadebox
|
.shadebox = { .left = 2, .top = 3, .right = 2, .bottom = 3},
|
||||||
{WD_STICKYBOX_LEFT, WD_STICKYBOX_TOP, WD_STICKYBOX_RIGHT, WD_STICKYBOX_BOTTOM}, ///< stickybox
|
.stickybox = { .left = 2, .top = 3, .right = 2, .bottom = 3},
|
||||||
{WD_DEBUGBOX_LEFT, WD_DEBUGBOX_TOP, WD_DEBUGBOX_RIGHT, WD_DEBUGBOX_BOTTOM}, ///< debugbox
|
.debugbox = { .left = 2, .top = 3, .right = 2, .bottom = 3},
|
||||||
{WD_DEFSIZEBOX_LEFT, WD_DEFSIZEBOX_TOP, WD_DEFSIZEBOX_RIGHT, WD_DEFSIZEBOX_BOTTOM}, ///< defsizebox
|
.defsizebox = { .left = 2, .top = 3, .right = 2, .bottom = 3},
|
||||||
{WD_RESIZEBOX_LEFT, WD_RESIZEBOX_TOP, WD_RESIZEBOX_RIGHT, WD_RESIZEBOX_BOTTOM}, ///< resizebox
|
.resizebox = { .left = 2, .top = 2, .right = 2, .bottom = 2},
|
||||||
{WD_CLOSEBOX_LEFT, WD_CLOSEBOX_TOP, WD_CLOSEBOX_RIGHT, WD_CLOSEBOX_BOTTOM}, ///< closebox
|
.closebox = { .left = 2, .top = 2, .right = 1, .bottom = 2},
|
||||||
{WD_CAPTIONTEXT_LEFT, WD_CAPTIONTEXT_TOP, WD_CAPTIONTEXT_RIGHT, WD_CAPTIONTEXT_BOTTOM}, ///< captiontext
|
.captiontext = { .left = 2, .top = 2, .right = 2, .bottom = 2},
|
||||||
{WD_DROPDOWNTEXT_LEFT, WD_DROPDOWNTEXT_TOP, WD_DROPDOWNTEXT_RIGHT, WD_DROPDOWNTEXT_BOTTOM}, ///< dropdowntext
|
.dropdowntext = { .left = 2, .top = 1, .right = 2, .bottom = 1},
|
||||||
{WD_BEVEL_LEFT, WD_BEVEL_TOP * 2, WD_BEVEL_RIGHT, WD_BEVEL_BOTTOM * 2}, ///< dropdownmenu
|
.dropdownlist = { .left = 1, .top = 2, .right = 1, .bottom = 2},
|
||||||
{20, 10, 20, 10}, ///< modalpopup
|
.modalpopup = { .left = 20, .top = 10, .right = 20, .bottom = 10},
|
||||||
{3, 3, 3, 3}, ///< picker
|
.picker = { .left = 3, .top = 3, .right = 3, .bottom = 3},
|
||||||
{10, 8, 10, 8}, ///< sparse window padding
|
.sparse = { .left = 10, .top = 8, .right = 10, .bottom = 8},
|
||||||
{10, 8, 10, 1}, ///< resizable sparse window padding
|
.sparse_resize = { .left = 10, .top = 8, .right = 10, .bottom = 0},
|
||||||
1, ///< vsep_picker
|
.vsep_picker = 1,
|
||||||
WD_PAR_VSEP_NORMAL, ///< vsep_normal
|
.vsep_normal = 2,
|
||||||
4, ///< vsep_sparse
|
.vsep_sparse = 4,
|
||||||
WD_PAR_VSEP_WIDE, ///< vsep_wide
|
.vsep_wide = 8,
|
||||||
2, ///< hsep_normal
|
.hsep_normal = 2,
|
||||||
6, ///< hsep_wide
|
.hsep_wide = 6,
|
||||||
10, ///< hsep_indent
|
.hsep_indent = 10,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* widget.cpp */
|
/* widget.cpp */
|
||||||
|
Loading…
Reference in New Issue
Block a user