+ if (!wxTheToolBarTimer)
+ wxTheToolBarTimer = new wxToolBarTimer;
+
+ wxToolBarTimer::buttonWidget = w;
+ wxToolBarTimer::helpString = tooltip;
+
+ /************************************************************/
+ /* Popup help label */
+ /************************************************************/
+ if (event->type == EnterNotify)
+ {
+ if (wxToolBarTimer::help_popup != (Widget) 0)
+ {
+ XtDestroyWidget (wxToolBarTimer::help_popup);
+ XtPopdown (wxToolBarTimer::help_popup);
+ }
+ wxToolBarTimer::help_popup = (Widget) 0;
+
+ // One shot
+ wxTheToolBarTimer->Start(delayMilli, TRUE);
+
+ }
+ /************************************************************/
+ /* Popdown help label */
+ /************************************************************/
+ else if (event->type == LeaveNotify)
+ {
+ if (wxTheToolBarTimer)
+ wxTheToolBarTimer->Stop();
+ if (wxToolBarTimer::help_popup != (Widget) 0)
+ {
+ XtDestroyWidget (wxToolBarTimer::help_popup);
+ XtPopdown (wxToolBarTimer::help_popup);
+ }
+ wxToolBarTimer::help_popup = (Widget) 0;
+ }
+}
+
+void wxToolBarTimer::Notify()
+{
+ Position x, y;
+
+ /************************************************************/
+ /* Create shell without window decorations */
+ /************************************************************/
+ help_popup = XtVaCreatePopupShell ("shell",
+ overrideShellWidgetClass, (Widget) wxTheApp->GetTopLevelWidget(),
+ NULL);
+
+ /************************************************************/
+ /* Get absolute position on display of toolbar button */
+ /************************************************************/
+ XtTranslateCoords (buttonWidget,
+ (Position) 0,
+ (Position) 0,
+ &x, &y);
+
+ // Move the tooltip more or less above the button
+ int yOffset = 20; // TODO: What should be really?
+ y -= yOffset;
+ if (y < yOffset) y = 0;
+
+ /************************************************************/
+ /* Set the position of the help popup */
+ /************************************************************/
+ XtVaSetValues (help_popup,
+ XmNx, (Position) x,
+ XmNy, (Position) y,
+ NULL);
+
+ /************************************************************/
+ /* Create help label */
+ /************************************************************/
+ XmString text = XmStringCreateSimple ((char*) (const char*) helpString);
+ XtVaCreateManagedWidget ("help_label",
+ xmLabelWidgetClass, help_popup,
+ XmNlabelString, text,
+ XtVaTypedArg,
+ XmNforeground, XtRString, "black",
+ strlen("black")+1,
+ XtVaTypedArg,
+ XmNbackground, XtRString, "LightGoldenrod",
+ strlen("LightGoldenrod")+1,
+ NULL);
+ XmStringFree (text);
+
+ /************************************************************/
+ /* Popup help label */
+ /************************************************************/
+ XtPopup (help_popup, XtGrabNone);