]> git.saurik.com Git - wxWidgets.git/blobdiff - interface/wx/grid.h
Suppress warnings about double to int truncation in wxHTML code.
[wxWidgets.git] / interface / wx / grid.h
index 00f9b254b880eba890ec8510572c66227951db1b..88c9196d60b2f359fdc70a25df7c99e9cc21783b 100644 (file)
@@ -3,7 +3,7 @@
 // Purpose:     interface of wxGrid and related classes
 // Author:      wxWidgets team
 // RCS-ID:      $Id$
 // Purpose:     interface of wxGrid and related classes
 // Author:      wxWidgets team
 // RCS-ID:      $Id$
-// Licence:     wxWindows license
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 /**
 /////////////////////////////////////////////////////////////////////////////
 
 /**
     @library{wxadv}
     @category{grid}
 
     @library{wxadv}
     @category{grid}
 
-    @see wxGridCellBoolRenderer, wxGridCellFloatRenderer,
-         wxGridCellNumberRenderer, wxGridCellStringRenderer
+    @see wxGridCellAutoWrapStringRenderer, wxGridCellBoolRenderer,
+         wxGridCellDateTimeRenderer, wxGridCellEnumRenderer,
+         wxGridCellFloatRenderer, wxGridCellNumberRenderer,
+         wxGridCellStringRenderer
 */
 class wxGridCellRenderer
 {
 */
 class wxGridCellRenderer
 {
@@ -50,6 +52,31 @@ public:
                                int row, int col) = 0;
 };
 
                                int row, int col) = 0;
 };
 
+/**
+    @class wxGridCellAutoWrapStringRenderer
+
+    This class may be used to format string data in a cell. The too
+    long lines are wrapped to be shown entirely at word boundaries.
+
+    @library{wxadv}
+    @category{grid}
+
+    @see wxGridCellRenderer, wxGridCellBoolRenderer,
+         wxGridCellDateTimeRenderer, wxGridCellEnumRenderer,
+         wxGridCellFloatRenderer, wxGridCellNumberRenderer,
+         wxGridCellStringRenderer
+*/
+
+class wxGridCellAutoWrapStringRenderer : public wxGridCellStringRenderer
+{
+public:
+    /**
+        Default constructor.
+    */
+    wxGridCellAutoWrapStringRenderer();
+};
+
+
 /**
     @class wxGridCellBoolRenderer
 
 /**
     @class wxGridCellBoolRenderer
 
@@ -58,7 +85,9 @@ public:
     @library{wxadv}
     @category{grid}
 
     @library{wxadv}
     @category{grid}
 
-    @see wxGridCellRenderer, wxGridCellFloatRenderer, wxGridCellNumberRenderer,
+    @see wxGridCellRenderer, wxGridCellAutoWrapStringRenderer,
+         wxGridCellDateTimeRenderer, wxGridCellEnumRenderer,
+         wxGridCellFloatRenderer, wxGridCellNumberRenderer,
          wxGridCellStringRenderer
 */
 class wxGridCellBoolRenderer : public wxGridCellRenderer
          wxGridCellStringRenderer
 */
 class wxGridCellBoolRenderer : public wxGridCellRenderer
@@ -70,6 +99,85 @@ public:
     wxGridCellBoolRenderer();
 };
 
     wxGridCellBoolRenderer();
 };
 
+/**
+    @class wxGridCellDateTimeRenderer
+
+    This class may be used to format a date/time data in a cell.
+    The class wxDateTime is used internally to display the local date/time
+    or to parse the string date entered in the cell thanks to the defined format.
+
+    @library{wxadv}
+    @category{grid}
+
+    @see wxGridCellRenderer, wxGridCellAutoWrapStringRenderer,
+         wxGridCellBoolRenderer, wxGridCellEnumRenderer,
+         wxGridCellFloatRenderer, wxGridCellNumberRenderer,
+         wxGridCellStringRenderer
+*/
+class wxGridCellDateTimeRenderer : public wxGridCellStringRenderer
+{
+public:
+    /**
+        Date/time renderer constructor.
+
+        @param outformat
+            strptime()-like format string used the parse the output date/time.
+        @param informat
+            strptime()-like format string used to parse the string entered in the cell.
+    */
+    wxGridCellDateTimeRenderer(const wxString& outformat = wxDefaultDateTimeFormat,
+                               const wxString& informat = wxDefaultDateTimeFormat);
+
+
+    /**
+        Sets the strptime()-like format string which will be used to parse
+        the date/time.
+
+        @param params
+            strptime()-like format string used to parse the date/time.
+    */
+    virtual void SetParameters(const wxString& params);
+};
+
+/**
+    @class wxGridCellEnumRenderer
+
+    This class may be used to render in a cell a number as a textual
+    equivalent.
+
+    The corresponding text strings are specified as comma-separated items in
+    the string passed to this renderer ctor or SetParameters() method. For
+    example, if this string is @c "John,Fred,Bob" the cell will be rendered as
+    "John", "Fred" or "Bob" if its contents is 0, 1 or 2 respectively.
+
+    @library{wxadv}
+    @category{grid}
+
+    @see wxGridCellRenderer, wxGridCellAutoWrapStringRenderer,
+         wxGridCellBoolRenderer, wxGridCellDateTimeRenderer,
+         wxGridCellFloatRenderer, wxGridCellNumberRenderer,
+         wxGridCellStringRenderer
+*/
+class wxGridCellEnumRenderer : public wxGridCellStringRenderer
+{
+public:
+    /**
+        Enum renderer ctor.
+
+        @param choices
+            Comma separated string parameters "item1[,item2[...,itemN]]".
+    */
+    wxGridCellEnumRenderer( const wxString& choices = wxEmptyString );
+
+    /**
+        Sets the comma separated string content of the enum.
+
+        @param params
+            Comma separated string parameters "item1[,item2[...,itemN]]".
+    */
+    virtual void SetParameters(const wxString& params);
+};
+
 /**
     @class wxGridCellFloatRenderer
 
 /**
     @class wxGridCellFloatRenderer
 
@@ -78,13 +186,17 @@ public:
     @library{wxadv}
     @category{grid}
 
     @library{wxadv}
     @category{grid}
 
-    @see wxGridCellRenderer, wxGridCellBoolRenderer, wxGridCellNumberRenderer,
+    @see wxGridCellRenderer, wxGridCellAutoWrapStringRenderer,
+         wxGridCellBoolRenderer, wxGridCellDateTimeRenderer,
+         wxGridCellEnumRenderer, wxGridCellNumberRenderer,
          wxGridCellStringRenderer
 */
 class wxGridCellFloatRenderer : public wxGridCellStringRenderer
 {
 public:
     /**
          wxGridCellStringRenderer
 */
 class wxGridCellFloatRenderer : public wxGridCellStringRenderer
 {
 public:
     /**
+        Float cell renderer ctor.
+
         @param width
             Minimum number of characters to be shown.
         @param precision
         @param width
             Minimum number of characters to be shown.
         @param precision
@@ -126,7 +238,9 @@ public:
     @library{wxadv}
     @category{grid}
 
     @library{wxadv}
     @category{grid}
 
-    @see wxGridCellRenderer, wxGridCellBoolRenderer, wxGridCellFloatRenderer,
+    @see wxGridCellRenderer, wxGridCellAutoWrapStringRenderer,
+         wxGridCellBoolRenderer, wxGridCellDateTimeRenderer,
+         wxGridCellEnumRenderer, wxGridCellFloatRenderer,
          wxGridCellStringRenderer
 */
 class wxGridCellNumberRenderer : public wxGridCellStringRenderer
          wxGridCellStringRenderer
 */
 class wxGridCellNumberRenderer : public wxGridCellStringRenderer
@@ -147,7 +261,9 @@ public:
     @library{wxadv}
     @category{grid}
 
     @library{wxadv}
     @category{grid}
 
-    @see wxGridCellRenderer, wxGridCellBoolRenderer, wxGridCellFloatRenderer,
+    @see wxGridCellRenderer, wxGridCellAutoWrapStringRenderer,
+         wxGridCellBoolRenderer, wxGridCellDateTimeRenderer,
+         wxGridCellEnumRenderer, wxGridCellFloatRenderer,
          wxGridCellNumberRenderer
 */
 class wxGridCellStringRenderer : public wxGridCellRenderer
          wxGridCellNumberRenderer
 */
 class wxGridCellStringRenderer : public wxGridCellRenderer
@@ -160,7 +276,6 @@ public:
 };
 
 
 };
 
 
-
 /**
     @class wxGridCellEditor
 
 /**
     @class wxGridCellEditor
 
@@ -173,8 +288,10 @@ public:
     @library{wxadv}
     @category{grid}
 
     @library{wxadv}
     @category{grid}
 
-    @see wxGridCellBoolEditor, wxGridCellChoiceEditor, wxGridCellFloatEditor,
-         wxGridCellNumberEditor, wxGridCellTextEditor
+    @see wxGridCellAutoWrapStringEditor, wxGridCellBoolEditor,
+         wxGridCellChoiceEditor, wxGridCellEnumEditor,
+         wxGridCellFloatEditor, wxGridCellNumberEditor,
+         wxGridCellTextEditor
 */
 class wxGridCellEditor
 {
 */
 class wxGridCellEditor
 {
@@ -295,6 +412,24 @@ protected:
     virtual ~wxGridCellEditor();
 };
 
     virtual ~wxGridCellEditor();
 };
 
+/**
+    @class wxGridCellAutoWrapStringEditor
+
+    Grid cell editor for wrappable string/text data.
+
+    @library{wxadv}
+    @category{grid}
+
+    @see wxGridCellEditor, wxGridCellBoolEditor, wxGridCellChoiceEditor,
+         wxGridCellEnumEditor, wxGridCellFloatEditor,
+         wxGridCellNumberEditor, wxGridCellTextEditor
+*/
+class wxGridCellAutoWrapStringEditor : public wxGridCellTextEditor
+{
+public:
+    wxGridCellAutoWrapStringEditor();
+};
+
 /**
     @class wxGridCellBoolEditor
 
 /**
     @class wxGridCellBoolEditor
 
@@ -303,8 +438,10 @@ protected:
     @library{wxadv}
     @category{grid}
 
     @library{wxadv}
     @category{grid}
 
-    @see wxGridCellEditor, wxGridCellChoiceEditor, wxGridCellFloatEditor,
-         wxGridCellNumberEditor, wxGridCellTextEditor
+    @see wxGridCellEditor, wxGridCellAutoWrapStringEditor,
+         wxGridCellChoiceEditor, wxGridCellEnumEditor,
+         wxGridCellFloatEditor, wxGridCellNumberEditor,
+         wxGridCellTextEditor
 */
 class wxGridCellBoolEditor : public wxGridCellEditor
 {
 */
 class wxGridCellBoolEditor : public wxGridCellEditor
 {
@@ -340,13 +477,17 @@ public:
     @library{wxadv}
     @category{grid}
 
     @library{wxadv}
     @category{grid}
 
-    @see wxGridCellEditor, wxGridCellBoolEditor, wxGridCellFloatEditor,
-         wxGridCellNumberEditor, wxGridCellTextEditor
+    @see wxGridCellEditor, wxGridCellAutoWrapStringEditor,
+         wxGridCellBoolEditor, wxGridCellEnumEditor,
+         wxGridCellFloatEditor, wxGridCellNumberEditor,
+         wxGridCellTextEditor
 */
 class wxGridCellChoiceEditor : public wxGridCellEditor
 {
 public:
     /**
 */
 class wxGridCellChoiceEditor : public wxGridCellEditor
 {
 public:
     /**
+        Choice cell renderer ctor.
+
         @param count
             Number of strings from which the user can choose.
         @param choices
         @param count
             Number of strings from which the user can choose.
         @param choices
@@ -358,7 +499,10 @@ public:
     wxGridCellChoiceEditor(size_t count = 0,
                            const wxString choices[] = NULL,
                            bool allowOthers = false);
     wxGridCellChoiceEditor(size_t count = 0,
                            const wxString choices[] = NULL,
                            bool allowOthers = false);
+
     /**
     /**
+        Choice cell renderer ctor.
+
         @param choices
             An array of strings from which the user can choose.
         @param allowOthers
         @param choices
             An array of strings from which the user can choose.
         @param allowOthers
@@ -374,6 +518,33 @@ public:
     virtual void SetParameters(const wxString& params);
 };
 
     virtual void SetParameters(const wxString& params);
 };
 
+/**
+    @class wxGridCellEnumEditor
+
+    Grid cell editor which displays an enum number as a textual equivalent
+    (eg. data in cell is 0,1,2 ... n the cell could be displayed as
+    "John","Fred"..."Bob" in the combo choice box).
+
+    @library{wxadv}
+    @category{grid}
+
+    @see wxGridCellEditor, wxGridCellAutoWrapStringEditor,
+         wxGridCellBoolEditor, wxGridCellChoiceEditor,
+         wxGridCellTextEditor, wxGridCellFloatEditor,
+         wxGridCellNumberEditor
+*/
+class wxGridCellEnumEditor : public wxGridCellChoiceEditor
+{
+public:
+    /**
+        Enum cell editor ctor.
+
+        @param choices
+            Comma separated choice parameters "item1[,item2[...,itemN]]".
+    */
+    wxGridCellEnumEditor( const wxString& choices = wxEmptyString );
+};
+
 /**
     @class wxGridCellTextEditor
 
 /**
     @class wxGridCellTextEditor
 
@@ -382,8 +553,10 @@ public:
     @library{wxadv}
     @category{grid}
 
     @library{wxadv}
     @category{grid}
 
-    @see wxGridCellEditor, wxGridCellBoolEditor, wxGridCellChoiceEditor,
-         wxGridCellFloatEditor, wxGridCellNumberEditor
+    @see wxGridCellEditor, wxGridCellAutoWrapStringEditor,
+         wxGridCellBoolEditor, wxGridCellChoiceEditor,
+         wxGridCellEnumEditor, wxGridCellFloatEditor,
+         wxGridCellNumberEditor
 */
 class wxGridCellTextEditor : public wxGridCellEditor
 {
 */
 class wxGridCellTextEditor : public wxGridCellEditor
 {
@@ -408,13 +581,17 @@ public:
     @library{wxadv}
     @category{grid}
 
     @library{wxadv}
     @category{grid}
 
-    @see wxGridCellEditor, wxGridCellNumberEditor, wxGridCellBoolEditor,
-    wxGridCellTextEditor, wxGridCellChoiceEditor
+    @see wxGridCellEditor, wxGridCellAutoWrapStringEditor,
+         wxGridCellBoolEditor, wxGridCellChoiceEditor,
+         wxGridCellEnumEditor, wxGridCellNumberEditor,
+         wxGridCellTextEditor
 */
 class wxGridCellFloatEditor : public wxGridCellTextEditor
 {
 public:
     /**
 */
 class wxGridCellFloatEditor : public wxGridCellTextEditor
 {
 public:
     /**
+        Float cell editor ctor.
+
         @param width
             Minimum number of characters to be shown.
         @param precision
         @param width
             Minimum number of characters to be shown.
         @param precision
@@ -436,8 +613,10 @@ public:
     @library{wxadv}
     @category{grid}
 
     @library{wxadv}
     @category{grid}
 
-    @see wxGridCellEditor, wxGridCellBoolEditor, wxGridCellChoiceEditor,
-         wxGridCellFloatEditor, wxGridCellTextEditor
+    @see wxGridCellEditor, wxGridCellAutoWrapStringEditor,
+         wxGridCellBoolEditor, wxGridCellChoiceEditor,
+         wxGridCellEnumEditor, wxGridCellFloatEditor,
+         wxGridCellTextEditor
 */
 class wxGridCellNumberEditor : public wxGridCellTextEditor
 {
 */
 class wxGridCellNumberEditor : public wxGridCellTextEditor
 {
@@ -1843,10 +2022,18 @@ public:
         are using the grid to display tabular data and don't have thousands of
         columns in it.
 
         are using the grid to display tabular data and don't have thousands of
         columns in it.
 
-        Also note that currently @c wxEVT_GRID_LABEL_LEFT_DCLICK and
-        @c wxEVT_GRID_LABEL_RIGHT_DCLICK events are not generated for the column
-        labels if the native columns header is used (but this limitation could
-        possibly be lifted in the future).
+        Another difference between the default behaviour and the native header
+        behaviour is that the latter provides the user with a context menu
+        (which appears on right clicking the header) allowing to rearrange the
+        grid columns if CanDragColMove() returns @true. If you want to prevent
+        this from happening for some reason, you need to define a handler for
+        @c wxEVT_GRID_LABEL_RIGHT_CLICK event which simply does nothing (in
+        particular doesn't skip the event) as this will prevent the default
+        right click handling from working.
+
+        Also note that currently @c wxEVT_GRID_LABEL_RIGHT_DCLICK event is not
+        generated for the column labels if the native columns header is used
+        (but this limitation could possibly be lifted in the future).
      */
     void UseNativeColHeader(bool native = true);
 
      */
     void UseNativeColHeader(bool native = true);