KiCad PCB EDA Suite
Loading...
Searching...
No Matches
drc_re_overlay_types.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2024 KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19 * or you may search the http://www.gnu.org website for the version 2 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
24#ifndef DRC_RE_OVERLAY_TYPES_H
25#define DRC_RE_OVERLAY_TYPES_H
26
27#include <wx/string.h>
28
29// GTK renders native controls with slightly different baseline/padding than macOS Cocoa.
30// These offsets shift all overlay field positions to compensate.
31#ifdef __WXGTK__
32constexpr int DRC_RE_OVERLAY_XO = -3;
33constexpr int DRC_RE_OVERLAY_YO = -5;
34#else
35constexpr int DRC_RE_OVERLAY_XO = 0;
36constexpr int DRC_RE_OVERLAY_YO = 0;
37#endif
38
39// Windows text controls have more internal border padding than GTK/macOS, so numeric
40// fields need extra width to display 4-decimal values without clipping.
41#ifdef __WXMSW__
42constexpr int DRC_RE_OVERLAY_WE = 15;
43#else
44constexpr int DRC_RE_OVERLAY_WE = 0;
45#endif
46
47
59
60
68{
69 int xStart;
70 int xEnd;
71 int yTop;
73
74 wxString labelText;
76
78 xStart( 0 ),
79 xEnd( 0 ),
80 yTop( 0 ),
81 tabOrder( 0 ),
82 labelText(),
84 {
85 }
86
87 DRC_RE_FIELD_POSITION( int aXStart, int aXEnd, int aYTop, int aTabOrder,
88 const wxString& aLabelText = wxEmptyString,
90 xStart( aXStart ),
91 xEnd( aXEnd ),
92 yTop( aYTop ),
93 tabOrder( aTabOrder ),
94 labelText( aLabelText ),
95 labelPosition( aLabelPos )
96 {
97 }
98};
99
100#endif // DRC_RE_OVERLAY_TYPES_H
constexpr int DRC_RE_OVERLAY_XO
constexpr int DRC_RE_OVERLAY_WE
constexpr int DRC_RE_OVERLAY_YO
LABEL_POSITION
Specifies the position of a label relative to its associated field.
@ NONE
Definition eda_shape.h:69
DRC_RE_FIELD_POSITION(int aXStart, int aXEnd, int aYTop, int aTabOrder, const wxString &aLabelText=wxEmptyString, LABEL_POSITION aLabelPos=LABEL_POSITION::NONE)
LABEL_POSITION labelPosition
Position of label relative to field.
int xEnd
Right edge X coordinate where the field ends.
int xStart
Left edge X coordinate where the field starts.
wxString labelText
Optional label text (empty for no label)
int tabOrder
Tab navigation order (1-based, lower numbers receive focus first)
int yTop
Top edge Y coordinate of the field.