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

Go to the SVN repository for this file.

1 #ifndef GUI_WIDGETS_WX___MULTI_FILE_INPUT__HPP
2 #define GUI_WIDGETS_WX___MULTI_FILE_INPUT__HPP
3 
4 /* $Id: multi_file_input.hpp 40970 2018-05-04 17:11:56Z katargir $
5  * ===========================================================================
6  *
7  * PUBLIC DOMAIN NOTICE
8  * National Center for Biotechnology Information
9  *
10  * This software/database is a "United States Government Work" under the
11  * terms of the United States Copyright Act. It was written as part of
12  * the author's official duties as a United States Government employee and
13  * thus cannot be copyrighted. This software/database is freely available
14  * to the public for use. The National Library of Medicine and the U.S.
15  * Government have not placed any restriction on its use or reproduction.
16  *
17  * Although all reasonable efforts have been taken to ensure the accuracy
18  * and reliability of the software and data, the NLM and the U.S.
19  * Government do not and cannot warrant the performance or results that
20  * may be obtained by using this software or data. The NLM and the U.S.
21  * Government disclaim all warranties, express or implied, including
22  * warranties of performance, merchantability or fitness for any particular
23  * purpose.
24  *
25  * Please cite the author in any work or product based on this material.
26  *
27  * ===========================================================================
28  *
29  * Authors: Andrey Yazhuk
30  *
31  * File Description:
32  *
33  */
34 
35 #include <corelib/ncbistd.hpp>
36 
37 #include <gui/gui_export.h>
38 
39 
40 class wxScrolledWindow;
41 class wxFlexGridSizer;
42 class wxHyperlinkEvent;
43 class wxBoxSizer;
44 
45 #include <wx/panel.h>
46 #include <wx/dnd.h>
47 
48 
50 
51 class CAdvancedFileInput;
52 
53 ///////////////////////////////////////////////////////////////////////////////
54 /// CMultiFileInput
56  public wxPanel
57 {
58  DECLARE_EVENT_TABLE()
59 public:
60  enum eControlIDs {
61  eDeleteAllFilesLink = 20001,
63  eFirstControl
64  };
65 
66 
68  CMultiFileInput(wxWindow* parent,
69  wxWindowID id = wxID_ANY,
70  const wxPoint& pos = wxDefaultPosition,
71  const wxSize& size = wxDefaultSize,
72  long style = wxTAB_TRAVERSAL,
73  const wxString& name = wxT("panel"));
74 
75 
76  virtual ~CMultiFileInput();
77 
78  void Init();
79  void Create(wxWindow* parent,
80  wxWindowID id = wxID_ANY,
81  const wxPoint& pos = wxDefaultPosition,
82  const wxSize& size = wxDefaultSize,
83  long style = wxTAB_TRAVERSAL,
84  const wxString& name = wxT("panel"));
85 
86  /// @name Attributes of wxFileDialog show on "Add Files" command
87  /// @{
88  void SetDlgTitle(const wxString& title);
89 
90  void SetDefaultDir(const wxString& dir);
91  wxString GetDefaultDir() const;
92 
93  void SetWildcard(const wxString& wildcard);
94  wxString GetWildcard() const;
95 
96  void SetDlgParent(wxWindow* parent);
97 
98  void SetDlgAttrs(const wxString& title, const wxString& dir,
99  const wxString& wildcard, wxWindow* parent);
100  void SetSingleMode (bool single);
101  /// @}
102 
103  void GetFilenames(vector<wxString>& filenames) const;
104  void SetFilenames(const vector<wxString>& filenames);
105  void AddFilenames(const vector<wxString>& filenames);
106 
107  void OnLink(wxHyperlinkEvent& event);
108  void OnBrowseBtn(wxCommandEvent& event);
109 
110 protected:
111  void x_AddFilenameRow(const wxString& filename);
112  void x_OnAddFilenames();
113  void x_AddFilenames(const vector<wxString>& paths);
114  void x_DeleteAllFilenames();
115  void x_DeleteFilename(int link_id);
116 
117  void x_SetSingleMode();
118  void x_SetMultiMode();
119  void x_SendFileTxtChangedEvt(CAdvancedFileInput* input,
120  const wxString& txt);
121 public:
122 
123  // local Drop Target
124  class CDropTarget : public wxDropTarget
125  {
126  public:
128  virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def);
129  virtual wxDragResult OnDragOver(wxCoord WXUNUSED(x),
130  wxCoord WXUNUSED(y),
131  wxDragResult def);
132  protected:
134  };
135 
136 protected:
137  wxString m_DlgTitle;
138  wxString m_DefaultDir;
139  wxString m_Wildcard;
141  vector<wxString> m_SaveFilenames;
142  wxWindow* m_DlgParent;
143 
144 
145  wxScrolledWindow* m_ScrollWnd;
146  wxFlexGridSizer* m_FileSizer;
147  wxBoxSizer* m_LinkSizer;
148  vector<CAdvancedFileInput*> m_Inputs;
150 };
151 
152 
154 
155 /* @} */
156 
157 #endif // GUI_WIDGETS_WX___MULTI_FILE_INPUT__HPP
CAdvancedFileInput.
CMultiFileInput.
void x_AddFilenames(const vector< wxString > &paths)
wxBoxSizer * m_LinkSizer
wxFlexGridSizer * m_FileSizer
vector< wxString > m_SaveFilenames
wxScrolledWindow * m_ScrollWnd
vector< CAdvancedFileInput * > m_Inputs
Include a standard set of the NCBI C++ Toolkit most basic headers.
static void Init(void)
Definition: cursor6.c:76
#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_GUIWIDGETS_WX_EXPORT
Definition: gui_export.h:543
Defines to provide correct exporting from DLLs in Windows.
static int input()
#define wxT(x)
Definition: muParser.cpp:41
const struct ncbi::grid::netcache::search::fields::SIZE size
static int filenames
Definition: pcregrep.c:172
static static static wxID_ANY
Modified on Fri Apr 12 17:20:21 2024 by modify_doxy.py rev. 669887