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

Go to the SVN repository for this file.

1 /* $Id: field_choice_panel.hpp 42721 2019-04-05 16:17:33Z 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 // Generated by DialogBlocks (unregistered), 12/06/2013 14:35:26
29 
30 #ifndef _FIELD_CHOICE_PANEL_H_
31 #define _FIELD_CHOICE_PANEL_H_
32 
33 #include <corelib/ncbistd.hpp>
35 
36 /*!
37  * Includes
38  */
39 
40 ////@begin includes
41 ////@end includes
42 
43 #include <wx/sizer.h>
44 #include <wx/choice.h>
45 
46 /*!
47  * Forward declarations
48  */
49 
50 ////@begin forward declarations
51 class wxBoxSizer;
52 ////@end forward declarations
53 
55 
56 /*!
57  * Control identifiers
58  */
59 
60 ////@begin control identifiers
61 #define SYMBOL_CFIELDCHOICEPANEL_STYLE wxSIMPLE_BORDER|wxTAB_TRAVERSAL
62 #define SYMBOL_CFIELDCHOICEPANEL_TITLE _("FieldChoicePanel")
63 #define SYMBOL_CFIELDCHOICEPANEL_IDNAME ID_CFIELDCHOICEPANEL
64 #define SYMBOL_CFIELDCHOICEPANEL_SIZE wxDefaultSize
65 #define SYMBOL_CFIELDCHOICEPANEL_POSITION wxDefaultPosition
66 ////@end control identifiers
67 
68 
69 /*!
70  * CFieldChoicePanel class declaration
71  */
72 
74 {
75  DECLARE_DYNAMIC_CLASS( CFieldChoicePanel )
76  DECLARE_EVENT_TABLE()
77 
78 public:
79  /// Constructors
81  CFieldChoicePanel( wxWindow* parent,
82  const vector<CFieldNamePanel::EFieldType>& field_types,
83  bool horizontal = false,
84  bool is_pair = false,
85  wxWindowID id = SYMBOL_CFIELDCHOICEPANEL_IDNAME,
86  const wxPoint& pos = SYMBOL_CFIELDCHOICEPANEL_POSITION,
87  const wxSize& size = SYMBOL_CFIELDCHOICEPANEL_SIZE,
88  long style = SYMBOL_CFIELDCHOICEPANEL_STYLE );
89 
90  /// Creation
91  bool Create( wxWindow* parent,
92  const vector<CFieldNamePanel::EFieldType>& field_types,
93  bool horizontal,
94  wxWindowID id = SYMBOL_CFIELDCHOICEPANEL_IDNAME,
95  const wxPoint& pos = SYMBOL_CFIELDCHOICEPANEL_POSITION,
96  const wxSize& size = SYMBOL_CFIELDCHOICEPANEL_SIZE,
97  long style = SYMBOL_CFIELDCHOICEPANEL_STYLE );
98 
99  /// Destructor
101 
102  /// Initialises member variables
103  void Init();
104 
105  /// Creates the controls and sizers
106  void CreateControls();
107 
108 ////@begin CFieldChoicePanel event handler declarations
109 
110 ////@end CFieldChoicePanel event handler declarations
111 
112 ////@begin CFieldChoicePanel member function declarations
113 
114  /// Retrieves bitmap resources
115  wxBitmap GetBitmapResource( const wxString& name );
116 
117  /// Retrieves icon resources
118  wxIcon GetIconResource( const wxString& name );
119 ////@end CFieldChoicePanel member function declarations
120 
121  /// Should we show tooltips?
122  static bool ShowToolTips();
123 
124 ////@begin CFieldChoicePanel member variables
125  wxBoxSizer* m_TopFieldTypeSizer;
126  wxBoxSizer* m_SideFieldTypeSizer;
127  wxBoxSizer* m_FieldPicker;
128 ////@end CFieldChoicePanel member variables
129 
130  void OnFieldTypeChoiceSelected( wxCommandEvent& event );
131  bool SetFieldType(CFieldNamePanel::EFieldType field_type, bool is_pair = false);
132  void SetSubpanelSelection(const string &sel);
133  string GetField1(const bool subfield = false);
134  string GetField2(const bool subfield = false);
135  const vector<CFieldNamePanel::EFieldType> GetFieldTypes();
136  CFieldNamePanel::EFieldType GetFieldType();
137  virtual vector<string> GetChoices(bool& allow_other);
138  virtual string GetFieldName(const bool subfield = false);
139  virtual bool SetFieldName(const string& field);
140  // only set the first field name
141  bool SetOneFieldName(const string& field);
142  // returns true if one of the fiels corresponds to 'protein name'
143  bool IsOneFieldProteinName( void );
144  void IncludeComposedItems(bool show);
145 
146  static string AutoMatch(string field_name);
147  static string AutoMatch(string field_name, CFieldNamePanel::EFieldType field_type);
148  static string AutoMatchSrc(string field_name);
149  static string AutoMatchCGP(string field_name);
150  static string AutoMatchMisc(string field_name);
151  static string AutoMatchFeat(string field_name);
152  static string AutoMatchRNA(string field_name);
153  static string AutoMatchPub(string field_name);
154  static string AutoMatchDBLink(string field_name);
155  static string AutoMatchMolInfo(string field_name);
156 
157  static bool LooksLikeHeader(const vector<string>& field_names);
158  CFieldNamePanel * GetFieldNamePanel(void) {return m_Field1;}
159  CFieldNamePanel * GetFieldNamePanel2(void) {return m_Field2;}
160  void SetShowLegalOnly(bool val) {m_show_legal_only = val;}
161 
162  enum {
163  ID_CFIELDCHOICEPANEL = 6210,
164  ID_CFIELD_TYPE_CHOICE
165  };
166 private:
167  wxChoice* m_FieldType;
168  bool m_IsPair;
171  vector<CFieldNamePanel::EFieldType> m_FieldTypes;
175 };
176 
177 wxDECLARE_EVENT(wxEVT_COMMAND_UPDATE_CONSTRAINT_FIELD, wxCommandEvent);
178 
180 
181 #endif
182  // _FIELD_CHOICE_PANEL_H_
CFieldNamePanel * GetFieldNamePanel2(void)
void SetShowLegalOnly(bool val)
wxBoxSizer * m_TopFieldTypeSizer
wxBoxSizer * m_SideFieldTypeSizer
CFieldNamePanel * m_Field1
CFieldNamePanel * GetFieldNamePanel(void)
CFieldNamePanel * m_Field2
vector< CFieldNamePanel::EFieldType > m_FieldTypes
virtual string GetFieldName(const bool subfield=false)=0
Returns the name of the field as selected in the panel.
virtual vector< string > GetChoices(bool &allow_other)
virtual bool SetFieldName(const string &field)=0
Include a standard set of the NCBI C++ Toolkit most basic headers.
static void Init(void)
Definition: cursor6.c:76
#define SYMBOL_CFIELDCHOICEPANEL_STYLE
#define SYMBOL_CFIELDCHOICEPANEL_IDNAME
#define SYMBOL_CFIELDCHOICEPANEL_SIZE
wxDECLARE_EVENT(wxEVT_COMMAND_UPDATE_CONSTRAINT_FIELD, wxCommandEvent)
#define SYMBOL_CFIELDCHOICEPANEL_POSITION
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define NCBI_GUIPKG_SEQUENCE_EDIT_EXPORT
Definition: gui_export.h:515
const struct ncbi::grid::netcache::search::fields::SIZE size
Modified on Sat Feb 24 07:49:15 2024 by modify_doxy.py rev. 669887