Merge branch 'grid-frozen'
Add support for freezing wxGrid columns and/or rows. Closes https://github.com/wxWidgets/wxWidgets/pull/1417 See https://github.com/wxWidgets/wxWidgets/pull/952
This commit is contained in:
@@ -1021,14 +1021,19 @@ public:
|
|||||||
int GetNumberRows() const { return m_numRows; }
|
int GetNumberRows() const { return m_numRows; }
|
||||||
int GetNumberCols() const { return m_numCols; }
|
int GetNumberCols() const { return m_numCols; }
|
||||||
|
|
||||||
|
int GetNumberFrozenRows() const { return m_numFrozenRows; }
|
||||||
|
int GetNumberFrozenCols() const { return m_numFrozenCols; }
|
||||||
|
|
||||||
// ------ display update functions
|
// ------ display update functions
|
||||||
//
|
//
|
||||||
wxArrayInt CalcRowLabelsExposed( const wxRegion& reg ) const;
|
wxArrayInt CalcRowLabelsExposed( const wxRegion& reg,
|
||||||
|
wxGridWindow *gridWindow = NULL) const;
|
||||||
wxArrayInt CalcColLabelsExposed( const wxRegion& reg ) const;
|
wxArrayInt CalcColLabelsExposed( const wxRegion& reg,
|
||||||
wxGridCellCoordsArray CalcCellsExposed( const wxRegion& reg ) const;
|
wxGridWindow *gridWindow = NULL) const;
|
||||||
|
wxGridCellCoordsArray CalcCellsExposed( const wxRegion& reg,
|
||||||
|
wxGridWindow *gridWindow = NULL) const;
|
||||||
|
|
||||||
|
void PrepareDCFor(wxDC &dc, wxGridWindow *gridWindow);
|
||||||
|
|
||||||
void ClearGrid();
|
void ClearGrid();
|
||||||
bool InsertRows(int pos = 0, int numRows = 1, bool updateLabels = true)
|
bool InsertRows(int pos = 0, int numRows = 1, bool updateLabels = true)
|
||||||
@@ -1062,12 +1067,27 @@ public:
|
|||||||
pos, numCols, updateLabels);
|
pos, numCols, updateLabels);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool FreezeTo(int row, int col);
|
||||||
|
bool FreezeTo(const wxGridCellCoords& coords)
|
||||||
|
{
|
||||||
|
return FreezeTo(coords.GetRow(), coords.GetCol());
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsFrozen() const;
|
||||||
|
|
||||||
void DrawGridCellArea( wxDC& dc , const wxGridCellCoordsArray& cells );
|
void DrawGridCellArea( wxDC& dc , const wxGridCellCoordsArray& cells );
|
||||||
void DrawGridSpace( wxDC& dc );
|
void DrawGridSpace( wxDC& dc, wxGridWindow *gridWindow );
|
||||||
void DrawCellBorder( wxDC& dc, const wxGridCellCoords& );
|
void DrawCellBorder( wxDC& dc, const wxGridCellCoords& );
|
||||||
void DrawAllGridLines( wxDC& dc, const wxRegion & reg );
|
void DrawAllGridLines();
|
||||||
|
void DrawAllGridWindowLines( wxDC& dc, const wxRegion & reg , wxGridWindow *gridWindow);
|
||||||
void DrawCell( wxDC& dc, const wxGridCellCoords& );
|
void DrawCell( wxDC& dc, const wxGridCellCoords& );
|
||||||
void DrawHighlight(wxDC& dc, const wxGridCellCoordsArray& cells);
|
void DrawHighlight(wxDC& dc, const wxGridCellCoordsArray& cells);
|
||||||
|
void DrawFrozenBorder( wxDC& dc, wxGridWindow *gridWindow );
|
||||||
|
void DrawLabelFrozenBorder( wxDC& dc, wxWindow *window, bool isRow );
|
||||||
|
|
||||||
|
void ScrollWindow( int dx, int dy, const wxRect *rect ) wxOVERRIDE;
|
||||||
|
|
||||||
|
void UpdateGridWindows() const;
|
||||||
|
|
||||||
// this function is called when the current cell highlight must be redrawn
|
// this function is called when the current cell highlight must be redrawn
|
||||||
// and may be overridden by the user
|
// and may be overridden by the user
|
||||||
@@ -1111,6 +1131,11 @@ public:
|
|||||||
const wxArrayString& lines,
|
const wxArrayString& lines,
|
||||||
long *width, long *height ) const;
|
long *width, long *height ) const;
|
||||||
|
|
||||||
|
void RefreshBlock(const wxGridCellCoords& topLeft,
|
||||||
|
const wxGridCellCoords& bottomRight);
|
||||||
|
|
||||||
|
void RefreshBlock(int topRow, int leftCol,
|
||||||
|
int bottomRow, int rightCol);
|
||||||
|
|
||||||
// ------
|
// ------
|
||||||
// Code that does a lot of grid modification can be enclosed
|
// Code that does a lot of grid modification can be enclosed
|
||||||
@@ -1157,11 +1182,15 @@ public:
|
|||||||
// grid cells and labels so you will need to convert from device
|
// grid cells and labels so you will need to convert from device
|
||||||
// coordinates for mouse events etc.
|
// coordinates for mouse events etc.
|
||||||
//
|
//
|
||||||
wxGridCellCoords XYToCell(int x, int y) const;
|
wxGridCellCoords XYToCell(int x, int y, wxGridWindow *gridWindow = NULL) const;
|
||||||
void XYToCell(int x, int y, wxGridCellCoords& coords) const
|
void XYToCell(int x, int y,
|
||||||
{ coords = XYToCell(x, y); }
|
wxGridCellCoords& coords,
|
||||||
wxGridCellCoords XYToCell(const wxPoint& pos) const
|
wxGridWindow *gridWindow = NULL) const
|
||||||
{ return XYToCell(pos.x, pos.y); }
|
{ coords = XYToCell(x, y, gridWindow); }
|
||||||
|
|
||||||
|
wxGridCellCoords XYToCell(const wxPoint& pos,
|
||||||
|
wxGridWindow *gridWindow = NULL) const
|
||||||
|
{ return XYToCell(pos.x, pos.y, gridWindow); }
|
||||||
|
|
||||||
// these functions return the index of the row/columns corresponding to the
|
// these functions return the index of the row/columns corresponding to the
|
||||||
// given logical position in pixels
|
// given logical position in pixels
|
||||||
@@ -1169,8 +1198,8 @@ public:
|
|||||||
// if clipToMinMax is false (default, wxNOT_FOUND is returned if the
|
// if clipToMinMax is false (default, wxNOT_FOUND is returned if the
|
||||||
// position is outside any row/column, otherwise the first/last element is
|
// position is outside any row/column, otherwise the first/last element is
|
||||||
// returned in this case
|
// returned in this case
|
||||||
int YToRow( int y, bool clipToMinMax = false ) const;
|
int YToRow( int y, bool clipToMinMax = false, wxGridWindow *gridWindow = NULL ) const;
|
||||||
int XToCol( int x, bool clipToMinMax = false ) const;
|
int XToCol( int x, bool clipToMinMax = false, wxGridWindow *gridWindow = NULL ) const;
|
||||||
|
|
||||||
int YToEdgeOfRow( int y ) const;
|
int YToEdgeOfRow( int y ) const;
|
||||||
int XToEdgeOfCol( int x ) const;
|
int XToEdgeOfCol( int x ) const;
|
||||||
@@ -1179,9 +1208,32 @@ public:
|
|||||||
wxRect CellToRect( const wxGridCellCoords& coords ) const
|
wxRect CellToRect( const wxGridCellCoords& coords ) const
|
||||||
{ return CellToRect( coords.GetRow(), coords.GetCol() ); }
|
{ return CellToRect( coords.GetRow(), coords.GetCol() ); }
|
||||||
|
|
||||||
|
wxGridWindow* CellToGridWindow( int row, int col ) const;
|
||||||
|
wxGridWindow* CellToGridWindow( const wxGridCellCoords& coords ) const
|
||||||
|
{ return CellToGridWindow( coords.GetRow(), coords.GetCol() ); }
|
||||||
|
|
||||||
|
const wxGridCellCoords& GetGridCursorCoords() const
|
||||||
|
{ return m_currentCellCoords; }
|
||||||
|
|
||||||
int GetGridCursorRow() const { return m_currentCellCoords.GetRow(); }
|
int GetGridCursorRow() const { return m_currentCellCoords.GetRow(); }
|
||||||
int GetGridCursorCol() const { return m_currentCellCoords.GetCol(); }
|
int GetGridCursorCol() const { return m_currentCellCoords.GetCol(); }
|
||||||
|
|
||||||
|
void GetGridWindowOffset(const wxGridWindow *gridWindow, int &x, int &y) const;
|
||||||
|
wxPoint GetGridWindowOffset(const wxGridWindow *gridWindow) const;
|
||||||
|
|
||||||
|
wxGridWindow* DevicePosToGridWindow(wxPoint pos) const;
|
||||||
|
wxGridWindow* DevicePosToGridWindow(int x, int y) const;
|
||||||
|
|
||||||
|
void CalcGridWindowUnscrolledPosition(int x, int y, int *xx, int *yy,
|
||||||
|
const wxGridWindow *gridWindow) const;
|
||||||
|
wxPoint CalcGridWindowUnscrolledPosition(const wxPoint& pt,
|
||||||
|
const wxGridWindow *gridWindow) const;
|
||||||
|
|
||||||
|
void CalcGridWindowScrolledPosition(int x, int y, int *xx, int *yy,
|
||||||
|
const wxGridWindow *gridWindow) const;
|
||||||
|
wxPoint CalcGridWindowScrolledPosition(const wxPoint& pt,
|
||||||
|
const wxGridWindow *gridWindow) const;
|
||||||
|
|
||||||
// check to see if a cell is either wholly visible (the default arg) or
|
// check to see if a cell is either wholly visible (the default arg) or
|
||||||
// at least partially visible in the grid window
|
// at least partially visible in the grid window
|
||||||
//
|
//
|
||||||
@@ -1245,9 +1297,11 @@ public:
|
|||||||
wxColour GetCellHighlightColour() const { return m_cellHighlightColour; }
|
wxColour GetCellHighlightColour() const { return m_cellHighlightColour; }
|
||||||
int GetCellHighlightPenWidth() const { return m_cellHighlightPenWidth; }
|
int GetCellHighlightPenWidth() const { return m_cellHighlightPenWidth; }
|
||||||
int GetCellHighlightROPenWidth() const { return m_cellHighlightROPenWidth; }
|
int GetCellHighlightROPenWidth() const { return m_cellHighlightROPenWidth; }
|
||||||
|
wxColor GetGridFrozenBorderColour() const { return m_gridFrozenBorderColour; }
|
||||||
|
int GetGridFrozenBorderPenWidth() const { return m_gridFrozenBorderPenWidth; }
|
||||||
|
|
||||||
// this one will use wxHeaderCtrl for the column labels
|
// this one will use wxHeaderCtrl for the column labels
|
||||||
void UseNativeColHeader(bool native = true);
|
bool UseNativeColHeader(bool native = true);
|
||||||
|
|
||||||
// this one will still draw them manually but using the native renderer
|
// this one will still draw them manually but using the native renderer
|
||||||
// instead of using the same appearance as for the row labels
|
// instead of using the same appearance as for the row labels
|
||||||
@@ -1269,9 +1323,10 @@ public:
|
|||||||
void SetColLabelValue( int col, const wxString& );
|
void SetColLabelValue( int col, const wxString& );
|
||||||
void SetCornerLabelValue( const wxString& );
|
void SetCornerLabelValue( const wxString& );
|
||||||
void SetCellHighlightColour( const wxColour& );
|
void SetCellHighlightColour( const wxColour& );
|
||||||
void SetCellHighlightPenWidth(int width);
|
void SetCellHighlightPenWidth( int width );
|
||||||
void SetCellHighlightROPenWidth(int width);
|
void SetCellHighlightROPenWidth( int width );
|
||||||
|
void SetGridFrozenBorderColour( const wxColour& );
|
||||||
|
void SetGridFrozenBorderPenWidth( int width );
|
||||||
|
|
||||||
// interactive grid mouse operations control
|
// interactive grid mouse operations control
|
||||||
// -----------------------------------------
|
// -----------------------------------------
|
||||||
@@ -1298,7 +1353,7 @@ public:
|
|||||||
{ return m_canDragColSize && DoCanResizeLine(col, m_setFixedCols); }
|
{ return m_canDragColSize && DoCanResizeLine(col, m_setFixedCols); }
|
||||||
|
|
||||||
// interactive column reordering (disabled by default)
|
// interactive column reordering (disabled by default)
|
||||||
void EnableDragColMove( bool enable = true );
|
bool EnableDragColMove( bool enable = true );
|
||||||
void DisableDragColMove() { EnableDragColMove( false ); }
|
void DisableDragColMove() { EnableDragColMove( false ); }
|
||||||
bool CanDragColMove() const { return m_canDragColMove; }
|
bool CanDragColMove() const { return m_canDragColMove; }
|
||||||
|
|
||||||
@@ -1624,7 +1679,8 @@ public:
|
|||||||
// to the client size of the grid window.
|
// to the client size of the grid window.
|
||||||
//
|
//
|
||||||
wxRect BlockToDeviceRect( const wxGridCellCoords & topLeft,
|
wxRect BlockToDeviceRect( const wxGridCellCoords & topLeft,
|
||||||
const wxGridCellCoords & bottomRight ) const;
|
const wxGridCellCoords & bottomRight,
|
||||||
|
const wxGridWindow *gridWindow = NULL) const;
|
||||||
|
|
||||||
// Access or update the selection fore/back colours
|
// Access or update the selection fore/back colours
|
||||||
wxColour GetSelectionBackground() const
|
wxColour GetSelectionBackground() const
|
||||||
@@ -1660,8 +1716,11 @@ public:
|
|||||||
|
|
||||||
// Accessors for component windows
|
// Accessors for component windows
|
||||||
wxWindow* GetGridWindow() const { return (wxWindow*)m_gridWin; }
|
wxWindow* GetGridWindow() const { return (wxWindow*)m_gridWin; }
|
||||||
|
wxWindow* GetFrozenCornerGridWindow()const { return (wxWindow*)m_frozenCornerGridWin; }
|
||||||
|
wxWindow* GetFrozenRowGridWindow() const { return (wxWindow*)m_frozenRowGridWin; }
|
||||||
|
wxWindow* GetFrozenColGridWindow() const { return (wxWindow*)m_frozenColGridWin; }
|
||||||
wxWindow* GetGridRowLabelWindow() const { return (wxWindow*)m_rowLabelWin; }
|
wxWindow* GetGridRowLabelWindow() const { return (wxWindow*)m_rowLabelWin; }
|
||||||
wxWindow* GetGridColLabelWindow() const { return m_colWindow; }
|
wxWindow* GetGridColLabelWindow() const { return m_colLabelWin; }
|
||||||
wxWindow* GetGridCornerLabelWindow() const { return (wxWindow*)m_cornerLabelWin; }
|
wxWindow* GetGridCornerLabelWindow() const { return (wxWindow*)m_cornerLabelWin; }
|
||||||
|
|
||||||
// This one can only be called if we are using the native header window
|
// This one can only be called if we are using the native header window
|
||||||
@@ -1672,7 +1731,7 @@ public:
|
|||||||
// static_cast<> doesn't work without the full class declaration in
|
// static_cast<> doesn't work without the full class declaration in
|
||||||
// view and we prefer to avoid adding more compile-time dependencies
|
// view and we prefer to avoid adding more compile-time dependencies
|
||||||
// even at the cost of using reinterpret_cast<>
|
// even at the cost of using reinterpret_cast<>
|
||||||
return reinterpret_cast<wxHeaderCtrl *>(m_colWindow);
|
return reinterpret_cast<wxHeaderCtrl *>(m_colLabelWin);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allow adjustment of scroll increment. The default is (15, 15).
|
// Allow adjustment of scroll increment. The default is (15, 15).
|
||||||
@@ -1893,19 +1952,24 @@ protected:
|
|||||||
bool m_created;
|
bool m_created;
|
||||||
|
|
||||||
wxGridWindow *m_gridWin;
|
wxGridWindow *m_gridWin;
|
||||||
|
wxGridWindow *m_frozenColGridWin;
|
||||||
|
wxGridWindow *m_frozenRowGridWin;
|
||||||
|
wxGridWindow *m_frozenCornerGridWin;
|
||||||
wxGridCornerLabelWindow *m_cornerLabelWin;
|
wxGridCornerLabelWindow *m_cornerLabelWin;
|
||||||
wxGridRowLabelWindow *m_rowLabelWin;
|
wxGridRowLabelWindow *m_rowLabelWin;
|
||||||
|
wxGridRowLabelWindow *m_rowFrozenLabelWin;
|
||||||
|
|
||||||
// the real type of the column window depends on m_useNativeHeader value:
|
// the real type of the column window depends on m_useNativeHeader value:
|
||||||
// if it is true, its dynamic type is wxHeaderCtrl, otherwise it is
|
// if it is true, its dynamic type is wxHeaderCtrl, otherwise it is
|
||||||
// wxGridColLabelWindow, use accessors below when the real type matters
|
// wxGridColLabelWindow, use accessors below when the real type matters
|
||||||
wxWindow *m_colWindow;
|
wxWindow *m_colLabelWin;
|
||||||
|
wxWindow *m_colFrozenLabelWin;
|
||||||
|
|
||||||
wxGridColLabelWindow *GetColLabelWindow() const
|
wxGridColLabelWindow *GetColLabelWindow() const
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( !m_useNativeHeader, "no column label window" );
|
wxASSERT_MSG( !m_useNativeHeader, "no column label window" );
|
||||||
|
|
||||||
return reinterpret_cast<wxGridColLabelWindow *>(m_colWindow);
|
return reinterpret_cast<wxGridColLabelWindow *>(m_colLabelWin);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxGridTableBase *m_table;
|
wxGridTableBase *m_table;
|
||||||
@@ -1914,6 +1978,10 @@ protected:
|
|||||||
int m_numRows;
|
int m_numRows;
|
||||||
int m_numCols;
|
int m_numCols;
|
||||||
|
|
||||||
|
// Number of frozen rows/columns in the beginning of the grid, 0 if none.
|
||||||
|
int m_numFrozenRows;
|
||||||
|
int m_numFrozenCols;
|
||||||
|
|
||||||
wxGridCellCoords m_currentCellCoords;
|
wxGridCellCoords m_currentCellCoords;
|
||||||
|
|
||||||
// the corners of the block being currently selected or wxGridNoCellCoords
|
// the corners of the block being currently selected or wxGridNoCellCoords
|
||||||
@@ -2003,7 +2071,8 @@ protected:
|
|||||||
wxColour m_cellHighlightColour;
|
wxColour m_cellHighlightColour;
|
||||||
int m_cellHighlightPenWidth;
|
int m_cellHighlightPenWidth;
|
||||||
int m_cellHighlightROPenWidth;
|
int m_cellHighlightROPenWidth;
|
||||||
|
wxColour m_gridFrozenBorderColour;
|
||||||
|
int m_gridFrozenBorderPenWidth;
|
||||||
|
|
||||||
// common part of AutoSizeColumn/Row() and GetBestSize()
|
// common part of AutoSizeColumn/Row() and GetBestSize()
|
||||||
int SetOrCalcColumnSizes(bool calcOnly, bool setAsMin = true);
|
int SetOrCalcColumnSizes(bool calcOnly, bool setAsMin = true);
|
||||||
@@ -2189,6 +2258,9 @@ protected:
|
|||||||
{ UpdateBlockBeingSelected(topLeft.GetRow(), topLeft.GetCol(),
|
{ UpdateBlockBeingSelected(topLeft.GetRow(), topLeft.GetCol(),
|
||||||
bottomRight.GetRow(), bottomRight.GetCol()); }
|
bottomRight.GetRow(), bottomRight.GetCol()); }
|
||||||
|
|
||||||
|
virtual bool ShouldScrollToChildOnFocus(wxWindow* WXUNUSED(win)) wxOVERRIDE
|
||||||
|
{ return false; }
|
||||||
|
|
||||||
friend class WXDLLIMPEXP_FWD_CORE wxGridSelection;
|
friend class WXDLLIMPEXP_FWD_CORE wxGridSelection;
|
||||||
friend class wxGridRowOperations;
|
friend class wxGridRowOperations;
|
||||||
friend class wxGridColumnOperations;
|
friend class wxGridColumnOperations;
|
||||||
@@ -2207,6 +2279,10 @@ private:
|
|||||||
// implement wxScrolledWindow method to return m_gridWin size
|
// implement wxScrolledWindow method to return m_gridWin size
|
||||||
virtual wxSize GetSizeAvailableForScrollTarget(const wxSize& size) wxOVERRIDE;
|
virtual wxSize GetSizeAvailableForScrollTarget(const wxSize& size) wxOVERRIDE;
|
||||||
|
|
||||||
|
// depending on the values of m_numFrozenRows and m_numFrozenCols, it will
|
||||||
|
// create and initialize or delete the frozen windows
|
||||||
|
void InitializeFrozenWindows();
|
||||||
|
|
||||||
// redraw the grid lines, should be called after changing their attributes
|
// redraw the grid lines, should be called after changing their attributes
|
||||||
void RedrawGridLines();
|
void RedrawGridLines();
|
||||||
|
|
||||||
@@ -2254,8 +2330,7 @@ private:
|
|||||||
//
|
//
|
||||||
// this always returns a valid position, even if the coordinate is out of
|
// this always returns a valid position, even if the coordinate is out of
|
||||||
// bounds (in which case first/last column is returned)
|
// bounds (in which case first/last column is returned)
|
||||||
int XToPos(int x) const;
|
int XToPos(int x, wxGridWindow *gridWindow) const;
|
||||||
|
|
||||||
|
|
||||||
// event handlers and their helpers
|
// event handlers and their helpers
|
||||||
// --------------------------------
|
// --------------------------------
|
||||||
@@ -2266,14 +2341,27 @@ private:
|
|||||||
bool isFirstDrag);
|
bool isFirstDrag);
|
||||||
|
|
||||||
// process row/column resizing drag event
|
// process row/column resizing drag event
|
||||||
void DoGridLineDrag(wxMouseEvent& event, const wxGridOperations& oper);
|
void DoGridLineDrag(int pos,
|
||||||
|
const wxGridOperations& oper,
|
||||||
|
wxGridWindow* gridWindow);
|
||||||
|
|
||||||
// process mouse drag event in the grid window, return false if starting
|
// process mouse drag event in the grid window, return false if starting
|
||||||
// dragging was vetoed by the user-defined wxEVT_GRID_CELL_BEGIN_DRAG
|
// dragging was vetoed by the user-defined wxEVT_GRID_CELL_BEGIN_DRAG
|
||||||
// handler
|
// handler
|
||||||
bool DoGridDragEvent(wxMouseEvent& event,
|
bool DoGridDragEvent(wxMouseEvent& event,
|
||||||
const wxGridCellCoords& coords,
|
const wxGridCellCoords& coords,
|
||||||
bool isFirstDrag);
|
bool isFirstDrag,
|
||||||
|
wxGridWindow* gridWindow);
|
||||||
|
|
||||||
|
void DrawGridDragLine(wxPoint position,
|
||||||
|
const wxGridOperations& oper,
|
||||||
|
wxGridWindow* gridWindow);
|
||||||
|
|
||||||
|
// return the current grid windows involved in the drag process
|
||||||
|
void GetDragGridWindows(int pos,
|
||||||
|
const wxGridOperations& oper,
|
||||||
|
wxGridWindow*& firstGridWindow,
|
||||||
|
wxGridWindow*& secondGridWindow);
|
||||||
|
|
||||||
// process different clicks on grid cells
|
// process different clicks on grid cells
|
||||||
void DoGridCellLeftDown(wxMouseEvent& event,
|
void DoGridCellLeftDown(wxMouseEvent& event,
|
||||||
@@ -2282,30 +2370,38 @@ private:
|
|||||||
void DoGridCellLeftDClick(wxMouseEvent& event,
|
void DoGridCellLeftDClick(wxMouseEvent& event,
|
||||||
const wxGridCellCoords& coords,
|
const wxGridCellCoords& coords,
|
||||||
const wxPoint& pos);
|
const wxPoint& pos);
|
||||||
void DoGridCellLeftUp(wxMouseEvent& event, const wxGridCellCoords& coords);
|
void DoGridCellLeftUp(wxMouseEvent& event,
|
||||||
|
const wxGridCellCoords& coords,
|
||||||
|
wxGridWindow* gridWindow);
|
||||||
|
|
||||||
// process movement (but not dragging) event in the grid cell area
|
// process movement (but not dragging) event in the grid cell area
|
||||||
void DoGridMouseMoveEvent(wxMouseEvent& event,
|
void DoGridMouseMoveEvent(wxMouseEvent& event,
|
||||||
const wxGridCellCoords& coords,
|
const wxGridCellCoords& coords,
|
||||||
const wxPoint& pos);
|
const wxPoint& pos,
|
||||||
|
wxGridWindow* gridWindow);
|
||||||
|
|
||||||
// process mouse events in the grid window
|
// process mouse events in the grid window
|
||||||
void ProcessGridCellMouseEvent(wxMouseEvent& event);
|
void ProcessGridCellMouseEvent(wxMouseEvent& event, wxGridWindow* gridWindow);
|
||||||
|
|
||||||
// process mouse events in the row/column labels/corner windows
|
// process mouse events in the row/column labels/corner windows
|
||||||
void ProcessRowLabelMouseEvent(wxMouseEvent& event);
|
void ProcessRowLabelMouseEvent(wxMouseEvent& event,
|
||||||
void ProcessColLabelMouseEvent(wxMouseEvent& event);
|
wxGridRowLabelWindow* rowLabelWin);
|
||||||
|
void ProcessColLabelMouseEvent(wxMouseEvent& event,
|
||||||
|
wxGridColLabelWindow* colLabelWin);
|
||||||
void ProcessCornerLabelMouseEvent(wxMouseEvent& event);
|
void ProcessCornerLabelMouseEvent(wxMouseEvent& event);
|
||||||
|
|
||||||
void DoColHeaderClick(int col);
|
void DoColHeaderClick(int col);
|
||||||
|
|
||||||
void DoStartResizeCol(int col);
|
void DoStartResizeCol(int col);
|
||||||
void DoUpdateResizeCol(int x);
|
|
||||||
void DoUpdateResizeColWidth(int w);
|
void DoUpdateResizeColWidth(int w);
|
||||||
void DoStartMoveCol(int col);
|
void DoStartMoveCol(int col);
|
||||||
|
|
||||||
void DoEndDragResizeRow(const wxMouseEvent& event);
|
void DoEndDragResizeRow(const wxMouseEvent& event, wxGridWindow *gridWindow);
|
||||||
void DoEndDragResizeCol(const wxMouseEvent& event);
|
void DoEndDragResizeCol(const wxMouseEvent& event, wxGridWindow *gridWindow);
|
||||||
|
void DoEndDragResizeCol(const wxMouseEvent& event)
|
||||||
|
{
|
||||||
|
DoEndDragResizeCol(event, m_gridWin);
|
||||||
|
}
|
||||||
void DoEndMoveCol(int pos);
|
void DoEndMoveCol(int pos);
|
||||||
|
|
||||||
// process a TAB keypress
|
// process a TAB keypress
|
||||||
@@ -2313,11 +2409,13 @@ private:
|
|||||||
|
|
||||||
// common implementations of methods defined for both rows and columns
|
// common implementations of methods defined for both rows and columns
|
||||||
void DeselectLine(int line, const wxGridOperations& oper);
|
void DeselectLine(int line, const wxGridOperations& oper);
|
||||||
bool DoEndDragResizeLine(const wxGridOperations& oper);
|
bool DoEndDragResizeLine(const wxGridOperations& oper, wxGridWindow *gridWindow);
|
||||||
int PosToLinePos(int pos, bool clipToMinMax,
|
int PosToLinePos(int pos, bool clipToMinMax,
|
||||||
const wxGridOperations& oper) const;
|
const wxGridOperations& oper,
|
||||||
|
wxGridWindow *gridWindow) const;
|
||||||
int PosToLine(int pos, bool clipToMinMax,
|
int PosToLine(int pos, bool clipToMinMax,
|
||||||
const wxGridOperations& oper) const;
|
const wxGridOperations& oper,
|
||||||
|
wxGridWindow *gridWindow) const;
|
||||||
int PosToEdgeOfLine(int pos, const wxGridOperations& oper) const;
|
int PosToEdgeOfLine(int pos, const wxGridOperations& oper) const;
|
||||||
|
|
||||||
bool DoMoveCursor(bool expandSelection,
|
bool DoMoveCursor(bool expandSelection,
|
||||||
@@ -2373,6 +2471,12 @@ private:
|
|||||||
void DoSetRowSize( int row, int height );
|
void DoSetRowSize( int row, int height );
|
||||||
void DoSetColSize( int col, int width );
|
void DoSetColSize( int col, int width );
|
||||||
|
|
||||||
|
// These methods can only be called when m_useNativeHeader is true and call
|
||||||
|
// SetColumnCount() and Set- or ResetColumnsOrder() as necessary on the
|
||||||
|
// native wxHeaderCtrl being used. Note that the first one already calls
|
||||||
|
// the second one, so it's never necessary to call both of them.
|
||||||
|
void SetNativeHeaderColCount();
|
||||||
|
void SetNativeHeaderColOrder();
|
||||||
|
|
||||||
// these sets contain the indices of fixed, i.e. non-resizable
|
// these sets contain the indices of fixed, i.e. non-resizable
|
||||||
// interactively, grid rows or columns and are NULL if there are no fixed
|
// interactively, grid rows or columns and are NULL if there are no fixed
|
||||||
|
@@ -158,9 +158,9 @@ protected:
|
|||||||
return m_columns[idx];
|
return m_columns[idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
|
||||||
wxGrid *GetOwner() const { return static_cast<wxGrid *>(GetParent()); }
|
wxGrid *GetOwner() const { return static_cast<wxGrid *>(GetParent()); }
|
||||||
|
|
||||||
|
private:
|
||||||
static wxMouseEvent GetDummyMouseEvent()
|
static wxMouseEvent GetDummyMouseEvent()
|
||||||
{
|
{
|
||||||
// make up a dummy event for the grid event to use -- unfortunately we
|
// make up a dummy event for the grid event to use -- unfortunately we
|
||||||
@@ -327,6 +327,7 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual bool IsFrozen() const { return false; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void OnPaint( wxPaintEvent& event );
|
void OnPaint( wxPaintEvent& event );
|
||||||
@@ -338,6 +339,18 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class wxGridRowFrozenLabelWindow : public wxGridRowLabelWindow
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxGridRowFrozenLabelWindow(wxGrid *parent)
|
||||||
|
: wxGridRowLabelWindow(parent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual bool IsFrozen() const { return true; }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class WXDLLIMPEXP_ADV wxGridColLabelWindow : public wxGridSubwindow
|
class WXDLLIMPEXP_ADV wxGridColLabelWindow : public wxGridSubwindow
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -346,6 +359,7 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual bool IsFrozen() const { return false; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void OnPaint( wxPaintEvent& event );
|
void OnPaint( wxPaintEvent& event );
|
||||||
@@ -357,6 +371,18 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class wxGridColFrozenLabelWindow : public wxGridColLabelWindow
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxGridColFrozenLabelWindow(wxGrid *parent)
|
||||||
|
: wxGridColLabelWindow(parent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual bool IsFrozen() const { return true; }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class WXDLLIMPEXP_ADV wxGridCornerLabelWindow : public wxGridSubwindow
|
class WXDLLIMPEXP_ADV wxGridCornerLabelWindow : public wxGridSubwindow
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -377,10 +403,21 @@ private:
|
|||||||
class WXDLLIMPEXP_ADV wxGridWindow : public wxGridSubwindow
|
class WXDLLIMPEXP_ADV wxGridWindow : public wxGridSubwindow
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxGridWindow(wxGrid *parent)
|
// grid window variants for scrolling possibilities
|
||||||
|
enum wxGridWindowType
|
||||||
|
{
|
||||||
|
wxGridWindowNormal = 0,
|
||||||
|
wxGridWindowFrozenCol = 1,
|
||||||
|
wxGridWindowFrozenRow = 2,
|
||||||
|
wxGridWindowFrozenCorner = wxGridWindowFrozenCol |
|
||||||
|
wxGridWindowFrozenRow
|
||||||
|
};
|
||||||
|
|
||||||
|
wxGridWindow(wxGrid *parent, wxGridWindowType type)
|
||||||
: wxGridSubwindow(parent,
|
: wxGridSubwindow(parent,
|
||||||
wxWANTS_CHARS | wxCLIP_CHILDREN,
|
wxWANTS_CHARS | wxCLIP_CHILDREN,
|
||||||
"GridWindow")
|
"GridWindow"),
|
||||||
|
m_type(type)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -389,7 +426,11 @@ public:
|
|||||||
|
|
||||||
virtual bool AcceptsFocus() const wxOVERRIDE { return true; }
|
virtual bool AcceptsFocus() const wxOVERRIDE { return true; }
|
||||||
|
|
||||||
|
wxGridWindowType GetType() const { return m_type; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
const wxGridWindowType m_type;
|
||||||
|
|
||||||
void OnPaint( wxPaintEvent &event );
|
void OnPaint( wxPaintEvent &event );
|
||||||
void OnMouseWheel( wxMouseEvent& event );
|
void OnMouseWheel( wxMouseEvent& event );
|
||||||
void OnMouseEvent( wxMouseEvent& event );
|
void OnMouseEvent( wxMouseEvent& event );
|
||||||
@@ -467,8 +508,14 @@ public:
|
|||||||
// if this object is a wxGridColumnOperations and vice versa.
|
// if this object is a wxGridColumnOperations and vice versa.
|
||||||
virtual wxGridOperations& Dual() const = 0;
|
virtual wxGridOperations& Dual() const = 0;
|
||||||
|
|
||||||
// Return the number of rows or columns.
|
// Return the total number of rows or columns.
|
||||||
virtual int GetNumberOfLines(const wxGrid *grid) const = 0;
|
virtual int GetTotalNumberOfLines(const wxGrid *grid) const = 0;
|
||||||
|
|
||||||
|
// Return the current number of rows or columns of a grid window.
|
||||||
|
virtual int GetNumberOfLines(const wxGrid *grid, wxGridWindow *gridWindow) const = 0;
|
||||||
|
|
||||||
|
// Return the first line for this grid type.
|
||||||
|
virtual int GetFirstLine(const wxGrid *grid, wxGridWindow *gridWindow) const = 0;
|
||||||
|
|
||||||
// Return the selection mode which allows selecting rows or columns.
|
// Return the selection mode which allows selecting rows or columns.
|
||||||
virtual wxGrid::wxGridSelectionModes GetSelectionMode() const = 0;
|
virtual wxGrid::wxGridSelectionModes GetSelectionMode() const = 0;
|
||||||
@@ -515,7 +562,7 @@ public:
|
|||||||
|
|
||||||
// Return the index of the row or column at the given pixel coordinate.
|
// Return the index of the row or column at the given pixel coordinate.
|
||||||
virtual int
|
virtual int
|
||||||
PosToLine(const wxGrid *grid, int pos, bool clip = false) const = 0;
|
PosToLine(const wxGrid *grid, int pos, wxGridWindow *gridWindow, bool clip = false) const = 0;
|
||||||
|
|
||||||
// Get the top/left position, in pixels, of the given row or column
|
// Get the top/left position, in pixels, of the given row or column
|
||||||
virtual int GetLineStartPos(const wxGrid *grid, int line) const = 0;
|
virtual int GetLineStartPos(const wxGrid *grid, int line) const = 0;
|
||||||
@@ -565,6 +612,8 @@ public:
|
|||||||
// Get the width or height of the row or column label window
|
// Get the width or height of the row or column label window
|
||||||
virtual int GetHeaderWindowSize(wxGrid *grid) const = 0;
|
virtual int GetHeaderWindowSize(wxGrid *grid) const = 0;
|
||||||
|
|
||||||
|
// Get the row or column frozen grid window
|
||||||
|
virtual wxGridWindow *GetFrozenGrid(wxGrid* grid) const = 0;
|
||||||
|
|
||||||
// This class is never used polymorphically but give it a virtual dtor
|
// This class is never used polymorphically but give it a virtual dtor
|
||||||
// anyhow to suppress g++ complaints about it
|
// anyhow to suppress g++ complaints about it
|
||||||
@@ -576,9 +625,13 @@ class wxGridRowOperations : public wxGridOperations
|
|||||||
public:
|
public:
|
||||||
virtual wxGridOperations& Dual() const wxOVERRIDE;
|
virtual wxGridOperations& Dual() const wxOVERRIDE;
|
||||||
|
|
||||||
virtual int GetNumberOfLines(const wxGrid *grid) const wxOVERRIDE
|
virtual int GetTotalNumberOfLines(const wxGrid *grid) const wxOVERRIDE
|
||||||
{ return grid->GetNumberRows(); }
|
{ return grid->GetNumberRows(); }
|
||||||
|
|
||||||
|
virtual int GetNumberOfLines(const wxGrid *grid, wxGridWindow *gridWindow) const wxOVERRIDE;
|
||||||
|
|
||||||
|
virtual int GetFirstLine(const wxGrid *grid, wxGridWindow *gridWindow) const wxOVERRIDE;
|
||||||
|
|
||||||
virtual wxGrid::wxGridSelectionModes GetSelectionMode() const wxOVERRIDE
|
virtual wxGrid::wxGridSelectionModes GetSelectionMode() const wxOVERRIDE
|
||||||
{ return wxGrid::wxGridSelectRows; }
|
{ return wxGrid::wxGridSelectRows; }
|
||||||
|
|
||||||
@@ -602,8 +655,8 @@ public:
|
|||||||
virtual void DrawParallelLine(wxDC& dc, int start, int end, int pos) const wxOVERRIDE
|
virtual void DrawParallelLine(wxDC& dc, int start, int end, int pos) const wxOVERRIDE
|
||||||
{ dc.DrawLine(start, pos, end, pos); }
|
{ dc.DrawLine(start, pos, end, pos); }
|
||||||
|
|
||||||
virtual int PosToLine(const wxGrid *grid, int pos, bool clip = false) const wxOVERRIDE
|
virtual int PosToLine(const wxGrid *grid, int pos, wxGridWindow *gridWindow , bool clip = false) const wxOVERRIDE
|
||||||
{ return grid->YToRow(pos, clip); }
|
{ return grid->YToRow(pos, clip, gridWindow); }
|
||||||
virtual int GetLineStartPos(const wxGrid *grid, int line) const wxOVERRIDE
|
virtual int GetLineStartPos(const wxGrid *grid, int line) const wxOVERRIDE
|
||||||
{ return grid->GetRowTop(line); }
|
{ return grid->GetRowTop(line); }
|
||||||
virtual int GetLineEndPos(const wxGrid *grid, int line) const wxOVERRIDE
|
virtual int GetLineEndPos(const wxGrid *grid, int line) const wxOVERRIDE
|
||||||
@@ -635,6 +688,9 @@ public:
|
|||||||
{ return grid->GetGridRowLabelWindow(); }
|
{ return grid->GetGridRowLabelWindow(); }
|
||||||
virtual int GetHeaderWindowSize(wxGrid *grid) const wxOVERRIDE
|
virtual int GetHeaderWindowSize(wxGrid *grid) const wxOVERRIDE
|
||||||
{ return grid->GetRowLabelSize(); }
|
{ return grid->GetRowLabelSize(); }
|
||||||
|
|
||||||
|
virtual wxGridWindow *GetFrozenGrid(wxGrid* grid) const wxOVERRIDE
|
||||||
|
{ return (wxGridWindow*)grid->GetFrozenRowGridWindow(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
class wxGridColumnOperations : public wxGridOperations
|
class wxGridColumnOperations : public wxGridOperations
|
||||||
@@ -642,9 +698,13 @@ class wxGridColumnOperations : public wxGridOperations
|
|||||||
public:
|
public:
|
||||||
virtual wxGridOperations& Dual() const wxOVERRIDE;
|
virtual wxGridOperations& Dual() const wxOVERRIDE;
|
||||||
|
|
||||||
virtual int GetNumberOfLines(const wxGrid *grid) const wxOVERRIDE
|
virtual int GetTotalNumberOfLines(const wxGrid *grid) const wxOVERRIDE
|
||||||
{ return grid->GetNumberCols(); }
|
{ return grid->GetNumberCols(); }
|
||||||
|
|
||||||
|
virtual int GetNumberOfLines(const wxGrid *grid, wxGridWindow *gridWindow) const wxOVERRIDE;
|
||||||
|
|
||||||
|
virtual int GetFirstLine(const wxGrid *grid, wxGridWindow *gridWindow) const wxOVERRIDE;
|
||||||
|
|
||||||
virtual wxGrid::wxGridSelectionModes GetSelectionMode() const wxOVERRIDE
|
virtual wxGrid::wxGridSelectionModes GetSelectionMode() const wxOVERRIDE
|
||||||
{ return wxGrid::wxGridSelectColumns; }
|
{ return wxGrid::wxGridSelectColumns; }
|
||||||
|
|
||||||
@@ -668,8 +728,8 @@ public:
|
|||||||
virtual void DrawParallelLine(wxDC& dc, int start, int end, int pos) const wxOVERRIDE
|
virtual void DrawParallelLine(wxDC& dc, int start, int end, int pos) const wxOVERRIDE
|
||||||
{ dc.DrawLine(pos, start, pos, end); }
|
{ dc.DrawLine(pos, start, pos, end); }
|
||||||
|
|
||||||
virtual int PosToLine(const wxGrid *grid, int pos, bool clip = false) const wxOVERRIDE
|
virtual int PosToLine(const wxGrid *grid, int pos, wxGridWindow *gridWindow, bool clip = false) const wxOVERRIDE
|
||||||
{ return grid->XToCol(pos, clip); }
|
{ return grid->XToCol(pos, clip, gridWindow); }
|
||||||
virtual int GetLineStartPos(const wxGrid *grid, int line) const wxOVERRIDE
|
virtual int GetLineStartPos(const wxGrid *grid, int line) const wxOVERRIDE
|
||||||
{ return grid->GetColLeft(line); }
|
{ return grid->GetColLeft(line); }
|
||||||
virtual int GetLineEndPos(const wxGrid *grid, int line) const wxOVERRIDE
|
virtual int GetLineEndPos(const wxGrid *grid, int line) const wxOVERRIDE
|
||||||
@@ -704,6 +764,9 @@ public:
|
|||||||
{ return grid->GetGridColLabelWindow(); }
|
{ return grid->GetGridColLabelWindow(); }
|
||||||
virtual int GetHeaderWindowSize(wxGrid *grid) const wxOVERRIDE
|
virtual int GetHeaderWindowSize(wxGrid *grid) const wxOVERRIDE
|
||||||
{ return grid->GetColLabelSize(); }
|
{ return grid->GetColLabelSize(); }
|
||||||
|
|
||||||
|
virtual wxGridWindow *GetFrozenGrid(wxGrid* grid) const wxOVERRIDE
|
||||||
|
{ return (wxGridWindow*)grid->GetFrozenColGridWindow(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
// This class abstracts the difference between operations going forward
|
// This class abstracts the difference between operations going forward
|
||||||
@@ -828,7 +891,7 @@ public:
|
|||||||
virtual int MoveByPixelDistance(int line, int distance) const wxOVERRIDE
|
virtual int MoveByPixelDistance(int line, int distance) const wxOVERRIDE
|
||||||
{
|
{
|
||||||
int pos = m_oper.GetLineStartPos(m_grid, line);
|
int pos = m_oper.GetLineStartPos(m_grid, line);
|
||||||
return m_oper.PosToLine(m_grid, pos - distance + 1, true);
|
return m_oper.PosToLine(m_grid, pos - distance + 1, NULL, true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -839,7 +902,7 @@ class wxGridForwardOperations : public wxGridDirectionOperations
|
|||||||
public:
|
public:
|
||||||
wxGridForwardOperations(wxGrid *grid, const wxGridOperations& oper)
|
wxGridForwardOperations(wxGrid *grid, const wxGridOperations& oper)
|
||||||
: wxGridDirectionOperations(grid, oper),
|
: wxGridDirectionOperations(grid, oper),
|
||||||
m_numLines(oper.GetNumberOfLines(grid))
|
m_numLines(oper.GetTotalNumberOfLines(grid))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -878,7 +941,7 @@ public:
|
|||||||
virtual int MoveByPixelDistance(int line, int distance) const wxOVERRIDE
|
virtual int MoveByPixelDistance(int line, int distance) const wxOVERRIDE
|
||||||
{
|
{
|
||||||
int pos = m_oper.GetLineStartPos(m_grid, line);
|
int pos = m_oper.GetLineStartPos(m_grid, line);
|
||||||
return m_oper.PosToLine(m_grid, pos + distance, true);
|
return m_oper.PosToLine(m_grid, pos + distance, NULL, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -14,6 +14,10 @@
|
|||||||
#include "wx/control.h"
|
#include "wx/control.h"
|
||||||
#include "wx/panel.h"
|
#include "wx/panel.h"
|
||||||
|
|
||||||
|
#ifdef __WXOSX__
|
||||||
|
#include "wx/scrolbar.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class WXDLLIMPEXP_FWD_CORE wxScrollHelperEvtHandler;
|
class WXDLLIMPEXP_FWD_CORE wxScrollHelperEvtHandler;
|
||||||
class WXDLLIMPEXP_FWD_BASE wxTimer;
|
class WXDLLIMPEXP_FWD_BASE wxTimer;
|
||||||
|
|
||||||
@@ -305,6 +309,21 @@ protected:
|
|||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Can be overridden to return false if the child window shouldn't be
|
||||||
|
// scrolled into view automatically when it gets focus, which is the
|
||||||
|
// default behaviour.
|
||||||
|
virtual bool ShouldScrollToChildOnFocus(wxWindow* child)
|
||||||
|
{
|
||||||
|
#if defined(__WXOSX__) && wxUSE_SCROLLBAR
|
||||||
|
if ( wxDynamicCast(child, wxScrollBar) )
|
||||||
|
return false;
|
||||||
|
#else
|
||||||
|
wxUnusedVar(child);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
double m_scaleX;
|
double m_scaleX;
|
||||||
double m_scaleY;
|
double m_scaleY;
|
||||||
|
@@ -2687,8 +2687,13 @@ public:
|
|||||||
Also note that currently @c wxEVT_GRID_LABEL_RIGHT_DCLICK event is not
|
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
|
generated for the column labels if the native columns header is used
|
||||||
(but this limitation could possibly be lifted in the future).
|
(but this limitation could possibly be lifted in the future).
|
||||||
|
|
||||||
|
Finally, please note that using the native control is currently
|
||||||
|
incompatible with freezing columns in the grid (see FreezeTo()) and
|
||||||
|
this function will return @false, without doing anything, if it's
|
||||||
|
called on a grid in which any columns are frozen.
|
||||||
*/
|
*/
|
||||||
void UseNativeColHeader(bool native = true);
|
bool UseNativeColHeader(bool native = true);
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
@@ -3767,8 +3772,14 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Enables or disables column moving by dragging with the mouse.
|
Enables or disables column moving by dragging with the mouse.
|
||||||
|
|
||||||
|
Note that reordering columns by dragging them is currently not
|
||||||
|
supported when the grid has any frozen columns (see FreezeTo()) and if
|
||||||
|
this method is called with @a enable equal to @true in this situation,
|
||||||
|
it returns @false without doing anything. Otherwise it returns @true to
|
||||||
|
indicate that it was successful.
|
||||||
*/
|
*/
|
||||||
void EnableDragColMove(bool enable = true);
|
bool EnableDragColMove(bool enable = true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Enables or disables column sizing by dragging with the mouse.
|
Enables or disables column sizing by dragging with the mouse.
|
||||||
@@ -3827,13 +3838,28 @@ public:
|
|||||||
*/
|
*/
|
||||||
//@{
|
//@{
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the current grid cursor position.
|
||||||
|
|
||||||
|
If grid cursor doesn't have any valid position (e.g. if the grid is
|
||||||
|
completely empty and doesn't have any rows or columns), returns
|
||||||
|
@c wxGridNoCellCoords which has both row and columns set to @c -1.
|
||||||
|
|
||||||
|
@since 3.1.3
|
||||||
|
*/
|
||||||
|
const wxGridCellCoords& GetGridCursorCoords() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the current grid cell column position.
|
Returns the current grid cell column position.
|
||||||
|
|
||||||
|
@see GetGridCursorCoords()
|
||||||
*/
|
*/
|
||||||
int GetGridCursorCol() const;
|
int GetGridCursorCol() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the current grid cell row position.
|
Returns the current grid cell row position.
|
||||||
|
|
||||||
|
@see GetGridCursorCoords()
|
||||||
*/
|
*/
|
||||||
int GetGridCursorRow() const;
|
int GetGridCursorRow() const;
|
||||||
|
|
||||||
@@ -4265,10 +4291,13 @@ public:
|
|||||||
limited by @a topLeft and @a bottomRight cell in device coords and
|
limited by @a topLeft and @a bottomRight cell in device coords and
|
||||||
clipped to the client size of the grid window.
|
clipped to the client size of the grid window.
|
||||||
|
|
||||||
|
@since 3.1.3 Parameter @a gridWindow has been added.
|
||||||
|
|
||||||
@see CellToRect()
|
@see CellToRect()
|
||||||
*/
|
*/
|
||||||
wxRect BlockToDeviceRect(const wxGridCellCoords& topLeft,
|
wxRect BlockToDeviceRect(const wxGridCellCoords& topLeft,
|
||||||
const wxGridCellCoords& bottomRight) const;
|
const wxGridCellCoords& bottomRight,
|
||||||
|
const wxGridWindow *gridWindow = NULL) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Return the rectangle corresponding to the grid cell's size and position
|
Return the rectangle corresponding to the grid cell's size and position
|
||||||
@@ -4286,7 +4315,78 @@ public:
|
|||||||
wxRect CellToRect(const wxGridCellCoords& coords) const;
|
wxRect CellToRect(const wxGridCellCoords& coords) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the column at the given pixel position.
|
Returns the grid window that contains the cell.
|
||||||
|
|
||||||
|
In a grid without frozen rows or columns (see FreezeTo()), this will
|
||||||
|
always return the same window as GetGridWindow(), however if some parts
|
||||||
|
of the grid are frozen, this function returns the window containing the
|
||||||
|
given cell.
|
||||||
|
|
||||||
|
@since 3.1.3
|
||||||
|
*/
|
||||||
|
wxGridWindow* CellToGridWindow( int row, int col ) const;
|
||||||
|
|
||||||
|
/// @overload
|
||||||
|
wxGridWindow* CellToGridWindow( const wxGridCellCoords& coords ) const
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the grid window that includes the input coordinates.
|
||||||
|
|
||||||
|
@since 3.1.3
|
||||||
|
*/
|
||||||
|
wxGridWindow* DevicePosToGridWindow(wxPoint pos) const;
|
||||||
|
|
||||||
|
/// @overload
|
||||||
|
wxGridWindow* DevicePosToGridWindow(int x, int y) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the grid window's offset from the grid starting position taking
|
||||||
|
into account the frozen cells.
|
||||||
|
|
||||||
|
If there are no frozen cells, returns (0, 0).
|
||||||
|
|
||||||
|
@since 3.1.3
|
||||||
|
|
||||||
|
@see FreezeTo()
|
||||||
|
*/
|
||||||
|
void GetGridWindowOffset(const wxGridWindow *gridWindow, int &x, int &y) const;
|
||||||
|
|
||||||
|
/// @overload
|
||||||
|
wxPoint GetGridWindowOffset(const wxGridWindow *gridWindow) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Translates the device coordinates to the logical ones, taking into
|
||||||
|
account the grid window type.
|
||||||
|
|
||||||
|
@since 3.1.3
|
||||||
|
|
||||||
|
@see wxScrolled::CalcUnscrolledPosition()
|
||||||
|
*/
|
||||||
|
void CalcGridWindowUnscrolledPosition(int x, int y,
|
||||||
|
int *xx, int *yy,
|
||||||
|
const wxGridWindow *gridWindow) const;
|
||||||
|
/// @overload
|
||||||
|
wxPoint CalcGridWindowUnscrolledPosition(const wxPoint& pt,
|
||||||
|
const wxGridWindow *gridWindow) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Translates the logical coordinates to the device ones, taking into
|
||||||
|
account the grid window type.
|
||||||
|
|
||||||
|
@since 3.1.3
|
||||||
|
|
||||||
|
@see wxScrolled::CalcScrolledPosition()
|
||||||
|
*/
|
||||||
|
void CalcGridWindowScrolledPosition(int x, int y,
|
||||||
|
int *xx, int *yy,
|
||||||
|
const wxGridWindow *gridWindow) const;
|
||||||
|
|
||||||
|
/// @overload
|
||||||
|
wxPoint CalcGridWindowScrolledPosition(const wxPoint& pt,
|
||||||
|
const wxGridWindow *gridWindow) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the column at the given pixel position depending on the window.
|
||||||
|
|
||||||
@param x
|
@param x
|
||||||
The x position to evaluate.
|
The x position to evaluate.
|
||||||
@@ -4294,10 +4394,15 @@ public:
|
|||||||
If @true, rather than returning @c wxNOT_FOUND, it returns either
|
If @true, rather than returning @c wxNOT_FOUND, it returns either
|
||||||
the first or last column depending on whether @a x is too far to
|
the first or last column depending on whether @a x is too far to
|
||||||
the left or right respectively.
|
the left or right respectively.
|
||||||
|
@param gridWindow
|
||||||
|
The associated grid window that limits the search (note that this
|
||||||
|
parameter is only available since wxWidgets 3.1.3).
|
||||||
|
If @a gridWindow is @NULL, it will consider all the cells, no matter
|
||||||
|
which grid they belong to.
|
||||||
@return
|
@return
|
||||||
The column index or @c wxNOT_FOUND.
|
The column index or @c wxNOT_FOUND.
|
||||||
*/
|
*/
|
||||||
int XToCol(int x, bool clipToMinMax = false) const;
|
int XToCol(int x, bool clipToMinMax = false, wxGridWindow *gridWindow = NULL) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the column whose right hand edge is close to the given logical
|
Returns the column whose right hand edge is close to the given logical
|
||||||
@@ -4315,20 +4420,22 @@ public:
|
|||||||
the mouse position, which is expressed in device coordinates, to
|
the mouse position, which is expressed in device coordinates, to
|
||||||
logical ones.
|
logical ones.
|
||||||
|
|
||||||
@see XToCol(), YToRow()
|
The parameter @a gridWindow is new since wxWidgets 3.1.3. If it is
|
||||||
*/
|
specified, i.e. non-@NULL, the coordinates must be in this window
|
||||||
wxGridCellCoords XYToCell(int x, int y) const;
|
coordinate system and only the cells of this window are considered,
|
||||||
/**
|
i.e. the function returns @c wxNOT_FOUND if the coordinates are out of
|
||||||
Translates logical pixel coordinates to the grid cell coordinates.
|
bounds.
|
||||||
|
|
||||||
Notice that this function expects logical coordinates on input so if
|
If @a gridWindow is @NULL, coordinates are relative to the main grid
|
||||||
you use this function in a mouse event handler you need to translate
|
window and all cells are considered.
|
||||||
the mouse position, which is expressed in device coordinates, to
|
|
||||||
logical ones.
|
|
||||||
|
|
||||||
@see XToCol(), YToRow()
|
@see XToCol(), YToRow()
|
||||||
*/
|
*/
|
||||||
wxGridCellCoords XYToCell(const wxPoint& pos) const;
|
wxGridCellCoords XYToCell(int x, int y, wxGridWindow *gridWindow = NULL) const;
|
||||||
|
|
||||||
|
/// @overload
|
||||||
|
wxGridCellCoords XYToCell(const wxPoint& pos, wxGridWindow *gridWindow = NULL) const;
|
||||||
|
|
||||||
// XYToCell(int, int, wxGridCellCoords&) overload is intentionally
|
// XYToCell(int, int, wxGridCellCoords&) overload is intentionally
|
||||||
// undocumented, using it is ugly and non-const reference parameters are
|
// undocumented, using it is ugly and non-const reference parameters are
|
||||||
// not used in wxWidgets API
|
// not used in wxWidgets API
|
||||||
@@ -4344,9 +4451,16 @@ public:
|
|||||||
/**
|
/**
|
||||||
Returns the grid row that corresponds to the logical @a y coordinate.
|
Returns the grid row that corresponds to the logical @a y coordinate.
|
||||||
|
|
||||||
Returns @c wxNOT_FOUND if there is no row at the @a y position.
|
|
||||||
|
The parameter @a gridWindow is new since wxWidgets 3.1.3. If it is
|
||||||
|
specified, i.e. non-@NULL, only the cells of this window are
|
||||||
|
considered, i.e. the function returns @c wxNOT_FOUND if @a y is out of
|
||||||
|
bounds.
|
||||||
|
|
||||||
|
If @a gridWindow is @NULL, the function returns @c wxNOT_FOUND only if
|
||||||
|
there is no row at all at the @a y position.
|
||||||
*/
|
*/
|
||||||
int YToRow(int y, bool clipToMinMax = false) const;
|
int YToRow(int y, bool clipToMinMax = false, wxGridWindow *gridWindow = NULL) const;
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
@@ -4474,6 +4588,31 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool DeleteRows(int pos = 0, int numRows = 1, bool updateLabels = true);
|
bool DeleteRows(int pos = 0, int numRows = 1, bool updateLabels = true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets or resets the frozen columns and rows.
|
||||||
|
|
||||||
|
@param row
|
||||||
|
The number of rows to freeze, 0 means to unfreeze all rows.
|
||||||
|
@param col
|
||||||
|
The number of columns to freeze, 0 means to unfreeze all columns.
|
||||||
|
@return @true on success or @false if it failed.
|
||||||
|
|
||||||
|
Note that this method doesn't do anything, and returns @false, if any
|
||||||
|
of the following conditions are true:
|
||||||
|
- Either @a row or @a col are out of range
|
||||||
|
- Size of the frozen area would be bigger than the current viewing area
|
||||||
|
- There are any merged cells in the area to be frozen
|
||||||
|
- Grid uses a native header control (see UseNativeColHeader())
|
||||||
|
|
||||||
|
(some of these limitations could be lifted in the future).
|
||||||
|
|
||||||
|
@since 3.1.3
|
||||||
|
*/
|
||||||
|
bool FreezeTo(unsigned row, unsigned col);
|
||||||
|
|
||||||
|
/// @overload
|
||||||
|
bool FreezeTo(const wxGridCellCoords& coords);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Decrements the grid's batch count.
|
Decrements the grid's batch count.
|
||||||
|
|
||||||
@@ -4520,6 +4659,28 @@ public:
|
|||||||
*/
|
*/
|
||||||
int GetNumberRows() const;
|
int GetNumberRows() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the number of frozen grid columns.
|
||||||
|
|
||||||
|
If there are no frozen columns, returns 0.
|
||||||
|
|
||||||
|
@since 3.1.3
|
||||||
|
|
||||||
|
@see FreezeTo()
|
||||||
|
*/
|
||||||
|
int GetNumberFrozenCols() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the number of frozen grid rows.
|
||||||
|
|
||||||
|
If there are no frozen rows, returns 0.
|
||||||
|
|
||||||
|
@since 3.1.3
|
||||||
|
|
||||||
|
@see FreezeTo()
|
||||||
|
*/
|
||||||
|
int GetNumberFrozenRows() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the attribute for the given cell creating one if necessary.
|
Returns the attribute for the given cell creating one if necessary.
|
||||||
|
|
||||||
@@ -4678,9 +4839,12 @@ public:
|
|||||||
void SetRowAttr(int row, wxGridCellAttr* attr);
|
void SetRowAttr(int row, wxGridCellAttr* attr);
|
||||||
|
|
||||||
|
|
||||||
wxArrayInt CalcRowLabelsExposed( const wxRegion& reg );
|
wxArrayInt CalcRowLabelsExposed( const wxRegion& reg,
|
||||||
wxArrayInt CalcColLabelsExposed( const wxRegion& reg );
|
wxGridWindow *gridWindow = NULL) const;
|
||||||
wxGridCellCoordsArray CalcCellsExposed( const wxRegion& reg );
|
wxArrayInt CalcColLabelsExposed( const wxRegion& reg,
|
||||||
|
wxGridWindow *gridWindow = NULL) const;
|
||||||
|
wxGridCellCoordsArray CalcCellsExposed( const wxRegion& reg,
|
||||||
|
wxGridWindow *gridWindow = NULL) const;
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
@@ -4761,15 +4925,19 @@ public:
|
|||||||
|
|
||||||
Return the various child windows of wxGrid.
|
Return the various child windows of wxGrid.
|
||||||
|
|
||||||
wxGrid is an empty parent window for 4 children representing the column
|
wxGrid is an empty parent window for at least 4 children representing
|
||||||
labels window (top), the row labels window (left), the corner window
|
the column labels window (top), the row labels window (left), the
|
||||||
(top left) and the main grid window. It may be necessary to use these
|
corner window (top left) and the main grid window. It may be necessary
|
||||||
individual windows and not the wxGrid window itself if you need to
|
to use these individual windows and not the wxGrid window itself if you
|
||||||
handle events for them (this can be done using wxEvtHandler::Connect()
|
need to handle events for them (using wxEvtHandler::Bind()) or do
|
||||||
or wxWindow::PushEventHandler()) or do something else requiring the use
|
something else requiring the use of the correct window pointer. Notice
|
||||||
of the correct window pointer. Notice that you should not, however,
|
that you should not, however, change these windows (e.g. reposition
|
||||||
change these windows (e.g. reposition them or draw over them) because
|
them or draw over them) because they are managed by wxGrid itself.
|
||||||
they are managed by wxGrid itself.
|
|
||||||
|
When parts of the grid are frozen using FreezeTo() function, the main
|
||||||
|
grid window contains only the unfrozen part and additional windows are
|
||||||
|
used for the parts containing frozen rows and/or columns and the corner
|
||||||
|
window if both some rows and some columns are frozen.
|
||||||
*/
|
*/
|
||||||
//@{
|
//@{
|
||||||
|
|
||||||
@@ -4780,6 +4948,33 @@ public:
|
|||||||
*/
|
*/
|
||||||
wxWindow *GetGridWindow() const;
|
wxWindow *GetGridWindow() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Return the corner grid window containing frozen cells.
|
||||||
|
|
||||||
|
This window is shown only when there are frozen rows and columns.
|
||||||
|
|
||||||
|
@since 3.1.3
|
||||||
|
*/
|
||||||
|
wxWindow* GetFrozenCornerGridWindow() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Return the rows grid window containing row frozen cells.
|
||||||
|
|
||||||
|
This window is shown only when there are frozen rows.
|
||||||
|
|
||||||
|
@since 3.1.3
|
||||||
|
*/
|
||||||
|
wxWindow* GetFrozenRowGridWindow() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Return the columns grid window containing column frozen cells.
|
||||||
|
|
||||||
|
This window is shown only when there are frozen columns.
|
||||||
|
|
||||||
|
@since 3.1.3
|
||||||
|
*/
|
||||||
|
wxWindow* GetFrozenColGridWindow() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Return the row labels window.
|
Return the row labels window.
|
||||||
|
|
||||||
@@ -4849,6 +5044,8 @@ public:
|
|||||||
void SetCellHighlightColour( const wxColour& );
|
void SetCellHighlightColour( const wxColour& );
|
||||||
void SetCellHighlightPenWidth(int width);
|
void SetCellHighlightPenWidth(int width);
|
||||||
void SetCellHighlightROPenWidth(int width);
|
void SetCellHighlightROPenWidth(int width);
|
||||||
|
void SetGridFrozenBorderColour( const wxColour& );
|
||||||
|
void SetGridFrozenBorderPenWidth( int width );
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@@ -581,6 +581,19 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual bool SendAutoScrollEvents(wxScrollWinEvent& event) const;
|
virtual bool SendAutoScrollEvents(wxScrollWinEvent& event) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
This method can be overridden in a derived class to prevent scrolling
|
||||||
|
the child window into view automatically when it gets focus.
|
||||||
|
|
||||||
|
The default behaviour is to scroll this window to show its currently
|
||||||
|
focused child automatically, to ensure that the user can interact with
|
||||||
|
it. This is usually helpful, but can be undesirable for some windows,
|
||||||
|
in which case this method can be overridden to return @false for them
|
||||||
|
to prevent any scrolling from taking place when such windows get focus.
|
||||||
|
|
||||||
|
@since 3.1.3
|
||||||
|
*/
|
||||||
|
virtual bool ShouldScrollToChildOnFocus(wxWindow* child)
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
|
@@ -189,6 +189,8 @@ wxBEGIN_EVENT_TABLE( GridFrame, wxFrame )
|
|||||||
EVT_MENU( ID_SELCOLS, GridFrame::SelectCols )
|
EVT_MENU( ID_SELCOLS, GridFrame::SelectCols )
|
||||||
EVT_MENU( ID_SELROWSORCOLS, GridFrame::SelectRowsOrCols )
|
EVT_MENU( ID_SELROWSORCOLS, GridFrame::SelectRowsOrCols )
|
||||||
|
|
||||||
|
EVT_MENU( ID_FREEZE_OR_THAW, GridFrame::FreezeOrThaw )
|
||||||
|
|
||||||
EVT_MENU( ID_SET_CELL_FG_COLOUR, GridFrame::SetCellFgColour )
|
EVT_MENU( ID_SET_CELL_FG_COLOUR, GridFrame::SetCellFgColour )
|
||||||
EVT_MENU( ID_SET_CELL_BG_COLOUR, GridFrame::SetCellBgColour )
|
EVT_MENU( ID_SET_CELL_BG_COLOUR, GridFrame::SetCellBgColour )
|
||||||
|
|
||||||
@@ -370,6 +372,8 @@ GridFrame::GridFrame()
|
|||||||
editMenu->Append( ID_CLEARGRID, "Cl&ear grid cell contents" );
|
editMenu->Append( ID_CLEARGRID, "Cl&ear grid cell contents" );
|
||||||
editMenu->Append( ID_SETCORNERLABEL, "&Set corner label..." );
|
editMenu->Append( ID_SETCORNERLABEL, "&Set corner label..." );
|
||||||
|
|
||||||
|
editMenu->AppendCheckItem( ID_FREEZE_OR_THAW, "Freeze up to cursor\tCtrl-F" );
|
||||||
|
|
||||||
wxMenu *selectMenu = new wxMenu;
|
wxMenu *selectMenu = new wxMenu;
|
||||||
selectMenu->Append( ID_SELECT_UNSELECT, "Add new cells to the selection",
|
selectMenu->Append( ID_SELECT_UNSELECT, "Add new cells to the selection",
|
||||||
"When off, old selection is deselected before "
|
"When off, old selection is deselected before "
|
||||||
@@ -573,10 +577,10 @@ GridFrame::GridFrame()
|
|||||||
"This takes two cells",
|
"This takes two cells",
|
||||||
"Another choice",
|
"Another choice",
|
||||||
};
|
};
|
||||||
grid->SetCellEditor(4, 0, new wxGridCellChoiceEditor(WXSIZEOF(choices), choices));
|
grid->SetCellEditor(4, 2, new wxGridCellChoiceEditor(WXSIZEOF(choices), choices));
|
||||||
grid->SetCellSize(4, 0, 1, 2);
|
grid->SetCellSize(4, 2, 1, 2);
|
||||||
grid->SetCellValue(4, 0, choices[0]);
|
grid->SetCellValue(4, 2, choices[0]);
|
||||||
grid->SetCellOverflow(4, 0, false);
|
grid->SetCellOverflow(4, 2, false);
|
||||||
|
|
||||||
grid->SetCellSize(7, 1, 3, 4);
|
grid->SetCellSize(7, 1, 3, 4);
|
||||||
grid->SetCellAlignment(7, 1, wxALIGN_CENTRE, wxALIGN_CENTRE);
|
grid->SetCellAlignment(7, 1, wxALIGN_CENTRE, wxALIGN_CENTRE);
|
||||||
@@ -1209,6 +1213,30 @@ void GridFrame::SelectRowsOrCols( wxCommandEvent& WXUNUSED(ev) )
|
|||||||
grid->SetSelectionMode( wxGrid::wxGridSelectRowsOrColumns );
|
grid->SetSelectionMode( wxGrid::wxGridSelectRowsOrColumns );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GridFrame::FreezeOrThaw(wxCommandEvent& ev)
|
||||||
|
{
|
||||||
|
if ( ev.IsChecked() )
|
||||||
|
{
|
||||||
|
if ( !grid->FreezeTo(grid->GetGridCursorCoords()) )
|
||||||
|
{
|
||||||
|
wxLogMessage("Failed to freeze the grid.");
|
||||||
|
GetMenuBar()->Check(ID_FREEZE_OR_THAW, false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxLogMessage("Grid is now frozen");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// This never fails.
|
||||||
|
grid->FreezeTo(0, 0);
|
||||||
|
|
||||||
|
wxLogMessage("Grid is now thawed");
|
||||||
|
}
|
||||||
|
|
||||||
|
GetMenuBar()->Enable( ID_TOGGLECOLMOVING, !grid->IsFrozen() );
|
||||||
|
}
|
||||||
|
|
||||||
void GridFrame::SetCellFgColour( wxCommandEvent& WXUNUSED(ev) )
|
void GridFrame::SetCellFgColour( wxCommandEvent& WXUNUSED(ev) )
|
||||||
{
|
{
|
||||||
wxColour col = wxGetColourFromUser(this);
|
wxColour col = wxGetColourFromUser(this);
|
||||||
|
@@ -75,6 +75,8 @@ class GridFrame : public wxFrame
|
|||||||
void SelectCols( wxCommandEvent& );
|
void SelectCols( wxCommandEvent& );
|
||||||
void SelectRowsOrCols( wxCommandEvent& );
|
void SelectRowsOrCols( wxCommandEvent& );
|
||||||
|
|
||||||
|
void FreezeOrThaw( wxCommandEvent& );
|
||||||
|
|
||||||
void DeselectCell(wxCommandEvent& event);
|
void DeselectCell(wxCommandEvent& event);
|
||||||
void DeselectCol(wxCommandEvent& event);
|
void DeselectCol(wxCommandEvent& event);
|
||||||
void DeselectRow(wxCommandEvent& event);
|
void DeselectRow(wxCommandEvent& event);
|
||||||
@@ -204,6 +206,8 @@ public:
|
|||||||
ID_SIZE_LABELS_ROW,
|
ID_SIZE_LABELS_ROW,
|
||||||
ID_SIZE_GRID,
|
ID_SIZE_GRID,
|
||||||
|
|
||||||
|
ID_FREEZE_OR_THAW,
|
||||||
|
|
||||||
ID_SET_HIGHLIGHT_WIDTH,
|
ID_SET_HIGHLIGHT_WIDTH,
|
||||||
ID_SET_RO_HIGHLIGHT_WIDTH,
|
ID_SET_RO_HIGHLIGHT_WIDTH,
|
||||||
|
|
||||||
|
1517
src/generic/grid.cpp
1517
src/generic/grid.cpp
File diff suppressed because it is too large
Load Diff
@@ -259,9 +259,7 @@ void wxGridSelection::SelectRow(int row, const wxKeyboardState& kbd)
|
|||||||
// Update View:
|
// Update View:
|
||||||
if ( !m_grid->GetBatchCount() )
|
if ( !m_grid->GetBatchCount() )
|
||||||
{
|
{
|
||||||
wxRect r = m_grid->BlockToDeviceRect( wxGridCellCoords( row, 0 ),
|
m_grid->RefreshBlock(row, 0, row, m_grid->GetNumberCols() - 1);
|
||||||
wxGridCellCoords( row, m_grid->GetNumberCols() - 1 ) );
|
|
||||||
((wxWindow *)m_grid->m_gridWin)->Refresh( false, &r );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send Event
|
// Send Event
|
||||||
@@ -353,9 +351,7 @@ void wxGridSelection::SelectCol(int col, const wxKeyboardState& kbd)
|
|||||||
// Update View:
|
// Update View:
|
||||||
if ( !m_grid->GetBatchCount() )
|
if ( !m_grid->GetBatchCount() )
|
||||||
{
|
{
|
||||||
wxRect r = m_grid->BlockToDeviceRect( wxGridCellCoords( 0, col ),
|
m_grid->RefreshBlock(0, col, m_grid->GetNumberRows() - 1, col);
|
||||||
wxGridCellCoords( m_grid->GetNumberRows() - 1, col ) );
|
|
||||||
((wxWindow *)m_grid->m_gridWin)->Refresh( false, &r );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send Event
|
// Send Event
|
||||||
@@ -572,9 +568,7 @@ void wxGridSelection::SelectBlock( int topRow, int leftCol,
|
|||||||
// Update View:
|
// Update View:
|
||||||
if ( !m_grid->GetBatchCount() )
|
if ( !m_grid->GetBatchCount() )
|
||||||
{
|
{
|
||||||
wxRect r = m_grid->BlockToDeviceRect( wxGridCellCoords( topRow, leftCol ),
|
m_grid->RefreshBlock(topRow, leftCol, bottomRow, rightCol);
|
||||||
wxGridCellCoords( bottomRow, rightCol ) );
|
|
||||||
((wxWindow *)m_grid->m_gridWin)->Refresh( false, &r );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send Event, if not disabled.
|
// Send Event, if not disabled.
|
||||||
@@ -621,10 +615,7 @@ void wxGridSelection::SelectCell( int row, int col,
|
|||||||
// Update View:
|
// Update View:
|
||||||
if ( !m_grid->GetBatchCount() )
|
if ( !m_grid->GetBatchCount() )
|
||||||
{
|
{
|
||||||
wxRect r = m_grid->BlockToDeviceRect(
|
m_grid->RefreshBlock(selectedTopLeft, selectedBottomRight);
|
||||||
selectedTopLeft,
|
|
||||||
selectedBottomRight );
|
|
||||||
((wxWindow *)m_grid->m_gridWin)->Refresh( false, &r );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send event
|
// Send event
|
||||||
@@ -674,8 +665,7 @@ wxGridSelection::ToggleCellSelection(int row, int col,
|
|||||||
m_cellSelection.RemoveAt(n);
|
m_cellSelection.RemoveAt(n);
|
||||||
if ( !m_grid->GetBatchCount() )
|
if ( !m_grid->GetBatchCount() )
|
||||||
{
|
{
|
||||||
wxRect r = m_grid->BlockToDeviceRect( coords, coords );
|
m_grid->RefreshBlock(coords, coords);
|
||||||
((wxWindow *)m_grid->m_gridWin)->Refresh( false, &r );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send event
|
// Send event
|
||||||
@@ -810,10 +800,7 @@ wxGridSelection::ToggleCellSelection(int row, int col,
|
|||||||
{
|
{
|
||||||
if ( !m_grid->GetBatchCount() )
|
if ( !m_grid->GetBatchCount() )
|
||||||
{
|
{
|
||||||
r = m_grid->BlockToDeviceRect(
|
m_grid->RefreshBlock(row, col, row, col);
|
||||||
wxGridCellCoords( row, col ),
|
|
||||||
wxGridCellCoords( row, col ) );
|
|
||||||
((wxWindow *)m_grid->m_gridWin)->Refresh( false, &r );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxGridRangeSelectEvent gridEvt( m_grid->GetId(),
|
wxGridRangeSelectEvent gridEvt( m_grid->GetId(),
|
||||||
@@ -839,10 +826,7 @@ wxGridSelection::ToggleCellSelection(int row, int col,
|
|||||||
{
|
{
|
||||||
if ( !m_grid->GetBatchCount() )
|
if ( !m_grid->GetBatchCount() )
|
||||||
{
|
{
|
||||||
r = m_grid->BlockToDeviceRect(
|
m_grid->RefreshBlock(row, colFrom, row, colTo - 1);
|
||||||
wxGridCellCoords( row, colFrom ),
|
|
||||||
wxGridCellCoords( row, colTo-1 ) );
|
|
||||||
((wxWindow *)m_grid->m_gridWin)->Refresh( false, &r );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxGridRangeSelectEvent gridEvt( m_grid->GetId(),
|
wxGridRangeSelectEvent gridEvt( m_grid->GetId(),
|
||||||
@@ -872,10 +856,7 @@ wxGridSelection::ToggleCellSelection(int row, int col,
|
|||||||
{
|
{
|
||||||
if ( !m_grid->GetBatchCount() )
|
if ( !m_grid->GetBatchCount() )
|
||||||
{
|
{
|
||||||
r = m_grid->BlockToDeviceRect(
|
m_grid->RefreshBlock(rowFrom, col, rowTo - 1, col);
|
||||||
wxGridCellCoords( rowFrom, col ),
|
|
||||||
wxGridCellCoords( rowTo - 1, col ) );
|
|
||||||
((wxWindow *)m_grid->m_gridWin)->Refresh( false, &r );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxGridRangeSelectEvent gridEvt( m_grid->GetId(),
|
wxGridRangeSelectEvent gridEvt( m_grid->GetId(),
|
||||||
@@ -911,11 +892,10 @@ void wxGridSelection::ClearSelection()
|
|||||||
m_cellSelection.RemoveAt(n);
|
m_cellSelection.RemoveAt(n);
|
||||||
if ( !m_grid->GetBatchCount() )
|
if ( !m_grid->GetBatchCount() )
|
||||||
{
|
{
|
||||||
r = m_grid->BlockToDeviceRect( coords1, coords1 );
|
m_grid->RefreshBlock(coords1, coords1);
|
||||||
((wxWindow *)m_grid->m_gridWin)->Refresh( false, &r );
|
|
||||||
|
|
||||||
#ifdef __WXMAC__
|
#ifdef __WXMAC__
|
||||||
((wxWindow *)m_grid->m_gridWin)->Update();
|
m_grid->UpdateGridWindows();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -931,11 +911,10 @@ void wxGridSelection::ClearSelection()
|
|||||||
m_blockSelectionBottomRight.RemoveAt(n);
|
m_blockSelectionBottomRight.RemoveAt(n);
|
||||||
if ( !m_grid->GetBatchCount() )
|
if ( !m_grid->GetBatchCount() )
|
||||||
{
|
{
|
||||||
r = m_grid->BlockToDeviceRect( coords1, coords2 );
|
m_grid->RefreshBlock(coords1, coords2);
|
||||||
((wxWindow *)m_grid->m_gridWin)->Refresh( false, &r );
|
|
||||||
|
|
||||||
#ifdef __WXMAC__
|
#ifdef __WXMAC__
|
||||||
((wxWindow *)m_grid->m_gridWin)->Update();
|
m_grid->UpdateGridWindows();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -950,12 +929,10 @@ void wxGridSelection::ClearSelection()
|
|||||||
m_rowSelection.RemoveAt(n);
|
m_rowSelection.RemoveAt(n);
|
||||||
if ( !m_grid->GetBatchCount() )
|
if ( !m_grid->GetBatchCount() )
|
||||||
{
|
{
|
||||||
r = m_grid->BlockToDeviceRect( wxGridCellCoords( row, 0 ),
|
m_grid->RefreshBlock(row, 0, row, m_grid->GetNumberCols() - 1);
|
||||||
wxGridCellCoords( row, m_grid->GetNumberCols() - 1 ) );
|
|
||||||
((wxWindow *)m_grid->m_gridWin)->Refresh( false, &r );
|
|
||||||
|
|
||||||
#ifdef __WXMAC__
|
#ifdef __WXMAC__
|
||||||
((wxWindow *)m_grid->m_gridWin)->Update();
|
m_grid->UpdateGridWindows();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -971,12 +948,10 @@ void wxGridSelection::ClearSelection()
|
|||||||
m_colSelection.RemoveAt(n);
|
m_colSelection.RemoveAt(n);
|
||||||
if ( !m_grid->GetBatchCount() )
|
if ( !m_grid->GetBatchCount() )
|
||||||
{
|
{
|
||||||
r = m_grid->BlockToDeviceRect( wxGridCellCoords( 0, col ),
|
m_grid->RefreshBlock(0, col, m_grid->GetNumberRows() - 1, col);
|
||||||
wxGridCellCoords( m_grid->GetNumberRows() - 1, col ) );
|
|
||||||
((wxWindow *)m_grid->m_gridWin)->Refresh( false, &r );
|
|
||||||
|
|
||||||
#ifdef __WXMAC__
|
#ifdef __WXMAC__
|
||||||
((wxWindow *)m_grid->m_gridWin)->Update();
|
m_grid->UpdateGridWindows();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1070,10 +1070,11 @@ void wxScrollHelperBase::HandleOnChildFocus(wxChildFocusEvent& event)
|
|||||||
if ( win == m_targetWindow )
|
if ( win == m_targetWindow )
|
||||||
return; // nothing to do
|
return; // nothing to do
|
||||||
|
|
||||||
#if defined( __WXOSX__ ) && wxUSE_SCROLLBAR
|
if ( !ShouldScrollToChildOnFocus(win) )
|
||||||
if (wxDynamicCast(win, wxScrollBar))
|
{
|
||||||
|
// the window does not require to be scrolled into view
|
||||||
return;
|
return;
|
||||||
#endif
|
}
|
||||||
|
|
||||||
// Fixing ticket: https://trac.wxwidgets.org/ticket/9563
|
// Fixing ticket: https://trac.wxwidgets.org/ticket/9563
|
||||||
// When a child inside a wxControlContainer receives a focus, the
|
// When a child inside a wxControlContainer receives a focus, the
|
||||||
|
Reference in New Issue
Block a user