KiCad PCB EDA Suite
Loading...
Searching...
No Matches
footprint_choice.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) 2017-2021 KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef FOOTPRINT_CHOICE_H
21#define FOOTPRINT_CHOICE_H
22
23#include <wx/odcombo.h>
24
38class FOOTPRINT_CHOICE : public wxOwnerDrawnComboBox
39{
40public:
41 FOOTPRINT_CHOICE( wxWindow* aParent, int aId );
42
43 virtual ~FOOTPRINT_CHOICE();
44
45protected:
46 virtual void DoSetPopupControl( wxComboPopup* aPopup ) override;
47 virtual void OnDrawItem( wxDC& aDC, const wxRect& aRect, int aItem, int aFlags ) const override;
48 virtual wxCoord OnMeasureItem( size_t aItem ) const override;
49 virtual wxCoord OnMeasureItemWidth( size_t aItem ) const override;
50
54 static wxCoord DrawTextFragment( wxDC& aDC, wxCoord x, wxCoord y, const wxString& aText );
55
57 void TryVetoMouse( wxMouseEvent& aEvent );
58
65 void TryVetoSelect( wxCommandEvent& aEvent, bool aInner );
66
70 wxString SafeGetString( int aItem ) const;
71
75 int GetSelectionEither( bool aInner ) const;
76
81 void SetSelectionEither( bool aInner, int aSel );
82
83 static wxColour m_grey;
84
85private:
87};
88
89#endif // FOOTPRINT_CHOICE_H
Customized combo box for footprint selection.
wxString SafeGetString(int aItem) const
Safely get a string for an item, returning wxEmptyString if the item doesn't exist.
virtual wxCoord OnMeasureItem(size_t aItem) const override
void TryVetoSelect(wxCommandEvent &aEvent, bool aInner)
Veto a select event for the separator.
static wxColour m_grey
virtual ~FOOTPRINT_CHOICE()
static wxCoord DrawTextFragment(wxDC &aDC, wxCoord x, wxCoord y, const wxString &aText)
Draw a fragment of text, then return the next x coordinate to continue drawing.
void SetSelectionEither(bool aInner, int aSel)
Safely set selection for either the outer (combo box) or inner (popup) list, doing nothing for invali...
virtual wxCoord OnMeasureItemWidth(size_t aItem) const override
void TryVetoMouse(wxMouseEvent &aEvent)
Veto a mouseover event if in the separator.
virtual void DoSetPopupControl(wxComboPopup *aPopup) override
int GetSelectionEither(bool aInner) const
Get selection from either the outer (combo box) or inner (popup) list.
virtual void OnDrawItem(wxDC &aDC, const wxRect &aRect, int aItem, int aFlags) const override