X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d43851f77ed287aa156997acab4e97bc2063b645..4104ed92a537f36f7f41ce07d34cadbe4d78685c:/include/wx/generic/grid.h diff --git a/include/wx/generic/grid.h b/include/wx/generic/grid.h index a09c66fe91..c66bfc6bd9 100644 --- a/include/wx/generic/grid.h +++ b/include/wx/generic/grid.h @@ -11,10 +11,6 @@ #include "wx/defs.h" -#if !defined(wxUSE_NEW_GRID) || !(wxUSE_NEW_GRID) -#include "wx/generic/gridg.h" -#else - #ifndef __WXGRID_H__ #define __WXGRID_H__ @@ -22,10 +18,11 @@ #pragma interface "grid.h" #endif -#include "wx/hash.h" +#include "wx/hashmap.h" #include "wx/panel.h" #include "wx/scrolwin.h" #include "wx/string.h" +#include "wx/arrstr.h" #include "wx/scrolbar.h" #include "wx/event.h" #include "wx/combobox.h" @@ -84,6 +81,9 @@ class WXDLLEXPORT wxComboBox; class WXDLLEXPORT wxTextCtrl; class WXDLLEXPORT wxSpinCtrl; +WX_DECLARE_EXPORTED_HASH_MAP( long, long, wxIntegerHash, wxIntegerEqual, + wxLongToLongHashMap ); + // ---------------------------------------------------------------------------- // macros // ---------------------------------------------------------------------------- @@ -430,6 +430,8 @@ protected: private: size_t m_maxChars; // max number of chars allowed wxString m_startValue; + + DECLARE_NO_COPY_CLASS(wxGridCellTextEditor) }; // the editor for numeric (long) data @@ -475,6 +477,8 @@ private: m_max; long m_valueOld; + + DECLARE_NO_COPY_CLASS(wxGridCellNumberEditor) }; // the editor for floating point numbers (double) data @@ -508,6 +512,8 @@ private: int m_width, m_precision; double m_valueOld; + + DECLARE_NO_COPY_CLASS(wxGridCellFloatEditor) }; #endif // wxUSE_TEXTCTRL @@ -518,6 +524,8 @@ private: class WXDLLEXPORT wxGridCellBoolEditor : public wxGridCellEditor { public: + wxGridCellBoolEditor() { } + virtual void Create(wxWindow* parent, wxWindowID id, wxEvtHandler* evtHandler); @@ -543,6 +551,8 @@ protected: private: bool m_startValue; + + DECLARE_NO_COPY_CLASS(wxGridCellBoolEditor) }; #endif // wxUSE_CHECKBOX @@ -586,6 +596,8 @@ protected: wxString m_startValue; wxArrayString m_choices; bool m_allowOthers; + + DECLARE_NO_COPY_CLASS(wxGridCellChoiceEditor) }; #endif // wxUSE_COMBOBOX @@ -651,7 +663,8 @@ public: m_vAlign = vAlign; } void SetSize(int num_rows, int num_cols); - void SetOverflow( bool allow ) { m_overflow = allow; } + void SetOverflow(bool allow = TRUE) + { m_overflow = allow ? Overflow : SingleCell; } void SetReadOnly(bool isReadOnly = TRUE) { m_isReadOnly = isReadOnly ? ReadOnly : ReadWrite; } @@ -671,13 +684,15 @@ public: bool HasRenderer() const { return m_renderer != NULL; } bool HasEditor() const { return m_editor != NULL; } bool HasReadWriteMode() const { return m_isReadOnly != Unset; } + bool HasOverflowMode() const { return m_overflow != UnsetOverflow; } const wxColour& GetTextColour() const; const wxColour& GetBackgroundColour() const; const wxFont& GetFont() const; void GetAlignment(int *hAlign, int *vAlign) const; void GetSize(int *num_rows, int *num_cols) const; - bool GetOverflow() const { return m_overflow; } + bool GetOverflow() const + { return m_overflow != SingleCell; } wxGridCellRenderer *GetRenderer(wxGrid* grid, int row, int col) const; wxGridCellEditor *GetEditor(wxGrid* grid, int row, int col) const; @@ -695,6 +710,13 @@ private: ReadOnly }; + enum wxAttrOverflowMode + { + UnsetOverflow = -1, + Overflow, + SingleCell + }; + // the common part of all ctors void Init(wxGridCellAttr *attrDefault = NULL); @@ -715,7 +737,8 @@ private: m_vAlign; int m_sizeRows, m_sizeCols; - bool m_overflow; + + wxAttrOverflowMode m_overflow; wxGridCellRenderer* m_renderer; wxGridCellEditor* m_editor; @@ -963,7 +986,7 @@ private: wxArrayString m_rowLabels; wxArrayString m_colLabels; - DECLARE_DYNAMIC_CLASS( wxGridStringTable ) + DECLARE_DYNAMIC_CLASS_NO_COPY( wxGridStringTable ) }; @@ -1344,6 +1367,18 @@ public: void SetColMinimalWidth( int col, int width ); void SetRowMinimalHeight( int row, int width ); + /* These members can be used to query and modify the minimal + * acceptable size of grid rows and columns. Call this function in + * your code which creates the grid if you want to display cells + * with a size smaller than the default acceptable minimum size. + * Like the members SetColMinimalWidth and SetRowMinimalWidth, + * the existing rows or columns will not be checked/resized. + */ + void SetColMinimalAcceptableWidth( int width ); + void SetRowMinimalAcceptableHeight( int width ); + int GetColMinimalAcceptableWidth() const; + int GetRowMinimalAcceptableHeight() const; + void SetDefaultCellBackgroundColour( const wxColour& ); void SetCellBackgroundColour( int row, int col, const wxColour& ); void SetDefaultCellTextColour( const wxColour& ); @@ -1679,6 +1714,7 @@ protected: void InitRowHeights(); int m_defaultRowHeight; + int m_minAcceptableRowHeight; wxArrayInt m_rowHeights; wxArrayInt m_rowBottoms; @@ -1686,6 +1722,7 @@ protected: void InitColWidths(); int m_defaultColWidth; + int m_minAcceptableColWidth; wxArrayInt m_colWidths; wxArrayInt m_colRights; @@ -1738,8 +1775,8 @@ protected: // if a column has a minimal width, it will be the value for it in this // hash table - wxHashTableLong m_colMinWidths, - m_rowMinHeights; + wxLongToLongHashMap m_colMinWidths, + m_rowMinHeights; // get the minimal width of the given column/row int GetColMinimalWidth(int col) const; @@ -1874,6 +1911,7 @@ protected: DECLARE_NO_COPY_CLASS(wxGrid) }; + // ---------------------------------------------------------------------------- // Grid event class and event types // ---------------------------------------------------------------------------- @@ -1911,7 +1949,7 @@ protected: bool m_shift; bool m_alt; - DECLARE_DYNAMIC_CLASS(wxGridEvent) + DECLARE_DYNAMIC_CLASS_NO_COPY(wxGridEvent) }; class WXDLLEXPORT wxGridSizeEvent : public wxNotifyEvent @@ -1943,7 +1981,7 @@ protected: bool m_shift; bool m_alt; - DECLARE_DYNAMIC_CLASS(wxGridSizeEvent) + DECLARE_DYNAMIC_CLASS_NO_COPY(wxGridSizeEvent) }; @@ -1990,7 +2028,7 @@ protected: bool m_shift; bool m_alt; - DECLARE_DYNAMIC_CLASS(wxGridRangeSelectEvent) + DECLARE_DYNAMIC_CLASS_NO_COPY(wxGridRangeSelectEvent) }; @@ -2079,6 +2117,5 @@ extern const int wxEVT_GRID_CHANGE_SEL_LABEL; #endif -#endif // #ifndef __WXGRID_H__ +#endif // ifndef wxUSE_GRID -#endif // ifndef wxUSE_NEW_GRID