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

Go to the SVN repository for this file.

1 /* $Id: select_assembly_dialog.cpp 39749 2017-11-01 14:23:15Z 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: Bob Falk
27  *
28  * File Description:
29  *
30  */
31 
32 #include <ncbi_pch.hpp>
33 
35 
37 
39 
42 
45 
46 #include <wx/sizer.h>
47 #include <wx/button.h>
48 #include <wx/bitmap.h>
49 #include <wx/icon.h>
50 #include <wx/checkbox.h>
51 #include <wx/valgen.h>
52 
54 
55 IMPLEMENT_DYNAMIC_CLASS( CSelectAssemblyDialog, CDialog )
56 
57 BEGIN_EVENT_TABLE( CSelectAssemblyDialog, CDialog )
58 
59 ////@begin CSelectAssemblyDialog event table entries
60  EVT_INIT_DIALOG( CSelectAssemblyDialog::OnInitDialog )
61 
62 ////@end CSelectAssemblyDialog event table entries
63 
65 
67 {
68  Init();
69 }
70 
71 CSelectAssemblyDialog::CSelectAssemblyDialog( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
72 {
73  Init();
74  Create(parent, id, caption, pos, size, style);
75 }
76 
77 bool CSelectAssemblyDialog::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
78 {
79 ////@begin CSelectAssemblyDialog creation
80  SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
81  CDialog::Create( parent, id, caption, pos, size, style );
82 
84  if (GetSizer())
85  {
86  GetSizer()->SetSizeHints(this);
87  }
88  Centre();
89 ////@end CSelectAssemblyDialog creation
90 
91  return true;
92 }
93 
95 {
96 ////@begin CSelectAssemblyDialog destruction
97 ////@end CSelectAssemblyDialog destruction
98 }
99 
101 {
102 ////@begin CSelectAssemblyDialog member initialisation
104 ////@end CSelectAssemblyDialog member initialisation
105 }
106 
108 {
109 ////@begin CSelectAssemblyDialog content construction
110  CSelectAssemblyDialog* itemCDialog1 = this;
111 
112  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
113  itemCDialog1->SetSizer(itemBoxSizer2);
114 
115  m_AssemblyPanel = new CAssemblyListPanel( itemCDialog1, ID_SELECTASSEMBLYPANEL, wxDefaultPosition, wxSize(400, 300), wxNO_BORDER|wxFULL_REPAINT_ON_RESIZE|wxTAB_TRAVERSAL );
116  itemBoxSizer2->Add(m_AssemblyPanel, 1, wxGROW, 5);
117 
118  wxStaticLine* itemStaticLine4 = new wxStaticLine( itemCDialog1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
119  itemBoxSizer2->Add(itemStaticLine4, 0, wxGROW|wxALL, 5);
120 
121  wxStdDialogButtonSizer* itemStdDialogButtonSizer5 = new wxStdDialogButtonSizer;
122 
123  itemBoxSizer2->Add(itemStdDialogButtonSizer5, 0, wxALIGN_RIGHT|wxALL, 5);
124  wxButton* itemButton6 = new wxButton( itemCDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
125  itemStdDialogButtonSizer5->AddButton(itemButton6);
126 
127  wxButton* itemButton7 = new wxButton( itemCDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
128  itemStdDialogButtonSizer5->AddButton(itemButton7);
129 
130  itemStdDialogButtonSizer5->Realize();
131 
132 ////@end CSelectAssemblyDialog content construction
133 
135 }
136 
138 {
139  return true;
140 }
141 wxBitmap CSelectAssemblyDialog::GetBitmapResource( const wxString& name )
142 {
143  // Bitmap retrieval
144 ////@begin CSelectAssemblyDialog bitmap retrieval
145  wxUnusedVar(name);
146  return wxNullBitmap;
147 ////@end CSelectAssemblyDialog bitmap retrieval
148 }
149 wxIcon CSelectAssemblyDialog::GetIconResource( const wxString& name )
150 {
151  // Icon retrieval
152 ////@begin CSelectAssemblyDialog icon retrieval
153  wxUnusedVar(name);
154  return wxNullIcon;
155 ////@end CSelectAssemblyDialog icon retrieval
156 }
157 
158 void CSelectAssemblyDialog::OnInitDialog( wxInitDialogEvent& event )
159 {
160  CDialog::OnInitDialog(event);
161 }
162 
164 {
165  return m_AssemblyPanel->IsInputValid();
166 }
167 
169 {
171 }
172 
174 {
175  return m_AssemblyPanel->GetSearchTerm();
176 }
177 
179  string& description) const
180 {
181  vector<string> accs = m_AssemblyPanel->GetSelectedAssemblies();
182 
183  if (accs.size() >= 1) {
184  m_AssemblyPanel->GetAssmNameAndDesc(accs[0], name, description);
185  return accs[0];
186  }
187 
188  return "";
189 }
190 
191 //static const char* kSelOptionTag = "SelectedOption";
192 //static const char* kDefaultItem = "DefaultView.";
193 
195 {
196  m_RegPath = path; // store for later use
197  m_AssemblyPanel->SetRegistryPath(m_RegPath + ".AssemblyPanel");
198 
199 }
200 
202 {
204 }
205 
207 {
209 }
210 
void SetSearchTerm(const string &term)
void SetMultiSelection(bool flag)
void SetRegistryPath(const string &path)
vector< string > GetSelectedAssemblies() const
Get accessions of all selected assemblies.
void GetAssmNameAndDesc(const string &accession, string &name, string &description) const
Get the name and (if available) description for an accession.
string GetSearchTerm() const
CDialog.
Definition: dialog.hpp:47
string m_RegPath
Definition: dialog.hpp:70
class CRegistryReadView provides a nested hierarchical view at a particular key.
Definition: reg_view.hpp:58
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
void OnInitDialog(wxInitDialogEvent &event)
wxEVT_INIT_DIALOG event handler for ID_CSELECTASSEMBLYDIALOG
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
string GetSelectedAssembly(string &name, string &description) const
Get selected assemblies, if any.
CAssemblyListPanel * m_AssemblyPanel
string GetAssmSearchTerm() const
Get assembly query search term.
bool Create(wxWindow *parent, wxWindowID id=10096, const wxString &caption=_("Select Assembly"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxWANTS_CHARS|wxTAB_TRAVERSAL)
void SetRegistryPath(const string &path)
virtual void x_LoadSettings(const CRegistryReadView &view)
override these functions in derived classes
virtual void x_SaveSettings(CRegistryWriteView view) const
void SetAssmSearchTerm(const string &str)
Set assembly query search term.
#define _(proto)
Definition: ct_nlmzip_i.h:78
static void Init(void)
Definition: cursor6.c:76
static const char * str(char *buf, int n)
Definition: stats.c:84
#define NULL
Definition: ncbistd.hpp:225
#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()
const struct ncbi::grid::netcache::search::fields::SIZE size
#define ID_SELECTASSEMBLYPANEL
Modified on Fri Sep 20 14:57:44 2024 by modify_doxy.py rev. 669887