1. wxTreeCtrl::SetBackgroundColour() works (with new comctl32 anyhow)

2. wxToolTip should work with old comctl32


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5225 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2000-01-03 23:38:57 +00:00
parent 398b582f36
commit bb44855297
3 changed files with 54 additions and 3 deletions

View File

@ -442,6 +442,10 @@ public:
virtual bool MSWCommand(WXUINT param, WXWORD id);
virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
// override some base class virtuals
virtual bool SetBackgroundColour(const wxColour &colour);
virtual bool SetForegroundColour(const wxColour &colour);
// get/set the check state for the item (only for wxTR_MULTIPLE)
bool IsItemChecked(const wxTreeItemId& item) const;
void SetItemCheck(const wxTreeItemId& item, bool check = TRUE);

View File

@ -63,10 +63,11 @@ static WNDPROC gs_wndprocToolTip = (WNDPROC)NULL;
// private classes
// ----------------------------------------------------------------------------
// a simple wrapper around TOOLINFO Win32 structure
// a wrapper around TOOLINFO Win32 structure
#ifdef __VISUALC__
#pragma warning( disable : 4097 ) // we inherit from a typedef - so what?
#endif
class wxToolInfo : public TOOLINFO
{
public:
@ -75,11 +76,24 @@ public:
// initialize all members
::ZeroMemory(this, sizeof(TOOLINFO));
// the structure TOOLINFO has been extended with a 4 byte field in
// version 4.70 of comctl32.dll and if we compile on a newer machine
// but run on one with the old version of comctl32, nothing will work
// because the library will detect that we rely on a more recent
// version of it. So we always use the old size - if we ever start
// using our lParam member, we'd have to check for comctl32 version
// during run-time
#if defined(_WIN32_IE) && (_WIN32_IE >= 0x0300)
cbSize = sizeof(TOOLINFO) - sizeof(LPARAM);
#else // old headers
cbSize = sizeof(TOOLINFO);
#endif // compile-time comctl32.dll version
uFlags = TTF_IDISHWND;
uId = (UINT)hwnd;
}
};
#ifdef __VISUALC__
#pragma warning( default : 4097 )
#endif
@ -252,8 +266,7 @@ void wxToolTip::Add(WXHWND hWnd)
if ( !SendTooltipMessage(GetToolTipCtrl(), TTM_ADDTOOL, 0, &ti) )
{
wxLogSysError(_("Failed to create the tooltip '%s'"),
m_text.c_str());
wxLogDebug(_T("Failed to create the tooltip '%s'"), m_text.c_str());
}
}

View File

@ -62,6 +62,16 @@
#define TVIS_FOCUSED 0x0001
#endif
#ifndef TV_FIRST
#define TV_FIRST 0x1100
#endif
// old headers might miss these messages (comctl32.dll 4.71+ only)
#ifndef TVM_SETBKCOLOR
#define TVM_SETBKCOLOR (TV_FIRST + 29)
#define TVM_SETTEXTCOLOR (TV_FIRST + 30)
#endif
// ----------------------------------------------------------------------------
// private classes
// ----------------------------------------------------------------------------
@ -484,6 +494,30 @@ size_t wxTreeCtrl::GetChildrenCount(const wxTreeItemId& item,
return counter.GetCount() - 1;
}
// ----------------------------------------------------------------------------
// control colours
// ----------------------------------------------------------------------------
bool wxTreeCtrl::SetBackgroundColour(const wxColour &colour)
{
if ( !wxWindowBase::SetBackgroundColour(colour) )
return FALSE;
SendMessage(GetHwnd(), TVM_SETBKCOLOR, 0, colour.GetPixel());
return TRUE;
}
bool wxTreeCtrl::SetForegroundColour(const wxColour &colour)
{
if ( !wxWindowBase::SetForegroundColour(colour) )
return FALSE;
SendMessage(GetHwnd(), TVM_SETTEXTCOLOR, 0, colour.GetPixel());
return TRUE;
}
// ----------------------------------------------------------------------------
// Item access
// ----------------------------------------------------------------------------