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

Go to the SVN repository for this file.

1 /* $Id: wx_label_edit_dlg.cpp 29104 2013-10-22 18:01:10Z falkrb $
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: Vladimir Tereshkov
27  *
28  * File Description:
29  *
30  */
31 #include <ncbi_pch.hpp>////@begin includes
32 ////@end includes
33 
38 
39 #include <wx/panel.h>
40 #include <wx/stattext.h>
41 #include <wx/statline.h>
42 #include <wx/statbox.h>
43 #include <wx/combobox.h>
44 #include <wx/sizer.h>
45 #include <wx/button.h>
46 #include <wx/bitmap.h>
47 #include <wx/icon.h>
48 
49 #define PHYLO_FEAT_LABEL "label"
50 
51 ////@begin XPM images
52 ////@end XPM images
53 
55 
56 IMPLEMENT_DYNAMIC_CLASS( CwxLabelEditDlg, wxDialog )
57 
58 BEGIN_EVENT_TABLE( CwxLabelEditDlg, wxDialog )
59 
60 ////@begin CwxLabelEditDlg event table entries
61  EVT_BUTTON( wxID_OK, CwxLabelEditDlg::OnOkClick )
62 
63 ////@end CwxLabelEditDlg event table entries
64 
66 
68 : m_Tree(NULL)
69 , m_NodeIdx(CPhyloTree::Null())
70 {
71  Init();
72 }
73 
74 CwxLabelEditDlg::CwxLabelEditDlg( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
75 : m_Tree(NULL)
76 , m_NodeIdx(CPhyloTree::Null())
77 {
78  Init();
79  Create(parent, id, caption, pos, size, style);
80 }
81 
82 bool CwxLabelEditDlg::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
83 {
84 ////@begin CwxLabelEditDlg creation
85  SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
86  wxDialog::Create( parent, id, caption, pos, size, style );
87 
89  if (GetSizer())
90  {
91  GetSizer()->SetSizeHints(this);
92  }
93  Centre();
94 ////@end CwxLabelEditDlg creation
95  return true;
96 }
97 
99 {
100 ////@begin CwxLabelEditDlg destruction
101 ////@end CwxLabelEditDlg destruction
102 }
103 
105 {
106 ////@begin CwxLabelEditDlg member initialisation
107 ////@end CwxLabelEditDlg member initialisation
108 }
109 
111 {
112 ////@begin CwxLabelEditDlg content construction
113  // Generated by DialogBlocks, Sat 16 Feb 2008 11:12:46 AM EST (unregistered)
114 
115  CwxLabelEditDlg* itemDialog1 = this;
116 
117  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
118  itemDialog1->SetSizer(itemBoxSizer2);
119 
120  wxTextCtrl* itemTextCtrl3 = new wxTextCtrl( itemDialog1, ID_TEXTCTRL16, wxT(""), wxDefaultPosition, wxDefaultSize, 0 );
121  itemBoxSizer2->Add(itemTextCtrl3, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
122 
123  wxStdDialogButtonSizer* itemStdDialogButtonSizer4 = new wxStdDialogButtonSizer;
124 
125  itemBoxSizer2->Add(itemStdDialogButtonSizer4, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
126  wxButton* itemButton5 = new wxButton( itemDialog1, wxID_OK, wxT("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
127  itemButton5->SetDefault();
128  itemStdDialogButtonSizer4->AddButton(itemButton5);
129 
130  itemStdDialogButtonSizer4->Realize();
131 
132  // Set validators
133  itemTextCtrl3->SetValidator( wxTextValidator(wxFILTER_NONE, & m_Label) );
134 ////@end CwxLabelEditDlg content construction
135 }
136 
138 {
139  return true;
140 }
141 wxBitmap CwxLabelEditDlg::GetBitmapResource( const wxString& name )
142 {
143  // Bitmap retrieval
144 ////@begin CwxLabelEditDlg bitmap retrieval
145  wxUnusedVar(name);
146  return wxNullBitmap;
147 ////@end CwxLabelEditDlg bitmap retrieval
148 }
149 wxIcon CwxLabelEditDlg::GetIconResource( const wxString& name )
150 {
151  // Icon retrieval
152 ////@begin CwxLabelEditDlg icon retrieval
153  wxUnusedVar(name);
154  return wxNullIcon;
155 ////@end CwxLabelEditDlg icon retrieval
156 }
157 
159  CPhyloTree::TTreeIdx node_idx)
160 {
161  m_Tree = tree;
162  m_NodeIdx = node_idx;
163  m_Label.erase();
164 
165  m_Label = ToWxString((*tree)[node_idx]->GetLabel());
166 }
167 
168 void CwxLabelEditDlg::OnOkClick( wxCommandEvent& event )
169 {
170  TransferDataFromWindow();
171  event.Skip();
172 }
173 
Tree subclass also has functions and data needed for rendering and selection.
Definition: phylo_tree.hpp:52
CPhyloTree::TTreeIdx m_NodeIdx
wxBitmap GetBitmapResource(const wxString &name)
void OnOkClick(wxCommandEvent &event)
static bool ShowToolTips()
bool Create(wxWindow *parent, wxWindowID id=10018, const wxString &caption=wxT("Edit Label"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxCAPTION|wxSYSTEM_MENU|wxCLOSE_BOX)
void SetParams(CPhyloTree *tree, CPhyloTree::TTreeIdx node_idx)
wxIcon GetIconResource(const wxString &name)
static void Init(void)
Definition: cursor6.c:76
#define NULL
Definition: ncbistd.hpp:225
string GetLabel(const CSeq_id &id)
#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()
#define wxT(x)
Definition: muParser.cpp:41
const struct ncbi::grid::netcache::search::fields::SIZE size
#define ID_TEXTCTRL16
wxString ToWxString(const string &s)
Definition: wx_utils.hpp:173
Modified on Sun Mar 03 03:15:01 2024 by modify_doxy.py rev. 669887