KiCad PCB EDA Suite
dialog_helpers.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) 2010 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
5  * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
31 #ifndef DIALOG_HELPERS_H_
32 #define DIALOG_HELPERS_H_
33 
34 
35 #include <common.h> // EDA_UNITS_T
36 #include <dialog_shim.h>
37 #include <../common/dialogs/dialog_list_selector_base.h>
38 
39 
40 class EDA_DRAW_FRAME;
41 
42 #define SORT_LIST true
43 
54 {
55 public:
56 
69  EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitle,
70  const wxArrayString& aItemHeaders,
71  const std::vector<wxArrayString>& aItemList,
72  const wxString& aRefText,
73  void (* aCallBackFunction)( wxString& text, void* data ) = NULL,
74  void* aCallBackFunctionData = NULL,
75  bool aSortList = false, bool aShowHeaders = true );
76 
77  // ~EDA_LIST_DIALOG() {}
78 
79  void SetFilterHint( const wxString& aHint );
80  void SetListLabel( const wxString& aLabel );
81  void SetOKLabel( const wxString& aLabel );
82 
83  void Append( const wxArrayString& aItemStr );
84  void InsertItems( const std::vector<wxArrayString>& aItemList, int aPosition = 0 );
85 
93  wxString GetTextSelection( int aColumn = 0 );
94 
95 private:
96  void onListItemSelected( wxListEvent& event ) override;
97  void onListItemActivated( wxListEvent& event ) override;
98  void textChangeInFilterBox(wxCommandEvent& event) override;
99 
100  void initDialog( const wxArrayString& aItemHeaders,
101  const wxString& aSelection);
102  void sortList();
104  void (* m_cb_func)( wxString& text, void* data );
105  void* m_cb_data;
106  const std::vector<wxArrayString>* m_itemsListCp;
107 };
108 
109 
110 /**************************************************************************/
111 /* Class to edit/enter a coordinate (pair of values) ( INCHES or MM ) in */
112 /* dialog boxes, */
113 /**************************************************************************/
115 {
116 public:
118 
119  wxTextCtrl* m_FramePosX;
120  wxTextCtrl* m_FramePosY;
121 
122 private:
123  wxStaticText* m_TextX, * m_TextY;
124 
125 public:
126  EDA_POSITION_CTRL( wxWindow* parent, const wxString& title,
127  const wxPoint& pos_to_edit, EDA_UNITS_T user_unit, wxBoxSizer* BoxSizer );
128 
130 
131  void Enable( bool x_win_on, bool y_win_on );
132  void SetValue( int x_value, int y_value );
133  wxPoint GetValue();
134 };
135 
136 
137 /*************************************************************
138  * Class to edit/enter a size (pair of values for X and Y size)
139  * ( INCHES or MM ) in dialog boxes
140  ***************************************************************/
142 {
143 public:
144  EDA_SIZE_CTRL( wxWindow* parent, const wxString& title,
145  const wxSize& size_to_edit, EDA_UNITS_T user_unit, wxBoxSizer* BoxSizer );
146 
148  wxSize GetValue();
149 };
150 
151 
152 
153 #endif // DIALOG_HELPERS_H_
void initDialog(const wxArrayString &aItemHeaders, const wxString &aSelection)
Definition: displlst.cpp:80
wxString GetTextSelection(int aColumn=0)
Function GetTextSelection return the selected text from aColumn in the wxListCtrl in the dialog...
Definition: displlst.cpp:156
void textChangeInFilterBox(wxCommandEvent &event) override
Definition: displlst.cpp:132
void SetOKLabel(const wxString &aLabel)
Definition: displlst.cpp:126
void Append(const wxArrayString &aItemStr)
Definition: displlst.cpp:179
const std::vector< wxArrayString > * m_itemsListCp
class EDA_LIST_DIALOG
The base class for create windows for drawing purpose.
Definition: draw_frame.h:78
EDA_LIST_DIALOG(EDA_DRAW_FRAME *aParent, const wxString &aTitle, const wxArrayString &aItemHeaders, const std::vector< wxArrayString > &aItemList, const wxString &aRefText, void(*aCallBackFunction)(wxString &text, void *data)=NULL, void *aCallBackFunctionData=NULL, bool aSortList=false, bool aShowHeaders=true)
Constructor:
Definition: displlst.cpp:44
wxStaticText * m_TextY
EDA_UNITS_T m_UserUnit
Class EDA_LIST_DIALOG_BASE.
wxTextCtrl * m_FramePosX
void onListItemSelected(wxListEvent &event) override
Definition: displlst.cpp:227
void SetFilterHint(const wxString &aHint)
Definition: displlst.cpp:114
wxTextCtrl * m_FramePosY
The common library.
bool Enable(bool enable) override
EDA_UNITS_T
Definition: common.h:159
void InsertItems(const std::vector< wxArrayString > &aItemList, int aPosition=0)
Definition: displlst.cpp:193
void(* m_cb_func)(wxString &text, void *data)
void onListItemActivated(wxListEvent &event) override
Definition: displlst.cpp:239
void SetListLabel(const wxString &aLabel)
Definition: displlst.cpp:120