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

Go to the SVN repository for this file.

1 /* $Id: project_selector_dlg.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: Andrey Yazhuk
27  *
28  * File Description:
29  *
30  */
31 
32 #include <ncbi_pch.hpp>
33 
34 ////@begin includes
35 #include "wx/imaglist.h"
36 ////@end includes
37 
39 
41 
42 ////@begin XPM images
43 ////@end XPM images
44 
45 #include <wx/sizer.h>
46 #include <wx/stattext.h>
47 #include <wx/button.h>
48 #include <wx/statbox.h>
49 
50 
52 
53 
54 IMPLEMENT_DYNAMIC_CLASS( CProjectSelectorDlg, CDialog )
55 
56 BEGIN_EVENT_TABLE( CProjectSelectorDlg, CDialog )
57 
58 ////@begin CProjectSelectorDlg event table entries
59 ////@end CProjectSelectorDlg event table entries
60 
62 
63 
65 {
66  Init();
67 }
68 
69 
70 CProjectSelectorDlg::CProjectSelectorDlg( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
71  : m_Objects()
72 {
73  Init();
74  Create(parent, id, caption, pos, size, style);
75 }
76 
77 
78 bool CProjectSelectorDlg::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
79 {
80 ////@begin CProjectSelectorDlg creation
81  SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
82  CDialog::Create( parent, id, caption, pos, size, style );
83 
85  if (GetSizer())
86  {
87  GetSizer()->SetSizeHints(this);
88  }
89  Centre();
90 ////@end CProjectSelectorDlg creation
91  return true;
92 }
93 
94 
96 {
97 ////@begin CProjectSelectorDlg destruction
98 ////@end CProjectSelectorDlg destruction
99 }
100 
101 
103 {
104 ////@begin CProjectSelectorDlg member initialisation
105  m_Sizer = NULL;
106  m_List = NULL;
108 ////@end CProjectSelectorDlg member initialisation
109 }
110 
111 
113 {
114 ////@begin CProjectSelectorDlg content construction
115  CProjectSelectorDlg* itemCDialog1 = this;
116 
117  m_Sizer = new wxBoxSizer(wxVERTICAL);
118  itemCDialog1->SetSizer(m_Sizer);
119 
120  wxStaticBox* itemStaticBoxSizer3Static = new wxStaticBox(itemCDialog1, wxID_ANY, _("Project items to be created"));
121  wxStaticBoxSizer* itemStaticBoxSizer3 = new wxStaticBoxSizer(itemStaticBoxSizer3Static, wxVERTICAL);
122  m_Sizer->Add(itemStaticBoxSizer3, 1, wxGROW|wxALL, 5);
123 
124  m_List = new CObjectListWidget( itemStaticBoxSizer3->GetStaticBox(), ID_COBJECTLISTWIDGET, wxDefaultPosition, itemStaticBoxSizer3->GetStaticBox()->ConvertDialogToPixels(wxSize(300, 50)), wxLC_REPORT );
125  itemStaticBoxSizer3->Add(m_List, 1, wxGROW|wxALL, 5);
126 
127  wxStaticBox* itemStaticBoxSizer5Static = new wxStaticBox(itemCDialog1, wxID_ANY, _("Project to place new items"));
128  wxStaticBoxSizer* itemStaticBoxSizer5 = new wxStaticBoxSizer(itemStaticBoxSizer5Static, wxVERTICAL);
129  m_Sizer->Add(itemStaticBoxSizer5, 2, wxGROW|wxALL, 5);
130 
131  m_ProjectSelPanel = new CProjectSelectorPanel( itemStaticBoxSizer5->GetStaticBox(), ID_PANEL1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
132  itemStaticBoxSizer5->Add(m_ProjectSelPanel, 1, wxGROW|wxALL, 5);
133 
134  wxStdDialogButtonSizer* itemStdDialogButtonSizer7 = new wxStdDialogButtonSizer;
135 
136  m_Sizer->Add(itemStdDialogButtonSizer7, 0, wxALIGN_RIGHT|wxALL, 5);
137  wxButton* itemButton8 = new wxButton( itemCDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
138  itemButton8->SetDefault();
139  itemStdDialogButtonSizer7->AddButton(itemButton8);
140 
141  wxButton* itemButton9 = new wxButton( itemCDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
142  itemStdDialogButtonSizer7->AddButton(itemButton9);
143 
144  itemStdDialogButtonSizer7->Realize();
145 
146 ////@end CProjectSelectorDlg content construction
147 
149  m_Params.m_EnableDecideLater = false;
150 }
151 
152 
154 {
155  m_ProjectService = prj_srv;
157 }
158 
159 
161 {
163  m_Objects = &objects;
164  m_Params.m_EnableCreateSeparate = (objects.size() > 1);
165 }
166 
167 /*void CProjectSelectorDlg::SetParams(const SProjectSelectorParams& params)
168 {
169  m_Params = params;
170 }*/
171 
172 
174 {
175  m_ProjectSelPanel->GetParams(params);
176  //params = m_Params;
177 }
178 
179 
181 {
182  return true;
183 }
184 
185 
186 wxBitmap CProjectSelectorDlg::GetBitmapResource( const wxString& name )
187 {
188  // Bitmap retrieval
189 ////@begin CProjectSelectorDlg bitmap retrieval
190  wxUnusedVar(name);
191  return wxNullBitmap;
192 ////@end CProjectSelectorDlg bitmap retrieval
193 }
194 
195 
196 wxIcon CProjectSelectorDlg::GetIconResource( const wxString& name )
197 {
198  // Icon retrieval
199 ////@begin CProjectSelectorDlg icon retrieval
200  wxUnusedVar(name);
201  return wxNullIcon;
202 ////@end CProjectSelectorDlg icon retrieval
203 }
204 
205 
207 {
208  if(CDialog::TransferDataToWindow()) {
209  // locator
210  if (m_ProjectService && m_Objects){
212  }
214 
216  }
217  return false;
218 }
219 
220 
222 {
224  return CDialog::TransferDataFromWindow();
225  }
226  return false;
227 }
228 
229 
230 static const char* kTableTag = "Table";
231 
233 {
234  CRegistryWriteView table_view = view.GetWriteView(kTableTag);
235  m_List->SaveTableSettings(table_view);
236 }
237 
238 
240 {
241  CRegistryReadView table_view = view.GetReadView(kTableTag);
242  m_List->LoadTableSettings(table_view);
243 }
244 
CDialog.
Definition: dialog.hpp:47
CObjectListWidget - mediator widget.
void SetObjects(TConstScopedObjects &objects)
void SetObjects(TConstScopedObjects &objects)
SProjectSelectorParams m_Params
void SetProjectService(CProjectService *prj_srv)
CProjectService * m_ProjectService
wxBitmap GetBitmapResource(const wxString &name)
bool Create(wxWindow *parent, wxWindowID id=ID_CPROJECTSELECTORDLG, const wxString &caption=_("Project Selector Dialog"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxTAB_TRAVERSAL)
TConstScopedObjects * m_Objects
void GetParams(SProjectSelectorParams &params) const
virtual void x_LoadSettings(const CRegistryReadView &view)
override these functions in derived classes
wxIcon GetIconResource(const wxString &name)
CProjectSelectorPanel * m_ProjectSelPanel
virtual void x_SaveSettings(CRegistryWriteView view) const
CObjectListWidget * m_List
CProjectSelectorPanel - a panel that allows the user to specify how the project items created by a pl...
void SetProjectService(CProjectService *service)
void GetParams(SProjectSelectorParams &params) const
void SetParams(const SProjectSelectorParams &params)
CProjectService - a service providing API for operations with Workspaces and Projects.
class CRegistryReadView provides a nested hierarchical view at a particular key.
Definition: reg_view.hpp:58
CRegistryReadView GetReadView(const string &section) const
Definition: reg_view.cpp:74
CRegistryWriteView GetWriteView(const string &section)
Definition: reg_view.cpp:491
void LoadTableSettings(const CRegistryReadView &view, bool byName=false)
void SaveTableSettings(CRegistryWriteView &view, bool saveSorting=true) const
#define _(proto)
Definition: ct_nlmzip_i.h:78
static void Init(void)
Definition: cursor6.c:76
#define NULL
Definition: ncbistd.hpp:225
vector< SConstScopedObject > TConstScopedObjects
Definition: objects.hpp:65
#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
static const char * kTableTag
static static static wxID_ANY
SProjectSelectorParams - holds data for CProjectSelectorPanel.
void SelectProjectByObjects(TConstScopedObjects &objects, CProjectService *srv)
is all objects belong to the same project - selects the project
Modified on Wed Jun 19 17:03:22 2024 by modify_doxy.py rev. 669887