1. fixed wxBitmapButtons in wxStatBar95 bug

2. fixed handling of accels in wxDocMDIParentFrame
3. fixed wxComboBox tooltips


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7009 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2000-03-31 00:21:24 +00:00
parent 40dd4a59a2
commit 7f30725c85
5 changed files with 85 additions and 21 deletions

View File

@@ -81,6 +81,8 @@ public:
virtual bool MSWCommand(WXUINT param, WXWORD id);
bool MSWProcessEditMsg(WXUINT msg, WXWPARAM wParam, WXLPARAM lParam);
WXHWND GetEditHWND() const;
protected:
virtual void DoMoveWindow(int x, int y, int width, int height);
virtual wxSize DoGetBestSize() const;

View File

@@ -38,6 +38,13 @@
#include "wx/clipbrd.h"
#include "wx/msw/private.h"
#if wxUSE_TOOLTIPS
#ifndef __GNUWIN32_OLD__
#include <commctrl.h>
#endif
#include "wx/tooltip.h"
#endif // wxUSE_TOOLTIPS
// ----------------------------------------------------------------------------
// wxWin macros
// ----------------------------------------------------------------------------
@@ -73,15 +80,45 @@ LRESULT APIENTRY _EXPORT wxComboEditWndProc(HWND hWnd,
WPARAM wParam,
LPARAM lParam)
{
if ( message == WM_CHAR )
if (
message == WM_CHAR
#if wxUSE_TOOLTIPS
|| message == WM_NOTIFY
#endif // wxUSE_TOOLTIPS
)
{
HWND hwndCombo = ::GetParent(hWnd);
wxWindow *win = wxFindWinFromHandle((WXHWND)hwndCombo);
wxComboBox *combo = wxDynamicCast(win, wxComboBox);
wxCHECK_MSG( combo, 0, _T("should have combo as parent") );
if ( combo->MSWProcessEditMsg(message, wParam, lParam) )
return 0;
switch ( message )
{
case WM_CHAR:
if ( combo->MSWProcessEditMsg(message, wParam, lParam) )
return 0;
break;
#if wxUSE_TOOLTIPS
case WM_NOTIFY:
{
NMHDR* hdr = (NMHDR *)lParam;
if ( (int)hdr->code == TTN_NEEDTEXT )
{
wxToolTip *tooltip = combo->GetToolTip();
if ( tooltip )
{
TOOLTIPTEXT *ttt = (TOOLTIPTEXT *)lParam;
ttt->lpszText = (wxChar *)tooltip->GetTip().c_str();
}
// processed
return 0;
}
}
break;
#endif // wxUSE_TOOLTIPS
}
}
return ::CallWindowProc(CASTWNDPROC gs_wndprocEdit, hWnd, message, wParam, lParam);
@@ -131,6 +168,22 @@ bool wxComboBox::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
return FALSE;
}
WXHWND wxComboBox::GetEditHWND() const
{
if ( GetWindowStyle() & wxCB_READONLY )
return NULL;
POINT pt;
pt.x = pt.y = 4;
HWND hwndEdit = ::ChildWindowFromPoint(GetHwnd(), pt);
if ( !hwndEdit || hwndEdit == GetHwnd() )
{
wxFAIL_MSG(_T("not read only combobox without edit control?"));
}
return (WXHWND)hwndEdit;
}
bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
const wxString& value,
const wxPoint& pos,
@@ -182,23 +235,12 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
// edit control, we must subclass it as well
if ( !(style & wxCB_READONLY) )
{
// first find the child edit
POINT pt;
pt.x = pt.y = 4;
HWND hwndEdit = ::ChildWindowFromPoint(GetHwnd(), pt);
if ( !hwndEdit || hwndEdit == GetHwnd() )
{
wxFAIL_MSG(_T("not read only combobox without edit control?"));
}
else
{
gs_wndprocEdit = (WXFARPROC)::SetWindowLong
(
hwndEdit,
GWL_WNDPROC,
(LPARAM)wxComboEditWndProc
);
}
gs_wndprocEdit = (WXFARPROC)::SetWindowLong
(
(HWND)GetEditHWND(),
GWL_WNDPROC,
(LPARAM)wxComboEditWndProc
);
}
return TRUE;

View File

@@ -582,17 +582,20 @@ bool wxMDIParentFrame::MSWTranslateMessage(WXMSG* msg)
{
MSG *pMsg = (MSG *)msg;
// first let the current child get it
if ( m_currentChild && m_currentChild->GetHWND() &&
m_currentChild->MSWTranslateMessage(msg) )
{
return TRUE;
}
if ( m_acceleratorTable.Translate(this, msg) )
// then try out accel table (will also check the menu accels)
if ( wxFrame::MSWTranslateMessage(msg) )
{
return TRUE;
}
// finally, check for MDI specific built in accel keys
if ( pMsg->message == WM_KEYDOWN || pMsg->message == WM_SYSKEYDOWN )
{
if ( ::TranslateMDISysAccel(GetWinHwnd(GetClientWindow()), pMsg))

View File

@@ -71,6 +71,8 @@ LRESULT APIENTRY wxStatusBarProc(HWND hwnd,
{
switch (message) {
case WM_COMMAND:
case WM_DRAWITEM:
case WM_MEASUREITEM:
case WM_SIZE:
case WM_MOVE:
case WM_MOUSEMOVE:

View File

@@ -374,6 +374,21 @@ void wxToolTip::SetWindow(wxWindow *win)
Add((WXHWND)hwnd);
}
}
// VZ: it's ugly to do it here, but I don't want any major changes right
// now, later we will probably want to have wxWindow::OnGotToolTip() or
// something like this where the derived class can do such things
// itself instead of wxToolTip "knowing" about them all
wxComboBox *combo = wxDynamicCast(control, wxComboBox);
if ( combo )
{
WXHWND hwndComboEdit = combo->GetEditHWND();
if ( hwndComboEdit )
{
Add(hwndComboEdit);
}
//else: it's ok for a combo to be read only, of course
}
}
void wxToolTip::SetTip(const wxString& tip)