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, see <https://www.gnu.org/licenses/>.
18 */
19
20#ifndef DRC_RE_OVERLAY_TYPES_H
21#define DRC_RE_OVERLAY_TYPES_H
22
23#include <wx/string.h>
24
25// GTK renders native controls with slightly different baseline/padding than macOS Cocoa.
26// These offsets shift all overlay field positions to compensate.
27#ifdef __WXGTK__
28constexpr int DRC_RE_OVERLAY_XO = -3;
29constexpr int DRC_RE_OVERLAY_YO = -5;
30#else
31constexpr int DRC_RE_OVERLAY_XO = 0;
32constexpr int DRC_RE_OVERLAY_YO = 0;
33#endif
34
35// Windows text controls have more internal border padding than GTK/macOS, so numeric
36// fields need extra width to display 4-decimal values without clipping.
37#ifdef __WXMSW__
38constexpr int DRC_RE_OVERLAY_WE = 15;
39#else
40constexpr int DRC_RE_OVERLAY_WE = 0;
41#endif
42
43
55
56
64{
65 int xStart;
66 int xEnd;
67 int yTop;
69
70 wxString labelText;
72
74 xStart( 0 ),
75 xEnd( 0 ),
76 yTop( 0 ),
77 tabOrder( 0 ),
78 labelText(),
80 {
81 }
82
83 DRC_RE_FIELD_POSITION( int aXStart, int aXEnd, int aYTop, int aTabOrder,
84 const wxString& aLabelText = wxEmptyString,
86 xStart( aXStart ),
87 xEnd( aXEnd ),
88 yTop( aYTop ),
89 tabOrder( aTabOrder ),
90 labelText( aLabelText ),
91 labelPosition( aLabelPos )
92 {
93 }
94};
95
96#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:72
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.