1. fixed apparent bug in wxGrid code

2. fixed WM_CHAR handling in combobox
3. fixed controls positioning in the toolbar with older comctl32.dll/mingw32


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7005 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2000-03-30 22:26:34 +00:00
parent 3139a47403
commit 597acb605c
4 changed files with 69 additions and 51 deletions

View File

@@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////////
// Name: combobox.h
// Name: wx/msw/combobox.h
// Purpose: wxComboBox class
// Author: Julian Smart
// Modified by:
@@ -46,14 +46,16 @@ public:
Create(parent, id, value, pos, size, n, choices, style, validator, name);
}
bool Create(wxWindow *parent, wxWindowID id,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxComboBoxNameStr);
bool Create(wxWindow *parent,
wxWindowID id,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0,
const wxString choices[] = NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxComboBoxNameStr);
// List functions: see wxChoice
@@ -75,7 +77,9 @@ public:
virtual void SetSelection(long from, long to);
virtual void SetEditable(bool editable);
// implementation only from now on
virtual bool MSWCommand(WXUINT param, WXWORD id);
bool MSWProcessEditMsg(WXUINT msg, WXWPARAM wParam, WXLPARAM lParam);
protected:
virtual void DoMoveWindow(int x, int y, int width, int height);

View File

@@ -5427,8 +5427,10 @@ void wxGrid::DrawGridSpace( wxDC& dc )
int right, bottom;
CalcUnscrolledPosition( cw, ch, &right, &bottom );
if ( right > (m_numCols>0) ? GetColRight(m_numCols-1) : 0 ||
bottom > (m_numRows>0) ? GetRowBottom(m_numRows-1) : 0 )
int rightCol = m_numCols > 0 ? GetColRight(m_numCols - 1) : 0;
int bottomRow = m_numRows > 0 ? GetRowBottom(m_numRows - 1) : 0 ;
if ( right > rightCol || bottom > bottomRow )
{
int left, top;
CalcUnscrolledPosition( 0, 0, &left, &top );
@@ -5436,17 +5438,16 @@ void wxGrid::DrawGridSpace( wxDC& dc )
dc.SetBrush( wxBrush(GetDefaultCellBackgroundColour(), wxSOLID) );
dc.SetPen( *wxTRANSPARENT_PEN );
if ( right > (m_numCols>0) ? GetColRight(m_numCols-1) : 0 )
dc.DrawRectangle( (m_numCols>0) ? GetColRight(m_numCols-1) : 0,
top, right - (m_numCols>0) ?
GetColRight(m_numCols-1) : 0, ch );
if ( right > rightCol )
{
dc.DrawRectangle( rightCol, top, right - rightCol, ch);
}
if ( bottom > (m_numRows>0) ? GetRowBottom(m_numRows-1) : 0 )
dc.DrawRectangle( left,
(m_numRows>0) ? GetRowBottom(m_numRows-1) : 0,
cw,
bottom - ((m_numRows>0) ? GetRowBottom(m_numRows-1) : 0 ));
}
if ( bottom > bottomRow )
{
dc.DrawRectangle( left, bottomRow, cw, bottom - bottomRow);
}
}
}
@@ -6300,13 +6301,13 @@ bool wxGrid::MoveCursorUp( bool expandSelection )
{
if ( m_selectingKeyboard == wxGridNoCellCoords )
m_selectingKeyboard = m_currentCellCoords;
if ( m_selectingKeyboard.GetRow() > 0 )
{
m_selectingKeyboard.SetRow( m_selectingKeyboard.GetRow() - 1 );
MakeCellVisible( m_selectingKeyboard.GetRow(),
m_selectingKeyboard.GetCol() );
SelectBlock( m_currentCellCoords, m_selectingKeyboard );
}
if ( m_selectingKeyboard.GetRow() > 0 )
{
m_selectingKeyboard.SetRow( m_selectingKeyboard.GetRow() - 1 );
MakeCellVisible( m_selectingKeyboard.GetRow(),
m_selectingKeyboard.GetCol() );
SelectBlock( m_currentCellCoords, m_selectingKeyboard );
}
}
else
{
@@ -6332,13 +6333,13 @@ bool wxGrid::MoveCursorDown( bool expandSelection )
{
if ( m_selectingKeyboard == wxGridNoCellCoords )
m_selectingKeyboard = m_currentCellCoords;
if ( m_selectingKeyboard.GetRow() < m_numRows-1 )
{
m_selectingKeyboard.SetRow( m_selectingKeyboard.GetRow() + 1 );
MakeCellVisible( m_selectingKeyboard.GetRow(),
m_selectingKeyboard.GetCol() );
SelectBlock( m_currentCellCoords, m_selectingKeyboard );
}
if ( m_selectingKeyboard.GetRow() < m_numRows-1 )
{
m_selectingKeyboard.SetRow( m_selectingKeyboard.GetRow() + 1 );
MakeCellVisible( m_selectingKeyboard.GetRow(),
m_selectingKeyboard.GetCol() );
SelectBlock( m_currentCellCoords, m_selectingKeyboard );
}
}
else
{
@@ -6364,13 +6365,13 @@ bool wxGrid::MoveCursorLeft( bool expandSelection )
{
if ( m_selectingKeyboard == wxGridNoCellCoords )
m_selectingKeyboard = m_currentCellCoords;
if ( m_selectingKeyboard.GetCol() > 0 )
{
m_selectingKeyboard.SetCol( m_selectingKeyboard.GetCol() - 1 );
MakeCellVisible( m_selectingKeyboard.GetRow(),
m_selectingKeyboard.GetCol() );
SelectBlock( m_currentCellCoords, m_selectingKeyboard );
}
if ( m_selectingKeyboard.GetCol() > 0 )
{
m_selectingKeyboard.SetCol( m_selectingKeyboard.GetCol() - 1 );
MakeCellVisible( m_selectingKeyboard.GetRow(),
m_selectingKeyboard.GetCol() );
SelectBlock( m_currentCellCoords, m_selectingKeyboard );
}
}
else
{
@@ -6397,12 +6398,12 @@ bool wxGrid::MoveCursorRight( bool expandSelection )
if ( m_selectingKeyboard == wxGridNoCellCoords )
m_selectingKeyboard = m_currentCellCoords;
if ( m_selectingKeyboard.GetCol() < m_numCols - 1 )
{
m_selectingKeyboard.SetCol( m_selectingKeyboard.GetCol() + 1 );
MakeCellVisible( m_selectingKeyboard.GetRow(),
m_selectingKeyboard.GetCol() );
SelectBlock( m_currentCellCoords, m_selectingKeyboard );
}
{
m_selectingKeyboard.SetCol( m_selectingKeyboard.GetCol() + 1 );
MakeCellVisible( m_selectingKeyboard.GetRow(),
m_selectingKeyboard.GetCol() );
SelectBlock( m_currentCellCoords, m_selectingKeyboard );
}
}
else
{

View File

@@ -76,9 +76,12 @@ LRESULT APIENTRY _EXPORT wxComboEditWndProc(HWND hWnd,
if ( message == WM_CHAR )
{
HWND hwndCombo = ::GetParent(hWnd);
wxCHECK_MSG( hwndCombo, 0, _T("should have combo as parent") );
wxWindow *win = wxFindWinFromHandle((WXHWND)hwndCombo);
wxComboBox *combo = wxDynamicCast(win, wxComboBox);
wxCHECK_MSG( combo, 0, _T("should have combo as parent") );
::SendMessage(hwndCombo, message, wParam, lParam);
if ( combo->MSWProcessEditMsg(message, wParam, lParam) )
return 0;
}
return ::CallWindowProc(CASTWNDPROC gs_wndprocEdit, hWnd, message, wParam, lParam);
@@ -88,6 +91,16 @@ LRESULT APIENTRY _EXPORT wxComboEditWndProc(HWND hWnd,
// wxComboBox
// ----------------------------------------------------------------------------
bool wxComboBox::MSWProcessEditMsg(WXUINT msg, WXWPARAM wParam, WXLPARAM lParam)
{
if ( msg == WM_CHAR )
{
return HandleChar(wParam, lParam, TRUE /* isASCII */);
}
return FALSE;
}
bool wxComboBox::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
{
switch ( param )

View File

@@ -580,7 +580,7 @@ bool wxToolBar::Realize()
TBBUTTON tbb;
wxZeroMemory(tbb);
tbb.idCommand = 0;
tbb.fsState = TBSTATE_ENABLED | TBSTATE_HIDDEN;
tbb.fsState = TBSTATE_ENABLED;
tbb.fsStyle = TBSTYLE_SEP;
size_t nSeparators = size.x / widthSep;