23 #include "wx/wxprec.h"
31 #include "ObjCryst/wxCryst/wxScatteringPowerSphere.h"
51 static const long ID_SCATTPOWATOM_MENU_COLOUR=WXCRYST_ID();
52 static const long ID_SCATTPOWATOM_MENU_COLOUR_SETRGB=WXCRYST_ID();
54 BEGIN_EVENT_TABLE(WXScatteringPowerSphere, wxWindow)
55 EVT_MENU(ID_SCATTPOWATOM_MENU_COLOUR_SETRGB, WXScatteringPowerSphere::OnChangeColour)
56 EVT_UPDATE_UI(ID_CRYST_UPDATEUI, WXRefinableObj::OnUpdateUI)
59 WXScatteringPowerSphere::WXScatteringPowerSphere(wxWindow* parent,
60 ScatteringPowerSphere *obj):
61 WXRefinableObj(parent,(RefinableObj*)obj),mpScatteringPower(obj)
63 VFN_DEBUG_MESSAGE(
"WXScatteringPowerSphere::ScatteringPowerSphere()",6)
64 mpWXTitle->SetForegroundColour(wxColour(0,200,0));
66 mpMenuBar->AddMenu("Colour",ID_SCATTPOWATOM_MENU_COLOUR);
67 mpMenuBar->AddMenuItem(ID_SCATTPOWATOM_MENU_COLOUR,
68 ID_SCATTPOWATOM_MENU_COLOUR_SETRGB,"Set RGB Colour");
69 WXCrystObjBasic* pFieldRadius=
70 mpScatteringPower->GetPar(&(mpScatteringPower->mRadius)).WXCreate(this);
71 WXCrystObjBasic* pFieldBiso=
72 mpScatteringPower->GetPar(&(mpScatteringPower->mBiso )).WXCreate(this);
74 mpSizer->Add(pFieldRadius,0,wxALIGN_LEFT);
75 mList.Add(pFieldRadius);
76 mpSizer->Add(pFieldBiso,0,wxALIGN_LEFT);
77 mList.Add(pFieldBiso);
78 this->CrystUpdate(true);
84 VFN_DEBUG_MESSAGE(
"WXScatteringPowerSphere::OnChangeName()",6)
89 void WXScatteringPowerSphere::OnChangeColour(wxCommandEvent & event)
91 const float* oldColour=mpScatteringPower->
GetColourRGB();
100 wxTextEntryDialog dialog(
this,_T(
"Red"),
101 _T(
"Enter Red component (0.<r<1.)"),str,wxOK | wxCANCEL);
102 dialog.SetTextValidator(wxTextValidator(wxFILTER_NUMERIC));
103 if(wxID_OK!=dialog.ShowModal())
105 VFN_DEBUG_EXIT(
"WXScatteringPowerSphere::OnChangeColour():Cancelled",6)
108 dialog.GetValue().ToDouble(&r);
114 wxTextEntryDialog dialog(
this,_T(
"Green"),
115 _T(
"Enter Green component (0.<g<1.)"),str,wxOK | wxCANCEL);
116 dialog.SetTextValidator(wxTextValidator(wxFILTER_NUMERIC));
117 if(wxID_OK!=dialog.ShowModal())
119 VFN_DEBUG_EXIT(
"WXScatteringPowerSphere::OnChangeColour():Cancelled",6)
122 dialog.GetValue().ToDouble(&g);
128 wxTextEntryDialog dialog(
this,_T(
"Blue"),
129 _T(
"Enter Blue component (0.<b<1.)"),str,wxOK | wxCANCEL);
130 dialog.SetTextValidator(wxTextValidator(wxFILTER_NUMERIC));
131 if(wxID_OK!=dialog.ShowModal())
133 VFN_DEBUG_EXIT(
"WXScatteringPowerSphere::OnChangeColour():Cancelled",6)
136 dialog.GetValue().ToDouble(&b);
138 mpScatteringPower->SetColour(r,g,b);
The namespace which includes all objects (crystallographic and algorithmic) in ObjCryst++.
const float * GetColourRGB() const
Get the float[3] array of RGB components defining the colour of this scattering power.
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 ScatteringPowerSphere
virtual void UpdateUI(const bool mutexlock=false)
Update the User Interface, if necessary.