+// send a message to all existing tooltip controls
+static void SendTooltipMessageToAll(UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ // NB: it might be somewhat easier to maintain a list of all existing
+ // wxToolTip controls (put them there in ctor, delete from the list
+ // in dtor) - may be it's worth doing it this way? OTOH, typical
+ // application won't have many top level windows, so iterating over all
+ // of them shouldnt' take much time neither...
+
+ // iterate over all top level windows and send message to the tooltip
+ // control of each and every of them (or more precisely to all dialogs and
+ // frames)
+ wxDialog *dialog = NULL;
+ wxFrame *frame = NULL;
+
+ wxNode *node = wxTopLevelWindows.First();
+ while ( node )
+ {
+ wxWindow *win = (wxWindow *)node->Data();
+
+ node = node->Next();
+
+ if ( win->IsKindOf(CLASSINFO(wxFrame)) )
+ {
+ frame = (wxFrame *)win;
+ dialog = NULL;
+ }
+ else if ( win->IsKindOf(CLASSINFO(wxDialog)) )
+ {
+ dialog = (wxDialog *)win;
+ frame = NULL;
+ }
+ else
+ {
+ // skip this strange top level window
+ continue;
+ }
+
+ wxASSERT_MSG( dialog || frame, "logic error" );
+
+ WXHWND hwndTT = frame ? frame->GetToolTipCtrl()
+ : dialog->GetToolTipCtrl();
+ if ( hwndTT )
+ {
+ (void)SendTooltipMessage(hwndTT, msg, wParam, (void *)lParam);
+ }
+ }
+}
+