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

Go to the SVN repository for this file.

1 /* $Id: seqsub_molinfo_panel.cpp 47033 2022-05-23 19:38:42Z asztalos $
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: Andrea Asztalos
27  */
28 
29 
30 #include <ncbi_pch.hpp>
35 
36 #include <wx/sizer.h>
37 #include <wx/listbook.h>
38 #include <wx/icon.h>
39 
40 
42 
43 /*
44  * CSubMolinfoPanel type definition
45  */
46 
47 IMPLEMENT_DYNAMIC_CLASS( CSubMolinfoPanel, wxPanel )
48 
49 
50 /*
51  * CSubMolinfoPanel event table definition
52  */
53 
54 BEGIN_EVENT_TABLE( CSubMolinfoPanel, wxPanel )
55  EVT_LISTBOOK_PAGE_CHANGED(ID_MOLINFONOTEBOOK, CSubMolinfoPanel::OnPageChanged)
56  EVT_LISTBOOK_PAGE_CHANGING(ID_MOLINFONOTEBOOK, CSubMolinfoPanel::OnPageChanging)
58 
59 
60 /*
61  * CSubMolinfoPanel constructors
62  */
63 
65 {
66  Init();
67 }
68 
69 CSubMolinfoPanel::CSubMolinfoPanel( wxWindow* parent, ICommandProccessor* cmdproc, objects::CSeq_entry_Handle seh, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
70  : m_CmdProcessor(cmdproc), m_Seh(seh)
71 {
72  Init();
73  Create(parent, id, pos, size, style);
74 }
75 
76 
77 /*
78  * CSubMolinfoPanel creator
79  */
80 
81 bool CSubMolinfoPanel::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
82 {
83 ////@begin CSubMolinfoPanel creation
84  SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY);
85  wxPanel::Create( parent, id, pos, size, style );
86 
88  if (GetSizer())
89  {
90  GetSizer()->SetSizeHints(this);
91  }
92  Centre();
93 ////@end CSubMolinfoPanel creation
94  return true;
95 }
96 
97 
98 /*
99  * CSubMolinfoPanel destructor
100  */
101 
103 {
104 ////@begin CSubMolinfoPanel destruction
105 ////@end CSubMolinfoPanel destruction
106 }
107 
108 
109 /*
110  * Member initialisation
111  */
112 
114 {
115 ////@begin CSubMolinfoPanel member initialisation
116  m_Listbook = NULL;
120 ////@end CSubMolinfoPanel member initialisation
121 }
122 
123 
124 /*
125  * Control creation for CSubMolinfoPanel
126  */
127 
129 {
130 ////@begin CSubMolinfoPanel content construction
131  CSubMolinfoPanel* itemPanel1 = this;
132 
133  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
134  itemPanel1->SetSizer(itemBoxSizer2);
135 
136  m_Listbook = new wxListbook( itemPanel1, ID_MOLINFONOTEBOOK, wxDefaultPosition, wxDefaultSize, wxBK_TOP|wxNO_BORDER );
137  itemBoxSizer2->Add(m_Listbook, 1, wxGROW | wxALL, 5);
138 
140  m_Listbook->AddPage(m_ChromosomePanel, _("Chromosome"));
141 
143  m_Listbook->AddPage(m_PlasmidPanel, _("Plasmid"));
144 
146  m_Listbook->AddPage(m_OrganellePanel, _("Organelle"));
147 
148 ////@end CSubMolinfoPanel content construction
149 }
150 
152 {
153  return x_DoStepForward(m_Listbook);
154 }
155 
157 {
159 }
160 
161 void CSubMolinfoPanel::OnPageChanged(wxBookCtrlEvent& event)
162 {
163  GetParentWizard(this)->UpdateOnPageChange(this);
164 }
165 
166 /*
167  * Should we show tooltips?
168  */
169 
171 {
172  return true;
173 }
174 
175 /*
176  * Get bitmap resources
177  */
178 
179 wxBitmap CSubMolinfoPanel::GetBitmapResource( const wxString& name )
180 {
181  // Bitmap retrieval
182 ////@begin CSubMolinfoPanel bitmap retrieval
183  wxUnusedVar(name);
184  return wxNullBitmap;
185 ////@end CSubMolinfoPanel bitmap retrieval
186 }
187 
188 /*
189  * Get icon resources
190  */
191 
192 wxIcon CSubMolinfoPanel::GetIconResource( const wxString& name )
193 {
194  // Icon retrieval
195 ////@begin CSubMolinfoPanel icon retrieval
196  wxUnusedVar(name);
197  return wxNullIcon;
198 ////@end CSubMolinfoPanel icon retrieval
199 }
200 
202 {
203  for (size_t i = 0; i < m_Listbook->GetPageCount(); ++i) {
204  m_Listbook->GetPage(i)->TransferDataToWindow();
205  }
206  return wxPanel::TransferDataToWindow();
207 }
208 
209 void CSubMolinfoPanel::OnPageChanging(wxBookCtrlEvent& event)
210 {
211  ApplyCommand();
212 }
213 
215 {
216  auto page = x_GetCurrentPage();
217  if (page) {
218  page->ApplyCommand();
219  }
220 }
221 
223 {
224  ISubmissionPage* page = nullptr;
225  if (m_Listbook) {
226  wxWindow *win = m_Listbook->GetCurrentPage();
227  if (win) {
228  page = dynamic_cast<ISubmissionPage*>(win);
229  }
230  }
231  return page;
232 }
233 
234 void CSubMolinfoPanel::SetSeqEntryHandle(objects::CSeq_entry_Handle seh)
235 {
236  m_Seh = seh;
240 }
241 
243 {
244  for (size_t i = 0; i < m_Listbook->GetPageCount(); ++i)
245  {
246  wxWindow* win = m_Listbook->GetPage(i);
247  ISubmissionPage* page = dynamic_cast<ISubmissionPage*>(win);
248  page->ReportMissingFields(text);
249  }
250 }
251 
253 {
254  auto page = x_GetCurrentPage();
255  if (page) {
256  return page->GetAnchor();
257  }
258  return wxEmptyString;
259 }
260 
262 {
263  auto page = x_GetCurrentPage();
264  if (page) {
265  return page->GetName();
266  }
267  return wxEmptyString;
268 }
269 
virtual void SetSeqEntryHandle(objects::CSeq_entry_Handle seh)
virtual void SetSeqEntryHandle(objects::CSeq_entry_Handle seh)
virtual void SetSeqEntryHandle(objects::CSeq_entry_Handle seh)
CSeqSubChromoPanel * m_ChromosomePanel
virtual bool StepBackward()
virtual void ApplyCommand()
void OnPageChanged(wxBookCtrlEvent &event)
ISubmissionPage * x_GetCurrentPage() const
virtual wxString GetAnchor()
~CSubMolinfoPanel()
Destructor.
CSeqSubOrganellePanel * m_OrganellePanel
virtual void ReportMissingFields(string &text)
void OnPageChanging(wxBookCtrlEvent &event)
bool Create(wxWindow *parent, wxWindowID id=ID_CSUBMOLINFOPANEL, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxTAB_TRAVERSAL)
Creation.
void Init()
Initialises member variables.
void CreateControls()
Creates the controls and sizers.
static bool ShowToolTips()
Should we show tooltips?
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
virtual wxString GetName() const
ICommandProccessor * m_CmdProcessor
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
CSubMolinfoPanel()
Constructors.
CSeqSubPlasmidPanel * m_PlasmidPanel
objects::CSeq_entry_Handle m_Seh
virtual bool StepForward()
virtual bool TransferDataToWindow()
virtual void SetSeqEntryHandle(objects::CSeq_entry_Handle seh)
virtual void UpdateOnPageChange(wxWindow *current_page)=0
Undo/Redo interface for editing operations.
bool x_DoStepForward(wxListbook *book)
virtual void ReportMissingFields(string &text)
bool x_DoStepBackward(wxListbook *book)
CSubmissionPageChangeListener * GetParentWizard(wxWindow *wnd) const
#define _(proto)
Definition: ct_nlmzip_i.h:78
static void Init(void)
Definition: cursor6.c:76
#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()
int i
static void text(MDB_val *v)
Definition: mdb_dump.c:62
const struct ncbi::grid::netcache::search::fields::SIZE size
Modified on Mon Feb 26 04:00:26 2024 by modify_doxy.py rev. 669887