NCBI C++ ToolKit
user_object_util.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: user_object_util.hpp 45095 2020-05-29 13:13:36Z bollin $
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 #ifndef _USER_OBJECT_UTIL_H_
31 #define _USER_OBJECT_UTIL_H_
32 
33 #include <corelib/ncbistd.hpp>
37 #include <wx/panel.h>
38 #include <wx/sizer.h>
39 #include <wx/scrolwin.h>
40 
42 
43 class CSingleUserFieldPanel : public wxPanel
44 {
45 public:
46  virtual ~CSingleUserFieldPanel() {};
48 
49 protected:
51 
52  void x_OnChange();
53 };
54 
55 
57 {
58 public:
59  virtual ~CUserFieldManager() {};
60  virtual CSingleUserFieldPanel * MakeEditor(wxWindow* parent, objects::CUser_field& field) = 0;
61  virtual bool IsEligible(const objects::CUser_field& field) = 0;
62  virtual bool IsEmpty(const objects::CUser_field& field) = 0;
63  virtual CRef<objects::CUser_field> GetUserField(wxWindow* ctrl) = 0;
64 };
65 
66 
68 {
69 public:
72 
73  virtual CSingleUserFieldPanel * MakeEditor(wxWindow* parent, objects::CUser_field& field);
74  virtual bool IsEligible(const objects::CUser_field& field);
75  virtual bool IsEmpty(const objects::CUser_field& field);
76  virtual CRef<objects::CUser_field> GetUserField(wxWindow* ctrl);
77 private:
78  bool x_IsTypeString(const string& str);
79 
80  static bool x_HasPopulatedFields(const objects::CUser_field& field);
81 };
82 
83 
85 {
86 public:
89 
90  virtual CSingleUserFieldPanel * MakeEditor(wxWindow* parent, objects::CUser_field& field);
91  virtual bool IsEligible(const objects::CUser_field& field);
92  virtual bool IsEmpty(const objects::CUser_field& field);
93  virtual CRef<objects::CUser_field> GetUserField(wxWindow* ctrl);
94 };
95 
96 
97 class CUserFieldListPanel : public wxPanel
98 {
99 public:
100  virtual void AddLastField (wxWindow* link);
102  void PopulateFields(objects::CUser_object& user_obj);
103  virtual bool TransferDataToWindow();
104  virtual bool TransferDataFromWindow();
106 
107 protected:
109  vector< CRef< objects::CUser_field > > m_Fields;
110  wxScrolledWindow* m_ScrolledWindow;
111  wxBoxSizer* m_Sizer;
112 
119 
121 
122  wxWindow* x_AddRow(CRef<objects::CUser_field> field, wxScrolledWindow* scrolled_window, wxBoxSizer* sizer);
123  void x_UpdateFields();
124  bool x_IsTPA() const;
125 };
126 
127 
128 bool IsLastRow(wxWindow* wnd, wxSizerItemList& itemList);
129 
130 CRef<objects::CSeq_table> ReadTabDelimitedTable(const wxString& filename, bool read_header);
131 bool SaveTableFile (const string& save_file_name, CRef<objects::CSeq_table> values_table, bool include_header);
132 bool SaveTableRowAsListFile (const string& save_file_name, CRef<objects::CSeq_table> values_table, int col);
134 CRef<objects::CSeq_table> SeqTableFromAssemblyFields (const objects::CUser_object& obj);
135 
136 
138 
139 #endif
140 // _USER_OBJECT_UTIL_H_
User-defined methods of the data storage class.
virtual CSingleUserFieldPanel * MakeEditor(wxWindow *parent, objects::CUser_field &field)
virtual bool IsEmpty(const objects::CUser_field &field)
virtual bool IsEligible(const objects::CUser_field &field)
virtual CRef< objects::CUser_field > GetUserField(wxWindow *ctrl)
bool x_IsTypeString(const string &str)
virtual CRef< objects::CUser_field > GetUserField(wxWindow *ctrl)
virtual CSingleUserFieldPanel * MakeEditor(wxWindow *parent, objects::CUser_field &field)
virtual bool IsEligible(const objects::CUser_field &field)
virtual bool IsEmpty(const objects::CUser_field &field)
static bool x_HasPopulatedFields(const objects::CUser_field &field)
virtual CRef< objects::CUser_field > GetUser_field()=0
CRef< objects::CUser_field > m_Field
wxScrolledWindow * m_ScrolledWindow
void SetNeedsEmptyLastRow(bool val)
virtual bool TransferDataToWindow()
virtual void AddLastField(wxWindow *link)
vector< CRef< objects::CUser_field > > m_Fields
CRef< objects::CUser_object > m_UserObj
void SetUser_object(CRef< objects::CUser_object > user)
void PopulateFields(objects::CUser_object &user_obj)
virtual bool TransferDataFromWindow()
wxWindow * x_AddRow(CRef< objects::CUser_field > field, wxScrolledWindow *scrolled_window, wxBoxSizer *sizer)
CUserFieldManager * m_FieldManager
virtual ~CUserFieldManager()
virtual CRef< objects::CUser_field > GetUserField(wxWindow *ctrl)=0
virtual bool IsEligible(const objects::CUser_field &field)=0
virtual CSingleUserFieldPanel * MakeEditor(wxWindow *parent, objects::CUser_field &field)=0
virtual bool IsEmpty(const objects::CUser_field &field)=0
Include a standard set of the NCBI C++ Toolkit most basic headers.
static const char * str(char *buf, int n)
Definition: stats.c:84
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
<!DOCTYPE HTML >< html > n< header > n< title > PubSeq Gateway Help Page</title > n< style > n table
CRef< objects::CSeq_table > SeqTableFromAssemblyFields(const objects::CUser_object &obj)
CRef< objects::CSeq_table > ReadTabDelimitedTable(const wxString &filename, bool read_header)
bool IsLastRow(wxWindow *wnd, wxSizerItemList &itemList)
bool SaveTableRowAsListFile(const string &save_file_name, CRef< objects::CSeq_table > values_table, int col)
void AddAssemblyUserFieldsFromSeqTable(CRef< objects::CUser_object > obj, CRef< objects::CSeq_table > table)
bool SaveTableFile(const string &save_file_name, CRef< objects::CSeq_table > values_table, bool include_header)
Modified on Fri Sep 20 14:57:48 2024 by modify_doxy.py rev. 669887