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

Go to the SVN repository for this file.

1 /* $Id: bond_panel.cpp 27153 2012-12-31 19:59:43Z 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: Roman Katargin and Igor Filippov
27  */
28 
29 
30 #include <ncbi_pch.hpp>
31 ////@begin includes
32 #include "wx/imaglist.h"
33 ////@end includes
34 
37 
38 
39 #include <wx/sizer.h>
40 #include <wx/bitmap.h>
41 #include <wx/icon.h>
42 
43 #include "bond_panel.hpp"
44 
45 
48 
49 ////@begin XPM images
50 ////@end XPM images
51 
52 
53 
54 IMPLEMENT_DYNAMIC_CLASS( CBondPanel, wxPanel )
55 
56 
57 BEGIN_EVENT_TABLE( CBondPanel, wxPanel )
58 
60 
61 
62 
64 {
65  Init();
66 }
67 
69  wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
70 : m_Bond(bond)
71 {
72  Init();
73  Create(parent, id, pos, size, style);
74 }
75 
76 
77 bool CBondPanel::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
78 {
79 
80  wxPanel::Create( parent, id, pos, size, style );
81 
83  if (GetSizer())
84  {
85  GetSizer()->SetSizeHints(this);
86  }
87  Centre();
88 
89  return true;
90 }
91 
92 
93 
95 {
96 }
97 
98 
100 {
101 }
102 
103 
105 {
106  CBondPanel* itemPanel1 = this;
107 
108  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
109  itemPanel1->SetSizer(itemBoxSizer2);
110 
111  wxArrayString types;
112  CBondList list;
113  int selection = 0;
114  int j = 0;
115  for (CBondList::const_iterator i = list.begin(); i != list.end(); ++i)
116  {
117  types.Add(ToWxString(i->first));
118  if (i->second == m_Bond) selection = j;
119  j++;
120  }
121 
122  m_Choice = new wxChoice(itemPanel1, ID_BONDPANEL_CHOICE, wxDefaultPosition, wxDefaultSize, types ,0,wxDefaultValidator,"Bond");
123  m_Choice->SetSelection(selection);
124  itemBoxSizer2->Add(m_Choice, 0, wxALIGN_LEFT|wxALL, 5);
125 
126 }
127 
128 
129 
131 {
132  bool result = wxPanel::TransferDataFromWindow();
133  int selection = m_Choice->GetSelection();
134  CBondList list;
135  int j=0;
136  for (CBondList::const_iterator i = list.begin(); i != list.end(); ++i)
137  {
138  if (j == selection) m_Bond = i->second;
139  j++;
140  }
141 
142  return result;
143 }
144 
145 
147 {
148  return true;
149 }
150 
151 wxBitmap CBondPanel::GetBitmapResource( const wxString& name )
152 {
153  // Bitmap retrieval
154  wxUnusedVar(name);
155  return wxNullBitmap;
156 }
157 
158 wxIcon CBondPanel::GetIconResource( const wxString& name )
159 {
160  // Icon retrieval
161  wxUnusedVar(name);
162  return wxNullIcon;
163 }
164 
166 {
167  return m_Bond;
168 }
169 
171 
USING_SCOPE(objects)
#define ID_BONDPANEL_CHOICE
Definition: bond_panel.hpp:57
TBondMap::const_iterator const_iterator
const_iterator end() const
const_iterator begin() const
wxChoice * m_Choice
Definition: bond_panel.hpp:104
bool Create(wxWindow *parent, wxWindowID id=10027, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxTAB_TRAVERSAL)
Creation.
Definition: bond_panel.cpp:77
~CBondPanel()
Destructor.
Definition: bond_panel.cpp:94
void CreateControls()
Creates the controls and sizers.
Definition: bond_panel.cpp:104
void Init()
Initialises member variables.
Definition: bond_panel.cpp:99
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
Definition: bond_panel.cpp:158
CSeqFeatData::EBond m_Bond
Definition: bond_panel.hpp:103
CBondPanel()
Constructors.
Definition: bond_panel.cpp:63
CSeqFeatData::EBond GetBond()
Definition: bond_panel.cpp:165
virtual bool TransferDataFromWindow()
Definition: bond_panel.cpp:130
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
Definition: bond_panel.cpp:151
static bool ShowToolTips()
Should we show tooltips?
Definition: bond_panel.cpp:146
static void Init(void)
Definition: cursor6.c:76
static const struct type types[]
Definition: type.c:22
#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()
int i
const struct ncbi::grid::netcache::search::fields::SIZE size
else result
Definition: token2.c:20
wxString ToWxString(const string &s)
Definition: wx_utils.hpp:173
Modified on Tue Apr 23 07:40:19 2024 by modify_doxy.py rev. 669887