void TreePropertiesDlg::ReplaceColourPicker( wxColourPickerCtrl* wxColourPicker, Colour& colour )
{
	#ifndef WIN32
	wxColourPicker->Hide();
	CustomColourButton* customColourButton = new CustomColourButton( wxColourPicker->GetParent(), wxColourPicker,
		wxColour(colour.GetRedInt(), colour.GetGreenInt(), colour.GetBlueInt()) );

	wxSizer* colourIconSizer = wxColourPicker->GetContainingSizer();
	colourIconSizer->Replace( wxColourPicker, customColourButton );
	colourIconSizer->Layout();

	customColourButton->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( TreePropertiesDlg::OnCustomColourButtonClicked ), NULL, this );
	#endif
}
void TreePropertiesDlg::OnCustomColourButtonClicked( wxMouseEvent& event )
{
	// Retrieve the CustomColourButton object that was clicked
	CustomColourButton* customColourButton = ( CustomColourButton* )event.GetEventObject();

	// Create and open the colour picker dialog
	wxColourData *colourData = new wxColourData();
	colourData->SetColour( customColourButton->GetBackgroundColour() );
	wxColourDialog *colourPicker = new wxColourDialog( this, colourData );
	if ( colourPicker->ShowModal() == wxID_CANCEL ) return;

	// Set the CustomColourButton background colour (used for display under Mac/Unix releases)
	customColourButton->SetBackgroundColour( colourPicker->GetColourData().GetColour() );
	customColourButton->Refresh();

	// Set the wxColourPickerCtrl colour picker (hidden, but its value will be used to change the location colour)
	customColourButton->GetWXColourPickerCtrl()->SetColour( colourPicker->GetColourData().GetColour() );
}
示例#3
0
void StudyPropertiesDlg::Init()
{
	// set the title of the properties dialog
	this->SetLabel( wxString(m_studyLayer->GetName().c_str()) + wxT( " : Study Properties" ) );

	// set state of controls on General page
	m_txtLayerName->SetValue(wxString(m_studyLayer->GetName().c_str()));
	m_txtLayerDescription->SetValue(wxString(m_studyLayer->GetDescription().c_str()));
	m_txtAuthours->SetValue(wxString(m_studyLayer->GetAuthours().c_str()));

	// set state of controls on Projection page
	StudyControllerPtr studyController = m_studyLayer->GetStudyController();
	m_cboDatum->SetValue(wxString(studyController->GetDatum().c_str()));
	m_cboProjection->SetValue(wxString(studyController->GetProjection().c_str()));

	// set state of controls on Symbology page
	Colour bgColour = App::Inst().GetViewport()->GetBackgroundColour();
	m_colourBackground->SetColour(wxColour(bgColour.GetRedInt(), bgColour.GetGreenInt(), bgColour.GetBlueInt()));

	#ifndef WIN32
	m_colourBackground->Hide();

	CustomColourButton* customColourButton = new CustomColourButton( m_colourBackground->GetParent(), m_colourBackground,
		wxColour(bgColour.GetRedInt(), bgColour.GetGreenInt(), bgColour.GetBlueInt()) );

	wxSizer* colourIconSizer = m_colourBackground->GetContainingSizer();
	colourIconSizer->Replace( m_colourBackground, customColourButton );
	colourIconSizer->Layout();

	customColourButton->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( StudyPropertiesDlg::OnCustomColourButtonClicked ), NULL, this );
	#endif

	int maxTerrainResolution = App::Inst().GetViewport()->GetMaxTerrainResolution();
	if      (maxTerrainResolution == 256)  m_cboTerrainResolution->SetValue(_T("256"));
	else if (maxTerrainResolution == 512)  m_cboTerrainResolution->SetValue(_T("512"));
	else if (maxTerrainResolution == 1024) m_cboTerrainResolution->SetValue(_T("1024"));
	else if (maxTerrainResolution == 2048) m_cboTerrainResolution->SetValue(_T("2048"));
	else if (maxTerrainResolution == 4096) m_cboTerrainResolution->SetValue(_T("4096"));
	else if (maxTerrainResolution == 8196) m_cboTerrainResolution->SetValue(_T("8196"));
}