Rework the trip history window layout.
[openttd-joker.git] / src / tilehighlight_type.h
blob09c1edbcf6bee65ff3a26860e9ea743bc4dfcb61
1 /* $Id$ */
3 /*
4 * This file is part of OpenTTD.
5 * OpenTTD 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, version 2.
6 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
8 */
10 /** @file tilehighlight_type.h Types related to highlighting tiles. */
12 #ifndef TILEHIGHLIGHT_TYPE_H
13 #define TILEHIGHLIGHT_TYPE_H
15 #include "core/geometry_type.hpp"
16 #include "window_type.h"
17 #include "tile_type.h"
18 #include "viewport_type.h"
20 /** Highlighting draw styles */
21 enum HighLightStyle {
22 HT_NONE = 0x000, ///< default
23 HT_RECT = 0x010, ///< rectangle (stations, depots, ...)
24 HT_POINT = 0x020, ///< point (lower land, raise land, level land, ...)
25 HT_SPECIAL = 0x030, ///< special mode used for highlighting while dragging (and for tunnels/docks)
26 HT_DRAG = 0x040, ///< dragging items in the depot windows
27 HT_LINE = 0x008, ///< used for autorail highlighting (longer stretches), lower bits: direction
28 HT_RAIL = 0x080, ///< autorail (one piece), lower bits: direction
29 HT_VEHICLE = 0x100, ///< vehicle is accepted as target as well (bitmask)
30 HT_DIAGONAL = 0x200, ///< Also allow 'diagonal rectangles'. Only usable in combination with #HT_RECT or #HT_POINT.
31 HT_POLY = 0x400, ///< polyline mode; connect highlighted track with previous one
32 HT_NEW_POLY = 0xC00, ///< start completly new polyline; implies #HT_POLY
33 HT_DRAG_MASK = 0x0F8, ///< Mask for the tile drag-type modes.
34 HT_TUNNEL = 0x1000,///< tunnel highlight hint
36 /* lower bits (used with HT_LINE and HT_RAIL):
37 * (see ASCII art in table/autorail.h for a visual interpretation) */
38 HT_DIR_X = 0, ///< X direction
39 HT_DIR_Y = 1, ///< Y direction
40 HT_DIR_HU = 2, ///< horizontal upper
41 HT_DIR_HL = 3, ///< horizontal lower
42 HT_DIR_VL = 4, ///< vertical left
43 HT_DIR_VR = 5, ///< vertical right
44 HT_DIR_END, ///< end marker
45 HT_DIR_MASK = 0x7, ///< masks the drag-direction
47 DECLARE_ENUM_AS_BIT_SET(HighLightStyle)
50 /** Metadata about the current highlighting. */
51 struct TileHighlightData {
52 Point pos; ///< Location, in tile "units", of the northern tile of the selected area.
53 Point size; ///< Size, in tile "units", of the white/red selection area.
54 Point offs; ///< Offset, in tile "units", for the blue coverage area from the selected area's northern tile.
55 Point outersize; ///< Size, in tile "units", of the blue coverage area excluding the side of the selected area.
56 bool diagonal; ///< Whether the dragged area is a 45 degrees rotated rectangle.
58 Point new_pos; ///< New value for \a pos; used to determine whether to redraw the selection.
59 Point new_size; ///< New value for \a size; used to determine whether to redraw the selection.
60 Point new_offs; ///< New value for \a offs; used to determine whether to redraw the selection.
61 Point new_outersize; ///< New value for \a outersize; used to determine whether to redraw the selection.
62 byte dirty; ///< Whether the build station window needs to redraw due to the changed selection.
64 Point selstart; ///< The location where the dragging started.
65 Point selend; ///< The location where the drag currently ends.
66 Point selstart2; ///< The location where the second segment of a polyline track starts.
67 Point selend2; ///< The location where the second segment of a polyline track ends.
68 HighLightStyle dir2; ///< Direction of the second segment of a polyline track, HT_DIR_END if second segment is not selected. HT_LINE drawstyle.
69 byte sizelimit; ///< Whether the selection is limited in length, and what the maximum length is.
71 HighLightStyle drawstyle; ///< Lower bits 0-3 are reserved for detailed highlight information.
72 HighLightStyle next_drawstyle; ///< Queued, but not yet drawn style.
74 HighLightStyle place_mode; ///< Method which is used to place the selection.
75 WindowClass window_class; ///< The \c WindowClass of the window that is responsible for the selection mode.
76 WindowNumber window_number; ///< The \c WindowNumber of the window that is responsible for the selection mode.
78 bool make_square_red; ///< Whether to give a tile a red selection.
79 TileIndex redsq; ///< The tile that has to get a red selection.
81 ViewportPlaceMethod select_method; ///< The method which governs how tiles are selected.
82 ViewportDragDropSelectionProcess select_proc; ///< The procedure that has to be called when the selection is done.
84 void Reset();
86 bool IsDraggingDiagonal();
87 Window *GetCallbackWnd();
90 #endif /* TILEHIGHLIGHT_TYPE_H */