]> git.saurik.com Git - wxWidgets.git/blobdiff - interface/wx/propgrid/propgrid.h
wxUniv/MSW compilation fix in wxWindowBase::GetDlgUnitBase().
[wxWidgets.git] / interface / wx / propgrid / propgrid.h
index 818c14dd511bce17bbc40e7979d5c1431a1bb6f7..c88cf3efcca5c6583e64d08279d2e2801fed10a8 100644 (file)
@@ -3,7 +3,7 @@
 // Purpose:     interface of wxPropertyGrid
 // Author:      wxWidgets team
 // RCS-ID:      $Id$
-// Licence:     wxWindows license
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 
@@ -233,14 +233,35 @@ wxPG_VFB_BEEP                       = 0x02,
 wxPG_VFB_MARK_CELL                  = 0x04,
 
 /**
-    Display customizable text message explaining the situation.
+    Display a text message explaining the situation. 
+
+    To customize the way the message is displayed, you need to
+    reimplement wxPropertyGrid::DoShowPropertyError() in a
+    derived class. Default behavior is to display the text on
+    the top-level frame's status bar, if present, and otherwise
+    using wxMessageBox.
 */
 wxPG_VFB_SHOW_MESSAGE               = 0x08,
 
+/**
+    Similar to wxPG_VFB_SHOW_MESSAGE, except always displays the
+    message using wxMessageBox.
+*/
+wxPG_VFB_SHOW_MESSAGEBOX            = 0x10,
+
+/**
+    Similar to wxPG_VFB_SHOW_MESSAGE, except always displays the
+    message on the status bar (when present - you can reimplement
+    wxPropertyGrid::GetStatusBar() in a derived class to specify
+    this yourself).
+*/
+wxPG_VFB_SHOW_MESSAGE_ON_STATUSBAR  = 0x20,
+
 /**
     Defaults.
 */
-wxPG_VFB_DEFAULT                    = wxPG_VFB_STAY_IN_PROPERTY|wxPG_VFB_BEEP,
+wxPG_VFB_DEFAULT                    = wxPG_VFB_MARK_CELL |
+                                      wxPG_VFB_SHOW_MESSAGEBOX,
 };
 
 /** @}
@@ -418,7 +439,9 @@ typedef int (*wxPGSortCallback)(wxPropertyGrid* propGrid,
     @category{propgrid}
     @appearance{propertygrid.png}
 */
-class wxPropertyGrid : public wxScrolledWindow, public wxPropertyGridInterface
+class wxPropertyGrid : public wxControl,
+                       public wxScrollHelper,
+                       public wxPropertyGridInterface
 {
 public:
     /**
@@ -429,7 +452,7 @@ public:
 
     /**
         Constructor.
-        The styles to be used are styles valid for the wxWindow and wxScrolledWindow.
+        The styles to be used are styles valid for the wxWindow.
 
         @see @ref propgrid_window_styles.
     */
@@ -445,6 +468,15 @@ public:
     /**
         Adds given key combination to trigger given action.
 
+        Here is a sample code to make Enter key press move focus to
+        the next property.
+
+        @code
+            propGrid->AddActionTrigger(wxPG_ACTION_NEXT_PROPERTY,
+                                       WXK_RETURN);
+            propGrid->DedicateKey(WXK_RETURN);
+        @endcode
+
         @param action
             Which action to trigger. See @ref propgrid_keyboard_actions.
         @param keycode
@@ -491,7 +523,7 @@ public:
 
         @see EndLabelEdit(), MakeColumnEditable()
     */
-    void BeginLabelEdit( unsigned int column = 0 );
+    void BeginLabelEdit( unsigned int colIndex = 0 );
 
     /**
         Changes value of a property, as if from an editor. Use this instead of
@@ -503,11 +535,13 @@ public:
     bool ChangePropertyValue( wxPGPropArg id, wxVariant newValue );
 
     /**
-        Centers the splitter. If argument is true, automatic splitter centering
-        is enabled (only applicable if style wxPG_SPLITTER_AUTO_CENTER was
-        defined).
+        Centers the splitter.
+
+        @param enableAutoResizing
+            If @true, automatic column resizing is enabled (only applicapple
+            if window style wxPG_SPLITTER_AUTO_CENTER is used).
     */
-    void CenterSplitter( bool enable_auto_centering = false );
+    void CenterSplitter( bool enableAutoResizing = false );
 
     /**
         Deletes all properties.
@@ -544,6 +578,16 @@ public:
                 long style = wxPG_DEFAULT_STYLE,
                 const wxChar* name = wxPropertyGridNameStr );
 
+    /**
+        Dedicates a specific keycode to wxPropertyGrid. This means that such
+        key presses will not be redirected to editor controls.
+
+        Using this function allows, for example, navigation between
+        properties using arrow keys even when the focus is in the editor
+        control.
+    */
+    void DedicateKey( int keycode );
+
     /**
         Enables or disables (shows/hides) categories according to parameter
         enable.
@@ -735,7 +779,7 @@ public:
     /**
         Returns current splitter x position.
     */
-    int GetSplitterPosition() const;
+    int GetSplitterPosition( unsigned int splitterIndex = 0 ) const;
 
     /**
         Returns wxTextCtrl active in currently selected property, if any. Takes
@@ -768,7 +812,7 @@ public:
 
         @param pt
             Coordinates in the virtual grid space. You may need to use
-            wxScrolledWindow::CalcScrolledPosition() for translating
+            wxScrolled<T>::CalcScrolledPosition() for translating
             wxPropertyGrid client coordinates into something this member
             function can use.
     */
@@ -793,6 +837,8 @@ public:
     /**
         Makes given column editable by user.
 
+        @param column
+            The index of the column to make editable.
         @param editable
             Using @false here will disable column from being editable.
 
@@ -839,6 +885,17 @@ public:
     */
     void ResetColours();
 
+    /**
+        Resets column sizes and splitter positions, based on proportions.
+
+        @param enableAutoResizing
+            If @true, automatic column resizing is enabled (only applicapple
+            if window style wxPG_SPLITTER_AUTO_CENTER is used).
+
+        @see wxPropertyGridInterface::SetColumnProportion()
+    */
+    void ResetColumnSizes( bool enableAutoResizing = false );
+
     /**
         Removes given property from selection. If property is not selected,
         an assertion failure will occur.
@@ -1010,6 +1067,45 @@ public:
     */
     void SetVerticalSpacing( int vspacing );
 
+    /**
+        @name wxPropertyGrid customization
+
+        Reimplement these member functions in derived class for better
+        control over wxPropertyGrid behavior.
+    */
+    //@{
+    
+    /**
+        Override in derived class to display error messages in custom manner
+        (these message usually only result from validation failure).
+
+        @remarks If you implement this, then you also need to implement
+                 DoHidePropertyError() - possibly to do nothing, if error
+                 does not need hiding (e.g. it was logged or shown in a
+                 message box).
+
+        @see DoHidePropertyError()
+    */
+    virtual void DoShowPropertyError( wxPGProperty* property,
+                                      const wxString& msg );
+
+    /**
+        Override in derived class to hide an error displayed by
+        DoShowPropertyError().
+
+        @see DoShowPropertyError()
+    */
+    virtual void DoHidePropertyError( wxPGProperty* property );
+
+    /**
+        Return wxStatusBar that is used by this wxPropertyGrid. You can
+        reimplement this member function in derived class to override
+        the default behavior of using the top-level wxFrame's status
+        bar, if any.
+    */
+    virtual wxStatusBar* GetStatusBar();
+
+    //@}
 
     /**
         @name Property development functions
@@ -1117,6 +1213,11 @@ public:
 
     /**
         Returns property associated with this event.
+
+        @remarks You should assume that this property can always be NULL.
+                 For instance, wxEVT_PG_SELECTED is emitted not only when
+                 a new property is selected, but also when selection is
+                 cleared by user activity.
     */
     wxPGProperty* GetProperty() const;