Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

PropertyGrid support.

Ignore-this: fba1166bac06e76782638a974d64147e

Merge PropertyGrid support from Dave Tapley's branch. This contains items
from the following patches:

Sat Nov 12 20:46:48 GMT 2011  dukedave@gmail.com
  * Wrap wxPGProperty_SetHelpString

Fri Nov 11 18:23:11 GMT 2011  dukedave@gmail.com
  * Wrapped wxPropertyGrid DisableProperty and added usage to sample

Tue Oct  4 00:33:05 BST 2011  dukedave@gmail.com
  * Make PropertyGrid sample more user friendly

Mon Oct  3 23:38:07 BST 2011  dukedave@gmail.com
  * Make the PropertyGrid example a little bigger

Mon Oct  3 23:37:44 BST 2011  dukedave@gmail.com
  * Wrapped wxPropertyCategory

Mon Oct  3 22:47:48 BST 2011  dukedave@gmail.com
  * Clean up the wxPropertyGrid sample

Sat Oct  1 22:25:15 BST 2011  dukedave@gmail.com
  * Print out the parse error when one is encountered running wxdirect

Sat Oct  1 22:24:32 BST 2011  dukedave@gmail.com
  * Wrap extra PGProperty subclasses

Fri Sep 30 02:49:11 BST 2011  dukedave@gmail.com
  * Set label, name and value when creating PGProperty subclasses
  Ideally I'd keep the default PGProperty constructors and wrap the Set.. functions,
  however I tried this and SetValue doesn't play nicely (throwing a run-time assertion
  about the value being a user defined one, which is confusing).

Thu Sep 29 23:40:35 BST 2011  dukedave@gmail.com
  * Updated PropertyGrid sample

Thu Sep 29 22:45:28 BST 2011  dukedave@gmail.com
  * Wrapped extra code for wxPropertyGrid, some refactoring

Thu Sep 22 22:22:30 BST 2011  dukedave@gmail.com
  * Fix for Prelude.chr error using wxString in wx-2.9
  This is a fix for the problem reported here:
  http://sourceforge.net/mailarchive/message.php?msg_id=28116578

Thu Sep 22 22:21:57 BST 2011  dukedave@gmail.com
  * Clearer logging for the PropertyGrid sample code

Thu Sep 22 22:20:46 BST 2011  dukedave@gmail.com
  * Added wxEVT_PG_CHANGED and test code

Thu Sep 22 22:13:11 BST 2011  dukedave@gmail.com
  * Fix segfault with wxPGProperty caused returning local wxString
  The initial implementation of wxPGProperty was causing a segfault,
  after comparing my approach to that used by existing methods I noticed
  that they all return wxString* (i.e. a pointer and not a copy) and use
  pattern [1], after modifying wxPGProperty to do the same the segfault
  went away.

  [1]
      wxString *result = new wxString();
      *result = self->FuncWhichReturnswxString();
      return result;
Tue Aug 30 23:42:08 BST 2011  dukedave@gmail.com
  * Added wxStringProperty and wxPropertyGrid_Append
  I'm also updated the PropertyGrid.hs sample, to create a couple of wxStringProperty's and
  wxPropertyGrid_Append them; and updated the highlighted call back to print the label name
  when an item is hovered over, unfortunately this causes a segfault presently.

Fri Aug 26 06:25:25 BST 2011  dukedave@gmail.com
  * Added wxPropertyGridEvent_HasProperty, made PropertyGridHighlighted have a Maybe PGProperty

Fri Aug 26 01:01:27 BST 2011  dukedave@gmail.com
  * Wrapping wxPropertyGrid

darcs-hash:20120325113657-75908-a48d980c5b338054e3855404c2b960ee8cce7d53.gz
  • Loading branch information...
commit 7cb7075058d005d83ad47f0797c197f5f124e9bd 1 parent a66efa7
@jodonoghue authored
Showing with 127 additions and 0 deletions.
  1. +11 −0 wxc/src/cpp/eljevent.cpp
  2. +116 −0 wxc/src/cpp/extra.cpp
View
11 wxc/src/cpp/eljevent.cpp
@@ -1059,6 +1059,17 @@ EWXWEXPORT(void,wxHelpEvent_SetTarget)(wxHelpEvent* self,wxString* target)
self->SetTarget(*target);
}
+EWXWEXPORT(bool,wxPropertyGridEvent_HasProperty)(wxPropertyGridEvent* self)
+{
+ return self->GetProperty() != 0;
+}
+
+EWXWEXPORT(wxPGProperty*,wxPropertyGridEvent_GetProperty)(wxPropertyGridEvent* self)
+{
+ wxPGProperty* const prop = self->GetProperty();
+ return prop == 0 ? new wxPGProperty() : prop;
+}
+
////////////////////////////////////////////////////////////////////////////////
// Event wrappers
////////////////////////////////////////////////////////////////////////////////
View
116 wxc/src/cpp/extra.cpp
@@ -6,6 +6,8 @@
#include "wx/grid.h"
#include "wx/fileconf.h"
#include "wx/spinctrl.h"
+#include "wx/propgrid/propgrid.h"
+#include "wx/propgrid/advprops.h"
#include <wx/numdlg.h>
#include <wx/power.h>
@@ -2427,5 +2429,119 @@ EWXWEXPORT(wxFileConfig*,wxFileConfig_Create)(wxInputStream* inp)
return new wxFileConfig( *inp );
}
+/*-----------------------------------------------------------------------------
+ PropertyGrid
+-----------------------------------------------------------------------------*/
+EWXWEXPORT(void*,wxPropertyGrid_Append)(wxPropertyGrid* self, wxPGProperty * property)
+{
+ return (void*) self->Append(property);
+}
+
+EWXWEXPORT(void*,wxPropertyGrid_Create)(wxWindow* _prt,int _id, int _lft,int _top,int _wdt,int _hgt,int _stl)
+{
+ return (void*) new wxPropertyGrid (_prt, _id,wxPoint(_lft, _top),wxSize(_wdt, _hgt), _stl);
+}
+
+EWXWEXPORT(bool,wxPropertyGrid_DisableProperty)(wxPropertyGrid* self, wxString const * propName)
+{
+ return self->DisableProperty(*propName);
+}
+
+/*-----------------------------------------------------------------------------
+ wxPropertyGridEvent
+ Defined within eljevent.cpp
+-----------------------------------------------------------------------------*/
+
+/*-----------------------------------------------------------------------------
+ PGProperty
+-----------------------------------------------------------------------------*/
+EWXWEXPORT(wxString*,wxPGProperty_GetLabel)(wxPGProperty* self)
+{
+ wxString *result = new wxString();
+ *result = self->GetLabel();
+ return result;
+}
+
+EWXWEXPORT(wxString*,wxPGProperty_GetName)(wxPGProperty* self)
+{
+ wxString *result = new wxString();
+ *result = self->GetName();
+ return result;
+}
+
+EWXWEXPORT(wxString*,wxPGProperty_GetValueAsString)(wxPGProperty* self)
+{
+ wxString *result = new wxString();
+ *result = self->GetValueAsString();
+ return result;
+}
+
+EWXWEXPORT(wxString*,wxPGProperty_GetValueType)(wxPGProperty* self)
+{
+ wxString *result = new wxString();
+ *result = self->GetValueType();
+ return result;
+}
+
+EWXWEXPORT(void,wxPGProperty_SetHelpString)(wxPGProperty* self, wxString const* helpString)
+{
+ self->SetHelpString(*helpString);
+}
+
+/*-----------------------------------------------------------------------------
+ wxStringProperty
+-----------------------------------------------------------------------------*/
+EWXWEXPORT(wxStringProperty*,wxStringProperty_Create)(wxString const* label, wxString const* name, wxString const* value)
+{
+ return new wxStringProperty(*label, *name, *value);
+}
+
+/*-----------------------------------------------------------------------------
+ wxIntProperty
+-----------------------------------------------------------------------------*/
+EWXWEXPORT(wxIntProperty*,wxIntProperty_Create)(wxString const* label, wxString const* name, int value)
+{
+ return new wxIntProperty(*label, *name, value);
+}
+
+/*-----------------------------------------------------------------------------
+ wxBoolProperty
+-----------------------------------------------------------------------------*/
+EWXWEXPORT(wxBoolProperty*,wxBoolProperty_Create)(wxString const* label, wxString const* name, bool value)
+{
+ return new wxBoolProperty(*label, *name, value);
+}
+
+/*-----------------------------------------------------------------------------
+ wxFloatProperty
+-----------------------------------------------------------------------------*/
+EWXWEXPORT(wxFloatProperty*,wxFloatProperty_Create)(wxString const* label, wxString const* name, float value)
+{
+ return new wxFloatProperty(*label, *name, value);
+}
+
+/*-----------------------------------------------------------------------------
+ wxDateProperty
+-----------------------------------------------------------------------------*/
+EWXWEXPORT(wxDateProperty*,wxDateProperty_Create)(wxString const* label, wxString const* name, wxDateTime const* value)
+{
+ return new wxDateProperty(*label, *name, *value);
+}
+
+/*-----------------------------------------------------------------------------
+ wxFileProperty
+-----------------------------------------------------------------------------*/
+EWXWEXPORT(wxFileProperty*,wxFileProperty_Create)(wxString const* label, wxString const* name, wxString const* value)
+{
+ return new wxFileProperty(*label, *name, *value);
+}
+
+/*-----------------------------------------------------------------------------
+ wxPropertyCategory
+-----------------------------------------------------------------------------*/
+EWXWEXPORT(wxPropertyCategory*,wxPropertyCategory_Create)(wxString const* label)
+{
+ return new wxPropertyCategory(*label);
+}
} /* extern "C" */
Please sign in to comment.
Something went wrong with that request. Please try again.