45 #include <wx/bitmap.h>
47 #include <wx/choice.h>
48 #include <wx/textctrl.h>
49 #include <wx/stattext.h>
50 #include <wx/valtext.h>
51 #include <wx/toplevel.h>
52 #include <wx/scrolwin.h>
53 #include <wx/checkbox.h>
96 m_User =
new objects::CUser_object();
100 Create(parent,
id, caption, pos,
size, style);
111 wxPanel::Create( parent,
id, pos,
size, style );
116 GetSizer()->SetSizeHints(
this);
198 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
199 itemPanel1->SetSizer(itemBoxSizer2);
204 m_StandardCommentTypeLabel =
new wxStaticText( itemPanel1, wxID_STATIC,
_(
"Standard Comment Type"), wxDefaultPosition, wxDefaultSize, 0 );
207 wxArrayString m_StandardCommentCtrlStrings;
211 wxBoxSizer* itemBoxSizer6 =
new wxBoxSizer(wxHORIZONTAL);
212 itemBoxSizer2->Add(itemBoxSizer6, 0, wxALIGN_LEFT|wxALL, 5);
214 wxStaticText* itemStaticText7 =
new wxStaticText( itemPanel1, wxID_STATIC,
_(
"Field Name"), wxDefaultPosition, wxSize(200, -1), 0 );
215 itemBoxSizer6->Add(itemStaticText7, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
217 wxStaticText* itemStaticText8 =
new wxStaticText( itemPanel1, wxID_STATIC,
_(
"Value"), wxDefaultPosition, wxSize(200, -1), 0 );
218 itemBoxSizer6->Add(itemStaticText8, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
220 wxHyperlinkCtrl* itemHyperlinkCtrl9 =
new wxHyperlinkCtrl( itemPanel1,
ID_HYPERLINKCTRL,
_(
"Add Field"), wxEmptyString, wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE );
221 itemBoxSizer6->Add(itemHyperlinkCtrl9, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
226 m_Sizer =
new wxBoxSizer(wxVERTICAL);
239 m_StandardCommentCtrlStrings.Add(wxEmptyString);
255 wxBoxSizer* row_sizer =
new wxBoxSizer(wxHORIZONTAL);
256 m_Sizer->Add (row_sizer, 0, wxGROW | wxALIGN_NOT|wxALL);
257 if (static_fieldname) {
258 wxStaticText* fieldNameText =
new wxStaticText(
m_ScrolledWindow, 0,
ToWxString(field_name), wxDefaultPosition, wxSize(200, -1), 0 );
259 row_sizer->Add(fieldNameText, 0, wxALIGN_NOT|wxALL);
262 wxTextCtrl* fieldNameText =
new wxTextCtrl(
m_ScrolledWindow, 0,
ToWxString(field_name), wxDefaultPosition, wxSize(200, -1), 0 );
263 row_sizer->Add(fieldNameText, 0, wxALIGN_NOT |wxALL);
267 wxStaticText* star =
new wxStaticText(
m_ScrolledWindow, 0, is_required ?
wxT(
"(*)") :
wxT(
" "), wxDefaultPosition, wxSize(20, -1), 0);
268 row_sizer->Add(star, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5);
270 wxTextCtrl* fieldValueText =
new wxTextCtrl(
m_ScrolledWindow, 0,
ToWxString(field_value), wxDefaultPosition, wxSize(200, -1), 0 );
271 row_sizer->Add(fieldValueText, 1, wxALIGN_NOT|wxALL);
276 if (!static_fieldname) {
278 itemHyperLink->SetVisitedColour(itemHyperLink->GetNormalColour());
279 row_sizer->Add(itemHyperLink, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5);
284 fieldValueText->GetClientSize(&row_width, &row_height);
292 if (!wxPanel::TransferDataToWindow())
308 vector<string> field_names;
309 vector<string> field_values;
310 vector<bool> displayed;
313 string field_name =
"";
315 if ( obj_id.
IsStr() ) {
316 field_name = obj_id.
GetStr();
320 if ((*it)->IsSetData() && (*it)->GetData().IsStr()) {
321 prefix = (*it)->GetData().GetStr();
325 if ((*it)->IsSetData() && (*it)->GetData().IsStr()) {
326 suffix = (*it)->GetData().GetStr();
330 field_names.push_back(field_name);
332 if ((*it)->IsSetData()) {
333 if ((*it)->GetData().IsStr()) {
334 value = (*it)->GetData().GetStr();
335 }
else if ((*it)->GetData().IsInt()) {
339 field_values.push_back(
value);
340 displayed.push_back(
false);
345 bool use_default_layout =
true;
352 bool is_required = (*field_it)->IsSetRequired() && (*field_it)->GetRequired();
356 for (
size_t i = 0;
i < field_names.size();
i++) {
358 s_AddRow((*field_it)->GetField_name(), field_values[
i],
true, is_required);
364 s_AddRow((*field_it)->GetField_name(),
"",
true, is_required);
368 use_default_layout =
false;
373 if (use_default_layout) {
377 for (
size_t i = 0;
i < field_names.size();
i++) {
383 if (use_default_layout) {
399 if (!wxPanel::TransferDataFromWindow())
416 string field_name =
"";
417 string field_value =
"";
422 field_name =
ToStdString(fieldNameText->GetValue());
424 wxStaticText* staticFieldNameText =
dynamic_cast<wxStaticText*
> (
m_FieldNameCtrls[
i]);
425 if (staticFieldNameText) {
426 field_name =
ToStdString (staticFieldNameText->GetLabel());
438 m_User->AddField (field_name, field_value);
441 m_User->AddField (field_name, field_value);
528 for(wxSizerItemList::iterator it = itemList.begin(); it != itemList.end(); ++it, ++row_num) {
529 wxSizer* sizer = (**it).GetSizer();
530 if (sizer && sizer->GetItem(wnd))
551 wxSizerItemList& itemList =
m_Sizer->GetChildren();
553 int row_num =
x_FindRow((wxWindow*)event.GetEventObject(), itemList);
558 if (
row == row_num) {
559 it =
m_User->SetData().erase(it);
595 m_User->Assign(desc.GetUser());
User-defined methods of the data storage class.
static bool CleanupUserObject(CUser_object &object)
CHyperlink is wrapper class for wxHyperlinkCtrl On OSX platform it posts URL click instead of sending...
Base class for all serializable objects.
CUser_object & AddField(const string &label, const string &value, EParseField parse=eParse_String)
add a data field to the user object that holds a given value
static const char * str(char *buf, int n)
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
#define MSerial_AsnText
I/O stream manipulators –.
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
void Reset(void)
Reset reference object.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
static bool EndsWith(const CTempString str, const CTempString end, ECase use_case=eCase)
Check if a string ends with a specified suffix value.
static bool IsBlank(const CTempString str, SIZE_TYPE pos=0)
Check if a string is blank (has no text).
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)
Check if a string starts with a specified prefix value.
static bool EqualNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive equality of a substring with another string.
static string & ReplaceInPlace(string &src, const string &search, const string &replace, SIZE_TYPE start_pos=0, SIZE_TYPE max_replace=0, SIZE_TYPE *num_replace=0)
Replace occurrences of a substring within a string.
bool IsSetData(void) const
the object itself Check if a value has been assigned to Data data member.
bool IsStr(void) const
Check if variant Str is selected.
const TStr & GetStr(void) const
Get the variant data.
const TData & GetData(void) const
Get the Data member data.
vector< CRef< CUser_field > > TData
const struct ncbi::grid::netcache::search::fields::SIZE size
const GenericPointer< typename T::ValueType > T2 value
static const char * suffix[]
static const char * prefix[]
#define row(bind, expected)
wxString ToWxString(const string &s)
string ToStdString(const wxString &s)