NCBI C++ ToolKit
agp_load_page.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: agp_load_page.cpp 38672 2017-06-07 21:13:40Z katargir $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Authors: Roman Katargin
27  */
28 
29 
30 #include <ncbi_pch.hpp>
31 
32 #include <wx/sizer.h>
33 #include <wx/checkbox.h>
34 #include <wx/button.h>
35 #include <wx/textctrl.h>
36 #include <wx/radiobox.h>
37 #include <wx/valtext.h>
38 #include <wx/valgen.h>
39 #include <wx/stattext.h>
40 #include <wx/bmpbuttn.h>
41 
42 #include <wx/bitmap.h>
43 #include <wx/icon.h>
44 #include <wx/filedlg.h>
45 #include <wx/artprov.h>
46 
47 ////@begin includes
48 ////@end includes
49 
51 
53 
54 /*!
55  * CAgpLoadPage type definition
56  */
57 
58 IMPLEMENT_DYNAMIC_CLASS( CAgpLoadPage, wxPanel )
59 
60 
61 /*!
62  * CAgpLoadPage event table definition
63  */
64 
65 BEGIN_EVENT_TABLE( CAgpLoadPage, wxPanel )
66 
67 ////@begin CAgpLoadPage event table entries
68  EVT_BUTTON( ID_BITMAPBUTTON1, CAgpLoadPage::OnFASTASeqsBrowse )
69 
70 ////@end CAgpLoadPage event table entries
71 
73 
74 
75 /*!
76  * CAgpLoadPage constructors
77  */
78 
80 {
81  Init();
82 }
83 
84 CAgpLoadPage::CAgpLoadPage( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
85 {
86  Init();
87  Create(parent, id, pos, size, style);
88 }
89 
90 
91 /*!
92  * CAgpLoadPage creator
93  */
94 
95 bool CAgpLoadPage::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
96 {
97 ////@begin CAgpLoadPage creation
98  wxPanel::Create( parent, id, pos, size, style );
99 
100  CreateControls();
101  if (GetSizer())
102  {
103  GetSizer()->SetSizeHints(this);
104  }
105  Centre();
106 ////@end CAgpLoadPage creation
107  return true;
108 }
109 
110 
111 /*!
112  * CAgpLoadPage destructor
113  */
114 
116 {
117 ////@begin CAgpLoadPage destruction
118 ////@end CAgpLoadPage destruction
119 }
120 
121 
122 /*!
123  * Member initialisation
124  */
125 
127 {
128 ////@begin CAgpLoadPage member initialisation
129 ////@end CAgpLoadPage member initialisation
130 }
131 
132 
133 /*!
134  * Control creation for CAgpLoadPage
135  */
136 
138 {
139 ////@begin CAgpLoadPage content construction
140  CAgpLoadPage* itemPanel1 = this;
141 
142  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
143  itemPanel1->SetSizer(itemBoxSizer2);
144 
145  wxStaticText* itemStaticText3 = new wxStaticText( itemPanel1, wxID_STATIC, _("AGP Load Parameters"), wxDefaultPosition, wxDefaultSize, 0 );
146  itemStaticText3->SetFont(wxFont(wxNORMAL_FONT->GetPointSize(), wxNORMAL_FONT->GetFamily(), wxNORMAL_FONT->GetStyle(), wxFONTWEIGHT_BOLD, wxNORMAL_FONT->GetUnderlined(), wxNORMAL_FONT->GetFaceName()));
147  itemBoxSizer2->Add(itemStaticText3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
148 
149  wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxHORIZONTAL);
150  itemBoxSizer2->Add(itemBoxSizer4, 0, wxALIGN_LEFT|wxALL, 5);
151 
152  wxArrayString itemRadioBox5Strings;
153  itemRadioBox5Strings.Add(_("Try to parse ID"));
154  itemRadioBox5Strings.Add(_("Always make a local ID"));
155  wxRadioBox* itemRadioBox5 = new wxRadioBox( itemPanel1, ID_RADIOBOX2, _("Component IDs"), wxDefaultPosition, wxDefaultSize, itemRadioBox5Strings, 1, wxRA_SPECIFY_COLS );
156  itemRadioBox5->SetSelection(0);
157  itemBoxSizer4->Add(itemRadioBox5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
158 
159  wxCheckBox* itemCheckBox6 = new wxCheckBox( itemPanel1, ID_CHECKBOX16, _("Set gap info"), wxDefaultPosition, wxDefaultSize, 0 );
160  itemCheckBox6->SetValue(false);
161  itemBoxSizer4->Add(itemCheckBox6, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
162 
163  wxBoxSizer* itemBoxSizer7 = new wxBoxSizer(wxHORIZONTAL);
164  itemBoxSizer2->Add(itemBoxSizer7, 0, wxGROW|wxALL, 5);
165 
166  wxStaticText* itemStaticText8 = new wxStaticText( itemPanel1, wxID_STATIC, _("FASTA sequences"), wxDefaultPosition, wxDefaultSize, 0 );
167  itemBoxSizer7->Add(itemStaticText8, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
168 
169  wxTextCtrl* itemTextCtrl9 = new wxTextCtrl( itemPanel1, ID_TEXTCTRL6, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
170  itemBoxSizer7->Add(itemTextCtrl9, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
171 
172  wxBitmapButton* itemBitmapButton10 = new wxBitmapButton( itemPanel1, ID_BITMAPBUTTON1, itemPanel1->GetBitmapResource(wxT("menu::open")), wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
173  itemBitmapButton10->SetHelpText(_("Select FASTA file"));
175  itemBitmapButton10->SetToolTip(_("Select FASTA file"));
176  itemBoxSizer7->Add(itemBitmapButton10, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
177 
178  // Set validators
179  itemRadioBox5->SetValidator( wxGenericValidator(& GetData().m_ParseIDs) );
180  itemCheckBox6->SetValidator( wxGenericValidator(& GetData().m_SetGapInfo) );
181  itemTextCtrl9->SetValidator( wxTextValidator(wxFILTER_NONE, & GetData().m_FastaFile) );
182 ////@end CAgpLoadPage content construction
183 }
184 
185 
186 /*!
187  * Should we show tooltips?
188  */
189 
191 {
192  return true;
193 }
194 
195 /*!
196  * Get bitmap resources
197  */
198 
199 wxBitmap CAgpLoadPage::GetBitmapResource( const wxString& name )
200 {
201  return wxArtProvider::GetBitmap(name);
202 }
203 
204 /*!
205  * Get icon resources
206  */
207 
208 wxIcon CAgpLoadPage::GetIconResource( const wxString& name )
209 {
210  // Icon retrieval
211 ////@begin CAgpLoadPage icon retrieval
212  wxUnusedVar(name);
213  return wxNullIcon;
214 ////@end CAgpLoadPage icon retrieval
215 }
216 
217 /*!
218  * Transfer data to the window
219  */
220 
222 {
223  return wxPanel::TransferDataToWindow();
224 }
225 
226 /*!
227  * Transfer data from the window
228  */
229 
231 {
232  return wxPanel::TransferDataFromWindow();
233 }
234 
235 void CAgpLoadPage::OnFASTASeqsBrowse( wxCommandEvent& WXUNUSED(event) )
236 {
237  wxTextCtrl* textCtrl = (wxTextCtrl*)FindWindow(ID_TEXTCTRL6);
238 
239  wxString path = textCtrl->GetValue();
240 
241  wxFileDialog dlg(this, wxT("Select a FASTA file"), wxT(""), wxT(""), wxALL_FILES_PATTERN,
242  wxFD_OPEN);
243 
244  dlg.SetPath(path);
245 
246  if (dlg.ShowModal() != wxID_OK)
247  return;
248 
249  path = dlg.GetPath();
250  textCtrl->SetValue(path);
251 }
252 
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
~CAgpLoadPage()
Destructor.
CAgpLoadPage()
Constructors.
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
virtual bool TransferDataFromWindow()
Transfer data from the window.
virtual bool TransferDataToWindow()
Transfer data to the window.
void OnFASTASeqsBrowse(wxCommandEvent &event)
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BITMAPBUTTON1
static bool ShowToolTips()
Should we show tooltips?
CAgpLoadParams & GetData()
Data access.
bool Create(wxWindow *parent, wxWindowID id=ID_CAGPLOADPAGE, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxTAB_TRAVERSAL)
Creation.
void CreateControls()
Creates the controls and sizers.
void Init()
Initialises member variables.
#define _(proto)
Definition: ct_nlmzip_i.h:78
static void Init(void)
Definition: cursor6.c:76
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
END_EVENT_TABLE()
#define wxT(x)
Definition: muParser.cpp:41
const struct ncbi::grid::netcache::search::fields::SIZE size
Modified on Sun Mar 03 03:09:19 2024 by modify_doxy.py rev. 669887