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 if(wxID_OK!=dialog.ShowModal())
104 VFN_DEBUG_EXIT(
"WXScatteringPowerSphere::OnChangeColour():Cancelled",6)
107 dialog.GetValue().ToDouble(&r);
113 wxTextEntryDialog dialog(
this,_T(
"Green"),
114 _T(
"Enter Green component (0.<g<1.)"),str,wxOK | wxCANCEL);
115 if(wxID_OK!=dialog.ShowModal())
117 VFN_DEBUG_EXIT(
"WXScatteringPowerSphere::OnChangeColour():Cancelled",6)
120 dialog.GetValue().ToDouble(&g);
126 wxTextEntryDialog dialog(
this,_T(
"Blue"),
127 _T(
"Enter Blue component (0.<b<1.)"),str,wxOK | wxCANCEL);
128 if(wxID_OK!=dialog.ShowModal())
130 VFN_DEBUG_EXIT(
"WXScatteringPowerSphere::OnChangeColour():Cancelled",6)
133 dialog.GetValue().ToDouble(&b);
135 mpScatteringPower->SetColour(r,g,b);
virtual void UpdateUI(const bool mutexlock=false)
Update the User Interface, if necessary.
virtual void UpdateUI(const bool mutexlock=false)
Update the User Interface, if necessary.
The namespace which includes all objects (crystallographic and algorithmic) in ObjCryst++.
wxCryst class for ScatteringPowerSphere
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.