]> git.saurik.com Git - wxWidgets.git/blob - src/motif/toolbar.cpp
suppress warning about converting -1 to MenuItemIndex
[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
208 FixupStyle();
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 Widget button;
282 Pixmap pixmap, insensPixmap;
283 wxBitmap bmp, insensBmp;
284
285 wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst();
286 while ( node )
287 {
288 wxToolBarTool *tool = (wxToolBarTool *)node->GetData();
289
290 switch ( tool->GetStyle() )
291 {
292 case wxTOOL_STYLE_CONTROL:
293 {
294 wxControl* control = tool->GetControl();
295 wxSize sz = control->GetSize();
296 wxPoint pos = control->GetPosition();
297 // Allow a control to specify a y[x]-offset by setting
298 // its initial position, but still don't allow it to
299 // position itself above the top[left] margin.
300 int controlY = (pos.y > 0) ? pos.y : currentY;
301 int controlX = (pos.x > 0) ? pos.x : currentX;
302 control->Move( isVertical ? controlX : currentX,
303 isVertical ? currentY : controlY );
304 if ( isVertical )
305 currentY += sz.y + packing;
306 else
307 currentX += sz.x + packing;
308
309 break;
310 }
311 case wxTOOL_STYLE_SEPARATOR:
312 // skip separators for vertical toolbars
313 if( !isVertical )
314 {
315 currentX += separatorSize;
316 }
317 break;
318
319 case wxTOOL_STYLE_BUTTON:
320 button = (Widget) 0;
321
322 if ( tool->CanBeToggled() && !tool->GetButtonWidget() )
323 {
324 button = XtVaCreateWidget("toggleButton",
325 xmToggleButtonWidgetClass, (Widget) m_mainWidget,
326 XmNx, currentX, XmNy, currentY,
327 XmNindicatorOn, False,
328 XmNshadowThickness, 2,
329 XmNborderWidth, 0,
330 XmNspacing, 0,
331 XmNmarginWidth, 0,
332 XmNmarginHeight, 0,
333 XmNmultiClick, XmMULTICLICK_KEEP,
334 XmNlabelType, XmPIXMAP,
335 NULL);
336 XtAddCallback ((Widget) button,
337 XmNvalueChangedCallback,
338 (XtCallbackProc) wxToolButtonCallback,
339 (XtPointer) this);
340
341 XtVaSetValues ((Widget) button,
342 XmNselectColor,
343 m_backgroundColour.AllocColour
344 (XtDisplay((Widget) button)),
345 NULL);
346 }
347 else if( !tool->GetButtonWidget() )
348 {
349 button = XtVaCreateWidget("button",
350 xmPushButtonWidgetClass, (Widget) m_mainWidget,
351 XmNx, currentX, XmNy, currentY,
352 XmNpushButtonEnabled, True,
353 XmNmultiClick, XmMULTICLICK_KEEP,
354 XmNlabelType, XmPIXMAP,
355 NULL);
356 XtAddCallback (button,
357 XmNactivateCallback,
358 (XtCallbackProc) wxToolButtonCallback,
359 (XtPointer) this);
360 }
361
362 if( !tool->GetButtonWidget() )
363 {
364 wxDoChangeBackgroundColour((WXWidget) button,
365 m_backgroundColour, true);
366
367 tool->SetWidget(button);
368 }
369 else
370 {
371 button = (Widget)tool->GetButtonWidget();
372 XtVaSetValues( button,
373 XmNx, currentX, XmNy, currentY,
374 NULL );
375 }
376
377 // For each button, if there is a mask, we must create
378 // a new wxBitmap that has the correct background colour
379 // for the button. Otherwise the background will just be
380 // e.g. black if a transparent XPM has been loaded.
381 bmp = tool->GetNormalBitmap();
382 insensBmp = tool->GetDisabledBitmap();
383 if ( bmp.GetMask() || insensBmp.GetMask() )
384 {
385 WXPixel backgroundPixel;
386 XtVaGetValues(button, XmNbackground, &backgroundPixel,
387 NULL);
388
389 wxColour col;
390 col.SetPixel(backgroundPixel);
391
392 if( bmp.Ok() && bmp.GetMask() )
393 {
394 bmp = wxCreateMaskedBitmap(bmp, col);
395 tool->SetNormalBitmap(bmp);
396 }
397
398 if( insensBmp.Ok() && insensBmp.GetMask() )
399 {
400 insensBmp = wxCreateMaskedBitmap(insensBmp, col);
401 tool->SetDisabledBitmap(insensBmp);
402 }
403 }
404
405 // Create a selected/toggled bitmap. If there isn't a 2nd
406 // bitmap, we need to create it (with a darker, selected
407 // background)
408 WXPixel backgroundPixel;
409 if ( tool->CanBeToggled() )
410 XtVaGetValues(button, XmNselectColor, &backgroundPixel,
411 NULL);
412 else
413 XtVaGetValues(button, XmNarmColor, &backgroundPixel,
414 NULL);
415 wxColour col;
416 col.SetPixel(backgroundPixel);
417
418 pixmap = (Pixmap) bmp.GetDrawable();
419 {
420 wxBitmap tmp = tool->GetDisabledBitmap();
421
422 insensPixmap = tmp.Ok() ?
423 (Pixmap)tmp.GetDrawable() :
424 tool->GetInsensPixmap();
425 }
426
427 if (tool->CanBeToggled())
428 {
429 // Toggle button
430 Pixmap pixmap2 = tool->GetArmPixmap();
431 Pixmap insensPixmap2 = tool->GetInsensPixmap();
432
433 XtVaSetValues (button,
434 XmNfillOnSelect, True,
435 XmNlabelPixmap, pixmap,
436 XmNselectPixmap, pixmap2,
437 XmNlabelInsensitivePixmap, insensPixmap,
438 XmNselectInsensitivePixmap, insensPixmap2,
439 XmNlabelType, XmPIXMAP,
440 NULL);
441 }
442 else
443 {
444 Pixmap pixmap2 = tool->GetArmPixmap();
445
446 // Normal button
447 XtVaSetValues(button,
448 XmNlabelPixmap, pixmap,
449 XmNlabelInsensitivePixmap, insensPixmap,
450 XmNarmPixmap, pixmap2,
451 NULL);
452 }
453
454 XtManageChild(button);
455
456 {
457 Dimension width, height;
458 XtVaGetValues(button,
459 XmNwidth, &width,
460 XmNheight, & height,
461 NULL);
462 if ( isVertical )
463 currentY += height + packing;
464 else
465 currentX += width + packing;
466 buttonHeight = wxMax(buttonHeight, height);
467 buttonWidth = wxMax(buttonWidth, width);
468 }
469
470 XtAddEventHandler (button, EnterWindowMask | LeaveWindowMask,
471 False, wxToolButtonPopupCallback, (XtPointer) this);
472
473 break;
474 }
475
476 node = node->GetNext();
477 }
478
479 SetSize( -1, -1,
480 isVertical ? buttonWidth + 2 * marginX : -1,
481 isVertical ? -1 : buttonHeight + 2*marginY );
482
483 return true;
484 }
485
486 wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord WXUNUSED(x),
487 wxCoord WXUNUSED(y)) const
488 {
489 wxFAIL_MSG( _T("TODO") );
490
491 return (wxToolBarToolBase *)NULL;
492 }
493
494 bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *tool)
495 {
496 tool->Attach(this);
497
498 return true;
499 }
500
501 bool wxToolBar::DoDeleteTool(size_t WXUNUSED(pos), wxToolBarToolBase *tool)
502 {
503 tool->Detach();
504
505 bool isVertical = GetWindowStyle() & wxTB_VERTICAL;
506 const int separatorSize = GetToolSeparation(); // 8;
507 int packing = GetToolPacking();
508 int offset = 0;
509
510 for( wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst();
511 node; node = node->GetNext() )
512 {
513 wxToolBarTool *t = (wxToolBarTool*)node->GetData();
514
515 if( t == tool )
516 {
517 switch ( t->GetStyle() )
518 {
519 case wxTOOL_STYLE_CONTROL:
520 {
521 wxSize size = t->GetControl()->GetSize();
522 offset = isVertical ? size.y : size.x;
523 offset += packing;
524 break;
525 }
526 case wxTOOL_STYLE_SEPARATOR:
527 offset = isVertical ? 0 : separatorSize;
528 break;
529 case wxTOOL_STYLE_BUTTON:
530 {
531 Widget w = t->GetButtonWidget();
532 Dimension width, height;
533
534 XtVaGetValues( w,
535 XmNwidth, &width,
536 XmNheight, &height,
537 NULL );
538
539 offset = isVertical ? height : width;
540 offset += packing;
541 break;
542 }
543 }
544 }
545 else if( offset )
546 {
547 switch ( t->GetStyle() )
548 {
549 case wxTOOL_STYLE_CONTROL:
550 {
551 wxPoint location = t->GetControl()->GetPosition();
552
553 if( isVertical )
554 location.y -= offset;
555 else
556 location.x -= offset;
557
558 t->GetControl()->Move( location );
559 break;
560 }
561 case wxTOOL_STYLE_SEPARATOR:
562 break;
563 case wxTOOL_STYLE_BUTTON:
564 {
565 Dimension x, y;
566 XtVaGetValues( t->GetButtonWidget(),
567 XmNx, &x,
568 XmNy, &y,
569 NULL );
570
571 if( isVertical )
572 y = (Dimension)(y - offset);
573 else
574 x = (Dimension)(x - offset);
575
576 XtVaSetValues( t->GetButtonWidget(),
577 XmNx, x,
578 XmNy, y,
579 NULL );
580 break;
581 }
582 }
583 }
584 }
585
586 return true;
587 }
588
589 void wxToolBar::DoEnableTool(wxToolBarToolBase *toolBase, bool enable)
590 {
591 wxToolBarTool *tool = (wxToolBarTool *)toolBase;
592 if (tool->GetButtonWidget()){
593 XtSetSensitive(tool->GetButtonWidget(), (Boolean) enable);
594 } else if (wxTOOL_STYLE_CONTROL == tool->GetStyle()){
595 // Controls (such as wxChoice) do not have button widgets
596 tool->GetControl()->Enable(enable);
597 }
598 }
599
600 void wxToolBar::DoToggleTool(wxToolBarToolBase *toolBase, bool toggle)
601 {
602 wxToolBarTool *tool = (wxToolBarTool *)toolBase;
603
604 XmToggleButtonSetState(tool->GetButtonWidget(), (Boolean) toggle, False);
605 }
606
607 void wxToolBar::DoSetToggle(wxToolBarToolBase * WXUNUSED(tool),
608 bool WXUNUSED(toggle))
609 {
610 // nothing to do
611 }
612
613 void wxToolBar::DoSetSize(int x, int y, int width, int height, int sizeFlags)
614 {
615 int old_width, old_height;
616 GetSize(&old_width, &old_height);
617
618 // Correct width and height if needed.
619 if ( width == -1 || height == -1 )
620 {
621 wxSize defaultSize = GetSize();
622
623 if ( width == -1 )
624 width = defaultSize.x;
625 if ( height == -1 )
626 height = defaultSize.y;
627 }
628
629 wxToolBarBase::DoSetSize(x, y, width, height, sizeFlags);
630
631 // We must refresh the frame size when the toolbar changes size
632 // otherwise the toolbar can be shown incorrectly
633 if ( old_width != width || old_height != height )
634 {
635 // But before we send the size event check it
636 // we have a frame that is not being deleted.
637 wxFrame *frame = wxDynamicCast(GetParent(), wxFrame);
638 if ( frame && !frame->IsBeingDeleted() )
639 {
640 frame->SendSizeEvent();
641 }
642 }
643 }
644
645 // ----------------------------------------------------------------------------
646 // Motif callbacks
647 // ----------------------------------------------------------------------------
648
649 wxToolBarToolBase *wxToolBar::FindToolByWidget(WXWidget w) const
650 {
651 wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst();
652 while ( node )
653 {
654 wxToolBarTool *tool = (wxToolBarTool *)node->GetData();
655 if ( tool->GetButtonWidget() == w)
656 {
657 return tool;
658 }
659
660 node = node->GetNext();
661 }
662
663 return (wxToolBarToolBase *)NULL;
664 }
665
666 static void wxToolButtonCallback(Widget w,
667 XtPointer clientData,
668 XtPointer WXUNUSED(ptr))
669 {
670 wxToolBar *toolBar = (wxToolBar *) clientData;
671 wxToolBarToolBase *tool = toolBar->FindToolByWidget((WXWidget) w);
672 if ( !tool )
673 return;
674
675 if ( tool->CanBeToggled() )
676 tool->Toggle();
677
678 if ( !toolBar->OnLeftClick(tool->GetId(), tool->IsToggled()) )
679 {
680 // revert
681 tool->Toggle();
682 }
683 }
684
685
686 static void wxToolButtonPopupCallback(Widget w,
687 XtPointer client_data,
688 XEvent *event,
689 Boolean *WXUNUSED(continue_to_dispatch))
690 {
691 // TODO: retrieve delay before popping up tooltip from wxSystemSettings.
692 static const int delayMilli = 800;
693
694 wxToolBar* toolBar = (wxToolBar*) client_data;
695 wxToolBarToolBase *tool = toolBar->FindToolByWidget((WXWidget) w);
696
697 if ( !tool )
698 return;
699
700 wxString tooltip = tool->GetShortHelp();
701 if ( !tooltip )
702 return;
703
704 if (!wxTheToolBarTimer)
705 wxTheToolBarTimer = new wxToolBarTimer;
706
707 wxToolBarTimer::buttonWidget = w;
708 wxToolBarTimer::helpString = tooltip;
709
710 /************************************************************/
711 /* Popup help label */
712 /************************************************************/
713 if (event->type == EnterNotify)
714 {
715 if (wxToolBarTimer::help_popup != (Widget) 0)
716 {
717 XtDestroyWidget (wxToolBarTimer::help_popup);
718 XtPopdown (wxToolBarTimer::help_popup);
719 }
720 wxToolBarTimer::help_popup = (Widget) 0;
721
722 // One shot
723 wxTheToolBarTimer->Start(delayMilli, true);
724
725 }
726 /************************************************************/
727 /* Popdown help label */
728 /************************************************************/
729 else if (event->type == LeaveNotify)
730 {
731 if (wxTheToolBarTimer)
732 wxTheToolBarTimer->Stop();
733 if (wxToolBarTimer::help_popup != (Widget) 0)
734 {
735 XtDestroyWidget (wxToolBarTimer::help_popup);
736 XtPopdown (wxToolBarTimer::help_popup);
737 }
738 wxToolBarTimer::help_popup = (Widget) 0;
739 }
740 }
741
742 void wxToolBarTimer::Notify()
743 {
744 Position x, y;
745
746 /************************************************************/
747 /* Create shell without window decorations */
748 /************************************************************/
749 help_popup = XtVaCreatePopupShell ("shell",
750 overrideShellWidgetClass, (Widget) wxTheApp->GetTopLevelWidget(),
751 NULL);
752
753 /************************************************************/
754 /* Get absolute position on display of toolbar button */
755 /************************************************************/
756 XtTranslateCoords (buttonWidget,
757 (Position) 0,
758 (Position) 0,
759 &x, &y);
760
761 // Move the tooltip more or less above the button
762 int yOffset = 20; // TODO: What should be really?
763 y = (Position)(y - yOffset);
764 if (y < yOffset) y = 0;
765
766 /************************************************************/
767 /* Set the position of the help popup */
768 /************************************************************/
769 XtVaSetValues (help_popup,
770 XmNx, (Position) x,
771 XmNy, (Position) y,
772 NULL);
773
774 /************************************************************/
775 /* Create help label */
776 /************************************************************/
777 XmString text = XmStringCreateSimple ((char*) (const char*) helpString);
778 XtVaCreateManagedWidget ("help_label",
779 xmLabelWidgetClass, help_popup,
780 XmNlabelString, text,
781 XtVaTypedArg,
782 XmNforeground, XtRString, "black",
783 strlen("black")+1,
784 XtVaTypedArg,
785 XmNbackground, XtRString, "LightGoldenrod",
786 strlen("LightGoldenrod")+1,
787 NULL);
788 XmStringFree (text);
789
790 /************************************************************/
791 /* Popup help label */
792 /************************************************************/
793 XtPopup (help_popup, XtGrabNone);
794 }