wxWidgets3: update to svn r70933

This commit is contained in:
Shawn Hoffman
2012-03-17 18:12:27 -07:00
parent 0ed8af2287
commit a648aca65c
906 changed files with 39468 additions and 17244 deletions

View File

@ -4,7 +4,7 @@
// Author: Michael Bedward (based on code by Julian Smart, Robin Dunn)
// Modified by: Santiago Palacios
// Created: 1/08/1999
// RCS-ID: $Id: grid.h 66792 2011-01-27 18:35:01Z SC $
// RCS-ID: $Id: grid.h 69861 2011-11-28 19:15:59Z VZ $
// Copyright: (c) Michael Bedward
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -301,6 +301,8 @@ public:
m_owner = owner;
}
virtual wxWindow *GetMainWindowOfCompositeControl() { return m_owner; }
virtual bool AcceptsFocus() const { return false; }
wxGrid *GetOwner() { return m_owner; }
@ -546,6 +548,11 @@ public:
// implemented for the lines
virtual int GetLineAt(const wxGrid *grid, int pos) const = 0;
// Return the display position of the line with the given index.
//
// NB: As GetLineAt(), currently this is always identity for rows.
virtual int GetLinePos(const wxGrid *grid, int line) const = 0;
// Return the index of the line just before the given one.
virtual int GetLineBefore(const wxGrid* grid, int line) const = 0;
@ -613,7 +620,9 @@ public:
virtual void SetDefaultLineSize(wxGrid *grid, int size, bool resizeExisting) const
{ grid->SetDefaultRowSize(size, resizeExisting); }
virtual int GetLineAt(const wxGrid * WXUNUSED(grid), int line) const
virtual int GetLineAt(const wxGrid * WXUNUSED(grid), int pos) const
{ return pos; } // TODO: implement row reordering
virtual int GetLinePos(const wxGrid * WXUNUSED(grid), int line) const
{ return line; } // TODO: implement row reordering
virtual int GetLineBefore(const wxGrid* WXUNUSED(grid), int line) const
@ -677,8 +686,10 @@ public:
virtual void SetDefaultLineSize(wxGrid *grid, int size, bool resizeExisting) const
{ grid->SetDefaultColSize(size, resizeExisting); }
virtual int GetLineAt(const wxGrid *grid, int line) const
{ return grid->GetColAt(line); }
virtual int GetLineAt(const wxGrid *grid, int pos) const
{ return grid->GetColAt(pos); }
virtual int GetLinePos(const wxGrid *grid, int line) const
{ return grid->GetColPos(line); }
virtual int GetLineBefore(const wxGrid* grid, int line) const
{ return grid->GetColAt(wxMax(0, grid->GetColPos(line) - 1)); }
@ -691,7 +702,10 @@ public:
// This class abstracts the difference between operations going forward
// (down/right) and backward (up/left) and allows to use the same code for
// functions which differ only in the direction of grid traversal
// functions which differ only in the direction of grid traversal.
//
// Notice that all operations in this class work with display positions and not
// internal indices which can be different if the columns were reordered.
//
// Like wxGridOperations it's an ABC with two concrete subclasses below. Unlike
// it, this is a normal object and not just a function dispatch table and has a
@ -720,6 +734,12 @@ public:
// Find the line at the given distance, in pixels, away from this one
// (this uses clipping, i.e. anything after the last line is counted as the
// last one and anything before the first one as 0)
//
// TODO: Implementation of this method currently doesn't support column
// reordering as it mixes up indices and positions. But this doesn't
// really matter as it's only called for rows (Page Up/Down only work
// vertically) and row reordering is not currently supported. We'd
// need to fix it if this ever changes however.
virtual int MoveByPixelDistance(int line, int distance) const = 0;
// This class is never used polymorphically but give it a virtual dtor
@ -727,6 +747,28 @@ public:
virtual ~wxGridDirectionOperations() { }
protected:
// Get the position of the row or column from the given coordinates pair.
//
// This is just a shortcut to avoid repeating m_oper and m_grid multiple
// times in the derived classes code.
int GetLinePos(const wxGridCellCoords& coords) const
{
return m_oper.GetLinePos(m_grid, m_oper.Select(coords));
}
// Get the index of the row or column from the position.
int GetLineAt(int pos) const
{
return m_oper.GetLineAt(m_grid, pos);
}
// Check if the given line is visible, i.e. has non 0 size.
bool IsLineVisible(int line) const
{
return m_oper.GetLineSize(m_grid, line) != 0;
}
wxGrid * const m_grid;
const wxGridOperations& m_oper;
};
@ -743,14 +785,38 @@ public:
{
wxASSERT_MSG( m_oper.Select(coords) >= 0, "invalid row/column" );
return m_oper.Select(coords) == 0;
int pos = GetLinePos(coords);
while ( pos )
{
// Check the previous line.
int line = GetLineAt(--pos);
if ( IsLineVisible(line) )
{
// There is another visible line before this one, hence it's
// not at boundary.
return false;
}
}
// We reached the boundary without finding any visible lines.
return true;
}
virtual void Advance(wxGridCellCoords& coords) const
{
wxASSERT( !IsAtBoundary(coords) );
int pos = GetLinePos(coords);
for ( ;; )
{
// This is not supposed to happen if IsAtBoundary() returned false.
wxCHECK_RET( pos, "can't advance when already at boundary" );
m_oper.Set(coords, m_oper.Select(coords) - 1);
int line = GetLineAt(--pos);
if ( IsLineVisible(line) )
{
m_oper.Set(coords, line);
break;
}
}
}
virtual int MoveByPixelDistance(int line, int distance) const
@ -760,6 +826,8 @@ public:
}
};
// Please refer to the comments above when reading this class code, it's
// absolutely symmetrical to wxGridBackwardOperations.
class wxGridForwardOperations : public wxGridDirectionOperations
{
public:
@ -773,14 +841,32 @@ public:
{
wxASSERT_MSG( m_oper.Select(coords) < m_numLines, "invalid row/column" );
return m_oper.Select(coords) == m_numLines - 1;
int pos = GetLinePos(coords);
while ( pos < m_numLines - 1 )
{
int line = GetLineAt(++pos);
if ( IsLineVisible(line) )
return false;
}
return true;
}
virtual void Advance(wxGridCellCoords& coords) const
{
wxASSERT( !IsAtBoundary(coords) );
int pos = GetLinePos(coords);
for ( ;; )
{
wxCHECK_RET( pos < m_numLines - 1,
"can't advance when already at boundary" );
m_oper.Set(coords, m_oper.Select(coords) + 1);
int line = GetLineAt(++pos);
if ( IsLineVisible(line) )
{
m_oper.Set(coords, line);
break;
}
}
}
virtual int MoveByPixelDistance(int line, int distance) const

View File

@ -3,7 +3,7 @@
// Purpose: private definitions of wxListCtrl helpers
// Author: Robert Roebling
// Vadim Zeitlin (virtual list control support)
// Id: $Id: listctrl.h 67254 2011-03-20 00:14:35Z DS $
// Id: $Id: listctrl.h 70285 2012-01-07 15:09:54Z VZ $
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -402,6 +402,10 @@ public:
wxTextCtrl *GetText() const { return m_text; }
// Check if the given key event should stop editing and return true if it
// does or false otherwise.
bool CheckForEndEditKey(const wxKeyEvent& event);
// Different reasons for calling EndEdit():
//
// It was called because:
@ -557,6 +561,7 @@ public:
// called to switch the selection from the current item to newCurrent,
void OnArrowChar( size_t newCurrent, const wxKeyEvent& event );
void OnCharHook( wxKeyEvent &event );
void OnChar( wxKeyEvent &event );
void OnKeyDown( wxKeyEvent &event );
void OnKeyUp( wxKeyEvent &event );
@ -570,13 +575,12 @@ public:
void DrawImage( int index, wxDC *dc, int x, int y );
void GetImageSize( int index, int &width, int &height ) const;
int GetTextLength( const wxString &s ) const;
void SetImageList( wxImageList *imageList, int which );
void SetItemSpacing( int spacing, bool isSmall = false );
int GetItemSpacing( bool isSmall = false );
void SetColumn( int col, wxListItem &item );
void SetColumn( int col, const wxListItem &item );
void SetColumnWidth( int col, int width );
void GetColumn( int col, wxListItem &item ) const;
int GetColumnWidth( int col ) const;
@ -640,7 +644,7 @@ public:
long FindItem( const wxPoint& pt );
long HitTest( int x, int y, int &flags ) const;
void InsertItem( wxListItem &item );
void InsertColumn( long col, wxListItem &item );
void InsertColumn( long col, const wxListItem &item );
int GetItemWidthWithImage(wxListItem * item);
void SortItems( wxListCtrlCompare fn, wxIntPtr data );
@ -788,6 +792,10 @@ private:
// delete all items but don't refresh: called from dtor
void DoDeleteAllItems();
// Compute the minimal width needed to fully display the column header.
int ComputeMinHeaderWidth(const wxListHeaderData* header) const;
// the height of one line using the current font
wxCoord m_lineHeight;

View File

@ -0,0 +1,62 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/generic/private/richtooltip.h
// Purpose: wxRichToolTipGenericImpl declaration.
// Author: Vadim Zeitlin
// Created: 2011-10-18
// RCS-ID: $Id: richtooltip.h 69488 2011-10-20 16:20:19Z VZ $
// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GENERIC_PRIVATE_RICHTOOLTIP_H_
#define _GENERIC_PRIVATE_RICHTOOLTIP_H_
#include "wx/icon.h"
#include "wx/colour.h"
// ----------------------------------------------------------------------------
// wxRichToolTipGenericImpl: defines generic wxRichToolTip implementation.
// ----------------------------------------------------------------------------
class wxRichToolTipGenericImpl : public wxRichToolTipImpl
{
public:
wxRichToolTipGenericImpl(const wxString& title, const wxString& message) :
m_title(title),
m_message(message)
{
m_tipKind = wxTipKind_Auto;
// This is pretty arbitrary, we could follow MSW and use some multiple
// of double-click time here.
m_timeout = 5000;
}
virtual void SetBackgroundColour(const wxColour& col,
const wxColour& colEnd);
virtual void SetCustomIcon(const wxIcon& icon);
virtual void SetStandardIcon(int icon);
virtual void SetTimeout(unsigned milliseconds);
virtual void SetTipKind(wxTipKind tipKind);
virtual void SetTitleFont(const wxFont& font);
virtual void ShowFor(wxWindow* win);
protected:
wxString m_title,
m_message;
private:
wxIcon m_icon;
wxColour m_colStart,
m_colEnd;
unsigned m_timeout;
wxTipKind m_tipKind;
wxFont m_titleFont;
};
#endif // _WX_GENERIC_PRIVATE_RICHTOOLTIP_H_