X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2b01fd49183b64be59c4e7ba9bdaee479ff29ed2..d5dc103fd4afb197f48d6a87f67f6b82dd7f56fe:/include/wx/generic/grid.h diff --git a/include/wx/generic/grid.h b/include/wx/generic/grid.h index c554e7236d..ead133cc7b 100644 --- a/include/wx/generic/grid.h +++ b/include/wx/generic/grid.h @@ -2,7 +2,7 @@ // Name: wx/generic/grid.h // Purpose: wxGrid and related classes // Author: Michael Bedward (based on code by Julian Smart, Robin Dunn) -// Modified by: +// Modified by: Santiago Palacios // Created: 1/08/1999 // RCS-ID: $Id$ // Copyright: (c) Michael Bedward @@ -28,6 +28,8 @@ // constants // ---------------------------------------------------------------------------- +extern WXDLLEXPORT_DATA(const wxChar) wxGridNameStr[]; + // Default parameters for wxGrid // #define WXGRID_DEFAULT_NUMBER_ROWS 10 @@ -1077,14 +1079,14 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxWANTS_CHARS, - const wxString& name = wxPanelNameStr ); + const wxString& name = wxGridNameStr ); bool Create( wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxWANTS_CHARS, - const wxString& name = wxPanelNameStr ); + const wxString& name = wxGridNameStr ); virtual ~wxGrid(); @@ -1123,6 +1125,7 @@ public: void DoEndDragResizeRow(); void DoEndDragResizeCol(); + void DoEndDragMoveCol(); wxGridTableBase * GetTable() const { return m_table; } bool SetTable( wxGridTableBase *table, bool takeOwnership = false, @@ -1226,7 +1229,7 @@ public: // void XYToCell( int x, int y, wxGridCellCoords& ); int YToRow( int y ); - int XToCol( int x ); + int XToCol( int x, bool clipToMinMax = false ); int YToEdgeOfRow( int y ); int XToEdgeOfCol( int x ); @@ -1281,6 +1284,12 @@ public: wxString GetRowLabelValue( int row ); wxString GetColLabelValue( int col ); wxColour GetGridLineColour() { return m_gridLineColour; } + + // these methods may be overridden to customize individual grid lines + // appearance + virtual wxPen GetDefaultGridLinePen(); + virtual wxPen GetRowGridLinePen(int row); + virtual wxPen GetColGridLinePen(int col); wxColour GetCellHighlightColour() { return m_cellHighlightColour; } int GetCellHighlightPenWidth() { return m_cellHighlightPenWidth; } int GetCellHighlightROPenWidth() { return m_cellHighlightROPenWidth; } @@ -1306,6 +1315,9 @@ public: void EnableDragColSize( bool enable = true ); void DisableDragColSize() { EnableDragColSize( false ); } bool CanDragColSize() { return m_canDragColSize; } + void EnableDragColMove( bool enable = true ); + void DisableDragColMove() { EnableDragColMove( false ); } + bool CanDragColMove() { return m_canDragColMove; } void EnableDragGridSize(bool enable = true); void DisableDragGridSize() { EnableDragGridSize(false); } bool CanDragGridSize() { return m_canDragGridSize; } @@ -1361,6 +1373,33 @@ public: void SetColSize( int col, int width ); + //Column positions + int GetColAt( int colPos ) const + { + if ( m_colAt.IsEmpty() ) + return colPos; + else + return m_colAt[colPos]; + } + + void SetColPos( int colID, int newPos ); + + int GetColPos( int colID ) const + { + if ( m_colAt.IsEmpty() ) + return colID; + else + { + for ( int i = 0; i < m_numCols; i++ ) + { + if ( m_colAt[i] == colID ) + return i; + } + } + + return -1; + } + // automatically size the column or row to fit to its contents, if // setAsMin is true, this optimal width will also be set as minimal width // for this column @@ -1869,7 +1908,8 @@ protected: WXGRID_CURSOR_RESIZE_ROW, WXGRID_CURSOR_RESIZE_COL, WXGRID_CURSOR_SELECT_ROW, - WXGRID_CURSOR_SELECT_COL + WXGRID_CURSOR_SELECT_COL, + WXGRID_CURSOR_MOVE_COL }; // this method not only sets m_cursorMode but also sets the correct cursor @@ -1885,8 +1925,13 @@ protected: wxWindow *m_winCapture; // the window which captured the mouse CursorMode m_cursorMode; + //Column positions + wxArrayInt m_colAt; + int m_moveToCol; + bool m_canDragRowSize; bool m_canDragColSize; + bool m_canDragColMove; bool m_canDragGridSize; bool m_canDragCell; int m_dragLastPos; @@ -1980,7 +2025,7 @@ public: bool MetaDown() { return m_meta; } bool ShiftDown() { return m_shift; } bool AltDown() { return m_alt; } - bool CmdDown() + bool CmdDown() { #if defined(__WXMAC__) || defined(__WXCOCOA__) return MetaDown(); @@ -2022,7 +2067,7 @@ public: bool MetaDown() { return m_meta; } bool ShiftDown() { return m_shift; } bool AltDown() { return m_alt; } - bool CmdDown() + bool CmdDown() { #if defined(__WXMAC__) || defined(__WXCOCOA__) return MetaDown(); @@ -2077,7 +2122,7 @@ public: bool MetaDown() { return m_meta; } bool ShiftDown() { return m_shift; } bool AltDown() { return m_alt; } - bool CmdDown() + bool CmdDown() { #if defined(__WXMAC__) || defined(__WXCOCOA__) return MetaDown();