X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ef316e23c9a67ab20180f3a07bd78476a6caa69a..85136e3bf5dadf921652519e71da5db351fb3194:/docs/latex/wx/grid.tex diff --git a/docs/latex/wx/grid.tex b/docs/latex/wx/grid.tex index 0231c365d0..6c51b452e4 100644 --- a/docs/latex/wx/grid.tex +++ b/docs/latex/wx/grid.tex @@ -24,15 +24,40 @@ relationship between the various grid classes and has a summary of the keyboard shortcuts and mouse functions provided by wxGrid. wxGrid has been greatly expanded and redesigned for wxWidgets 2.2 -onwards. If you have been using the old wxGrid class you will probably -want to have a look at the \helpref{wxGrid classes overview}{gridoverview} to see -how things have changed. The new grid classes are reasonably backward-compatible +onwards. The new grid classes are reasonably backward-compatible but there are some exceptions. There are also easier ways of doing many things compared to the previous implementation. +A \helpref{wxGridTableBase}{wxgridtablebase} class holds the actual +data to be displayed by a wxGrid class. One or more wxGrid classes +may act as a view for one table class. +The default table class is called wxGridStringTable and +holds an array of strings. An instance of such a class is created +by \helpref{wxGrid::CreateGrid}{wxgridcreategrid}. + +\helpref{wxGridCellRenderer}{wxgridcellrenderer} is the abstract base +class for rendereing contents in a cell. The following renderers are +predefined: +\helpref{wxGridCellStringRenderer}{wxgridcellstringrenderer}, +\helpref{wxGridCellBoolRenderer}{wxgridcellboolrenderer}, +\helpref{wxGridCellFloatRenderer}{wxgridcellfloatrenderer}, +\helpref{wxGridCellNumberRenderer}{wxgridcellnumberrenderer}. The +look of a cell can be further defined using \helpref{wxGridCellAttr}{wxgridcellattr}. +An object of this type may be returned by \helpref{wxGridTableBase::GetAttr}{wxgridtablebasegetattr}. + +\helpref{wxGridCellEditor}{wxgridcelleditor} is the abstract base +class for editing the value of a cell. The following editors are +predefined: +\helpref{wxGridCellTextEditor}{wxgridcelltexteditor} +\helpref{wxGridCellBoolEditor}{wxgridcellbooleditor} +\helpref{wxGridCellChoiceEditor}{wxgridcellchoiceeditor} +\helpref{wxGridCellNumberEditor}{wxgridcellnumbereditor}. + + \wxheading{Derived from} \helpref{wxScrolledWindow}{wxscrolledwindow}\\ +\helpref{wxPanel}{wxpanel}\\ \helpref{wxWindow}{wxwindow}\\ \helpref{wxEvtHandler}{wxevthandler}\\ \helpref{wxObject}{wxobject} @@ -41,6 +66,10 @@ the previous implementation. +\wxheading{Library} + +\helpref{wxAdv}{librarieslist} + \wxheading{Window styles} There are presently no specific window styles for wxGrid. @@ -56,8 +85,10 @@ The ...\_CMD\_... variants also take a window identifier. \twocolwidtha{7cm} \begin{twocollist}\itemsep=0pt \twocolitem{{\bf EVT\_GRID\_COL\_SIZE(func)}}{The user resized a column by dragging it. Processes a wxEVT\_GRID\_COL\_SIZE.} +\twocolitem{{\bf EVT\_GRID\_COL\_MOVE(func)}}{The user moved a column by dragging it. Processes a wxEVT\_GRID\_COL\_MOVE.} \twocolitem{{\bf EVT\_GRID\_ROW\_SIZE(func)}}{The user resized a row by dragging it. Processes a wxEVT\_GRID\_ROW\_SIZE.} \twocolitem{{\bf EVT\_GRID\_CMD\_COL\_SIZE(func)}}{The user resized a column by dragging it; variant taking a window identifier. Processes a wxEVT\_GRID\_COL\_SIZE.} +\twocolitem{{\bf EVT\_GRID\_CMD\_COL\_MOVE(func)}}{The user moved a column by dragging it; variant taking a window identifier. Processes a wxEVT\_GRID\_COL\_MOVE.} \twocolitem{{\bf EVT\_GRID\_CMD\_ROW\_SIZE(func)}}{The user resized a row by dragging it; variant taking a window identifier. Processes a wxEVT\_GRID\_ROW\_SIZE.} \end{twocollist}% @@ -98,10 +129,93 @@ The ...\_CMD\_... variant also takes a window identifier. \helpref{SetTable}{wxgridsettable} - -\membersection{Display format}\label{wxgriddisplayformat} - - +\membersection{Cursor movement}\label{wxgridcursormovement} + +\helpref{wxGrid::MoveCursorUp}{wxgridmovecursorup}\\ +\helpref{wxGrid::MoveCursorDown}{wxgridmovecursordown}\\ +\helpref{wxGrid::MoveCursorLeft}{wxgridmovecursorleft}\\ +\helpref{wxGrid::MoveCursorRight}{wxgridmovecursorright}\\ +\helpref{wxGrid::MoveCursorPageUp}{wxgridmovecursorup}\\ +\helpref{wxGrid::MoveCursorPageDown}{wxgridmovecursordown}\\ +\helpref{wxGrid::MoveCursorUpBlock}{wxgridmovecursorupblock}\\ +\helpref{wxGrid::MoveCursorDownBlock}{wxgridmovecursordownblock}\\ +\helpref{wxGrid::MoveCursorLeftBlock}{wxgridmovecursorleftblock}\\ +\helpref{wxGrid::MoveCursorRightBlock}{wxgridmovecursorrightblock} + + +\membersection{Grid line formatting}\label{wxgridlineformatting} + +\helpref{wxGrid::EnableGridLines}{wxgridenablegridlines}\\ +\helpref{wxGrid::GridLinesEnabled}{wxgridgridlinesenabled}\\ +\helpref{wxGrid::SetGridLineColour}{wxgridsetgridlinecolour}\\ +\helpref{wxGrid::GetGridLineColour}{wxgridgetgridlinecolour}\\ +\helpref{wxGrid::GetDefaultGridLinePen}{wxgridgetdefaultgridlinepen}\\ +\helpref{wxGrid::GetRowGridLinePen}{wxgridgetrowgridlinepen}\\ +\helpref{wxGrid::GetColGridLinePen}{wxgridgetcolgridlinepen} + +\membersection{Row and column label value and format}\label{wxgridrowcoulmlabelformat} + +\helpref{wxGrid::SetRowLabelValue}{wxgridsetrowlabelvalue}\\ +\helpref{wxGrid::SetColLabelValue}{wxgridsetcollabelvalue}\\ +\helpref{wxGrid::GetRowLabelValue}{wxgridgetrowlabelvalue}\\ +\helpref{wxGrid::GetColLabelValue}{wxgridgetcollabelvalue}\\ +\helpref{wxGrid::SetUseNativeColLabels}{wxgridsetsenativecollabels}\\ +\helpref{wxGrid::HideColLabels}{wxgridhidecollabels}\\ +\helpref{wxGrid::HideRowLabels}{wxgridhiderowlabels}\\ +\helpref{wxGrid::SetRowLabelSize}{wxgridsetrowlabelsize}\\ +\helpref{wxGrid::SetColLabelSize}{wxgridsetcollabelsize}\\ +\helpref{wxGrid::GetRowLabelSize}{wxgridgetrowlabelsize}\\ +\helpref{wxGrid::GetColLabelSize}{wxgridgetcollabelsize}\\ +\helpref{wxGrid::AutoSizeRowLabelSize}{wxgridautosizerowlabelsize}\\ +\helpref{wxGrid::AutoSizeColLabelSize}{wxgridautosizecollabelsize}\\ +\helpref{wxGrid::GetDefaultRowLabelSize}{wxgridgetdefaultrowlabelsize}\\ +\helpref{wxGrid::GetDefaultColLabelSize}{wxgridgetdefaultcollabelsize}\\ +\helpref{wxGrid::SetRowLabelAlignment}{wxgridsetrowlabelalignment}\\ +\helpref{wxGrid::SetColLabelAlignment}{wxgridsetcollabelalignment}\\ +\helpref{wxGrid::GetRowLabelAlignment}{wxgridgetrowlabelalignment}\\ +\helpref{wxGrid::GetColLabelAlignment}{wxgridgetcollabelalignment}\\ +\helpref{wxGrid::SetLabelFont}{wxgridsetlabelfont}\\ +\helpref{wxGrid::SetLabelTextColour}{wxgridsetlabeltextcolour}\\ +\helpref{wxGrid::SetLabelBackgroundColour}{wxgridsetlabelbackgroundcolour}\\ +\helpref{wxGrid::GetLabelFont}{wxgridgetlabelfont}\\ +\helpref{wxGrid::GetLabelBackgroundColour}{wxgridgetlabelbackgroundcolour}\\ +\helpref{wxGrid::GetLabelTextColour}{wxgridgetlabeltextcolour}\\ +%\helpref{wxGrid::SetColLabelTextOrientation}{wxgridsetcollabeltextorientation}\\ +%\helpref{wxGrid::GetColLabelTextOrientation}{wxgridgetcollabeltextorientation} +wxGrid::SetColLabelTextOrientation\\ +wxGrid::GetColLabelTextOrientation + +\membersection{Cell, row and column user-resizing and dragging}\label{wxgridcellrowcolresizing} + +\helpref{wxGrid::EnableDragRowSize}{wxgridenabledragrowsize}\\ +\helpref{wxGrid::EnableDragColSize}{wxgridenabledragcolsize}\\ +\helpref{wxGrid::CanDragRowSize}{wxgridcandragrowsize}\\ +\helpref{wxGrid::CanDragColSize}{wxgridcandragcolsize}\\ +\helpref{wxGrid::EnableDragColMove}{wxgridenabledragcolmove}\\ +\helpref{wxGrid::CanDragColMove}{wxgridcandragcolmove}\\ +\helpref{wxGrid::EnableDragGridSize}{wxgridenabledraggridsize}\\ +\helpref{wxGrid::CanDragGridSize}{wxgridcandraggridsize}\\ +\helpref{wxGrid::GetColAt}{wxgridgetcolat}\\ +\helpref{wxGrid::SetColPos}{wxgridsetcolpos}\\ +\helpref{wxGrid::GetColPos}{wxgridgetcolpos}\\ +%\helpref{wxGrid::EnableDragCell}{wxgridenabledragcell}\\ +%\helpref{wxGrid::CanDragCell}{wxgridcandragcell} +wxGrid::EnableDragCell\\ +wxGrid::CanDragCell + +\membersection{Autoresizing and cell size constraints}\label{wxgridautoresizingandcellconstriants} + +\helpref{wxGrid::AutoSizeColumn}{wxgridautosizecolumn}\\ +\helpref{wxGrid::AutoSizeRow}{wxgridautosizerow}\\ +\helpref{wxGrid::AutoSizeColumns}{wxgridautosizecolumns}\\ +\helpref{wxGrid::AutoSizeRows}{wxgridautosizerows}\\ +\helpref{wxGrid::AutoSize}{wxgridautosize}\\ +\helpref{wxGrid::SetColMinimalWidth}{wxgridsetcolminimalwidth}\\ +\helpref{wxGrid::SetRowMinimalHeight}{wxgridsetrowminimalheight}\\ +\helpref{wxGrid::SetColMinimalAcceptableWidth}{wxgridsetcolminimalacceptablewidth}\\ +\helpref{wxGrid::SetRowMinimalAcceptableHeight}{wxgridsetrowminimalacceptableheight}\\ +\helpref{wxGrid::GetColMinimalAcceptableWidth}{wxgridgetcolminimalacceptablewidth}\\ +\helpref{wxGrid::GetRowMinimalAcceptableHeight}{wxgridgetrowminimalacceptableheight} \membersection{Selection functions}\label{wxgridselectionfunctions} @@ -183,11 +297,11 @@ The memory requirements for this could become prohibitive if your grid is very l -\membersection{wxGrid::AutoSizeColOrRow}\label{wxgridautosizecolorrow} +\membersection{wxGrid::AutoSizeColLabelSize}\label{wxgridautosizecollabelsize} -\func{void}{AutoSizeColOrRow}{\param{int }{n}, \param{bool }{setAsMin}, \param{bool }{column}} +\func{void}{AutoSizeColLabelSize}{\param{int }{col}} -Common part of AutoSizeColumn/Row() or row? +Automatically adjusts width of the column to fit its label. @@ -230,6 +344,14 @@ The memory requirements for this could become prohibitive if your grid is very l +\membersection{wxGrid::AutoSizeRowLabelSize}\label{wxgridautosizerowlabelsize} + +\func{void}{AutoSizeRowLabelSize}{\param{int }{col}} + +Automatically adjusts height of the row to fit its label. + + + \membersection{wxGrid::AutoSizeRows}\label{wxgridautosizerows} \func{void}{AutoSizeRows}{\param{bool }{setAsMin = true}} @@ -253,6 +375,10 @@ the grid is suppressed. Each call to BeginBatch must be matched by a later call modification can be enclosed between BeginBatch and EndBatch calls to avoid screen flicker. The final EndBatch will cause the grid to be repainted. +\wxheading{See also} + +\helpref{wxGridUpdateLocker}{wxgridupdatelocker} + \membersection{wxGrid::BlockToDeviceRect}\label{wxgridblocktodevicerect} @@ -514,6 +640,10 @@ EndBatch. Code that does a lot of grid modification can be enclosed between BeginBatch and EndBatch calls to avoid screen flicker. The final EndBatch will cause the grid to be repainted. +\wxheading{See also} + +\helpref{wxGridUpdateLocker}{wxgridupdatelocker} + \membersection{wxGrid::Fit}\label{wxgridfit} @@ -1129,6 +1259,23 @@ Returned number of whole cols visible. Hides the in-place cell edit control. +\membersection{wxGrid::HideColLabels}\label{wxgridhidecollabels} + +\func{void}{HideColLabels}{\void} + +Hides the column labels by calling \helpref{SetColLabelSize}{wxgridsetcollabelsize} +with a size of 0. Show labels again by calling that method with +a width greater than 0. + + +\membersection{wxGrid::HideRowLabels}\label{wxgridhiderowlabels} + +\func{void}{HideRowLabels}{\void} + +Hides the row labels by calling \helpref{SetRowLabelSize}{wxgridsetrowlabelsize} +with a size of 0. Show labels again by calling that method with +a width greater than 0. + \membersection{wxGrid::InitColWidths}\label{wxgridinitcolwidths} @@ -1604,6 +1751,9 @@ Vertical alignment should be one of wxALIGN\_TOP, wxALIGN\_CENTRE or wxALIGN\_BO Sets the height of the column labels. +If \arg{height} equals to \texttt{wxGRID\_AUTOSIZE} then height is calculated automatically +so that no label is truncated. Note that this could be slow for a large table. + \membersection{wxGrid::SetColLabelValue}\label{wxgridsetcollabelvalue} @@ -1843,6 +1993,9 @@ Vertical alignment should be one of wxALIGN\_TOP, wxALIGN\_CENTRE or wxALIGN\_BO Sets the width of the row labels. +If \arg{width} equals \texttt{wxGRID\_AUTOSIZE} then width is calculated automatically +so that no label is truncated. Note that this could be slow for a large table. + \membersection{wxGrid::SetRowLabelValue}\label{wxgridsetrowlabelvalue} @@ -1971,6 +2124,15 @@ application involves complex or non-string data or data sets that are too large wholly in memory. +\membersection{wxGrid::SetUseNativeColLabels}\label{wxgridsetsenativecollabels} + +\func{void}{SetUseNativeColLabels}{\param{bool }{native= true}} + +Call this in order to make the column labels use a native look by using +\helpref{wxRenderer::DrawHeaderButton}{wxrenderernativedrawheaderbutton} +internally. There is no equivalent method for drawing row columns as +there is not native look for that. This option is useful when using +wxGrid for displaying tables and not as a spread-sheet. \membersection{wxGrid::ShowCellEditControl}\label{wxgridshowcelleditcontrol}