1. wxGrid row can't be resized to less than minimal height
2. memory leaks fixed in wxHashTableLong 3. and in wxGrid 4. changed newgrid sample to use char buffers 5. fixed double clicking owner-drawn buttons 6. compilation fix in enhmeta.cpp for !wxUSE_DND 7. bug introduced earlier today in wxGridCellAttr::GetEditor() fixed 8. bool renderer/editor now look as good as I may ever make them look good under MSW git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6391 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -80,6 +80,7 @@ class WXDLLEXPORT wxHashTableLong : public wxObject
|
||||
{
|
||||
public:
|
||||
wxHashTableLong(size_t size = wxHASH_SIZE_DEFAULT) { Init(size); }
|
||||
virtual ~wxHashTableLong();
|
||||
|
||||
void Create(size_t size = wxHASH_SIZE_DEFAULT);
|
||||
void Destroy();
|
||||
|
@@ -256,6 +256,17 @@ extern HBITMAP wxInvertMask(HBITMAP hbmpMask, int w = 0, int h = 0);
|
||||
#define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp))
|
||||
#endif // GET_X_LPARAM
|
||||
|
||||
// get the current state of SHIFT/CTRL keys
|
||||
extern inline bool wxIsShiftDown()
|
||||
{
|
||||
return (::GetKeyState(VK_SHIFT) & 0x100) != 0;
|
||||
}
|
||||
|
||||
extern inline bool wxIsCtrlDown()
|
||||
{
|
||||
return (::GetKeyState(VK_CONTROL) & 0x100) != 0;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// small helper classes
|
||||
// ---------------------------------------------------------------------------
|
||||
|
@@ -123,6 +123,11 @@ wxNodeBase *wxHashTableBase::GetNode(long key, long value) const
|
||||
// wxHashTableLong
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxHashTableLong::~wxHashTableLong()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
void wxHashTableLong::Init(size_t size)
|
||||
{
|
||||
m_hashSize = size;
|
||||
|
@@ -914,8 +914,8 @@ void wxGridCellBoolEditor::SetSize(const wxRect& r)
|
||||
// so shift it to the right
|
||||
size.x -= 8;
|
||||
#elif defined(__WXMSW__)
|
||||
// here too...
|
||||
size.x -= 6;
|
||||
// here too, but in other way
|
||||
size.x += 1;
|
||||
size.y -= 2;
|
||||
#endif
|
||||
|
||||
@@ -1457,11 +1457,7 @@ wxSize wxGridCellBoolRenderer::ms_sizeCheckMark;
|
||||
// FIXME these checkbox size calculations are really ugly...
|
||||
|
||||
// between checkmark and box
|
||||
#ifdef __WXGTK__
|
||||
static const wxCoord wxGRID_CHECKMARK_MARGIN = 4;
|
||||
#else
|
||||
static const wxCoord wxGRID_CHECKMARK_MARGIN = 2;
|
||||
#endif
|
||||
static const wxCoord wxGRID_CHECKMARK_MARGIN = 2;
|
||||
|
||||
wxSize wxGridCellBoolRenderer::GetBestSize(wxGrid& grid,
|
||||
wxGridCellAttr& WXUNUSED(attr),
|
||||
@@ -1476,7 +1472,7 @@ wxSize wxGridCellBoolRenderer::GetBestSize(wxGrid& grid,
|
||||
wxCoord checkSize = 0;
|
||||
wxCheckBox *checkbox = new wxCheckBox(&grid, -1, wxEmptyString);
|
||||
wxSize size = checkbox->GetBestSize();
|
||||
checkSize = size.y + wxGRID_CHECKMARK_MARGIN;
|
||||
checkSize = size.y + 2*wxGRID_CHECKMARK_MARGIN;
|
||||
|
||||
// FIXME wxGTK::wxCheckBox::GetBestSize() gives "wrong" result
|
||||
#if defined(__WXGTK__) || defined(__WXMOTIF__)
|
||||
@@ -1512,22 +1508,11 @@ void wxGridCellBoolRenderer::Draw(wxGrid& grid,
|
||||
}
|
||||
|
||||
// draw a border around checkmark
|
||||
wxRect rectMark;
|
||||
rectMark.x = rect.x + rect.width/2 - size.x/2;
|
||||
rectMark.y = rect.y + rect.height/2 - size.y/2;
|
||||
rectMark.width = size.x;
|
||||
rectMark.height = size.y;
|
||||
|
||||
dc.SetBrush(*wxTRANSPARENT_BRUSH);
|
||||
dc.SetPen(wxPen(attr.GetTextColour(), 1, wxSOLID));
|
||||
dc.DrawRectangle(rectMark);
|
||||
|
||||
rectMark.Inflate(-wxGRID_CHECKMARK_MARGIN);
|
||||
|
||||
#ifdef __WXMSW__
|
||||
// looks nicer under MSW
|
||||
rectMark.x++;
|
||||
#endif // MSW
|
||||
wxRect rectBorder;
|
||||
rectBorder.x = rect.x + rect.width/2 - size.x/2;
|
||||
rectBorder.y = rect.y + rect.height/2 - size.y/2;
|
||||
rectBorder.width = size.x;
|
||||
rectBorder.height = size.y;
|
||||
|
||||
bool value;
|
||||
if ( grid.GetTable()->CanGetValueAs(row, col, wxGRID_VALUE_BOOL) )
|
||||
@@ -1537,9 +1522,23 @@ void wxGridCellBoolRenderer::Draw(wxGrid& grid,
|
||||
|
||||
if ( value )
|
||||
{
|
||||
wxRect rectMark = rectBorder;
|
||||
#ifdef __WXMSW__
|
||||
// MSW DrawCheckMark() is weird (and should probably be changed...)
|
||||
rectMark.Inflate(-wxGRID_CHECKMARK_MARGIN/2);
|
||||
rectMark.x++;
|
||||
rectMark.y++;
|
||||
#else // !MSW
|
||||
rectMark.Inflate(-wxGRID_CHECKMARK_MARGIN);
|
||||
#endif // MSW/!MSW
|
||||
|
||||
dc.SetTextForeground(attr.GetTextColour());
|
||||
dc.DrawCheckMark(rectMark);
|
||||
}
|
||||
|
||||
dc.SetBrush(*wxTRANSPARENT_BRUSH);
|
||||
dc.SetPen(wxPen(attr.GetTextColour(), 1, wxSOLID));
|
||||
dc.DrawRectangle(rectBorder);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -1689,8 +1688,8 @@ wxGridCellEditor* wxGridCellAttr::GetEditor(wxGrid* grid, int row, int col) cons
|
||||
editor->IncRef();
|
||||
}
|
||||
|
||||
if ( grid ) // get renderer for the data type
|
||||
editor = grid->GetDefaultEditorForCell(row, col);
|
||||
if ( !editor && grid ) // get renderer for the data type
|
||||
editor = grid->GetDefaultEditorForCell(row, col);
|
||||
|
||||
if ( !editor )
|
||||
// if we still don't have one then use the grid default
|
||||
@@ -1855,8 +1854,8 @@ wxGridCellAttr *wxGridRowOrColAttrData::GetAttr(int rowOrCol) const
|
||||
|
||||
void wxGridRowOrColAttrData::SetAttr(wxGridCellAttr *attr, int rowOrCol)
|
||||
{
|
||||
int n = m_rowsOrCols.Index(rowOrCol);
|
||||
if ( n == wxNOT_FOUND )
|
||||
int i = m_rowsOrCols.Index(rowOrCol);
|
||||
if ( i == wxNOT_FOUND )
|
||||
{
|
||||
// add the attribute
|
||||
m_rowsOrCols.Add(rowOrCol);
|
||||
@@ -1864,17 +1863,19 @@ void wxGridRowOrColAttrData::SetAttr(wxGridCellAttr *attr, int rowOrCol)
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t n = (size_t)i;
|
||||
if ( attr )
|
||||
{
|
||||
// change the attribute
|
||||
m_attrs[(size_t)n] = attr;
|
||||
m_attrs[n]->DecRef();
|
||||
m_attrs[n] = attr;
|
||||
}
|
||||
else
|
||||
{
|
||||
// remove this attribute
|
||||
m_attrs[(size_t)n]->DecRef();
|
||||
m_rowsOrCols.RemoveAt((size_t)n);
|
||||
m_attrs.RemoveAt((size_t)n);
|
||||
m_attrs[n]->DecRef();
|
||||
m_rowsOrCols.RemoveAt(n);
|
||||
m_attrs.RemoveAt(n);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2121,8 +2122,6 @@ int wxGridTypeRegistry::FindOrCloneDataType(const wxString& typeName)
|
||||
editor->SetParameters(params);
|
||||
|
||||
// register the new typename
|
||||
renderer->IncRef();
|
||||
editor->IncRef();
|
||||
RegisterDataType(typeName, renderer, editor);
|
||||
|
||||
// we just registered it, it's the last one
|
||||
@@ -4254,7 +4253,8 @@ void wxGrid::ProcessGridCellMouseEvent( wxMouseEvent& event )
|
||||
|
||||
wxClientDC dc( m_gridWin );
|
||||
PrepareDC( dc );
|
||||
y = wxMax( y, GetRowTop(m_dragRowOrCol) + WXGRID_MIN_ROW_HEIGHT );
|
||||
y = wxMax( y, GetRowTop(m_dragRowOrCol) +
|
||||
GetRowMinimalHeight(m_dragRowOrCol) );
|
||||
dc.SetLogicalFunction(wxINVERT);
|
||||
if ( m_dragLastPos >= 0 )
|
||||
{
|
||||
@@ -7257,7 +7257,9 @@ void wxGrid::AutoSizeColOrRow( int colOrRow, bool setAsMin, bool column )
|
||||
{
|
||||
wxClientDC dc(m_gridWin);
|
||||
|
||||
int row, col;
|
||||
// init both of them to avoid compiler warnings, even if weo nly need one
|
||||
int row = -1,
|
||||
col = -1;
|
||||
if ( column )
|
||||
col = colOrRow;
|
||||
else
|
||||
@@ -7312,8 +7314,11 @@ void wxGrid::AutoSizeColOrRow( int colOrRow, bool setAsMin, bool column )
|
||||
}
|
||||
else
|
||||
{
|
||||
// leave some space around text
|
||||
extentMax += 10;
|
||||
if ( column )
|
||||
{
|
||||
// leave some space around text
|
||||
extentMax += 10;
|
||||
}
|
||||
}
|
||||
|
||||
if ( column )
|
||||
|
@@ -237,8 +237,9 @@ bool wxButton::MSWCommand(WXUINT param, WXWORD id)
|
||||
bool processed = FALSE;
|
||||
switch ( param )
|
||||
{
|
||||
case 1: // means that the message came from an accelerator
|
||||
case BN_CLICKED:
|
||||
case 1: // message came from an accelerator
|
||||
case BN_CLICKED: // normal buttons send this
|
||||
case BN_DOUBLECLICKED: // owner-drawn ones also send this
|
||||
processed = SendClickEvent();
|
||||
break;
|
||||
}
|
||||
@@ -256,6 +257,11 @@ long wxButton::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
|
||||
|
||||
// let the default processign take place too
|
||||
}
|
||||
else if ( nMsg == WM_LBUTTONDBLCLK )
|
||||
{
|
||||
// trick the base class into thinking that this was just a click
|
||||
nMsg = WM_LBUTTONDOWN;
|
||||
}
|
||||
|
||||
// let the base class do all real processing
|
||||
return wxControl::MSWWindowProc(nMsg, wParam, lParam);
|
||||
|
@@ -145,6 +145,8 @@ void wxCheckBox::SetLabel(const wxString& label)
|
||||
SetWindowText(GetHwnd(), label);
|
||||
}
|
||||
|
||||
#define CHECK_SIZE 13
|
||||
|
||||
wxSize wxCheckBox::DoGetBestSize() const
|
||||
{
|
||||
int wCheckbox, hCheckbox;
|
||||
@@ -154,15 +156,15 @@ wxSize wxCheckBox::DoGetBestSize() const
|
||||
if ( !str.IsEmpty() )
|
||||
{
|
||||
GetTextExtent(str, &wCheckbox, &hCheckbox);
|
||||
wCheckbox += RADIO_SIZE;
|
||||
wCheckbox += CHECK_SIZE;
|
||||
|
||||
if ( hCheckbox < RADIO_SIZE )
|
||||
hCheckbox = RADIO_SIZE;
|
||||
if ( hCheckbox < CHECK_SIZE )
|
||||
hCheckbox = CHECK_SIZE;
|
||||
}
|
||||
else
|
||||
{
|
||||
wCheckbox = RADIO_SIZE;
|
||||
hCheckbox = RADIO_SIZE;
|
||||
wCheckbox = CHECK_SIZE;
|
||||
hCheckbox = CHECK_SIZE;
|
||||
}
|
||||
|
||||
return wxSize(wCheckbox, hCheckbox);
|
||||
|
@@ -164,9 +164,13 @@ wxSize wxEnhMetaFile::GetSize() const
|
||||
|
||||
bool wxEnhMetaFile::SetClipboard(int WXUNUSED(width), int WXUNUSED(height))
|
||||
{
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
wxCHECK_MSG( m_hMF, FALSE, _T("can't copy invalid metafile to clipboard") );
|
||||
|
||||
return wxTheClipboard->AddData(new wxEnhMetaFileDataObject(*this));
|
||||
#else // !wxUSE_DRAG_AND_DROP
|
||||
wxFAIL_MSG(_T("not implemented"));
|
||||
#endif // wxUSE_DRAG_AND_DROP/!wxUSE_DRAG_AND_DROP
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@@ -86,10 +86,6 @@
|
||||
// looks quite ugly.
|
||||
#define wxUSE_CHECKBOXES_IN_MULTI_SEL_TREE 0
|
||||
|
||||
// from msw/window.cpp
|
||||
extern bool wxIsShiftDown();
|
||||
extern bool wxIsCtrlDown();
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// private functions
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@@ -129,10 +129,6 @@ wxWindow *wxFindWinFromHandle(WXHWND hWnd);
|
||||
// mouse clicks
|
||||
static void TranslateKbdEventToMouse(wxWindow *win, int *x, int *y, WPARAM *flags);
|
||||
|
||||
// get the current state of SHIFT/CTRL keys
|
||||
inline bool wxIsShiftDown() { return (GetKeyState(VK_SHIFT) & 0x100) != 0; }
|
||||
inline bool wxIsCtrlDown() { return (GetKeyState(VK_CONTROL) & 0x100) != 0; }
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// event tables
|
||||
// ---------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user