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/dialogs/dialog_list_selector_base.h>
36 #include <common.h> // EDA_UNITS
37 
38 void ConvertMarkdown2Html( const wxString& aMarkdownInput, wxString& aHtmlOutput );
39 
40 class EDA_DRAW_FRAME;
41 
52 {
53 public:
54 
65  EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitle,
66  const wxArrayString& aItemHeaders,
67  const std::vector<wxArrayString>& aItemList,
68  const wxString& aRefText,
69  void (* aCallBackFunction)( wxString& text, void* data ) = NULL,
70  void* aCallBackFunctionData = NULL );
71 
72  // ~EDA_LIST_DIALOG() {}
73 
74  void SetListLabel( const wxString& aLabel );
75  void SetOKLabel( const wxString& aLabel );
76 
77  void Append( const wxArrayString& aItemStr );
78  void InsertItems( const std::vector<wxArrayString>& aItemList, int aPosition = 0 );
79 
87  wxString GetTextSelection( int aColumn = 0 );
88 
89 private:
90  void onListItemSelected( wxListEvent& event ) override;
91  void onListItemActivated( wxListEvent& event ) override;
92  void textChangeInFilterBox(wxCommandEvent& event) override;
93 
94  void initDialog( const wxArrayString& aItemHeaders,
95  const wxString& aSelection);
96  void sortList();
97  void (* m_cb_func)( wxString& text, void* data );
98  void* m_cb_data;
99  const std::vector<wxArrayString>* m_itemsListCp;
100 };
101 
102 
103 /**************************************************************************/
104 /* Class to edit/enter a coordinate (pair of values) ( INCHES or MM ) in */
105 /* dialog boxes, */
106 /**************************************************************************/
108 {
109 public:
111 
112  wxTextCtrl* m_FramePosX;
113  wxTextCtrl* m_FramePosY;
114 
115 private:
116  wxStaticText* m_TextX, * m_TextY;
117 
118 public:
119  EDA_POSITION_CTRL( wxWindow* parent, const wxString& title, const wxPoint& pos_to_edit,
120  EDA_UNITS user_unit, wxBoxSizer* BoxSizer );
121 
123 
124  void Enable( bool x_win_on, bool y_win_on );
125  void SetValue( int x_value, int y_value );
126  wxPoint GetValue();
127 };
128 
129 
130 /*************************************************************
131  * Class to edit/enter a size (pair of values for X and Y size)
132  * ( INCHES or MM ) in dialog boxes
133  ***************************************************************/
135 {
136 public:
137  EDA_SIZE_CTRL( wxWindow* parent, const wxString& title, const wxSize& size_to_edit,
138  EDA_UNITS user_unit, wxBoxSizer* BoxSizer );
139 
141  wxSize GetValue();
142 };
143 
144 
145 
146 #endif // DIALOG_HELPERS_H_
EDA_UNITS
Definition: common.h:198
EDA_SIZE_CTRL(wxWindow *parent, const wxString &title, const wxSize &size_to_edit, EDA_UNITS user_unit, wxBoxSizer *BoxSizer)
void initDialog(const wxArrayString &aItemHeaders, const wxString &aSelection)
Definition: displlst.cpp:71
wxString GetTextSelection(int aColumn=0)
Function GetTextSelection return the selected text from aColumn in the wxListCtrl in the dialog.
Definition: displlst.cpp:141
void textChangeInFilterBox(wxCommandEvent &event) override
Definition: displlst.cpp:118
void ConvertMarkdown2Html(const wxString &aMarkdownInput, wxString &aHtmlOutput)
void Enable(bool x_win_on, bool y_win_on)
void SetOKLabel(const wxString &aLabel)
Definition: displlst.cpp:112
void Append(const wxArrayString &aItemStr)
Definition: displlst.cpp:164
const std::vector< wxArrayString > * m_itemsListCp
EDA_LIST_DIALOG.
The base class for create windows for drawing purpose.
#define NULL
wxStaticText * m_TextY
Class EDA_LIST_DIALOG_BASE.
wxTextCtrl * m_FramePosX
EDA_POSITION_CTRL(wxWindow *parent, const wxString &title, const wxPoint &pos_to_edit, EDA_UNITS user_unit, wxBoxSizer *BoxSizer)
wxSize GetValue()
void onListItemSelected(wxListEvent &event) override
Definition: displlst.cpp:211
wxTextCtrl * m_FramePosY
The common library.
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)
Constructor:
Definition: displlst.cpp:40
wxStaticText * m_TextX
void SetValue(int x_value, int y_value)
void InsertItems(const std::vector< wxArrayString > &aItemList, int aPosition=0)
Definition: displlst.cpp:178
void(* m_cb_func)(wxString &text, void *data)
void onListItemActivated(wxListEvent &event) override
Definition: displlst.cpp:223
void SetListLabel(const wxString &aLabel)
Definition: displlst.cpp:105