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

Go to the SVN repository for this file.

1 #ifndef GUI_WIDGETS_EDIT___MACRO_APPLY_SRCTABLE__HPP
2 #define GUI_WIDGETS_EDIT___MACRO_APPLY_SRCTABLE__HPP
3 /* $Id: macro_applysrc_table.hpp 46825 2021-10-26 19:54:09Z asztalos $
4 * ===========================================================================
5 *
6 * PUBLIC DOMAIN NOTICE
7 * National Center for Biotechnology Information
8 *
9 * This software / database is a "United States Government Work" under the
10 * terms of the United States Copyright Act.It was written as part of
11 * the author's official duties as a United States Government employee and
12 * thus cannot be copyrighted.This software / database is freely available
13 * to the public for use.The National Library of Medicine and the U.S.
14 * Government have not placed any restriction on its use or reproduction.
15 *
16 * Although all reasonable efforts have been taken to ensure the accuracy
17 * and reliability of the software and data, the NLM and the U.S.
18 * Government do not and cannot warrant the performance or results that
19 * may be obtained by using this software or data.The NLM and the U.S.
20 * Government disclaim all warranties, express or implied, including
21 * warranties of performance, merchantability or fitness for any particular
22 * purpose.
23 *
24 * Please cite the author in any work or product based on this material.
25 *
26 * ===========================================================================
27 *
28 * Authors: Andrea Asztalos
29 *
30 */
31 
32 #include <corelib/ncbistd.hpp>
34 #include <wx/hyperlink.h>
35 #include <wx/panel.h>
36 #include <wx/sizer.h>
37 #include <wx/checkbox.h>
38 
39 class wxScrolledWindow;
40 class wxFlexGridSizer;
41 class wxStaticText;
42 class wxTextCtrl;
43 class wxRadioButton;
44 class wxListCtrl;
45 
47 
48 class CSingleQualPanel;
49 
50 /*!
51  * Control identifiers
52  */
53 
54 ////@begin control identifiers
55 #define SYMBOL_CMACROAPPLYSRCTABLEPANEL_STYLE wxTAB_TRAVERSAL
56 #define SYMBOL_CMACROAPPLYSRCTABLEPANEL_TITLE _("Macro Apply Source Table")
57 #define SYMBOL_CMACROAPPLYSRCTABLEPANEL_IDNAME ID_CMACROAPPLYSRCTABLEPANEL
58 #define SYMBOL_CMACROAPPLYSRCTABLEPANEL_SIZE wxDefaultSize
59 #define SYMBOL_CMACROAPPLYSRCTABLEPANEL_POSITION wxDefaultPosition
60 ////@end control identifiers
61 
62 
63 /*!
64  * CMacroApplySrcTablePanel class declaration
65  */
66 
67 class CMacroApplySrcTablePanel: public wxPanel
68 {
69  DECLARE_DYNAMIC_CLASS(CMacroApplySrcTablePanel)
70  DECLARE_EVENT_TABLE()
71 
72 public:
73  using TAddValue = vector<tuple<string, int, EMacroFieldType, bool>>;
74 
75  /// Constructors
77  CMacroApplySrcTablePanel( wxWindow* parent, EMacroFieldType field_type,
79  const wxPoint& pos = SYMBOL_CMACROAPPLYSRCTABLEPANEL_POSITION,
82 
83  /// Creation
84  bool Create( wxWindow* parent,
86  const wxPoint& pos = SYMBOL_CMACROAPPLYSRCTABLEPANEL_POSITION,
89 
90  /// Destructor
92 
93  /// Initialises member variables
94  void Init();
95 
96  /// Creates the controls and sizers
97  void CreateControls();
98 
99 ////@begin CMacroApplySrcTablePanel event handler declarations
100 
101  void OnDelete(wxHyperlinkEvent& event);
102 
103  void OnOpenFile(wxCommandEvent& event);
104 
105  void OnHyperlinkClicked(wxHyperlinkEvent& event);
106 
107  void OnDelimiterSelected(wxCommandEvent& event);
108 
109  void OnNewFileEntered(wxCommandEvent& event);
110 ///@end CMacroApplySrcTablePanel event handler declarations
111 
112 ////@begin CMacroApplySrcTablePanel 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 CMacroApplySrcTablePanel member function declarations
120 
121  /// Should we show tooltips?
122  static bool ShowToolTips();
123 
124  string GetFilename() const;
125  void SetFilename(const string& fname);
126 
127  string GetDelimiter() const;
128  void SetDelimiter(const string& del);
129 
130  bool IsMergeDelimiterSet() const { return m_MergeDel->IsChecked(); }
131  bool IsSplitFirstSet() const { return m_SplitFirstCol->IsChecked(); }
132  bool IsConvertMultiSet() const { return m_ConvertMulti->IsChecked(); }
133  bool IsMergeFirstSet() const { return m_MergeTwoCols->IsChecked(); }
134 
135  void SetMergeDelimiter(bool value) { m_MergeDel->SetValue(value); }
136  void SetSplitFirst(bool value) { m_SplitFirstCol->SetValue(value); }
137  void SetConvertMulti(bool value) { m_ConvertMulti->SetValue(value); }
138  void SetMergeFirst(bool value) { m_MergeTwoCols->SetValue(value); }
140  void SetValues(const TAddValue& values);
141 
143  /// Control identifiers
144  enum {
162  };
163 
164 private:
166  void x_AddRowToWindow(wxWindow* row);
167  void x_ProcessFirstLine(bool update_only_table = false);
168 
169  int m_RowHeight{ 0 };
171  wxScrolledWindow* m_ScrolledWindow;
172  wxFlexGridSizer* m_Sizer;
173  wxListCtrl* m_TablePreview;
174  wxStaticText* m_QualLabel;
175  wxTextCtrl* m_Filename;
176  wxRadioButton* m_Tabdel;
177  wxRadioButton* m_Semidel;
178  wxRadioButton* m_Commadel;
179  wxRadioButton* m_Spacedel;
180  wxRadioButton* m_Otherdel;
181  wxTextCtrl* m_OtherText;
182  wxCheckBox* m_MergeDel;
183  wxCheckBox* m_SplitFirstCol;
184  wxCheckBox* m_ConvertMulti;
185  wxCheckBox* m_MergeTwoCols;
186 };
187 
189 
190 #endif
191  // GUI_WIDGETS_EDIT___MACRO_APPLY_SRCTABLE__HPP
void x_AddRowToWindow(wxWindow *row)
SFieldFromTable GetMatchField() const
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
wxScrolledWindow * m_ScrolledWindow
void OnOpenFile(wxCommandEvent &event)
wxBitmap GetBitmapResource(const wxString &name)
@end CMacroApplySrcTablePanel event handler declarations
bool Create(wxWindow *parent, wxWindowID id=ID_CMACROAPPLYSRCTABLEPANEL, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL)
Creation.
void Init()
Initialises member variables.
TStringPairsVector GetValues() const
vector< tuple< string, int, EMacroFieldType, bool > > TAddValue
void SetDelimiter(const string &del)
CSingleQualPanel * x_AddEmptyRow()
void OnHyperlinkClicked(wxHyperlinkEvent &event)
static bool ShowToolTips()
Should we show tooltips?
void SetFilename(const string &fname)
void SetValues(const TAddValue &values)
void x_ProcessFirstLine(bool update_only_table=false)
void CreateControls()
Creates the controls and sizers.
void OnNewFileEntered(wxCommandEvent &event)
void OnDelete(wxHyperlinkEvent &event)
void OnDelimiterSelected(wxCommandEvent &event)
char value[7]
Definition: config.c:431
Include a standard set of the NCBI C++ Toolkit most basic headers.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
vector< pair< string, string > > TStringPairsVector
Definition: ncbistr.hpp:4809
#define SYMBOL_CMACROAPPLYSRCTABLEPANEL_POSITION
#define SYMBOL_CMACROAPPLYSRCTABLEPANEL_STYLE
#define SYMBOL_CMACROAPPLYSRCTABLEPANEL_SIZE
#define SYMBOL_CMACROAPPLYSRCTABLEPANEL_IDNAME
const struct ncbi::grid::netcache::search::fields::SIZE size
Modified on Sat Dec 02 09:24:17 2023 by modify_doxy.py rev. 669887