Contents Up Previous Next

wxGrid: wxPanel

wxGrid classes overview

wxGrid::wxGrid
wxGrid::AdjustScrollbars
wxGrid::AppendCols
wxGrid::AppendRows
wxGrid::BeginBatch
wxGrid::CellHitTest
wxGrid::CreateGrid
wxGrid::CurrentCellVisible
wxGrid::DeleteCols
wxGrid::DeleteRows
wxGrid::EndBatch
wxGrid::GetBatchCount
wxGrid::GetCell
wxGrid::GetCellAlignment
wxGrid::GetCellBackgroundColour
wxGrid::GetCells
wxGrid::GetCellTextColour
wxGrid::GetCellTextFont
wxGrid::GetCellValue
wxGrid::GetCols
wxGrid::GetColumnWidth
wxGrid::GetCurrentRect
wxGrid::GetCursorColumn
wxGrid::GetCursorRow
wxGrid::GetEditable
wxGrid::GetHorizScrollBar
wxGrid::GetLabelAlignment
wxGrid::GetLabelBackgroundColour
wxGrid::GetLabelSize
wxGrid::GetLabelTextColour
wxGrid::GetLabelTextFont
wxGrid::GetLabelValue
wxGrid::GetRowHeight
wxGrid::GetRows
wxGrid::GetScrollPosX
wxGrid::GetScrollPosX
wxGrid::GetTextItem
wxGrid::GetVertScrollBar
wxGrid::InsertCols
wxGrid::InsertRows
wxGrid::OnActivate
wxGrid::OnChangeLabels
wxGrid::OnChangeSelectionLabel
wxGrid::OnCreateCell
wxGrid::OnCellLeftClick
wxGrid::OnCellRightClick
wxGrid::OnLabelLeftClick
wxGrid::OnLabelRightClick
wxGrid::OnSelectCell
wxGrid::OnSelectCellImplementation
wxGrid::SetCellAlignment
wxGrid::SetCellBackgroundColour
wxGrid::SetCellTextColour
wxGrid::SetCellTextFont
wxGrid::SetCellValue
wxGrid::SetColumnWidth
wxGrid::SetDividerPen
wxGrid::SetEditable
wxGrid::SetGridCursor
wxGrid::SetLabelAlignment
wxGrid::SetLabelBackgroundColour
wxGrid::SetLabelSize
wxGrid::SetLabelTextColour
wxGrid::SetLabelTextFont
wxGrid::SetLabelValue
wxGrid::SetRowHeight
wxGrid::UpdateDimensions


wxGrid::wxGrid

void wxGrid(wxWindow *parent, int x, int y, int width, int height, long style=0, char *name="grid")

Constructor. Before using a wxGrid object, you must call CreateGrid to set up the required rows and columns.


wxGrid::AdjustScrollbars

void AdjustScrollbars(void)

Call this function whenever a change has been made via the API that might alter the scrollbar characteristics: particularly when adding or deleting rows, or changing row or column dimensions. For example, removing rows might make it unnecessary to show the vertical scrollbar.


wxGrid::AppendCols

Bool AppendCols(int n=1, Bool updateLabels=TRUE)

Appends n columns to the grid. If updateLabels is TRUE, the function OnChangeLabels is called to give the application the opportunity to relabel.


wxGrid::AppendRows

Bool AppendRows(int n=1, Bool updateLabels=TRUE)

Appends n rows to the grid. If updateLabels is TRUE, the function OnChangeLabels is called to give the application the opportunity to relabel.


wxGrid::BeginBatch

void BeginBatch(void)

Start a BeginBatch/EndBatch pair between which, calls to SetCellValue or SetCellBitmap will not cause a refresh. This allows you to speed up some operations (for example, setting several hundred cell values). You can nest, but not overlap, these two functions.

See also EndBatch, GetBatchCount.


wxGrid::CellHitTest

Bool CellHitTest(int x, int y, int *row, int *col)

Returns TRUE if the x, y panel position coincides with a cell. If so, row and col are returned.


wxGrid::CreateGrid

Bool CreateGrid(int rows, int cols, wxString **cellValues=NULL, short *widths=NULL, short defaultWidth=wxGRID_DEFAULT_CELL_WIDTH, short defaultHeight=wxGRID_DEFAULT_CELL_HEIGHT)

Creates a grid rows high and cols wide. You can optionally specify an array of initial values and widths, and/or default cell width and height.

Call this function after creating the wxGrid object.


wxGrid::CurrentCellVisible

Bool CurrentCellVisible(void)

Returns TRUE if the currently selected cell is visible, FALSE otherwise.


wxGrid::DeleteCols

Bool DeleteCols(int pos=0, int n=1, Bool updateLabels=TRUE)

Deletes n columns from the grid at position pos. If updateLabels is TRUE, the function OnChangeLabels is called to give the application the opportunity to relabel.


wxGrid::DeleteRows

Bool DeleteRows(int pos=0, int n=1, Bool updateLabels=TRUE)

Deletes n rows from the grid at position pos. If updateLabels is TRUE, the function OnChangeLabels is called to give the application the opportunity to relabel.


wxGrid::EndBatch

void EndBatch(void)

End a BeginBatch/EndBatch pair between which, calls to SetCellValue or SetCellBitmap will not cause a refresh. This allows you to speed up some operations (for example, setting several hundred cell values). You can nest, but not overlap, these two functions.

See also BeginBatch, GetBatchCount.


wxGrid::GetBatchCount

void GetBatchCount(void)

Return the level of batch nesting. This is initially zero, and will be incremented every time BeginBatch is called, and decremented when EndBatch is called. When the batch count is more zero, some functions (such as SetCellValue and SetCellBitmap) will not refresh the cell.

See also BeginBatch, EndBatch.


wxGrid::GetCell

wxGridCell * GetCell(int row, int col)

Returns the grid cell object associated with this position.

wxGenericGrid implementation only.


wxGrid::GetCellAlignment

int GetCellAlignment(int row, int col)

int GetCellAlignment(void)

Sets the text alignment for the cell at the given position, or the global alignment value. The return value is wxLEFT, wxRIGHT or wxCENTRE.


wxGrid::GetCellBackgroundColour

wxColour& GetCellBackgroundColour(int row, int col)

wxColour& GetCellBackgroundColour(void)

Gets the background colour for the cell at the given position, or the global background colour.


wxGrid::GetCells

wxGridCell *** GetCells(void)

Returns the array of grid cell object associated with this wxGrid.

wxGenericGrid implementation only.


wxGrid::GetCellTextColour

wxColour& GetCellTextColour(int row, int col)

wxColour& GetCellTextColour(void)

Gets the text colour for the cell at the given position, or the global text colour.


wxGrid::GetCellTextFont

wxFont * GetCellTextFont(int row, int col)

wxFont * GetCellTextFont(void)

Gets the text font for the cell at the given position, or the global text font.


wxGrid::GetCellValue

wxString& GetCellValue(int row, int col)

Returns the cell value at the given position.


wxGrid::GetCols

int GetCols(void)

Returns the number of columns in the grid.


wxGrid::GetColumnWidth

int GetColumnWidth(int col)

Gets the width in pixels for column col.


wxGrid::GetCurrentRect

wxRectangle * GetCurrentRect(void)

Returns a pointer to the rectangle enclosing the currently selected cell. Do not delete this pointer.


wxGrid::GetCursorColumn

int GetCursorColumn(void)

Returns the column position of the currently selected cell.


wxGrid::GetCursorRow

int GetCursorRow(void)

Returns the row position of the currently selected cell.


wxGrid::GetEditable

Bool GetEditable(void)

Returns TRUE if the grid cells can be edited.


wxGrid::GetHorizScrollBar

wxScrollBar * GetHorizScrollBar(void)

Returns a pointer to the horizontal scrollbar.


wxGrid::GetLabelAlignment

int GetLabelAlignment(int orientation)

Gets the row or column label alignment. orientation should be wxHORIZONTAL to specify column label, wxVERTICAL to specify row label. alignment should be wxCENTRE, wxLEFT or wxRIGHT.


wxGrid::GetLabelBackgroundColour

wxColour& GetLabelBackgroundColour(void)

Gets a row and column label text colour.


wxGrid::GetLabelSize

int GetLabelSize(int orientation)

Gets the row label height, or column label width, in pixels. orientation should be wxHORIZONTAL to specify column label, wxVERTICAL to specify row label.


wxGrid::GetLabelTextColour

wxColour& GetLabelTextColour(void)

Gets a row and column label text colour.


wxGrid::GetLabelTextFont

wxFont * GetLabelTextFont(void)

Gets the font to be used for the row and column labels.


wxGrid::GetLabelValue

wxString& GetLabelValue(int orientation, int pos)

Gets a row or column label value. orientation should be wxHORIZONTAL to specify column label, wxVERTICAL to specify row label. pos is the label position.


wxGrid::GetRowHeight

int GetRowHeight(int row)

Gets the height in pixels for row row.


wxGrid::GetRows

int GetRows(void)

Returns the number of rows in the grid.


wxGrid::GetScrollPosX

int GetScrollPosX(void)

Returns the column scroll position.


wxGrid::GetScrollPosX

int GetScrollPosY(void)

Returns the row scroll position.


wxGrid::GetTextItem

wxText * GetTextItem(void)

Returns a pointer to the text item used for entering text into a cell.


wxGrid::GetVertScrollBar

wxScrollBar * GetVertScrollBar(void)

Returns a pointer to the vertical scrollbar.


wxGrid::InsertCols

Bool InsertCols(int pos=0, int n=1, Bool updateLabels=TRUE)

Inserts n number of columns before position pos. If updateLabels is TRUE, the function OnChangeLabels is called to give the application the opportunity to relabel.


wxGrid::InsertRows

Bool InsertRows(int pos=0, int n=1, Bool updateLabels=TRUE)

Inserts n number of rows before position pos. If updateLabels is TRUE, the function OnChangeLabels is called to give the application the opportunity to relabel.


wxGrid::OnActivate

void OnActivate(Bool active)

Sets the text item to have the focus. Call this function when the wxGrid window should have the focus, for example from wxFrame::OnActivate.


wxGrid::OnChangeLabels

void OnChangeLabels(void)

Called when rows and columns are created or deleted, to allow the application an opportunity to update the labels. By default, columns are labelled alphabetically, and rows numerically.


wxGrid::OnChangeSelectionLabel

void OnChangeSelectionLabel(void)

Called when a cell is selected, to allow the application an opportunity to update the selection label (the label of the wxText item used for entering cell text). By default, the cell column letter and row number are concatenated to form the selection label.


wxGrid::OnCreateCell

wxGridCell * OnCreateCell(void)

Override this virtual function if you want to replace the normal wxGridCell with a derived class.


wxGrid::OnCellLeftClick

void OnLeftClick(int row, int col, int x, int y, Bool control, Bool shift)

Virtual function called when the left button is depressed within a cell, just after OnSelectCell is called.


wxGrid::OnCellRightClick

void OnRightClick(int row, int col, int x, int y, Bool control, Bool shift)

Virtual function called when the right button is depressed within a cell, just after OnSelectCell is called.


wxGrid::OnLabelLeftClick

void OnLeftClick(int row, int col, int x, int y, Bool control, Bool shift)

Virtual function called when the left button is depressed within a label.

row will be -1 if the click is in the top labels.

col will be -1 if the click is in the left labels.

row and col will be -1 if the click is in the upper left corner.


wxGrid::OnLabelRightClick

void OnRightClick(int row, int col, int x, int y, Bool control, Bool shift)

Virtual function called when the right button is depressed within a label.

row will be -1 if the click is in the top labels.

col will be -1 if the click is in the left labels.

row and col will be -1 if the click is in the upper left corner.


wxGrid::OnSelectCell

void OnSelectCell(int row, int col)

Virtual function called when the user left-clicks on a cell.


wxGrid::OnSelectCellImplementation

void OnSelectCellImplementation(wxDC *dc, int row, int col)

Virtual function called when the user left-clicks on a cell. If you override this function, call wxGrid::OnSelectCell to apply the default behaviour.


wxGrid::SetCellAlignment

void SetCellAlignment(int alignment, int row, int col)

void SetCellAlignment(int alignment)

Sets the text alignment for the cell at the given position, or for the whole grid. alignment may be wxLEFT, wxRIGHT or wxCENTRE.


wxGrid::SetCellBackgroundColour

void SetCellBackgroundColour(const wxColour& colour, int row, int col)

void SetCellBackgroundColour(const wxColour& colour)

Sets the background colour for the cell at the given position, or for the whole grid.


wxGrid::SetCellTextColour

void SetCellTextColour(const wxColour& colour, int row, int col)

void SetCellTextColour(const wxColour& colour)

Sets the text colour for the cell at the given position, or for the whole grid.


wxGrid::SetCellTextFont

void SetCellTextFont(wxFont *font, int row, int col)

void SetCellTextFont(wxFont *font)

Sets the text font for the cell at the given position, or for the whole grid.


wxGrid::SetCellValue

void SetCellValue(const wxString& val, int row, int col)

Sets the cell value at the given position.


wxGrid::SetColumnWidth

void SetColumnWidth(int col, int width)

Sets the width in pixels for column col.


wxGrid::SetDividerPen

void SetDividerPen(wxPen *pen)

Specifies the pen to be used for drawing the divisions between cells. The default is a light grey. If NULL is specified, the divisions will not be drawn.


wxGrid::SetEditable

void SetEditable(Bool editable)

If editable is TRUE (the default), the grid cells will be editable by means of the text edit control. If FALSE, the text edit control will be hidden and the user will not be able to edit the cell contents.


wxGrid::SetGridCursor

void SetGridCursor(int row, int col)

Sets the position of the selected cell.


wxGrid::SetLabelAlignment

void SetLabelAlignment(int orientation, int alignment)

Sets the row or column label alignment. orientation should be wxHORIZONTAL to specify column label, wxVERTICAL to specify row label. alignment should be wxCENTRE, wxLEFT or wxRIGHT.


wxGrid::SetLabelBackgroundColour

void SetLabelBackgroundColour(const wxColour& value)

Sets a row or column label background colour.


wxGrid::SetLabelSize

void SetLabelSize(int orientation, int size)

Sets the row label height, or column label width, in pixels. orientation should be wxHORIZONTAL to specify column label, wxVERTICAL to specify row label.

If a dimension of zero is specified, the row or column labels will not be shown.


wxGrid::SetLabelTextColour

void SetLabelTextColour(const wxColour& value)

Sets a row and column label text colour.


wxGrid::SetLabelTextFont

void SetLabelTextFont(wxFont *font)

Sets the font to be used for the row and column labels.


wxGrid::SetLabelValue

void SetLabelValue(int orientation, const wxString& value, int pos)

Sets a row or column label value. orientation should be wxHORIZONTAL to specify column label, wxVERTICAL to specify row label. pos is the label position.


wxGrid::SetRowHeight

void SetRowHeight(int row, int height)

Sets the height in pixels for row row.


wxGrid::UpdateDimensions

void UpdateDimensions(void)

Call this function whenever a change has been made via the API that might alter size characteristics. You may also need to follow it with a call to AdjustScrollbars.