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);
// 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:
// 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
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());
}
}
#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
// ----------------------------------------------------------------------------
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
// ----------------------------------------------------------------------------