23 #include "wx/wxprec.h"
31 #include "ObjCryst/wxCryst/wxCryst.h"
32 #include "ObjCryst/ObjCryst/Undo.h"
35 #include "ObjCryst/Quirks/VFNDebug.h"
54 wxMultiChoiceDialog_ListBox::wxMultiChoiceDialog_ListBox(wxWindow* parent,
const wxString& message,
const wxString& caption,
55 int n,
const wxString* choices):
56 wxDialog(parent,-1,_T(
"Choose the molecule's atoms"),wxDefaultPosition,wxSize(300,400),wxCAPTION|wxSTAY_ON_TOP),
57 mListBox(this,-1,wxDefaultPosition,wxSize(250,350),n,choices,wxLB_MULTIPLE)
59 wxBoxSizer *sizer=
new wxBoxSizer(wxVERTICAL);
60 sizer->Add(&mListBox);
61 sizer->Add(this->CreateSeparatedButtonSizer(wxOK | wxCANCEL));
62 this->SetSizer(sizer);
63 sizer->SetSizeHints(
this);
67 wxArrayInt wxMultiChoiceDialog_ListBox::GetSelections()
const
70 mListBox.GetSelections(choice);
79 WXCRYST_ID::WXCRYST_ID(){mIndex=mCounter++;}
80 WXCRYST_ID::operator long(){
return mIndex;}
81 long WXCRYST_ID::mCounter=wxID_HIGHEST+100;
83 #ifdef VFN_CRYST_MUTEX
89 CrystMutex::CrystMutex():mNbLock(0){}
90 CrystMutex::~CrystMutex()
92 cout <<
"~CrystMutex("<<
this<<
"), Total number of Locks="<<mNbLock<<endl;
94 wxMutexError CrystMutex::Lock()
97 return this->wxMutex::Lock();
99 cout <<
"Thread:"<<wxThread::IsMain()<<
":CrystMutex("<<
this<<
")::Lock() ?"<<endl;
100 wxMutexError res=this->wxMutex::TryLock();
101 if(res==wxMUTEX_NO_ERROR)
102 cout <<
"Thread:"<<wxThread::IsMain()<<
":CrystMutex("<<
this<<
")::Lock()-OK"<<endl;
103 if(res==wxMUTEX_DEAD_LOCK)
105 cout <<
"Thread:"<<wxThread::IsMain()<<
":CrystMutex("<<
this<<
")::Lock()-DEADLOCK!"<<endl;
108 if(res==wxMUTEX_BUSY)
110 cout <<
"Thread:"<<wxThread::IsMain()<<
":CrystMutex("<<
this<<
")::Lock()-Busy?"<<endl;
111 res=this->wxMutex::Lock();
112 cout <<
"Thread:"<<wxThread::IsMain()<<
":CrystMutex("<<
this<<
")::Lock()-OK2"<<endl;
117 wxMutexError CrystMutex::Unlock()
121 return this->wxMutex::Unlock();
130 WXCrystObjBasic::WXCrystObjBasic(wxWindow* parent):
131 wxWindow(parent,-1),mWXCrystParent(0),mIsShown(true),mNeedUpdateUI(true)
133 VFN_DEBUG_MESSAGE(
"WXCrystObjBasic::WXCrystObjBasic() at "<<
this,6)
138 this->SetBackgroundColour(wxColour(240,240,240));
141 VFN_DEBUG_MESSAGE(
"WXCrystObjBasic::WXCrystObjBasic():End",6)
149 set<WXCrystObjBasicList*> vpList=
mvpList;
150 for(set<WXCrystObjBasicList*>::iterator pos=vpList.begin();pos!=vpList.end();++pos)
151 (*pos)->Remove(
this);
156 VFN_DEBUG_ENTRY(
"WXCrystObjBasic::BottomLayout(...)"<<this->GetSize().GetWidth()<<
","<<this->GetSize().GetHeight(),5);
157 wxTheApp->GetTopWindow()->SendSizeEvent();
158 VFN_DEBUG_EXIT(
"WXCrystObjBasic::BottomLayout(...)"<<this->GetSize().GetWidth()<<
","<<this->GetSize().GetHeight(),5);
162 VFN_DEBUG_ENTRY(
"WXCrystObjBasic::AddChild(...)"<<this->GetSize().GetWidth()<<
","<<this->GetSize().GetHeight(),5);
163 wxSizer *pSizer=this->GetSizer();
168 if(doBottomLayout) wxTheApp->GetTopWindow()->SendSizeEvent();
169 VFN_DEBUG_EXIT(
"WXCrystObjBasic::AddChild(...)"<<this->GetSize().GetWidth()<<
","<<this->GetSize().GetHeight(),5);
174 bool WXCrystObjBasic::Layout()
178 return wxWindow::Layout();
193 for(set<WXCrystObjBasic*>::iterator pos=vpWXCrystObj.begin();pos!=vpWXCrystObj.end();pos++)
194 (*pos)->RemovedFromList(
this);
202 VFN_DEBUG_MESSAGE(
"WXCrystObjBasicList::Add()",6)
209 VFN_DEBUG_MESSAGE(
"WXCrystObjBasicList::Remove():"<<win,6)
216 VFN_DEBUG_MESSAGE(
"WXCrystObjBasicList::Show(bool)",3)
220 VFN_DEBUG_MESSAGE(
"WXCrystObjBasicList::Show(bool):End",3)
226 VFN_DEBUG_ENTRY(
"WXCrystObjBasicList::CrystUpdate()",5)
229 VFN_DEBUG_MESSAGE(
"WXCrystObjBasicList::CrystUpdate("<<updateUI<<mutexlock<<
")@"<<*pos,5)
230 (*pos)->CrystUpdate(updateUI,mutexlock);
232 VFN_DEBUG_EXIT(
"WXCrystObjBasicList::CrystUpdate()",5)
236 VFN_DEBUG_ENTRY(
"WXCrystObjBasicList::UpdateUI("<<mutexlock<<
")"<<
"MainThread="<<wxThread::IsMain(),5)
238 (*pos)->UpdateUI(mutexlock);
239 VFN_DEBUG_EXIT(
"WXCrystObjBasicList::UpdateUI()",5)
241 void WXCrystObjBasicList::Enable(
bool enable)
244 (*pos)->Enable(enable);
265 VFN_DEBUG_ENTRY(
"WXCrystValidateAllUserInput()...",6)
270 VFN_DEBUG_EXIT(
"WXCrystValidateAllUserInput()...",6)
281 VFN_DEBUG_ENTRY(
"WXField::WXField()",6)
282 mpSizer =
new wxBoxSizer(wxHORIZONTAL);
283 mpLabel=
new wxStaticText(
this,-1,wxString::FromAscii(label.c_str()));
288 VFN_DEBUG_EXIT(
"WXField::WXField()",6)
292 VFN_DEBUG_MESSAGE(
"WXField::SetLabel()",3)
293 mpLabel->SetLabel(wxString::FromAscii(s.c_str()));
298 VFN_DEBUG_MESSAGE(
"WXField::SetLabel()",3)
299 mpLabel->SetForegroundColour(colour);
300 return this->wxWindow::SetForegroundColour(colour);
316 const
int id,const
int hsize,
bool isEditable):
317 WXField(parent,"",
id),mpString(&st),mValue(st),mIsSelfUpdating(false)
319 VFN_DEBUG_MESSAGE(
"WXFieldString::WXFieldName():End",6)
322 mpField=new wxTextCtrl(this,ID_WXFIELD,wxString::FromAscii(mValue.c_str()),
323 wxDefaultPosition,wxSize(hsize,-1),wxTE_PROCESS_ENTER,
324 wxTextValidator(wxFILTER_ASCII));
326 mpField=new wxTextCtrl(this,ID_WXFIELD,wxString::FromAscii(mValue.c_str()),
327 wxDefaultPosition,wxSize(hsize,-1),wxTE_READONLY,
328 wxTextValidator(wxFILTER_ASCII));
330 mpSizer->Add(mpField,0,wxALIGN_CENTER);
331 mpSizer->SetSizeHints(this);
337 VFN_DEBUG_MESSAGE(
"WXFieldString::OnEnter()",6)
343 VFN_DEBUG_MESSAGE(
"WXFieldString::OnText():",6)
353 VFN_DEBUG_ENTRY(
"WXFieldString::SetValue()",3)
354 wxMutexLocker mlock(
mMutex);
357 VFN_DEBUG_EXIT(
"WXFieldString::SetValue(): string unchanged",3)
362 VFN_DEBUG_EXIT(
"WXFieldString::SetValue()",3)
367 VFN_DEBUG_MESSAGE(
"WXFieldString::GetValue()"<<
mValue<<
":"<<
mpField->GetValue(),6)
372 VFN_DEBUG_ENTRY(
"WXFieldString::CrystUpdate()",3)
383 if(uui)
if(
true==wxThread::IsMain()) this->
UpdateUI(lock);
384 VFN_DEBUG_EXIT(
"WXFieldString::CrystUpdate()",3)
394 VFN_DEBUG_ENTRY(
"WXFieldString::UpdateUI("<<lock<<
")"<<
"MainThread="<<wxThread::IsMain(),4)
400 VFN_DEBUG_EXIT(
"WXFieldString::UpdateUI()",4)
404 VFN_DEBUG_MESSAGE(
"WXFieldString::Revert()",3)
405 wxMutexLocker mlock(
mMutex);
411 VFN_DEBUG_MESSAGE(
"WXFieldString::ValidateUserInput()",6)
413 wxMutexLocker mlock(
mMutex);
420 mpField->SetSize(width,height);
437 const
int id,const
int hsize,
bool isEditable):
438 WXField(parent,label,
id),mpWXObj(owner),mValue(""),mIsSelfUpdating(false)
440 VFN_DEBUG_ENTRY(
"WXFieldName::WXFieldName()",6)
442 mpField=new wxTextCtrl(this,ID_WXFIELD,wxString::FromAscii(mValue.c_str()),
443 wxDefaultPosition,wxSize(hsize,-1),wxTE_PROCESS_ENTER,
444 wxTextValidator(wxFILTER_ASCII));
446 mpField=new wxTextCtrl(this,ID_WXFIELD,wxString::FromAscii(mValue.c_str()),
447 wxDefaultPosition,wxSize(hsize,-1),wxTE_READONLY,
448 wxTextValidator(wxFILTER_ASCII));
450 mpSizer->Add(mpField,0,wxALIGN_CENTER);
458 VFN_DEBUG_MESSAGE(
"WXFieldName::OnEnter()",6)
463 if(
true==mIsSelfUpdating)
return;
464 VFN_DEBUG_MESSAGE(
"WXFieldName::OnText():",6)
474 VFN_DEBUG_ENTRY(
"WXFieldName::SetValue()",3)
475 wxMutexLocker mlock(
mMutex);
478 VFN_DEBUG_EXIT(
"WXFieldName::SetValue():name unchanged",3)
483 VFN_DEBUG_EXIT(
"WXFieldName::SetValue()",3)
488 VFN_DEBUG_MESSAGE(
"WXFieldName::GetValue()"<<
mValue<<
":"<<
mpField->GetValue(),6)
493 VFN_DEBUG_MESSAGE(
"WXFieldName::CrystUpdate()",3)
504 VFN_DEBUG_ENTRY(
"WXFieldName::UpdateUI("<<lock<<
")"<<
"MainThread="<<wxThread::IsMain(),4)
508 int w=
mpField->GetTextExtent(wxString::FromAscii(
mValue.c_str())).GetWidth();
509 const int wmax=wxTheApp->GetTopWindow()->GetSize().GetWidth();
511 if(w>
mpField->GetSize().GetWidth())
512 this->GetSizer()->SetItemMinSize(
mpField,w+30,-1);
513 this->GetSizer()->Fit(
this);
518 VFN_DEBUG_EXIT(
"WXFieldName::UpdateUI()",4)
522 VFN_DEBUG_MESSAGE(
"WXFieldName::Revert()",3)
523 wxMutexLocker mlock(
mMutex);
529 VFN_DEBUG_MESSAGE(
"WXFieldName::ValidateUserInput()",6)
538 mpField->SetSize(width,height);
554 const
int id, const
int hsize):
555 WXField(parent,label,
id),mIsSelfUpdating(false),mFormat(_T("%8f"))
557 VFN_DEBUG_MESSAGE(
"WXFieldParBase::WXFieldName():End",6)
559 mpField=
new wxTextCtrl(
this,ID_WXFIELD,_T(
""),
560 wxDefaultPosition,wxSize(hsize,-1),wxTE_PROCESS_ENTER,
561 wxTextValidator(wxFILTER_NUMERIC));
562 mpSizer->Add(mpField,0,wxALIGN_CENTER);
570 VFN_DEBUG_MESSAGE(
"WXFieldRefPar::OnEnter()",6)
576 VFN_DEBUG_MESSAGE(
"WXFieldRefPar::OnText()",6)
585 VFN_DEBUG_MESSAGE(
"WXFieldRefPar::ValidateUserInput()",6)
602 const int id,T *par,
const int hsize):
603 WXFieldParBase(parent,label,id,hsize),mpValue(par),mValue(*par),mValueOld(*par),mHumanScale(1)
609 const int id,
long *par,
const int hsize):
610 WXFieldParBase(parent,label,id,hsize),mpValue(par),mValue(*par),mValueOld(*par),mHumanScale(1)
618 if(lock) mMutex.Lock();
621 if(lock) mMutex.Unlock();
624 VFN_DEBUG_ENTRY(
"WXFieldPar<T>::CrystUpdate()",6)
628 if(lock) mMutex.Unlock();
629 if(uui)
if(
true==wxThread::IsMain()) this->UpdateUI(lock);
630 VFN_DEBUG_EXIT(
"WXFieldPar<T>::CrystUpdate()",6)
635 if(lock)mMutex.Lock();
636 if(mNeedUpdateUI==
false)
638 if(lock)mMutex.Unlock();
641 VFN_DEBUG_ENTRY(
"WXFieldPar<REAL>::UpdateUI("<<lock<<
")"<<
"MainThread="<<wxThread::IsMain(),4)
643 if((abs(mValue*mHumanScale)<1000)&&(abs(mValue*mHumanScale)>0.01)) tmp.Printf(_T(
"%6.4f"),mValue*mHumanScale);
644 else tmp.Printf(mFormat,mValue*mHumanScale);
645 mIsSelfUpdating=
true;
646 mpField->SetValue(tmp);
647 mIsSelfUpdating=
false;
649 if(lock)mMutex.Unlock();
650 VFN_DEBUG_EXIT(
"WXFieldPar<REAL>::UpdateUI()",4)
655 if(lock)mMutex.Lock();
656 if(mNeedUpdateUI==
false)
658 if(lock)mMutex.Unlock();
661 VFN_DEBUG_ENTRY(
"WXFieldPar<long>::UpdateUI("<<lock<<
")"<<
"MainThread="<<wxThread::IsMain(),4)
663 tmp.Printf(mFormat,mValue*mHumanScale);
664 mIsSelfUpdating=
true;
665 mpField->SetValue(tmp);
666 mIsSelfUpdating=
false;
668 if(lock)mMutex.Unlock();
669 VFN_DEBUG_EXIT(
"WXFieldPar<long>::UpdateUI()",4)
693 VFN_DEBUG_MESSAGE(
"WXFieldPar<T>::Revert()",6)
699 if(
true==wxThread::IsMain()) this->UpdateUI(
true);
709 VFN_DEBUG_MESSAGE(
"WXFieldPar<REAL>::ReadNewValue()",6)
710 wxMutexLocker mlock(mMutex);
712 wxString s=mpField->GetValue();
716 *mpValue /= mHumanScale;
720 VFN_DEBUG_MESSAGE(
"WXFieldPar<long>::ReadNewValue()",6)
721 wxMutexLocker mlock(mMutex);
723 wxString s=mpField->GetValue();
725 *mpValue /= mHumanScale;
738 WXFieldChoice::WXFieldChoice
739 (wxWindow *parent,
const int field_id,
const string &name,
const int hsize):
742 mpButton=
new wxButton(
this,field_id,wxString::FromAscii(name.c_str()),wxDefaultPosition,wxSize(hsize,-1));
766 mpButton->SetLabel(wxString::FromAscii(name.c_str()));
779 EVT_UPDATE_UI(ID_WXOBJ_ENABLE,WXCrystObj::OnEnable)
780 EVT_UPDATE_UI(ID_WXOBJ_DISABLE,WXCrystObj::OnEnable)
786 VFN_DEBUG_ENTRY(
"WXCrystObj::WXCrystObj()",6)
787 mpTopSizer=
new wxBoxSizer(orient);
788 this->SetSizer(mpTopSizer);
790 mpCollapseButton=
new wxButton(
this,ID_WXOBJ_COLLAPSE,_T(
"-"),
791 wxDefaultPosition,wxSize(14,14));
792 mpTopSizer->Add(mpCollapseButton,0, wxALIGN_TOP);
795 mpSizer=
new wxBoxSizer(wxVERTICAL);
796 mpTopSizer->Add(mpSizer,0, wxALIGN_TOP);
800 mpWXTitle =
new WXFieldName(
this,
"name:",
this,ID_WXOBJ_NAME,100);
801 mpSizer->Add(mpWXTitle,0,wxALIGN_LEFT);
805 VFN_DEBUG_EXIT(
"WXCrystObj::WXCrystObj():End",6)
808 WXCrystObj::~WXCrystObj()
821 VFN_DEBUG_MESSAGE(
"WXCrystObj::OnToggleCollapse()",6)
827 VFN_DEBUG_MESSAGE(
"WXCrystObj::OnToggleCollapse():End",6)
833 VFN_DEBUG_ENTRY(
"WXCrystObj::CrystUpdate("<<uui<<lock<<
")",6)
837 VFN_DEBUG_EXIT(
"WXCrystObj::CrystUpdate()",6)
841 VFN_DEBUG_ENTRY(
"WXCrystObj::UpdateUI("<<lock<<
")"<<
"MainThread="<<wxThread::IsMain(),6)
846 VFN_DEBUG_EXIT(
"WXCrystObj::UpdateUI()",6)
848 void WXCrystObj::OnEnable(wxUpdateUIEvent &event)
850 if(ID_WXOBJ_ENABLE==event.GetId()) this->Enable(
true);
851 else this->Enable(
false);
854 bool WXCrystObj::Enable(
bool enable)
856 mList.Enable(enable);
857 return this->wxWindow::Enable(enable);
862 VFN_DEBUG_ENTRY(
"WXCrystObj::AddChild(..)"<<this->GetSize().GetWidth()<<
","<<this->GetSize().GetHeight(),5);
867 if(doBottomLayout) wxTheApp->GetTopWindow()->SendSizeEvent();
868 VFN_DEBUG_EXIT(
"WXCrystObj::AddChild(..)"<<this->GetSize().GetWidth()<<
","<<this->GetSize().GetHeight(),5);
909 VFN_DEBUG_MESSAGE(
"WXCrystMenuBar::WXCrystMenuBar():",6)
910 mpSizer=
new wxBoxSizer(wxHORIZONTAL);
911 this->SetSizer(mpSizer);
916 VFN_DEBUG_MESSAGE(
"WXCrystMenuBar::AddMenu()",6)
917 const long id=ID_CRYST_MENU1+
mvpMenu.size();
918 mvpMenu[menuId]=make_pair(
new wxMenu(wxString::FromAscii(name.c_str())),
919 new wxButton(
this,
id,wxString::FromAscii(name.c_str())));
920 VFN_DEBUG_MESSAGE(
"WXCrystMenuBar::AddMenu():2",6)
921 mvpMenu[menuId].second->Layout();
924 VFN_DEBUG_MESSAGE(
"WXCrystMenuBar::AddMenu():End",6)
930 return *(
mvpMenu[menuId].first);
935 VFN_DEBUG_MESSAGE(
"WXCrystMenuBar::AddMenuItem():",6)
937 this->
GetMenu(menuId).Append(
id,wxString::FromAscii(item.c_str()),wxString::FromAscii(help.c_str()),checkable);
941 wxMenu *subMenu,
const wxString& helpString)
943 VFN_DEBUG_MESSAGE(
"WXCrystMenuBar::AddMenuItem():",6)
945 this->
GetMenu(menuId).Append(
id,item,subMenu,helpString);
957 VFN_DEBUG_MESSAGE(
"WXCrystMenuBar::OnPopupMenu():",6)
961 std::map<long,pair<wxMenu *,wxButton*> >::iterator pos;
962 const int i=
event.GetId();
963 for(pos=
mvpMenu.begin();pos!=
mvpMenu.end();++pos)
if(i==pos->second.second->GetId())
break;
965 this->PopupMenu(pos->second.first,pos->second.second->GetPosition());
The namespace which includes all objects (crystallographic and algorithmic) in ObjCryst++.
void WXCrystValidateAllUserInput()
This function validates all user input (in a WXField) not yet taken into account, if needs be.
WXField * spLastWXFieldInputNotValidated
This pointer records the last wxField in which something was enetered, so that it can be validated wh...
XMLConfigHistory gConfigHistory
Global object to hold configurations history.
std::map< wxWindowID, std::pair< wxPoint, wxSize > > gvWindowPosition
Used to remember window positions.
bool Store()
Store a new configuration.
Class to automatically assign a unique wxID to each window.
Abstract base class for all objects in wxCryst.
virtual ~WXCrystObjBasic()
Destructor.
CrystMutex mMutex
Mutex used to lock data when preparing to update the UI in non-main thread.
virtual void SetToolTip(const wxString &tip)
Set tooltip for this window.
void AddedToList(WXCrystObjBasicList *list)
void RemovedFromList(WXCrystObjBasicList *list)
WXCrystObjBasic * mWXCrystParent
Parent, if a WXCrystObjBasic itself.
bool mNeedUpdateUI
Do we need to update the display ?
virtual void AddChild(WXCrystObjBasic *pChild, bool doBottomLayout=true)
Notify that a new children has been added, also adding it to the correct sizer (which can be the top ...
std::set< WXCrystObjBasicList * > mvpList
WXCrystObjBasicList which are aware of this object, and which should be told on destruction.
A List of WXCrystObjBasic.
void Remove(WXCrystObjBasic *)
remove an object from the list
unsigned int GetNb() const
Number of objects.
void UpdateUI(const bool mutexlock=false)
Forces all objects in the list to update.
void Add(WXCrystObjBasic *)
Add an object to the list.
std::set< WXCrystObjBasic * > mvpWXCrystObj
List of pointers to the objects.
WXCrystObjBasicList()
Constructor.
void CrystUpdate(const bool updateUI=false, const bool mutexlock=false)
Forces all objects in the list to update.
bool Show(bool)
Show or hide all of the windows.
~WXCrystObjBasicList()
Destructor.
Base class for all displayed ObjCryst objects (with a title, and a sizer to stack objects).
WXFieldName * mpWXTitle
The title.
bool mIsExpanded
To be used for collapsing the sub-objects.
wxBoxSizer * mpSizer
Sizer including all sub-objects.
virtual void CrystUpdate(const bool updateUI=false, const bool mutexlock=false)
Get new values to be displayed from the underlying object, and raise flag if an UI update is necessar...
virtual void AddChild(WXCrystObjBasic *pChild, bool doBottomLayout=true)
Notify that a new children has been added, also adding it to the correct sizer (which can be the top ...
WXCrystObjBasicList mList
All windows but the title and collapse button are in this list.
virtual bool OnChangeName(const int id)=0
When a WXFieldName has been changed by the user, it is handled here.
virtual void UpdateUI(const bool mutexlock=false)
Update the User Interface, if necessary.
wxButton * mpCollapseButton
The collapse button.
void OnToggleCollapse(wxCommandEvent &WXUNUSED(event))
Only display the title, and collapse everything else.
This is the abstract base class for all fields, wether they contain a floating-point parameter,...
void SetLabel(const string &)
Change the field's label.
wxStaticText * mpLabel
The label.
virtual bool SetForegroundColour(const wxColour &colour)
Change the colour of the field's title.
WXField(wxWindow *parent, const string &label, const int field_id)
Constructor, specifying the label of the field.
wxBoxSizer * mpSizer
The horizontal sizer in which the title, button, fields, are put.
virtual void SetSize(int width, int height)
Change the size of the field (excluding the title)
virtual void ValidateUserInput()=0
This function shall be called when a new value has been entered.
const int mId
The Id of this field.
A field which directly links to a string.
void Revert()
After a user entry, this allows to go back to the last value, if for some reason the entry was reject...
void OnText(wxCommandEvent &WXUNUSED(event))
Records when text is entered (either from self-updating or user input)
virtual void SetSize(int width, int height)
Change the size of the field (excluding the title)
void SetValue(const string &)
This actually posts an UpdateUI event, so that it is safe to call it from a non-graphic thread.
string mValueOld
Last name displayed, before the value was changed by the user.
void OnEnter(wxCommandEvent &event)
When a new value is entered (must type it and then hit the 'enter' key).
const string GetValue() const
Get the current name.
string mValue
Last name displayed.
bool mIsSelfUpdating
Set to true if the Field is being updated, so that no 'EVT_TEXT' is understood as user input.
wxTextCtrl * mpField
The text window.
virtual void CrystUpdate(const bool updateUI=false, const bool mutexlock=false)
Get new values to be displayed from the underlying object, and raise flag if an UI update is necessar...
virtual void ValidateUserInput()
This function shall be called when a new value has been entered.
virtual void UpdateUI(const bool mutexlock=false)
Update the User Interface, if necessary.
virtual void SetToolTip(const wxString &tip)
Set tooltip for this window. It will be activated when going over the entry field.
string * mpString
The WXCrystObj whose name is shown here.
A field with the name of a WXCrystObj.
virtual void CrystUpdate(const bool updateUI=false, const bool mutexlock=false)
This does nothing.
wxTextCtrl * mpField
The text window.
void SetValue(const string &)
This actually posts an UpdateUI event, so that it is safe to call it from a non-graphic thread.
string mValueOld
Last name displayed, before the value was changed by the user.
bool mIsSelfUpdating
Set to true if the Field is being updated, so that no 'EVT_TEXT' is understood as user input.
void Revert()
After a user entry, this allows to go back to the last value, if for some reason the entry was reject...
virtual void UpdateUI(const bool mutexlock=false)
Update the User Interface, if necessary.
virtual void SetSize(int width, int height)
Change the size of the field (excluding the title)
virtual void SetToolTip(const wxString &tip)
Set tooltip for this window. It will be activated when going over the entry field.
string mValue
Last name displayed.
virtual void ValidateUserInput()
This function shall be called when a new value has been entered.
void OnText(wxCommandEvent &WXUNUSED(event))
Records when text is entered (either from self-updating or user input)
WXCrystObj * mpWXObj
The WXCrystObj whose name is shown here.
void OnEnter(wxCommandEvent &event)
When a new value is entered (must type it and then hit the 'enter' key).
const string GetValue() const
Get the current name.
bool mIsSelfUpdating
Set to true if the Field is being updated, so that no 'EVT_TEXT' is understood as user input.
void OnEnter(wxCommandEvent &WXUNUSED(event))
When a new value is entered (must type it and then hit the 'enter' key).
virtual void SetToolTip(const wxString &tip)
Set tooltip for this window. It will be activated when going over the entry field.
wxString mFormat
Format to be used, default = _T("%8f")
wxTextCtrl * mpField
The field in which the value is written.
virtual void ValidateUserInput()
This function shall be called when a new value has been entered.
virtual void ReadNewValue()=0
Reads the new value when the Enter key is hit.
void OnText(wxCommandEvent &WXUNUSED(event))
Records when text is entered (either from self-updating or user input)
void SetFormat(const wxString &format)
Set Format.
virtual void UpdateUI(const bool mutexlock=false)
Update the User Interface, if necessary.
virtual void CrystUpdate(const bool updateUI=false, const bool mutexlock=false)
This gets a new value from the parameter.
WXFieldPar(wxWindow *parent, const string &label, const int field_id, T *par, const int hsize=65)
Constructor.
void Revert()
After a user entry, this allows to go back to the last value, if for some reason the entry was reject...
virtual void CrystUpdate(const bool updateUI=false, const bool mutexlock=false)
Does nothing.
wxButton * mpButton
The button to be clicked to change the value.
virtual void UpdateUI(const bool mutexlock=false)
Does nothing.
void SetValue(const string &)
Used by the owner to change the name of the choice.
virtual void ValidateUserInput()
Unnecessary here. Any change is immediately taken into account.
Our own local menu bar, using buttons and Popup menus.
wxBoxSizer * mpSizer
The sizer of the menu.
virtual void SetToolTip(const wxString &tip, long menu=0)
Set tooltip for each menu.
wxMenu & GetMenu(const int menuId)
Get access to a menu.
void AddMenuItem(const int menuId, int id, const string &item, const string &help="", const bool checkable=false)
Add an entry to a menu.
std::map< long, pair< wxMenu *, wxButton * > > mvpMenu
List of menus, first is the menu Id and second is a pair of <pointer to the menu, pointer to the butt...
virtual void UpdateUI(const bool mutexlock=false)
Update the User Interface, if necessary.
void AddMenu(const string &name, const int menuId, const string &help="")
Add a menu.
virtual void CrystUpdate(const bool updateUI=false, const bool mutexlock=false)
Get new values to be displayed from the underlying object, and raise flag if an UI update is necessar...
void OnPopupMenu(wxCommandEvent &event)
Event handler to popu the menu when the button is clicked.