Respect cell alignment when positioning the editors
Define the common logic for positioning editors not taking the entire cell area (i.e. basically anything other than wxGridCellTextEditor) in the new DoPositionEditor() function. Also use the cell and editor alignment to decide where to position the control if it's smaller than the cell, as it looks better if e.g. wxGridCellDateEditor appears near the place where the date is displayed instead of being centered in the middle of a wide column.
This commit is contained in:
@@ -339,6 +339,16 @@ protected:
|
||||
// the dtor is private because only DecRef() can delete us
|
||||
virtual ~wxGridCellEditor();
|
||||
|
||||
// Helper for the derived classes positioning the control according to the
|
||||
// attribute alignment if the desired control size is smaller than the cell
|
||||
// size, or centering it vertically if its size is bigger: this looks like
|
||||
// the best compromise when the editor control doesn't fit into the cell.
|
||||
void DoPositionEditor(const wxSize& size,
|
||||
const wxRect& rectCell,
|
||||
int hAlign = wxALIGN_LEFT,
|
||||
int vAlign = wxALIGN_CENTRE_VERTICAL);
|
||||
|
||||
|
||||
// the actual window we show on screen (this variable should actually be
|
||||
// named m_window, but m_control is kept for backward compatibility)
|
||||
wxWindow* m_control;
|
||||
|
Reference in New Issue
Block a user