Rework wxMotif font/color inheritance so it works
[wxWidgets.git] / src / motif / toolbar.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/motif/toolbar.cpp
3 // Purpose: wxToolBar
4 // Author: Julian Smart
5 // Modified by: 13.12.99 by VZ during toolbar classes reorganization
6 // Created: 04/01/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 // ============================================================================
13 // declarations
14 // ============================================================================
15
16 // ----------------------------------------------------------------------------
17 // headers
18 // ----------------------------------------------------------------------------
19
20 // For compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
22
23 #ifdef __VMS
24 #define XtDisplay XTDISPLAY
25 #endif
26
27 #include "wx/toolbar.h"
28
29 #ifndef WX_PRECOMP
30 #include "wx/app.h"
31 #include "wx/frame.h"
32 #include "wx/timer.h"
33 #include "wx/settings.h"
34 #endif
35
36 #ifdef __VMS__
37 #pragma message disable nosimpint
38 #endif
39 #include <Xm/Xm.h>
40 #include <Xm/PushBG.h>
41 #include <Xm/PushB.h>
42 #include <Xm/Label.h>
43 #include <Xm/ToggleB.h>
44 #include <Xm/ToggleBG.h>
45 #include <Xm/Form.h>
46 #ifdef __VMS__
47 #pragma message enable nosimpint
48 #endif
49
50 #include "wx/motif/private.h"
51 #include "wx/motif/bmpmotif.h"
52
53 // ----------------------------------------------------------------------------
54 // wxWin macros
55 // ----------------------------------------------------------------------------
56
57 IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxControl)
58
59 // ----------------------------------------------------------------------------
60 // private functions
61 // ----------------------------------------------------------------------------
62
63 static void wxToolButtonCallback (Widget w, XtPointer clientData,
64 XtPointer ptr);
65 static void wxToolButtonPopupCallback (Widget w, XtPointer client_data,
66 XEvent *event, Boolean *continue_to_dispatch);
67
68 // ----------------------------------------------------------------------------
69 // private classes
70 // ----------------------------------------------------------------------------
71
72 class wxToolBarTimer : public wxTimer
73 {
74 public:
75 virtual void Notify();
76
77 static Widget help_popup;
78 static Widget buttonWidget;
79 static wxString helpString;
80 };
81
82 class wxToolBarTool : public wxToolBarToolBase
83 {
84 public:
85 wxToolBarTool(wxToolBar *tbar,
86 int id,
87 const wxString& label,
88 const wxBitmap& bmpNormal,
89 const wxBitmap& bmpToggled,
90 wxItemKind kind,
91 wxObject *clientData,
92 const wxString& shortHelp,
93 const wxString& longHelp)
94 : wxToolBarToolBase(tbar, id, label, bmpNormal, bmpToggled, kind,
95 clientData, shortHelp, longHelp)
96 {
97 Init();
98 }
99
100 wxToolBarTool(wxToolBar *tbar, wxControl *control, const wxString& label)
101 : wxToolBarToolBase(tbar, control, label)
102 {
103 Init();
104 }
105
106 virtual ~wxToolBarTool();
107
108 // accessors
109 void SetWidget(Widget widget) { m_widget = widget; }
110 Widget GetButtonWidget() const { return m_widget; }
111
112 Pixmap GetArmPixmap()
113 {
114 m_bitmapCache.SetBitmap( GetNormalBitmap() );
115 return (Pixmap)m_bitmapCache.GetArmPixmap( (WXWidget)m_widget );
116 }
117
118 Pixmap GetInsensPixmap()
119 {
120 m_bitmapCache.SetBitmap( GetNormalBitmap() );
121 return (Pixmap)m_bitmapCache.GetInsensPixmap( (WXWidget)m_widget );
122 }
123 protected:
124 void Init();
125
126 Widget m_widget;
127 wxBitmapCache m_bitmapCache;
128 };
129
130 // ----------------------------------------------------------------------------
131 // globals
132 // ----------------------------------------------------------------------------
133
134 static wxToolBarTimer* wxTheToolBarTimer = (wxToolBarTimer*) NULL;
135
136 Widget wxToolBarTimer::help_popup = (Widget) 0;
137 Widget wxToolBarTimer::buttonWidget = (Widget) 0;
138 wxString wxToolBarTimer::helpString;
139
140 // ============================================================================
141 // implementation
142 // ============================================================================
143
144 // ----------------------------------------------------------------------------
145 // wxToolBarTool
146 // ----------------------------------------------------------------------------
147
148 wxToolBarToolBase *wxToolBar::CreateTool(int id,
149 const wxString& label,
150 const wxBitmap& bmpNormal,
151 const wxBitmap& bmpToggled,
152 wxItemKind kind,
153 wxObject *clientData,
154 const wxString& shortHelp,
155 const wxString& longHelp)
156 {
157 return new wxToolBarTool(this, id, label, bmpNormal, bmpToggled, kind,
158 clientData, shortHelp, longHelp);
159 }
160
161
162 wxToolBarToolBase *
163 wxToolBar::CreateTool(wxControl *control, const wxString& label)
164 {
165 return new wxToolBarTool(this, control, label);
166 }
167
168 void wxToolBarTool::Init()
169 {
170 m_widget = (Widget)0;
171 }
172
173 wxToolBarTool::~wxToolBarTool()
174 {
175 if ( m_widget )
176 XtDestroyWidget(m_widget);
177 }
178
179 // ----------------------------------------------------------------------------
180 // wxToolBar construction
181 // ----------------------------------------------------------------------------
182
183 void wxToolBar::Init()
184 {
185 m_maxWidth = -1;
186 m_maxHeight = -1;
187 m_defaultWidth = 24;
188 m_defaultHeight = 22;
189 m_toolPacking = 2;
190 m_toolSeparation = 8;
191 m_xMargin = 2;
192 m_yMargin = 2;
193 m_maxRows = 100;
194 m_maxCols = 100;
195 }
196
197 bool wxToolBar::Create(wxWindow *parent,
198 wxWindowID id,
199 const wxPoint& pos,
200 const wxSize& size,
201 long style,
202 const wxString& name)
203 {
204 if( !wxControl::CreateControl( parent, id, pos, size, style,
205 wxDefaultValidator, name ) )
206 return false;
207 PreCreation();
208
209 FixupStyle();
210
211 Widget parentWidget = (Widget) parent->GetClientWidget();
212
213 Widget toolbar = XtVaCreateManagedWidget("toolbar",
214 xmBulletinBoardWidgetClass, (Widget) parentWidget,
215 XmNmarginWidth, 0,
216 XmNmarginHeight, 0,
217 XmNresizePolicy, XmRESIZE_NONE,
218 NULL);
219 /*
220 Widget toolbar = XtVaCreateManagedWidget("toolbar",
221 xmFormWidgetClass, (Widget) m_clientWidget,
222 XmNtraversalOn, False,
223 XmNhorizontalSpacing, 0,
224 XmNverticalSpacing, 0,
225 XmNleftOffset, 0,
226 XmNrightOffset, 0,
227 XmNmarginWidth, 0,
228 XmNmarginHeight, 0,
229 NULL);
230 */
231
232 m_mainWidget = (WXWidget) toolbar;
233
234 wxPoint rPos = pos;
235 wxSize rSize = size;
236
237 if( rPos.x == -1 ) rPos.x = 0;
238 if( rPos.y == -1 ) rPos.y = 0;
239 if( rSize.x == -1 && GetParent() )
240 rSize.x = GetParent()->GetSize().x;
241
242 PostCreation();
243 AttachWidget (parent, m_mainWidget, (WXWidget) NULL,
244 rPos.x, rPos.y, rSize.x, rSize.y);
245
246 return true;
247 }
248
249 wxToolBar::~wxToolBar()
250 {
251 delete wxTheToolBarTimer;
252 wxTheToolBarTimer = NULL;
253 }
254
255 bool wxToolBar::Realize()
256 {
257 if ( m_tools.GetCount() == 0 )
258 {
259 // nothing to do
260 return true;
261 }
262
263 bool isVertical = GetWindowStyle() & wxTB_VERTICAL;
264
265 // Separator spacing
266 const int separatorSize = GetToolSeparation(); // 8;
267 wxSize margins = GetToolMargins();
268 int packing = GetToolPacking();
269 int marginX = margins.x;
270 int marginY = margins.y;
271
272 int currentX = marginX;
273 int currentY = marginY;
274
275 int buttonHeight = 0, buttonWidth = 0;
276
277 Widget button;
278 Pixmap pixmap, insensPixmap;
279 wxBitmap bmp, insensBmp;
280
281 wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst();
282 while ( node )
283 {
284 wxToolBarTool *tool = (wxToolBarTool *)node->GetData();
285
286 switch ( tool->GetStyle() )
287 {
288 case wxTOOL_STYLE_CONTROL:
289 {
290 wxControl* control = tool->GetControl();
291 wxSize sz = control->GetSize();
292 wxPoint pos = control->GetPosition();
293 // Allow a control to specify a y[x]-offset by setting
294 // its initial position, but still don't allow it to
295 // position itself above the top[left] margin.
296 int controlY = (pos.y > 0) ? pos.y : currentY;
297 int controlX = (pos.x > 0) ? pos.x : currentX;
298 control->Move( isVertical ? controlX : currentX,
299 isVertical ? currentY : controlY );
300 if ( isVertical )
301 currentY += sz.y + packing;
302 else
303 currentX += sz.x + packing;
304
305 break;
306 }
307 case wxTOOL_STYLE_SEPARATOR:
308 // skip separators for vertical toolbars
309 if( !isVertical )
310 {
311 currentX += separatorSize;
312 }
313 break;
314
315 case wxTOOL_STYLE_BUTTON:
316 button = (Widget) 0;
317
318 if ( tool->CanBeToggled() && !tool->GetButtonWidget() )
319 {
320 button = XtVaCreateWidget("toggleButton",
321 xmToggleButtonWidgetClass, (Widget) m_mainWidget,
322 XmNx, currentX, XmNy, currentY,
323 XmNindicatorOn, False,
324 XmNshadowThickness, 2,
325 XmNborderWidth, 0,
326 XmNspacing, 0,
327 XmNmarginWidth, 0,
328 XmNmarginHeight, 0,
329 XmNmultiClick, XmMULTICLICK_KEEP,
330 XmNlabelType, XmPIXMAP,
331 NULL);
332 XtAddCallback ((Widget) button,
333 XmNvalueChangedCallback,
334 (XtCallbackProc) wxToolButtonCallback,
335 (XtPointer) this);
336
337 XtVaSetValues ((Widget) button,
338 XmNselectColor,
339 m_backgroundColour.AllocColour
340 (XtDisplay((Widget) button)),
341 NULL);
342 }
343 else if( !tool->GetButtonWidget() )
344 {
345 button = XtVaCreateWidget("button",
346 xmPushButtonWidgetClass, (Widget) m_mainWidget,
347 XmNx, currentX, XmNy, currentY,
348 XmNpushButtonEnabled, True,
349 XmNmultiClick, XmMULTICLICK_KEEP,
350 XmNlabelType, XmPIXMAP,
351 NULL);
352 XtAddCallback (button,
353 XmNactivateCallback,
354 (XtCallbackProc) wxToolButtonCallback,
355 (XtPointer) this);
356 }
357
358 if( !tool->GetButtonWidget() )
359 {
360 wxDoChangeBackgroundColour((WXWidget) button,
361 m_backgroundColour, true);
362
363 tool->SetWidget(button);
364 }
365 else
366 {
367 button = (Widget)tool->GetButtonWidget();
368 XtVaSetValues( button,
369 XmNx, currentX, XmNy, currentY,
370 NULL );
371 }
372
373 // For each button, if there is a mask, we must create
374 // a new wxBitmap that has the correct background colour
375 // for the button. Otherwise the background will just be
376 // e.g. black if a transparent XPM has been loaded.
377 bmp = tool->GetNormalBitmap();
378 insensBmp = tool->GetDisabledBitmap();
379 if ( bmp.GetMask() || insensBmp.GetMask() )
380 {
381 WXPixel backgroundPixel;
382 XtVaGetValues(button, XmNbackground, &backgroundPixel,
383 NULL);
384
385 wxColour col;
386 col.SetPixel(backgroundPixel);
387
388 if( bmp.Ok() && bmp.GetMask() )
389 {
390 bmp = wxCreateMaskedBitmap(bmp, col);
391 tool->SetNormalBitmap(bmp);
392 }
393
394 if( insensBmp.Ok() && insensBmp.GetMask() )
395 {
396 insensBmp = wxCreateMaskedBitmap(insensBmp, col);
397 tool->SetDisabledBitmap(insensBmp);
398 }
399 }
400
401 // Create a selected/toggled bitmap. If there isn't a 2nd
402 // bitmap, we need to create it (with a darker, selected
403 // background)
404 WXPixel backgroundPixel;
405 if ( tool->CanBeToggled() )
406 XtVaGetValues(button, XmNselectColor, &backgroundPixel,
407 NULL);
408 else
409 XtVaGetValues(button, XmNarmColor, &backgroundPixel,
410 NULL);
411 wxColour col;
412 col.SetPixel(backgroundPixel);
413
414 pixmap = (Pixmap) bmp.GetDrawable();
415 {
416 wxBitmap tmp = tool->GetDisabledBitmap();
417
418 insensPixmap = tmp.Ok() ?
419 (Pixmap)tmp.GetDrawable() :
420 tool->GetInsensPixmap();
421 }
422
423 if (tool->CanBeToggled())
424 {
425 // Toggle button
426 Pixmap pixmap2 = tool->GetArmPixmap();
427 Pixmap insensPixmap2 = tool->GetInsensPixmap();
428
429 XtVaSetValues (button,
430 XmNfillOnSelect, True,
431 XmNlabelPixmap, pixmap,
432 XmNselectPixmap, pixmap2,
433 XmNlabelInsensitivePixmap, insensPixmap,
434 XmNselectInsensitivePixmap, insensPixmap2,
435 XmNlabelType, XmPIXMAP,
436 NULL);
437 }
438 else
439 {
440 Pixmap pixmap2 = tool->GetArmPixmap();
441
442 // Normal button
443 XtVaSetValues(button,
444 XmNlabelPixmap, pixmap,
445 XmNlabelInsensitivePixmap, insensPixmap,
446 XmNarmPixmap, pixmap2,
447 NULL);
448 }
449
450 XtManageChild(button);
451
452 {
453 Dimension width, height;
454 XtVaGetValues(button,
455 XmNwidth, &width,
456 XmNheight, & height,
457 NULL);
458 if ( isVertical )
459 currentY += height + packing;
460 else
461 currentX += width + packing;
462 buttonHeight = wxMax(buttonHeight, height);
463 buttonWidth = wxMax(buttonWidth, width);
464 }
465
466 XtAddEventHandler (button, EnterWindowMask | LeaveWindowMask,
467 False, wxToolButtonPopupCallback, (XtPointer) this);
468
469 break;
470 }
471
472 node = node->GetNext();
473 }
474
475 SetSize( -1, -1,
476 isVertical ? buttonWidth + 2 * marginX : -1,
477 isVertical ? -1 : buttonHeight + 2*marginY );
478
479 return true;
480 }
481
482 wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord WXUNUSED(x),
483 wxCoord WXUNUSED(y)) const
484 {
485 wxFAIL_MSG( _T("TODO") );
486
487 return (wxToolBarToolBase *)NULL;
488 }
489
490 bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *tool)
491 {
492 tool->Attach(this);
493
494 return true;
495 }
496
497 bool wxToolBar::DoDeleteTool(size_t WXUNUSED(pos), wxToolBarToolBase *tool)
498 {
499 tool->Detach();
500
501 bool isVertical = GetWindowStyle() & wxTB_VERTICAL;
502 const int separatorSize = GetToolSeparation(); // 8;
503 int packing = GetToolPacking();
504 int offset = 0;
505
506 for( wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst();
507 node; node = node->GetNext() )
508 {
509 wxToolBarTool *t = (wxToolBarTool*)node->GetData();
510
511 if( t == tool )
512 {
513 switch ( t->GetStyle() )
514 {
515 case wxTOOL_STYLE_CONTROL:
516 {
517 wxSize size = t->GetControl()->GetSize();
518 offset = isVertical ? size.y : size.x;
519 offset += packing;
520 break;
521 }
522 case wxTOOL_STYLE_SEPARATOR:
523 offset = isVertical ? 0 : separatorSize;
524 break;
525 case wxTOOL_STYLE_BUTTON:
526 {
527 Widget w = t->GetButtonWidget();
528 Dimension width, height;
529
530 XtVaGetValues( w,
531 XmNwidth, &width,
532 XmNheight, &height,
533 NULL );
534
535 offset = isVertical ? height : width;
536 offset += packing;
537 break;
538 }
539 }
540 }
541 else if( offset )
542 {
543 switch ( t->GetStyle() )
544 {
545 case wxTOOL_STYLE_CONTROL:
546 {
547 wxPoint location = t->GetControl()->GetPosition();
548
549 if( isVertical )
550 location.y -= offset;
551 else
552 location.x -= offset;
553
554 t->GetControl()->Move( location );
555 break;
556 }
557 case wxTOOL_STYLE_SEPARATOR:
558 break;
559 case wxTOOL_STYLE_BUTTON:
560 {
561 Dimension x, y;
562 XtVaGetValues( t->GetButtonWidget(),
563 XmNx, &x,
564 XmNy, &y,
565 NULL );
566
567 if( isVertical )
568 y = (Dimension)(y - offset);
569 else
570 x = (Dimension)(x - offset);
571
572 XtVaSetValues( t->GetButtonWidget(),
573 XmNx, x,
574 XmNy, y,
575 NULL );
576 break;
577 }
578 }
579 }
580 }
581
582 return true;
583 }
584
585 void wxToolBar::DoEnableTool(wxToolBarToolBase *toolBase, bool enable)
586 {
587 wxToolBarTool *tool = (wxToolBarTool *)toolBase;
588 if (tool->GetButtonWidget()){
589 XtSetSensitive(tool->GetButtonWidget(), (Boolean) enable);
590 } else if (wxTOOL_STYLE_CONTROL == tool->GetStyle()){
591 // Controls (such as wxChoice) do not have button widgets
592 tool->GetControl()->Enable(enable);
593 }
594 }
595
596 void wxToolBar::DoToggleTool(wxToolBarToolBase *toolBase, bool toggle)
597 {
598 wxToolBarTool *tool = (wxToolBarTool *)toolBase;
599
600 XmToggleButtonSetState(tool->GetButtonWidget(), (Boolean) toggle, False);
601 }
602
603 void wxToolBar::DoSetToggle(wxToolBarToolBase * WXUNUSED(tool),
604 bool WXUNUSED(toggle))
605 {
606 // nothing to do
607 }
608
609 void wxToolBar::DoSetSize(int x, int y, int width, int height, int sizeFlags)
610 {
611 int old_width, old_height;
612 GetSize(&old_width, &old_height);
613
614 // Correct width and height if needed.
615 if ( width == -1 || height == -1 )
616 {
617 wxSize defaultSize = GetSize();
618
619 if ( width == -1 )
620 width = defaultSize.x;
621 if ( height == -1 )
622 height = defaultSize.y;
623 }
624
625 wxToolBarBase::DoSetSize(x, y, width, height, sizeFlags);
626
627 // We must refresh the frame size when the toolbar changes size
628 // otherwise the toolbar can be shown incorrectly
629 if ( old_width != width || old_height != height )
630 {
631 // But before we send the size event check it
632 // we have a frame that is not being deleted.
633 wxFrame *frame = wxDynamicCast(GetParent(), wxFrame);
634 if ( frame && !frame->IsBeingDeleted() )
635 {
636 frame->SendSizeEvent();
637 }
638 }
639 }
640
641 // ----------------------------------------------------------------------------
642 // Motif callbacks
643 // ----------------------------------------------------------------------------
644
645 wxToolBarToolBase *wxToolBar::FindToolByWidget(WXWidget w) const
646 {
647 wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst();
648 while ( node )
649 {
650 wxToolBarTool *tool = (wxToolBarTool *)node->GetData();
651 if ( tool->GetButtonWidget() == w)
652 {
653 return tool;
654 }
655
656 node = node->GetNext();
657 }
658
659 return (wxToolBarToolBase *)NULL;
660 }
661
662 static void wxToolButtonCallback(Widget w,
663 XtPointer clientData,
664 XtPointer WXUNUSED(ptr))
665 {
666 wxToolBar *toolBar = (wxToolBar *) clientData;
667 wxToolBarToolBase *tool = toolBar->FindToolByWidget((WXWidget) w);
668 if ( !tool )
669 return;
670
671 if ( tool->CanBeToggled() )
672 tool->Toggle();
673
674 if ( !toolBar->OnLeftClick(tool->GetId(), tool->IsToggled()) )
675 {
676 // revert
677 tool->Toggle();
678 }
679 }
680
681
682 static void wxToolButtonPopupCallback(Widget w,
683 XtPointer client_data,
684 XEvent *event,
685 Boolean *WXUNUSED(continue_to_dispatch))
686 {
687 // TODO: retrieve delay before popping up tooltip from wxSystemSettings.
688 static const int delayMilli = 800;
689
690 wxToolBar* toolBar = (wxToolBar*) client_data;
691 wxToolBarToolBase *tool = toolBar->FindToolByWidget((WXWidget) w);
692
693 if ( !tool )
694 return;
695
696 wxString tooltip = tool->GetShortHelp();
697 if ( !tooltip )
698 return;
699
700 if (!wxTheToolBarTimer)
701 wxTheToolBarTimer = new wxToolBarTimer;
702
703 wxToolBarTimer::buttonWidget = w;
704 wxToolBarTimer::helpString = tooltip;
705
706 /************************************************************/
707 /* Popup help label */
708 /************************************************************/
709 if (event->type == EnterNotify)
710 {
711 if (wxToolBarTimer::help_popup != (Widget) 0)
712 {
713 XtDestroyWidget (wxToolBarTimer::help_popup);
714 XtPopdown (wxToolBarTimer::help_popup);
715 }
716 wxToolBarTimer::help_popup = (Widget) 0;
717
718 // One shot
719 wxTheToolBarTimer->Start(delayMilli, true);
720
721 }
722 /************************************************************/
723 /* Popdown help label */
724 /************************************************************/
725 else if (event->type == LeaveNotify)
726 {
727 if (wxTheToolBarTimer)
728 wxTheToolBarTimer->Stop();
729 if (wxToolBarTimer::help_popup != (Widget) 0)
730 {
731 XtDestroyWidget (wxToolBarTimer::help_popup);
732 XtPopdown (wxToolBarTimer::help_popup);
733 }
734 wxToolBarTimer::help_popup = (Widget) 0;
735 }
736 }
737
738 void wxToolBarTimer::Notify()
739 {
740 Position x, y;
741
742 /************************************************************/
743 /* Create shell without window decorations */
744 /************************************************************/
745 help_popup = XtVaCreatePopupShell ("shell",
746 overrideShellWidgetClass, (Widget) wxTheApp->GetTopLevelWidget(),
747 NULL);
748
749 /************************************************************/
750 /* Get absolute position on display of toolbar button */
751 /************************************************************/
752 XtTranslateCoords (buttonWidget,
753 (Position) 0,
754 (Position) 0,
755 &x, &y);
756
757 // Move the tooltip more or less above the button
758 int yOffset = 20; // TODO: What should be really?
759 y = (Position)(y - yOffset);
760 if (y < yOffset) y = 0;
761
762 /************************************************************/
763 /* Set the position of the help popup */
764 /************************************************************/
765 XtVaSetValues (help_popup,
766 XmNx, (Position) x,
767 XmNy, (Position) y,
768 NULL);
769
770 /************************************************************/
771 /* Create help label */
772 /************************************************************/
773 XmString text = XmStringCreateSimple ((char*) (const char*) helpString);
774 XtVaCreateManagedWidget ("help_label",
775 xmLabelWidgetClass, help_popup,
776 XmNlabelString, text,
777 XtVaTypedArg,
778 XmNforeground, XtRString, "black",
779 strlen("black")+1,
780 XtVaTypedArg,
781 XmNbackground, XtRString, "LightGoldenrod",
782 strlen("LightGoldenrod")+1,
783 NULL);
784 XmStringFree (text);
785
786 /************************************************************/
787 /* Popup help label */
788 /************************************************************/
789 XtPopup (help_popup, XtGrabNone);
790 }