mirror of
https://github.com/Heretek-AI/GDevelop.git
synced 2026-07-24 11:55:28 -04:00
8672f179e9
Gui elements in SceneCanvas are now independant from the zoom factor. Work in progress: NewProjectDialog. git-svn-id: svn://localhost@837 8062f311-0dae-4547-b526-b8ab9ac864a5
101 lines
3.4 KiB
C++
101 lines
3.4 KiB
C++
/** \file
|
|
* Game Develop
|
|
* 2008-2012 Florian Rival (Florian.Rival@gmail.com)
|
|
*/
|
|
#include "ProjectPropertiesPnl.h"
|
|
|
|
//(*InternalHeaders(ProjectPropertiesPnl)
|
|
#include <wx/intl.h>
|
|
#include <wx/string.h>
|
|
//*)
|
|
#include <wx/settings.h>
|
|
#include <wx/treectrl.h>
|
|
#include "GDCore/PlatformDefinition/Project.h"
|
|
#include "../ProjectManager.h"
|
|
|
|
//(*IdInit(ProjectPropertiesPnl)
|
|
const long ProjectPropertiesPnl::ID_PROPGRID = wxNewId();
|
|
//*)
|
|
|
|
BEGIN_EVENT_TABLE(ProjectPropertiesPnl,wxPanel)
|
|
//(*EventTable(ProjectPropertiesPnl)
|
|
//*)
|
|
END_EVENT_TABLE()
|
|
|
|
ProjectPropertiesPnl::ProjectPropertiesPnl(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size) :
|
|
project(NULL),
|
|
associatedProjectManager(NULL),
|
|
associatedTree(NULL)
|
|
{
|
|
//(*Initialize(ProjectPropertiesPnl)
|
|
wxFlexGridSizer* FlexGridSizer1;
|
|
|
|
Create(parent, id, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("id"));
|
|
FlexGridSizer1 = new wxFlexGridSizer(0, 3, 0, 0);
|
|
FlexGridSizer1->AddGrowableCol(0);
|
|
FlexGridSizer1->AddGrowableRow(0);
|
|
propertyGrid = new wxPropertyGrid(this,ID_PROPGRID,wxDefaultPosition,wxSize(359,438),0,_T("ID_PROPGRID"));
|
|
FlexGridSizer1->Add(propertyGrid, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
|
|
SetSizer(FlexGridSizer1);
|
|
FlexGridSizer1->Fit(this);
|
|
FlexGridSizer1->SetSizeHints(this);
|
|
//*)
|
|
Connect(ID_PROPGRID, wxEVT_PG_SELECTED, (wxObjectEventFunction)&ProjectPropertiesPnl::OnPropertySelected);
|
|
Connect(ID_PROPGRID, wxEVT_PG_CHANGED, (wxObjectEventFunction)&ProjectPropertiesPnl::OnPropertyChanged);
|
|
|
|
wxColour my_grey_1(212,208,200);
|
|
wxColour my_grey_2(217,226,226);
|
|
propertyGrid->SetMarginColour( wxSystemSettings::GetColour(wxSYS_COLOUR_MENU) );
|
|
propertyGrid->SetCaptionBackgroundColour( wxSystemSettings::GetColour(wxSYS_COLOUR_MENU) );
|
|
propertyGrid->SetEmptySpaceColour( wxSystemSettings::GetColour(wxSYS_COLOUR_MENU) );
|
|
propertyGrid->SetCellBackgroundColour( *wxWHITE );
|
|
propertyGrid->SetCellTextColour( *wxBLACK );
|
|
propertyGrid->SetLineColour( my_grey_1 );
|
|
}
|
|
|
|
ProjectPropertiesPnl::~ProjectPropertiesPnl()
|
|
{
|
|
//(*Destroy(ProjectPropertiesPnl)
|
|
//*)
|
|
}
|
|
|
|
void ProjectPropertiesPnl::SetProject(gd::Project * project_)
|
|
{
|
|
project = project_;
|
|
propertyGrid->Clear();
|
|
|
|
if ( project != NULL )
|
|
{
|
|
project->PopulatePropertyGrid(propertyGrid);
|
|
propertyGrid->SetPropertyAttributeAll(wxPG_BOOL_USE_CHECKBOX, true);
|
|
}
|
|
}
|
|
|
|
void ProjectPropertiesPnl::OnPropertySelected(wxPropertyGridEvent& event)
|
|
{
|
|
if (project != NULL) project->OnSelectionInPropertyGrid(propertyGrid, event);
|
|
}
|
|
|
|
void ProjectPropertiesPnl::OnPropertyChanged(wxPropertyGridEvent& event)
|
|
{
|
|
if (project != NULL) project->OnChangeInPropertyGrid(propertyGrid, event);
|
|
|
|
if ( event.GetPropertyName() == _("Name of the project") && associatedTree != NULL)
|
|
associatedTree->SetItemText(associatedTreeItem, event.GetProperty()->GetValue());
|
|
|
|
if ( event.GetPropertyName() == _("Activate the use of C++ source files") && associatedProjectManager != NULL)
|
|
associatedProjectManager->Refresh();
|
|
}
|
|
|
|
void ProjectPropertiesPnl::SetAssociatedTreeCtrlProjectItem(wxTreeCtrl * tree, wxTreeItemId item)
|
|
{
|
|
associatedTree = tree;
|
|
associatedTreeItem = item;
|
|
}
|
|
|
|
void ProjectPropertiesPnl::SetAssociatedProjectManager(ProjectManager * associatedProjectManager_)
|
|
{
|
|
associatedProjectManager = associatedProjectManager_;
|
|
}
|
|
|