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