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

Go to the SVN repository for this file.

1 /* $Id: generic_report_dlg.cpp 41125 2018-05-29 19:08:26Z filippov $
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: Colleen Bollin
27  */
28 
29 
30 #include <ncbi_pch.hpp>
31 
36 #include <wx/sizer.h>
37 
39 
40 /*!
41  * CGenericReportDlg type definition
42  */
43 
44 IMPLEMENT_DYNAMIC_CLASS( CGenericReportDlg, wxFrame )
45 
46 
47 /*!
48  * CGenericReportDlg event table definition
49  */
50 
51 BEGIN_EVENT_TABLE( CGenericReportDlg, wxFrame )
54 
55 
56 /*!
57  * CGenericReportDlg constructors
58  */
59 
61 : m_Workbench(0)
62 {
63  Init();
64 }
65 
66 CGenericReportDlg::CGenericReportDlg( wxWindow* parent, IWorkbench* workbench,
67  wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
68  : m_Workbench(workbench)
69 {
70  Init();
71  Create(parent, id, caption, pos, size, style);
72  SetRegistryPath("GenericReportDialog");
73  LoadSettings();
74 }
75 
76 
77 /*!
78  * CGenericReportDlg creator
79  */
80 
81 bool CGenericReportDlg::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
82 {
83 ////@begin CGenericReportDlg creation
84  SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
85  wxFrame::Create( parent, id, caption, pos, size, style );
86  wxVisualAttributes attr = wxPanel::GetClassDefaultAttributes();
87  if (attr.colBg != wxNullColour)
88  SetOwnBackgroundColour(attr.colBg);
90  if (GetSizer())
91  {
92  GetSizer()->SetSizeHints(this);
93  }
94  Centre(wxBOTH|wxCENTRE_ON_SCREEN);
95 ////@end CGenericReportDlg creation
96  return true;
97 }
98 
99 
100 /*!
101  * CGenericReportDlg destructor
102  */
103 
105 {
106  SaveSettings();
107 }
108 
109 static const char* kCaseSensitive = "Search mode";
110 
111 void CGenericReportDlg::SetRegistryPath(const string& path)
112 {
113  m_RegPath = path;
114 }
115 
117 {
118  if (m_RegPath.empty())
119  return;
120 
122  CRegistryWriteView view = gui_reg.GetWriteView(m_RegPath);
123 
124  if (m_GenericPanel)
126 
127 }
128 
129 
131 {
132  if (m_RegPath.empty())
133  return;
134 
136 
137  CRegistryReadView view = gui_reg.GetReadView(m_RegPath);
138  if (m_GenericPanel)
140 }
141 
142 /*!
143  * Member initialisation
144  */
145 
147 {
149 }
150 
151 
152 /*!
153  * Control creation for CGenericReportDlg
154  */
155 
157 {
158  CGenericReportDlg* itemDialog1 = this;
159 
160  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
161  itemDialog1->SetSizer(itemBoxSizer2);
162 
163  m_GenericPanel = new CGenericPanel(itemDialog1, m_Workbench, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0);
164  itemBoxSizer2->Add(m_GenericPanel, 1, wxGROW|wxALL, 5);
165 }
166 
167 
168 void CGenericReportDlg::SetWorkDir(const wxString& workDir)
169 {
170  if (m_GenericPanel)
171  m_GenericPanel->SetWorkDir(workDir);
172 }
173 
174 
175 /*!
176  * Should we show tooltips?
177  */
178 
180 {
181  return true;
182 }
183 
184 /*!
185  * Get bitmap resources
186  */
187 
188 wxBitmap CGenericReportDlg::GetBitmapResource( const wxString& name )
189 {
190  // Bitmap retrieval
191 ////@begin CGenericReportDlg bitmap retrieval
192  wxUnusedVar(name);
193  return wxNullBitmap;
194 ////@end CGenericReportDlg bitmap retrieval
195 }
196 
197 /*!
198  * Get icon resources
199  */
200 
201 wxIcon CGenericReportDlg::GetIconResource( const wxString& name )
202 {
203  // Icon retrieval
204 ////@begin CGenericReportDlg icon retrieval
205  wxUnusedVar(name);
206  return wxNullIcon;
207 ////@end CGenericReportDlg icon retrieval
208 }
209 
210 
212 {
213  m_GenericPanel->SetLineSpacing(spacing);
214 }
215 
216 
217 void CGenericReportDlg::SetText( const wxString& text )
218 {
220 }
221 
222 void CGenericReportDlg::OnCloseWindow(wxCloseEvent& event)
223 {
224  Destroy();
225 }
226 
228 {
229  m_GenericPanel->SetRefresh(refresh);
230 }
231 
233 {
235 }
236 
237 
238 ////////////////////////////////////////////////////////////////////////////
239 
240 IMPLEMENT_DYNAMIC_CLASS( CGenericReportDlgModal, wxDialog )
241 
242 
243 /*!
244  * CGenericReportDlgModal event table definition
245  */
246 
247 BEGIN_EVENT_TABLE( CGenericReportDlgModal, wxDialog )
250 
251 
252 /*!
253  * CGenericReportDlgModal constructors
254  */
255 
257 : m_Workbench(0)
258 {
259  Init();
260 }
261 
263  wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
264  : m_Workbench(workbench)
265 {
266  Init();
267  Create(parent, id, caption, pos, size, style);
268 }
269 
270 
271 /*!
272  * CGenericReportDlgModal creator
273  */
274 
275 bool CGenericReportDlgModal::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
276 {
277 ////@begin CGenericReportDlgModal creation
278  SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
279  wxDialog::Create( parent, id, caption, pos, size, style );
280  wxVisualAttributes attr = wxPanel::GetClassDefaultAttributes();
281  if (attr.colBg != wxNullColour)
282  SetOwnBackgroundColour(attr.colBg);
283  CreateControls();
284  if (GetSizer())
285  {
286  GetSizer()->SetSizeHints(this);
287  }
288  Centre(wxBOTH|wxCENTRE_ON_SCREEN);
289 ////@end CGenericReportDlgModal creation
290  return true;
291 }
292 
293 
294 /*!
295  * CGenericReportDlgModal destructor
296  */
297 
299 {
300 }
301 
302 
303 /*!
304  * Member initialisation
305  */
306 
308 {
310 }
311 
312 
313 /*!
314  * Control creation for CGenericReportDlgModal
315  */
316 
318 {
319  CGenericReportDlgModal* itemDialog1 = this;
320 
321  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
322  itemDialog1->SetSizer(itemBoxSizer2);
323 
324  m_GenericPanel = new CGenericPanel(itemDialog1, m_Workbench, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0);
325  itemBoxSizer2->Add(m_GenericPanel, 1, wxGROW|wxALL, 5);
326 }
327 
328 /*!
329  * Should we show tooltips?
330  */
331 
333 {
334  return true;
335 }
336 
337 /*!
338  * Get bitmap resources
339  */
340 
341 wxBitmap CGenericReportDlgModal::GetBitmapResource( const wxString& name )
342 {
343  // Bitmap retrieval
344 ////@begin CGenericReportDlgModal bitmap retrieval
345  wxUnusedVar(name);
346  return wxNullBitmap;
347 ////@end CGenericReportDlgModal bitmap retrieval
348 }
349 
350 /*!
351  * Get icon resources
352  */
353 
354 wxIcon CGenericReportDlgModal::GetIconResource( const wxString& name )
355 {
356  // Icon retrieval
357 ////@begin CGenericReportDlgModal icon retrieval
358  wxUnusedVar(name);
359  return wxNullIcon;
360 ////@end CGenericReportDlgModal icon retrieval
361 }
362 
363 
364 
365 void CGenericReportDlgModal::SetText( const wxString& text )
366 {
368 }
369 
370 void CGenericReportDlgModal::OnCloseWindow(wxCloseEvent& event)
371 {
372  Destroy();
373 }
374 
376 {
377  m_GenericPanel->SetRefresh(refresh);
378 }
379 
381 {
383 }
384 
386 
void SetText(const wxString &text)
void SetWorkDir(const wxString &workDir)
void SetRefresh(IRefreshCntrl *refresh)
void SetLineSpacing(int spacing)
void SetFindMode(int mode)
static bool ShowToolTips()
Should we show tooltips?
bool Create(wxWindow *parent, wxWindowID id=10357, const wxString &caption=_("Generic Report"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxTAB_TRAVERSAL)
Creation.
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
void OnCloseWindow(wxCloseEvent &event)
void SetRefresh(IRefreshCntrl *refresh)
void CreateControls()
Creates the controls and sizers.
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
CGenericReportDlgModal()
Constructors.
void SetText(const wxString &text)
void Init()
Initialises member variables.
void SetText(const wxString &text)
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
void SetRegistryPath(const string &reg_path)
void SetRefresh(IRefreshCntrl *refresh)
static bool ShowToolTips()
Should we show tooltips?
void SetLineSpacing(int spacing)
CGenericReportDlg()
Constructors.
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
bool Create(wxWindow *parent, wxWindowID id=10357, const wxString &caption=_("Generic Report"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxTAB_TRAVERSAL)
Creation.
void SetWorkDir(const wxString &workDir)
void CreateControls()
Creates the controls and sizers.
void OnCloseWindow(wxCloseEvent &event)
CGenericPanel * m_GenericPanel
void Init()
Initialises member variables.
~CGenericReportDlg()
Destructor.
CRegistryWriteView GetWriteView(const string &section)
get a read-write view at a particular level.
Definition: registry.cpp:462
static CGuiRegistry & GetInstance()
access the application-wide singleton
Definition: registry.cpp:400
CRegistryReadView GetReadView(const string &section) const
get a read-only view at a particular level.
Definition: registry.cpp:428
class CRegistryReadView provides a nested hierarchical view at a particular key.
Definition: reg_view.hpp:58
int GetInt(const string &key, int default_val=0) const
access a named key at this level, with no recursion
Definition: reg_view.cpp:230
void Set(const string &key, int val)
access a named key at this level, with no recursion
Definition: reg_view.cpp:533
IWorkbench is the central interface in the application framework.
Definition: workbench.hpp:113
static void Init(void)
Definition: cursor6.c:76
static const char * kCaseSensitive
#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()
static void text(MDB_val *v)
Definition: mdb_dump.c:62
const struct ncbi::grid::netcache::search::fields::SIZE size
static static static wxID_ANY
Modified on Tue Nov 28 02:22:13 2023 by modify_doxy.py rev. 669887