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 if(wxID_OK!=dialog.ShowModal())
107 VFN_DEBUG_EXIT(
"WXScatteringPowerAtom::OnChangeColour():Cancelled",6)
110 dialog.GetValue().ToDouble(&r);
116 wxTextEntryDialog dialog(
this,_T(
"Green"),
117 _T(
"Enter Green component (0.<g<1.)"),str,wxOK | wxCANCEL);
118 if(wxID_OK!=dialog.ShowModal())
120 VFN_DEBUG_EXIT(
"WXScatteringPowerAtom::OnChangeColour():Cancelled",6)
123 dialog.GetValue().ToDouble(&g);
129 wxTextEntryDialog dialog(
this,_T(
"Blue"),
130 _T(
"Enter Blue component (0.<b<1.)"),str,wxOK | wxCANCEL);
131 if(wxID_OK!=dialog.ShowModal())
133 VFN_DEBUG_EXIT(
"WXScatteringPowerAtom::OnChangeColour():Cancelled",6)
136 dialog.GetValue().ToDouble(&b);
138 mpScatteringPowerAtom->SetColour(r,g,b);
143 VFN_DEBUG_ENTRY(
"WXScatteringPowerAtom::UpdateUI()",3)
148 VFN_DEBUG_EXIT(
"WXScatteringPowerAtom::UpdateUI()",3)
void SetValue(const string &)
This actually posts an UpdateUI event, so that it is safe to call it from a non-graphic thread...
CrystMutex mMutex
Mutex used to lock data when preparing to update the UI in non-main thread.
virtual void UpdateUI(const bool mutexlock=false)
Update the User Interface, if necessary.
virtual const string & GetSymbol() const
Returns the symbol ('Ta', 'O2-',...) of the atom.
virtual void UpdateUI(const bool mutexlock=false)
Update the User Interface, if necessary.
wxCryst class for ScatteringPowerAtom
The namespace which includes all objects (crystallographic and algorithmic) in ObjCryst++.
virtual bool OnChangeName(const int id)
When a WXFieldName has been changed by the user, it is handled here.