2008-09-12 16:57:41 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: samples/propgrid/propgrid.h
|
|
|
|
// Purpose: wxPropertyGrid sample
|
|
|
|
// Author: Jaakko Salli
|
|
|
|
// Modified by:
|
|
|
|
// Created: 2004-09-25
|
|
|
|
// Copyright: (c) Jaakko Salli
|
2010-07-13 09:29:13 -04:00
|
|
|
// Licence: wxWindows licence
|
2008-09-12 16:57:41 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_SAMPLES_PROPGRID_PROPGRID_H_
|
|
|
|
#define _WX_SAMPLES_PROPGRID_PROPGRID_H_
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
class wxAdvImageFileProperty : public wxFileProperty
|
|
|
|
{
|
|
|
|
WX_PG_DECLARE_PROPERTY_CLASS(wxAdvImageFileProperty)
|
|
|
|
public:
|
|
|
|
|
|
|
|
wxAdvImageFileProperty( const wxString& label = wxPG_LABEL,
|
|
|
|
const wxString& name = wxPG_LABEL,
|
|
|
|
const wxString& value = wxEmptyString );
|
|
|
|
virtual ~wxAdvImageFileProperty ();
|
|
|
|
|
|
|
|
virtual void OnSetValue(); // Override to allow image loading.
|
|
|
|
|
2008-09-19 13:13:51 -04:00
|
|
|
virtual bool IntToValue( wxVariant& variant, int number, int argFlags = 0 ) const;
|
|
|
|
virtual bool OnEvent( wxPropertyGrid* propgrid, wxWindow* primary, wxEvent& event );
|
|
|
|
virtual wxSize OnMeasureImage( int item ) const;
|
|
|
|
virtual void OnCustomPaint( wxDC& dc,
|
|
|
|
const wxRect& rect, wxPGPaintData& paintdata );
|
2008-09-12 16:57:41 -04:00
|
|
|
|
|
|
|
void LoadThumbnails( size_t n );
|
|
|
|
|
|
|
|
protected:
|
|
|
|
wxImage* m_pImage; // Temporary thumbnail data.
|
|
|
|
|
|
|
|
static wxPGChoices ms_choices;
|
|
|
|
|
|
|
|
int m_index; // Index required for choice behaviour.
|
|
|
|
};
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
class wxVector3f
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxVector3f()
|
|
|
|
{
|
|
|
|
x = y = z = 0.0;
|
|
|
|
}
|
|
|
|
wxVector3f( double x, double y, double z )
|
|
|
|
{
|
|
|
|
x = x; y = y; z = z;
|
|
|
|
}
|
|
|
|
|
|
|
|
double x, y, z;
|
|
|
|
};
|
|
|
|
|
|
|
|
inline bool operator == (const wxVector3f& a, const wxVector3f& b)
|
|
|
|
{
|
|
|
|
return (a.x == b.x && a.y == b.y && a.z == b.z);
|
|
|
|
}
|
|
|
|
|
2008-09-16 11:55:53 -04:00
|
|
|
WX_PG_DECLARE_VARIANT_DATA(wxVector3f)
|
2008-09-12 16:57:41 -04:00
|
|
|
|
|
|
|
class wxVectorProperty : public wxPGProperty
|
|
|
|
{
|
|
|
|
WX_PG_DECLARE_PROPERTY_CLASS(wxVectorProperty)
|
|
|
|
public:
|
|
|
|
|
|
|
|
wxVectorProperty( const wxString& label = wxPG_LABEL,
|
2009-02-07 20:01:00 -05:00
|
|
|
const wxString& name = wxPG_LABEL,
|
|
|
|
const wxVector3f& value = wxVector3f() );
|
2008-09-12 16:57:41 -04:00
|
|
|
virtual ~wxVectorProperty();
|
|
|
|
|
2009-06-07 03:52:53 -04:00
|
|
|
virtual wxVariant ChildChanged( wxVariant& thisValue,
|
|
|
|
int childIndex,
|
|
|
|
wxVariant& childValue ) const;
|
2008-09-19 13:13:51 -04:00
|
|
|
virtual void RefreshChildren();
|
2008-09-12 16:57:41 -04:00
|
|
|
|
|
|
|
protected:
|
|
|
|
};
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
class wxTriangle
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxVector3f a, b, c;
|
|
|
|
};
|
|
|
|
|
|
|
|
inline bool operator == (const wxTriangle& a, const wxTriangle& b)
|
|
|
|
{
|
|
|
|
return (a.a == b.a && a.b == b.b && a.c == b.c);
|
|
|
|
}
|
|
|
|
|
2008-09-16 11:55:53 -04:00
|
|
|
WX_PG_DECLARE_VARIANT_DATA(wxTriangle)
|
2008-09-12 16:57:41 -04:00
|
|
|
|
|
|
|
class wxTriangleProperty : public wxPGProperty
|
|
|
|
{
|
|
|
|
WX_PG_DECLARE_PROPERTY_CLASS(wxTriangleProperty)
|
|
|
|
public:
|
|
|
|
|
|
|
|
wxTriangleProperty( const wxString& label = wxPG_LABEL,
|
|
|
|
const wxString& name = wxPG_LABEL,
|
|
|
|
const wxTriangle& value = wxTriangle() );
|
|
|
|
virtual ~wxTriangleProperty();
|
|
|
|
|
2009-06-07 03:52:53 -04:00
|
|
|
virtual wxVariant ChildChanged( wxVariant& thisValue,
|
|
|
|
int childIndex,
|
|
|
|
wxVariant& childValue ) const;
|
2008-09-19 13:13:51 -04:00
|
|
|
virtual void RefreshChildren();
|
2008-09-12 16:57:41 -04:00
|
|
|
|
|
|
|
protected:
|
|
|
|
};
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
ID_COLOURSCHEME4 = 100
|
|
|
|
};
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
class FormMain : public wxFrame
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
FormMain(const wxString& title, const wxPoint& pos, const wxSize& size );
|
2009-02-07 20:01:00 -05:00
|
|
|
~FormMain();
|
2008-09-12 16:57:41 -04:00
|
|
|
|
|
|
|
wxPropertyGridManager* m_pPropGridManager;
|
|
|
|
wxPropertyGrid* m_propGrid;
|
|
|
|
|
|
|
|
wxTextCtrl* m_tcPropLabel;
|
|
|
|
wxWindow* m_panel;
|
|
|
|
wxBoxSizer* m_topSizer;
|
|
|
|
|
2009-12-12 04:59:20 -05:00
|
|
|
#if wxUSE_LOGWINDOW
|
|
|
|
wxLogWindow* m_logWindow;
|
|
|
|
#endif
|
|
|
|
|
2008-09-27 11:29:50 -04:00
|
|
|
wxPGEditor* m_pSampleMultiButtonEditor;
|
2008-09-12 16:57:41 -04:00
|
|
|
wxPGChoices m_combinedFlags;
|
|
|
|
|
|
|
|
wxMenuItem* m_itemCatColours;
|
|
|
|
wxMenuItem* m_itemFreeze;
|
|
|
|
wxMenuItem* m_itemEnable;
|
2009-12-12 04:38:10 -05:00
|
|
|
wxMenuItem* m_itemVetoDragging;
|
2008-09-12 16:57:41 -04:00
|
|
|
|
|
|
|
wxVariant m_storedValues;
|
|
|
|
|
|
|
|
wxString m_savedState;
|
|
|
|
|
|
|
|
|
|
|
|
void CreateGrid( int style, int extraStyle );
|
2008-10-16 13:31:46 -04:00
|
|
|
void FinalizeFramePosition();
|
2008-09-12 16:57:41 -04:00
|
|
|
|
|
|
|
// These are used in CreateGrid(), and in tests to compose
|
|
|
|
// grids for testing purposes.
|
|
|
|
void InitPanel();
|
|
|
|
void PopulateGrid();
|
|
|
|
void FinalizePanel( bool wasCreated = true );
|
|
|
|
|
|
|
|
void PopulateWithStandardItems();
|
|
|
|
void PopulateWithExamples();
|
|
|
|
void PopulateWithLibraryConfig();
|
|
|
|
|
|
|
|
void OnCloseClick( wxCommandEvent& event );
|
|
|
|
void OnLabelTextChange( wxCommandEvent& event );
|
|
|
|
|
|
|
|
void OnColourScheme( wxCommandEvent& event );
|
|
|
|
|
|
|
|
void OnInsertPropClick( wxCommandEvent& event );
|
|
|
|
void OnAppendPropClick( wxCommandEvent& event );
|
|
|
|
void OnClearClick( wxCommandEvent& event );
|
|
|
|
void OnAppendCatClick( wxCommandEvent& event );
|
|
|
|
void OnInsertCatClick( wxCommandEvent& event );
|
|
|
|
void OnDelPropClick( wxCommandEvent& event );
|
|
|
|
void OnDelPropRClick( wxCommandEvent& event );
|
|
|
|
|
|
|
|
void OnContextMenu( wxContextMenuEvent& event );
|
|
|
|
|
|
|
|
void OnEnableDisable( wxCommandEvent& event );
|
2010-01-31 13:14:24 -05:00
|
|
|
void OnSetReadOnly( wxCommandEvent& event );
|
2010-02-25 09:04:25 -05:00
|
|
|
void OnHide( wxCommandEvent& event );
|
2008-10-31 14:53:37 -04:00
|
|
|
void OnSetBackgroundColour( wxCommandEvent& event );
|
2008-09-12 16:57:41 -04:00
|
|
|
void OnClearModifyStatusClick( wxCommandEvent& event );
|
|
|
|
void OnFreezeClick( wxCommandEvent& event );
|
2009-08-23 11:31:03 -04:00
|
|
|
void OnEnableLabelEditing( wxCommandEvent& event );
|
2009-12-13 07:00:04 -05:00
|
|
|
void OnShowHeader( wxCommandEvent& event );
|
2008-09-12 16:57:41 -04:00
|
|
|
void OnDumpList( wxCommandEvent& event );
|
|
|
|
void OnCatColours( wxCommandEvent& event );
|
|
|
|
void OnSetColumns( wxCommandEvent& event );
|
|
|
|
void OnMisc( wxCommandEvent& event );
|
|
|
|
void OnPopulateClick( wxCommandEvent& event );
|
|
|
|
void OnSetSpinCtrlEditorClick( wxCommandEvent& event );
|
|
|
|
void OnTestReplaceClick( wxCommandEvent& event );
|
|
|
|
void OnTestXRC( wxCommandEvent& event );
|
|
|
|
void OnEnableCommonValues( wxCommandEvent& event );
|
|
|
|
void OnSelectStyle( wxCommandEvent& event );
|
|
|
|
|
|
|
|
void OnFitColumnsClick( wxCommandEvent& event );
|
|
|
|
|
|
|
|
void OnChangeFlagsPropItemsClick( wxCommandEvent& event );
|
|
|
|
|
|
|
|
void OnSaveToFileClick( wxCommandEvent& event );
|
|
|
|
void OnLoadFromFileClick( wxCommandEvent& event );
|
|
|
|
|
|
|
|
void OnSetPropertyValue( wxCommandEvent& event );
|
|
|
|
void OnInsertChoice( wxCommandEvent& event );
|
|
|
|
void OnDeleteChoice( wxCommandEvent& event );
|
|
|
|
void OnInsertPage( wxCommandEvent& event );
|
|
|
|
void OnRemovePage( wxCommandEvent& event );
|
|
|
|
|
|
|
|
void OnSaveState( wxCommandEvent& event );
|
|
|
|
void OnRestoreState( wxCommandEvent& event );
|
|
|
|
|
|
|
|
void OnRunMinimalClick( wxCommandEvent& event );
|
|
|
|
|
|
|
|
void OnIterate1Click( wxCommandEvent& event );
|
|
|
|
void OnIterate2Click( wxCommandEvent& event );
|
|
|
|
void OnIterate3Click( wxCommandEvent& event );
|
|
|
|
void OnIterate4Click( wxCommandEvent& event );
|
|
|
|
|
2010-06-12 05:30:57 -04:00
|
|
|
void OnExtendedKeyNav( wxCommandEvent& event );
|
|
|
|
|
2008-09-12 16:57:41 -04:00
|
|
|
void OnPropertyGridChange( wxPropertyGridEvent& event );
|
|
|
|
void OnPropertyGridChanging( wxPropertyGridEvent& event );
|
|
|
|
void OnPropertyGridSelect( wxPropertyGridEvent& event );
|
|
|
|
void OnPropertyGridHighlight( wxPropertyGridEvent& event );
|
|
|
|
void OnPropertyGridItemRightClick( wxPropertyGridEvent& event );
|
|
|
|
void OnPropertyGridItemDoubleClick( wxPropertyGridEvent& event );
|
|
|
|
void OnPropertyGridPageChange( wxPropertyGridEvent& event );
|
|
|
|
void OnPropertyGridButtonClick( wxCommandEvent& event );
|
|
|
|
void OnPropertyGridTextUpdate( wxCommandEvent& event );
|
|
|
|
void OnPropertyGridKeyEvent( wxKeyEvent& event );
|
|
|
|
void OnPropertyGridItemCollapse( wxPropertyGridEvent& event );
|
|
|
|
void OnPropertyGridItemExpand( wxPropertyGridEvent& event );
|
2009-08-23 11:31:03 -04:00
|
|
|
void OnPropertyGridLabelEditBegin( wxPropertyGridEvent& event );
|
|
|
|
void OnPropertyGridLabelEditEnding( wxPropertyGridEvent& event );
|
2009-12-12 04:38:10 -05:00
|
|
|
void OnPropertyGridColBeginDrag( wxPropertyGridEvent& event );
|
|
|
|
void OnPropertyGridColDragging( wxPropertyGridEvent& event );
|
|
|
|
void OnPropertyGridColEndDrag( wxPropertyGridEvent& event );
|
2008-09-12 16:57:41 -04:00
|
|
|
|
|
|
|
void OnAbout( wxCommandEvent& event );
|
|
|
|
|
|
|
|
void OnMove( wxMoveEvent& event );
|
|
|
|
void OnResize( wxSizeEvent& event );
|
|
|
|
void OnPaint( wxPaintEvent& event );
|
|
|
|
void OnCloseEvent( wxCloseEvent& event );
|
|
|
|
|
|
|
|
void OnIdle( wxIdleEvent& event );
|
|
|
|
|
|
|
|
void AddTestProperties( wxPropertyGridPage* pg );
|
|
|
|
|
|
|
|
bool RunTests( bool fullTest, bool interactive = false );
|
|
|
|
|
|
|
|
private:
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
};
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
class cxApplication : public wxApp
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
virtual bool OnInit();
|
|
|
|
|
|
|
|
private:
|
|
|
|
FormMain *Form1;
|
|
|
|
};
|
|
|
|
|
|
|
|
DECLARE_APP(cxApplication)
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
#endif // _WX_SAMPLES_PROPGRID_PROPGRID_H_
|