summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
dd38c87)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20536
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
+ enum wxAttrOverflowMode
+ {
+ Unset = -1,
+ Overflow,
+ SingleCell
+ };
+
// ctors
wxGridCellAttr(wxGridCellAttr *attrDefault = NULL)
{
// ctors
wxGridCellAttr(wxGridCellAttr *attrDefault = NULL)
{
m_vAlign = vAlign;
}
void SetSize(int num_rows, int num_cols);
m_vAlign = vAlign;
}
void SetSize(int num_rows, int num_cols);
- void SetOverflow( bool allow ) { m_overflow = allow; }
+ void SetOverflow(bool allow = TRUE)
+ { m_overflow = allow ? Overflow : SingleCell; }
void SetReadOnly(bool isReadOnly = TRUE)
{ m_isReadOnly = isReadOnly ? ReadOnly : ReadWrite; }
void SetReadOnly(bool isReadOnly = TRUE)
{ m_isReadOnly = isReadOnly ? ReadOnly : ReadWrite; }
bool HasRenderer() const { return m_renderer != NULL; }
bool HasEditor() const { return m_editor != NULL; }
bool HasReadWriteMode() const { return m_isReadOnly != Unset; }
bool HasRenderer() const { return m_renderer != NULL; }
bool HasEditor() const { return m_editor != NULL; }
bool HasReadWriteMode() const { return m_isReadOnly != Unset; }
+ bool HasOverflowMode() const { return m_overflow != Unset; }
const wxColour& GetTextColour() const;
const wxColour& GetBackgroundColour() const;
const wxFont& GetFont() const;
void GetAlignment(int *hAlign, int *vAlign) const;
void GetSize(int *num_rows, int *num_cols) const;
const wxColour& GetTextColour() const;
const wxColour& GetBackgroundColour() const;
const wxFont& GetFont() const;
void GetAlignment(int *hAlign, int *vAlign) const;
void GetSize(int *num_rows, int *num_cols) const;
- bool GetOverflow() const { return m_overflow; }
+ bool GetOverflow() const
+ { return m_overflow != wxGridCellAttr::SingleCell; }
wxGridCellRenderer *GetRenderer(wxGrid* grid, int row, int col) const;
wxGridCellEditor *GetEditor(wxGrid* grid, int row, int col) const;
wxGridCellRenderer *GetRenderer(wxGrid* grid, int row, int col) const;
wxGridCellEditor *GetEditor(wxGrid* grid, int row, int col) const;
m_vAlign;
int m_sizeRows,
m_sizeCols;
m_vAlign;
int m_sizeRows,
m_sizeCols;
+
+ wxAttrOverflowMode m_overflow;
wxGridCellRenderer* m_renderer;
wxGridCellEditor* m_editor;
wxGridCellRenderer* m_renderer;
wxGridCellEditor* m_editor;
wxGridWindow* gridWindow = wxDynamicCast(m_control->GetParent(), wxGridWindow);
if (gridWindow)
gridWindow->GetOwner()->PrepareDC(dc);
wxGridWindow* gridWindow = wxDynamicCast(m_control->GetParent(), wxGridWindow);
if (gridWindow)
gridWindow->GetOwner()->PrepareDC(dc);
dc.SetPen(*wxTRANSPARENT_PEN);
dc.SetBrush(wxBrush(attr->GetBackgroundColour(), wxSOLID));
dc.DrawRectangle(rectCell);
dc.SetPen(*wxTRANSPARENT_PEN);
dc.SetBrush(wxBrush(attr->GetBackgroundColour(), wxSOLID));
dc.DrawRectangle(rectCell);
if ( !HasReadWriteMode() && mergefrom->HasReadWriteMode() )
SetReadOnly(mergefrom->IsReadOnly());
if ( !HasReadWriteMode() && mergefrom->HasReadWriteMode() )
SetReadOnly(mergefrom->IsReadOnly());
+ if (!HasOverflowMode() && mergefrom->HasOverflowMode() )
+ SetReadOnly(mergefrom->GetOverflow());
+
SetDefAttr(mergefrom->m_defGridAttr);
}
SetDefAttr(mergefrom->m_defGridAttr);
}
else if ( event.RightDown() )
{
row = YToRow(y);
else if ( event.RightDown() )
{
row = YToRow(y);
!SendEvent( wxEVT_GRID_LABEL_RIGHT_CLICK, row, -1, event ) )
{
// no default action at the moment
!SendEvent( wxEVT_GRID_LABEL_RIGHT_CLICK, row, -1, event ) )
{
// no default action at the moment
int textOrientation )
{
wxArrayString lines;
int textOrientation )
{
wxArrayString lines;
StringToLines( value, lines );
StringToLines( value, lines );
//Forward to new API.
DrawTextRectangle( dc,
lines,
//Forward to new API.
DrawTextRectangle( dc,
lines,
horizAlign,
vertAlign,
textOrientation );
horizAlign,
vertAlign,
textOrientation );
}
void wxGrid::DrawTextRectangle( wxDC& dc,
}
void wxGrid::DrawTextRectangle( wxDC& dc,
long textWidth, textHeight;
long lineWidth, lineHeight;
int nLines;
long textWidth, textHeight;
long lineWidth, lineHeight;
int nLines;
dc.SetClippingRegion( rect );
dc.SetClippingRegion( rect );
nLines = lines.GetCount();
if( nLines > 0 )
{
int l;
float x = 0.0, y = 0.0;
nLines = lines.GetCount();
if( nLines > 0 )
{
int l;
float x = 0.0, y = 0.0;
if( textOrientation == wxHORIZONTAL )
GetTextBoxSize(dc, lines, &textWidth, &textHeight);
else
GetTextBoxSize( dc, lines, &textHeight, &textWidth );
if( textOrientation == wxHORIZONTAL )
GetTextBoxSize(dc, lines, &textWidth, &textHeight);
else
GetTextBoxSize( dc, lines, &textHeight, &textWidth );
switch( vertAlign )
{
case wxALIGN_BOTTOM:
switch( vertAlign )
{
case wxALIGN_BOTTOM:
else
x = rect.x + rect.width - textWidth;
break;
else
x = rect.x + rect.width - textWidth;
break;
case wxALIGN_CENTRE:
if( textOrientation == wxHORIZONTAL )
y = rect.y + ((rect.height - textHeight)/2);
else
x = rect.x + ((rect.width - textWidth)/2);
break;
case wxALIGN_CENTRE:
if( textOrientation == wxHORIZONTAL )
y = rect.y + ((rect.height - textHeight)/2);
else
x = rect.x + ((rect.width - textWidth)/2);
break;
case wxALIGN_TOP:
default:
if( textOrientation == wxHORIZONTAL )
case wxALIGN_TOP:
default:
if( textOrientation == wxHORIZONTAL )
// Align each line of a multi-line label
for( l = 0; l < nLines; l++ )
{
dc.GetTextExtent(lines[l], &lineWidth, &lineHeight);
// Align each line of a multi-line label
for( l = 0; l < nLines; l++ )
{
dc.GetTextExtent(lines[l], &lineWidth, &lineHeight);
switch( horizAlign )
{
case wxALIGN_RIGHT:
switch( horizAlign )
{
case wxALIGN_RIGHT:
else
y = rect.y + lineWidth + 1;
break;
else
y = rect.y + lineWidth + 1;
break;
case wxALIGN_CENTRE:
if( textOrientation == wxHORIZONTAL )
x = rect.x + ((rect.width - lineWidth)/2);
else
y = rect.y + rect.height - ((rect.height - lineWidth)/2);
break;
case wxALIGN_CENTRE:
if( textOrientation == wxHORIZONTAL )
x = rect.x + ((rect.width - lineWidth)/2);
else
y = rect.y + rect.height - ((rect.height - lineWidth)/2);
break;
case wxALIGN_LEFT:
default:
if( textOrientation == wxHORIZONTAL )
case wxALIGN_LEFT:
default:
if( textOrientation == wxHORIZONTAL )
y = rect.y + rect.height - 1;
break;
}
y = rect.y + rect.height - 1;
break;
}
if( textOrientation == wxHORIZONTAL )
{
dc.DrawText( lines[l], (int)x, (int)y );
if( textOrientation == wxHORIZONTAL )
{
dc.DrawText( lines[l], (int)x, (int)y );
if (coord < 0)
return clipToMinMax && (nMax > 0) ? 0 : -1;
if (coord < 0)
return clipToMinMax && (nMax > 0) ? 0 : -1;
if (!defaultDist)
defaultDist = 1;
if (!defaultDist)
defaultDist = 1;
int y = GetRowTop(row);
int newRow = internalYToRow( y - ch + 1 );
int y = GetRowTop(row);
int newRow = internalYToRow( y - ch + 1 );
- //row > 0 , so newrow can never be less than 0 here.
+ //row > 0 , so newrow can never be less than 0 here.
int newRow = internalYToRow( y + ch );
if ( newRow == row )
{
int newRow = internalYToRow( y + ch );
if ( newRow == row )
{
- // row < m_numRows , so newrow can't overflow here.
+ // row < m_numRows , so newrow can't overflow here.