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

Go to the SVN repository for this file.

1 /* $Id: net_blast_load_option_panel.cpp 39613 2017-10-13 21:57:04Z 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:
27  *
28  * File Description:
29  *
30  */
31 
32 #include <ncbi_pch.hpp>
33 
36 
37 #include <wx/sizer.h>
38 #include <wx/image.h>
39 #include <wx/icon.h>
40 #include <wx/stattext.h>
41 #include <wx/statbox.h>
42 #include <wx/menu.h>
43 
44 ////@begin XPM images
45 ////@end XPM images
46 
48 
49 IMPLEMENT_DYNAMIC_CLASS( CNetBLASTLoadOptionPanel, wxPanel )
50 
51 BEGIN_EVENT_TABLE( CNetBLASTLoadOptionPanel, wxPanel )
52 ////@begin CNetBLASTLoadOptionPanel event table entries
53 ////@end CNetBLASTLoadOptionPanel event table entries
55 
56 
58 {
59  Init();
60 }
61 
62 
63 CNetBLASTLoadOptionPanel::CNetBLASTLoadOptionPanel( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
64 {
65  Init();
66  Create(parent, id, pos, size, style);
67 }
68 
69 
70 bool CNetBLASTLoadOptionPanel::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
71 {
72 ////@begin CNetBLASTLoadOptionPanel creation
73  wxPanel::Create( parent, id, pos, size, style );
74 
76  if (GetSizer())
77  {
78  GetSizer()->SetSizeHints(this);
79  }
80  Centre();
81 ////@end CNetBLASTLoadOptionPanel creation
82  return true;
83 }
84 
85 
87 {
88 ////@begin CNetBLASTLoadOptionPanel destruction
89 ////@end CNetBLASTLoadOptionPanel destruction
90 }
91 
92 
94 {
95 ////@begin CNetBLASTLoadOptionPanel member initialisation
96 ////@end CNetBLASTLoadOptionPanel member initialisation
97 }
98 
99 namespace
100 {
101  class CTextCtrl : public wxTextCtrl
102  {
103  public:
104  CTextCtrl(wxWindow* parent, wxWindowID id, const wxString& value = "",
105  const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
106  long style = 0, const wxValidator& validator = wxDefaultValidator,
107  const wxString& name = wxTextCtrlNameStr)
108  : wxTextCtrl(parent, id, value, pos, size, style, validator, name) {}
109  protected:
110  void OnContextMenu(wxContextMenuEvent& event);
111 
112  DECLARE_EVENT_TABLE()
113  };
114 }
115 
116 BEGIN_EVENT_TABLE(CTextCtrl, wxTextCtrl)
117  EVT_CONTEXT_MENU(CTextCtrl::OnContextMenu)
119 
120 void CTextCtrl::OnContextMenu(wxContextMenuEvent& event)
121 {
122  wxMenu* menu = new wxMenu;
123  menu->Append(wxID_CUT, _("Cu&t"));
124  menu->Append(wxID_COPY, _("&Copy"));
125  menu->Append(wxID_PASTE, _("&Paste"));
126  menu->Append(wxID_CLEAR, _("&Delete"));
127  menu->AppendSeparator();
128  menu->Append(wxID_SELECTALL, _("Select &All"));
129  PopupMenu(menu);
130 }
131 
133 {
134 ////@begin CNetBLASTLoadOptionPanel content construction
135  CNetBLASTLoadOptionPanel* itemPanel1 = this;
136 
137  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
138  itemPanel1->SetSizer(itemBoxSizer2);
139 
140  wxStaticBox* itemStaticBoxSizer3Static = new wxStaticBox(itemPanel1, wxID_ANY, _("BLAST RIDs to load"));
141  wxStaticBoxSizer* itemStaticBoxSizer3 = new wxStaticBoxSizer(itemStaticBoxSizer3Static, wxVERTICAL);
142  itemBoxSizer2->Add(itemStaticBoxSizer3, 1, wxGROW|wxALL, 5);
143 
144  wxStaticText* itemStaticText4 = new wxStaticText( itemPanel1, wxID_STATIC, _("Separate BLAST RIDs with spaces, commas or semicolons"), wxDefaultPosition, wxDefaultSize, 0 );
145  itemStaticBoxSizer3->Add(itemStaticText4, 0, wxGROW|wxALL, 5);
146 
147  CTextCtrl* itemTextCtrl5 = new CTextCtrl( itemPanel1, ID_TEXTCTRL1, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
148  itemStaticBoxSizer3->Add(itemTextCtrl5, 1, wxGROW|wxALL, 5);
149 
150 ////@end CNetBLASTLoadOptionPanel content construction
151 
152  wxTextCtrl* ridInput = dynamic_cast<wxTextCtrl*>(FindWindow(ID_TEXTCTRL1));
153  _ASSERT(ridInput);
154 
155  wxAcceleratorEntry entries[6];
156 
157  entries[0].Set(wxACCEL_CMD, (int) 'C', wxID_COPY);
158  entries[1].Set(wxACCEL_CMD, (int) 'X', wxID_CUT);
159  entries[2].Set(wxACCEL_CMD, (int) 'V', wxID_PASTE);
160  entries[3].Set(wxACCEL_CMD, (int) 'A', wxID_SELECTALL);
161  entries[4].Set(wxACCEL_CMD, 384, wxID_COPY);
162  entries[5].Set(wxACCEL_SHIFT, 384, wxID_PASTE);
163 
164  wxAcceleratorTable accel(6, entries);
165  ridInput->SetAcceleratorTable(accel);
166 }
167 
168 
170 {
171  wxTextCtrl* ridInput = dynamic_cast<wxTextCtrl*>(FindWindow(ID_TEXTCTRL1));
172  _ASSERT(ridInput);
173  return string(ridInput->GetValue().ToUTF8());
174 }
175 
176 
178 {
179  wxTextCtrl* ridInput = dynamic_cast<wxTextCtrl*>(FindWindow(ID_TEXTCTRL1));
180  _ASSERT(ridInput);
181  ridInput->SetValue(wxString::FromUTF8(input.c_str()));
182 }
183 
184 
186 {
187  return true;
188 }
189 
190 static string sDelim(" \t\n,;");
191 
192 void CNetBLASTLoadOptionPanel::GetRIDs(vector<string>& rids)
193 {
194  wxTextCtrl* ridInput = dynamic_cast<wxTextCtrl*>(FindWindow(ID_TEXTCTRL1));
195  _ASSERT(ridInput);
196  string text = ToStdString(ridInput->GetValue());
197 
198  vector<string> tokens;
200 
201  rids = tokens;
202 }
203 
204 
206 {
207  return true;
208 }
209 
210 
211 wxBitmap CNetBLASTLoadOptionPanel::GetBitmapResource( const wxString& name )
212 {
213  // Bitmap retrieval
214 ////@begin CNetBLASTLoadOptionPanel bitmap retrieval
215  wxUnusedVar(name);
216  return wxNullBitmap;
217 ////@end CNetBLASTLoadOptionPanel bitmap retrieval
218 }
219 
220 wxIcon CNetBLASTLoadOptionPanel::GetIconResource( const wxString& name )
221 {
222  // Icon retrieval
223 ////@begin CNetBLASTLoadOptionPanel icon retrieval
224  wxUnusedVar(name);
225  return wxNullIcon;
226 ////@end CNetBLASTLoadOptionPanel icon retrieval
227 }
228 
229 
char value[7]
Definition: config.c:431
#define _(proto)
Definition: ct_nlmzip_i.h:78
static void Init(void)
Definition: cursor6.c:76
string
Definition: cgiapp.hpp:687
wxBitmap GetBitmapResource(const wxString &name)
bool Create(wxWindow *parent, wxWindowID id=ID_NETBLASTLOADOPTIONPANEL, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxTAB_TRAVERSAL)
void SetInput(const string &input)
wxIcon GetIconResource(const wxString &name)
void GetRIDs(vector< string > &rids)
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
static list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)
Split a string using specified delimiters.
Definition: ncbistr.cpp:3457
@ fSplit_Tokenize
All delimiters are merged and trimmed, to get non-empty tokens only.
Definition: ncbistr.hpp:2508
END_EVENT_TABLE()
static int input()
static void text(MDB_val *v)
Definition: mdb_dump.c:62
const struct ncbi::grid::netcache::search::fields::SIZE size
static string sDelim(" \t\n,;")
static static static wxID_ANY
#define _ASSERT
static wxAcceleratorEntry entries[3]
string ToStdString(const wxString &s)
Definition: wx_utils.hpp:161
Modified on Tue Feb 27 05:51:23 2024 by modify_doxy.py rev. 669887