23 #include "wx/wxprec.h"
31 #include "ObjCryst/wxCryst/wxScatteringPower.h"
51 static const long ID_WXSCATTPOWATOM_SYMBOL =WXCRYST_ID();
52 static const long ID_SCATTPOWATOM_MENU_COLOUR =WXCRYST_ID();
53 static const long ID_SCATTPOWATOM_MENU_COLOUR_SETRGB=WXCRYST_ID();
55 BEGIN_EVENT_TABLE(WXScatteringPowerAtom, wxWindow)
56 EVT_MENU(ID_SCATTPOWATOM_MENU_COLOUR_SETRGB, WXScatteringPowerAtom::OnChangeColour)
57 EVT_UPDATE_UI(ID_CRYST_UPDATEUI, WXRefinableObj::OnUpdateUI)
60 WXScatteringPowerAtom::WXScatteringPowerAtom(wxWindow* parent, ScatteringPowerAtom *obj):
61 WXRefinableObj(parent,(RefinableObj*)obj),mpScatteringPowerAtom(obj)
63 VFN_DEBUG_MESSAGE(
"WXScatteringPowerAtom::WXScatteringPowerAtom()",6)
64 mpWXTitle->SetForegroundColour(wxColour(0,200,0));
66 mpFieldSymbol=new WXFieldName
67 (this,"Symbol:",this,ID_WXSCATTPOWATOM_SYMBOL);
69 mpTopSizer->Add(mpFieldSymbol ,0,wxALIGN_TOP);
70 mList.Add(mpFieldSymbol);
72 this->BottomLayout(0);
73 this->CrystUpdate(true);
78 VFN_DEBUG_MESSAGE(
"WXScatteringPowerAtom::OnChangeName()",6)
80 if(
id==ID_WXSCATTPOWATOM_SYMBOL)
82 VFN_DEBUG_MESSAGE(
"WXScatteringPowerAtom::OnChangeName():Changing Symbol",6)
83 mpScatteringPowerAtom->Init(mpScatteringPowerAtom->GetName(),
84 mpFieldSymbol->GetValue(),
85 mpScatteringPowerAtom->GetBiso());
91 void WXScatteringPowerAtom::OnChangeColour(wxCommandEvent & event)
93 VFN_DEBUG_ENTRY(
"WXScatteringPowerAtom::OnChangeColour()",6)
94 const
float* oldColour=mpScatteringPowerAtom->GetColourRGB();
103 wxTextEntryDialog dialog(
this,_T(
"Red"),
104 _T(
"Enter Red component (0.<r<1.)"),str,wxOK | wxCANCEL);
105 dialog.SetTextValidator(wxTextValidator(wxFILTER_NUMERIC));
106 if(wxID_OK!=dialog.ShowModal())
108 VFN_DEBUG_EXIT(
"WXScatteringPowerAtom::OnChangeColour():Cancelled",6)
111 dialog.GetValue().ToDouble(&r);
117 wxTextEntryDialog dialog(
this,_T(
"Green"),
118 _T(
"Enter Green component (0.<g<1.)"),str,wxOK | wxCANCEL);
119 dialog.SetTextValidator(wxTextValidator(wxFILTER_NUMERIC));
120 if(wxID_OK!=dialog.ShowModal())
122 VFN_DEBUG_EXIT(
"WXScatteringPowerAtom::OnChangeColour():Cancelled",6)
125 dialog.GetValue().ToDouble(&g);
131 wxTextEntryDialog dialog(
this,_T(
"Blue"),
132 _T(
"Enter Blue component (0.<b<1.)"),str,wxOK | wxCANCEL);
133 dialog.SetTextValidator(wxTextValidator(wxFILTER_NUMERIC));
134 if(wxID_OK!=dialog.ShowModal())
136 VFN_DEBUG_EXIT(
"WXScatteringPowerAtom::OnChangeColour():Cancelled",6)
139 dialog.GetValue().ToDouble(&b);
141 mpScatteringPowerAtom->SetColour(r,g,b);
146 VFN_DEBUG_ENTRY(
"WXScatteringPowerAtom::UpdateUI()",3)
151 VFN_DEBUG_EXIT(
"WXScatteringPowerAtom::UpdateUI()",3)
The namespace which includes all objects (crystallographic and algorithmic) in ObjCryst++.
virtual const string & GetSymbol() const
Returns the symbol ('Ta', 'O2-',...) of the atom.
CrystMutex mMutex
Mutex used to lock data when preparing to update the UI in non-main thread.
void SetValue(const string &)
This actually posts an UpdateUI event, so that it is safe to call it from a non-graphic thread.
virtual bool OnChangeName(const int id)
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.
wxCryst class for ScatteringPowerAtom
virtual void UpdateUI(const bool mutexlock=false)
Update the User Interface, if necessary.