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

Go to the SVN repository for this file.

1 /* $Id: cap_change_panel.cpp 41872 2018-10-31 15:16:50Z asztalos $
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: Andrea Asztalos
27  */
28 
29 
30 #include <ncbi_pch.hpp>
31 #include <objmgr/scope.hpp>
33 
34 #include <wx/statbox.h>
35 #include <wx/radiobut.h>
36 #include <wx/sizer.h>
37 #include <wx/icon.h>
38 
39 
42 /*!
43  * CCapChangePanel type definition
44  */
45 
46 IMPLEMENT_DYNAMIC_CLASS( CCapChangePanel, wxPanel )
47 
48 
49 /*!
50  * CCapChangePanel event table definition
51  */
52 
53 BEGIN_EVENT_TABLE( CCapChangePanel, wxPanel )
55 
56 
57 /*!
58  * CCapChangePanel constructors
59  */
60 
62 {
63  Init();
64 }
65 
66 CCapChangePanel::CCapChangePanel( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
67 {
68  Init();
69  Create(parent, id, pos, size, style);
70 }
71 
72 
73 /*!
74  * CCapChangePanel creator
75  */
76 
77 bool CCapChangePanel::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
78 {
79 ////@begin CCapChangePanel creation
80  wxPanel::Create( parent, id, pos, size, style );
81 
83  if (GetSizer())
84  {
85  GetSizer()->SetSizeHints(this);
86  }
87  Centre();
88 ////@end CCapChangePanel creation
89  return true;
90 }
91 
92 
93 /*!
94  * CCapChangePanel destructor
95  */
96 
98 {
99 ////@begin CCapChangePanel destruction
100 ////@end CCapChangePanel destruction
101 }
102 
103 
104 /*!
105  * Member initialisation
106  */
107 
109 {
110 ////@begin CCapChangePanel member initialisation
112  m_CapToupper = NULL;
115  m_CapTolower = NULL;
119 ////@end CCapChangePanel member initialisation
120 }
121 
122 
123 /*!
124  * Control creation for CCapChangePanel
125  */
126 
128 {
129 ////@begin CCapChangePanel content construction
130  CCapChangePanel* itemPanel1 = this;
131 
132  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
133  itemPanel1->SetSizer(itemBoxSizer2);
134 
135  wxStaticBox* itemStaticBoxSizer3Static = new wxStaticBox(itemPanel1, wxID_ANY, _("Capitalization"));
136  wxStaticBoxSizer* itemStaticBoxSizer3 = new wxStaticBoxSizer(itemStaticBoxSizer3Static, wxVERTICAL);
137  itemBoxSizer2->Add(itemStaticBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
138 
139  wxFlexGridSizer* itemFlexGridSizer4 = new wxFlexGridSizer(0, 4, 0, 0);
140  itemStaticBoxSizer3->Add(itemFlexGridSizer4, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
141 
142  m_CapNochange = new wxRadioButton( itemStaticBoxSizer3->GetStaticBox(), ID_CAPCHANGE_NOCHANGE, _("No change"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
143  m_CapNochange->SetValue(true);
144  itemFlexGridSizer4->Add(m_CapNochange, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
145 
146  m_CapToupper = new wxRadioButton( itemStaticBoxSizer3->GetStaticBox(), ID_CAPCHANGE_UPPER, _("To upper"), wxDefaultPosition, wxDefaultSize, 0 );
147  m_CapToupper->SetValue(false);
148  itemFlexGridSizer4->Add(m_CapToupper, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
149 
150  m_CapFirstcap_nochange = new wxRadioButton( itemStaticBoxSizer3->GetStaticBox(), ID_CAPCHANGE_FCAP_NOCH, _("First cap, rest no change"), wxDefaultPosition, wxDefaultSize, 0 );
151  m_CapFirstcap_nochange->SetValue(false);
152  itemFlexGridSizer4->Add(m_CapFirstcap_nochange, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
153 
154  m_Capwords_space = new wxRadioButton( itemStaticBoxSizer3->GetStaticBox(), ID_CAPCHANGE_CAPWORDS_SP, _("Cap words, start at spaces"), wxDefaultPosition, wxDefaultSize, 0 );
155  m_Capwords_space->SetValue(false);
156  itemFlexGridSizer4->Add(m_Capwords_space, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
157 
158  m_CapTolower = new wxRadioButton( itemStaticBoxSizer3->GetStaticBox(), ID_CAPCHANGE_LOWER, _("To lower"), wxDefaultPosition, wxDefaultSize, 0 );
159  m_CapTolower->SetValue(false);
160  itemFlexGridSizer4->Add(m_CapTolower, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
161 
162  m_CapFirstcap_restlow = new wxRadioButton( itemStaticBoxSizer3->GetStaticBox(), ID_CAPCHANGE_FCAP_LOW, _("First cap, rest lower"), wxDefaultPosition, wxDefaultSize, 0 );
163  m_CapFirstcap_restlow->SetValue(false);
164  itemFlexGridSizer4->Add(m_CapFirstcap_restlow, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
165 
166  m_CapFirstlow_nochange = new wxRadioButton( itemStaticBoxSizer3->GetStaticBox(), ID_CAPCHANGE_FLOW_NOCH, _("First lower, rest no change"), wxDefaultPosition, wxDefaultSize, 0 );
167  m_CapFirstlow_nochange->SetValue(false);
168  itemFlexGridSizer4->Add(m_CapFirstlow_nochange, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
169 
170  m_Capwords_spacepunct = new wxRadioButton( itemStaticBoxSizer3->GetStaticBox(), ID_CAPCHANGE_CAPWORDS_SPPUNCT, _("Cap words, start at spaces or punct."), wxDefaultPosition, wxDefaultSize, 0 );
171  m_Capwords_spacepunct->SetValue(false);
172  itemFlexGridSizer4->Add(m_Capwords_spacepunct, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
173 
174 ////@end CCapChangePanel content construction
175 }
176 
178 {
179  m_CapNochange->SetValue(true);
180  m_CapToupper->SetValue(false);
181  m_CapFirstcap_nochange->SetValue(false);
182  m_Capwords_space->SetValue(false);
183  m_CapTolower->SetValue(false);
184  m_CapFirstcap_restlow->SetValue(false);
185  m_CapFirstlow_nochange->SetValue(false);
186  m_Capwords_spacepunct->SetValue(false);
187 }
188 
189 /*!
190  * Should we show tooltips?
191  */
192 
194 {
195  return true;
196 }
197 
198 /*!
199  * Get bitmap resources
200  */
201 
202 wxBitmap CCapChangePanel::GetBitmapResource( const wxString& name )
203 {
204  // Bitmap retrieval
205 ////@begin CCapChangePanel bitmap retrieval
206  wxUnusedVar(name);
207  return wxNullBitmap;
208 ////@end CCapChangePanel bitmap retrieval
209 }
210 
211 /*!
212  * Get icon resources
213  */
214 
215 wxIcon CCapChangePanel::GetIconResource( const wxString& name )
216 {
217  // Icon retrieval
218 ////@begin CCapChangePanel icon retrieval
219  wxUnusedVar(name);
220  return wxNullIcon;
221 ////@end CCapChangePanel icon retrieval
222 }
223 
224 
226 {
227  ECapChange cap_change = eCapChange_none;
228 
229  // read out which radiobutton is set
230  if (m_CapNochange->GetValue()) {
231  cap_change = eCapChange_none;
232  } else if (m_CapToupper->GetValue()) {
233  cap_change = eCapChange_toupper;
234  } else if (m_CapTolower->GetValue()) {
235  cap_change = eCapChange_tolower;
236  } else if (m_CapFirstcap_restlow->GetValue()) {
237  cap_change = eCapChange_firstcap_restlower;
238  } else if (m_CapFirstcap_nochange->GetValue()) {
240  } else if (m_CapFirstlow_nochange->GetValue()) {
242  } else if (m_Capwords_space->GetValue()) {
243  cap_change = eCapChange_capword_afterspace;
244  } else if (m_Capwords_spacepunct->GetValue()) {
246  }
247  return cap_change;
248 }
249 
250 
252 
USING_SCOPE(objects)
static bool ShowToolTips()
Should we show tooltips?
wxRadioButton * m_CapFirstcap_nochange
void CreateControls()
Creates the controls and sizers.
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
wxRadioButton * m_CapFirstlow_nochange
wxRadioButton * m_CapTolower
bool Create(wxWindow *parent, wxWindowID id=ID_CCAPCHANGEPANEL, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxTAB_TRAVERSAL)
Creation.
objects::ECapChange GetCapitalizationRequest()
wxRadioButton * m_Capwords_space
wxRadioButton * m_CapNochange
wxRadioButton * m_CapToupper
wxRadioButton * m_Capwords_spacepunct
void Init()
Initialises member variables.
~CCapChangePanel()
Destructor.
wxRadioButton * m_CapFirstcap_restlow
CCapChangePanel()
Constructors.
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
@ eCapChange_firstlower_restnochange
capitalize the first letter, the rest is not changed
@ eCapChange_capword_afterspacepunc
capitalize the first letter and letters after spaces
@ eCapChange_none
@ eCapChange_capword_afterspace
first letter is lower case, the rest is not changed
@ eCapChange_firstcap_restnochange
capitalize the first letter, the rest is lower case
@ eCapChange_firstcap_restlower
change each letter to upper case
@ eCapChange_tolower
no change
@ eCapChange_toupper
change each letter to lower case
#define _(proto)
Definition: ct_nlmzip_i.h:78
static void Init(void)
Definition: cursor6.c:76
#define NULL
Definition: ncbistd.hpp:225
#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()
const struct ncbi::grid::netcache::search::fields::SIZE size
static static static wxID_ANY
Modified on Fri Jan 05 07:25:46 2024 by modify_doxy.py rev. 669887