1 ///////////////////////////////////////////////////////////////////////////// 
   2 // Name:        src/motif/gauge.cpp 
   3 // Purpose:     wxGauge class 
   4 // Author:      Julian Smart 
   8 // Copyright:   (c) Julian Smart 
   9 // Licence:     wxWindows licence 
  10 ///////////////////////////////////////////////////////////////////////////// 
  12 // For compilers that support precompilation, includes "wx.h". 
  13 #include "wx/wxprec.h" 
  16 #include "wx/vms_x_fix.h" 
  36 #pragma message disable nosimpint 
  41 #endif // __WXMOTIF20__ 
  43 #pragma message enable nosimpint 
  45 #include "wx/motif/private.h" 
  47 IMPLEMENT_DYNAMIC_CLASS(wxGauge
, wxControl
) 
  49 #if !wxCHECK_MOTIF_VERSION( 2, 0 ) || wxCHECK_LESSTIF() 
  51 // XmGauge copyright notice: 
  54 * Copyright 1994 GROUPE BULL 
  56 * Permission to use, copy, modify, and distribute this software and its 
  57 * documentation for any purpose and without fee is hereby granted, provided 
  58 * that the above copyright notice appear in all copies and that both that 
  59 * copyright notice and this permission notice appear in supporting 
  60 * documentation, and that the name of GROUPE BULL not be used in advertising 
  61 * or publicity pertaining to distribution of the software without specific, 
  62 * written prior permission.  GROUPE BULL makes no representations about the 
  63 * suitability of this software for any purpose.  It is provided "as is" 
  64 * without express or implied warranty. 
  66 * GROUPE BULL disclaims all warranties with regard to this software, 
  67 * including all implied warranties of merchantability and fitness, 
  68 * in no event shall GROUPE BULL be liable for any special, 
  69 * indirect or consequential damages or any damages 
  70 * whatsoever resulting from loss of use, data or profits, 
  71 * whether in an action of contract, negligence or other tortious 
  72 * action, arising out of or in connection with the use 
  73 * or performance of this software. 
  77 //// PUBLIC XMGAUGE DECLARATIONS 
  78 typedef struct _XmGaugeClassRec
*  XmGaugeWidgetClass
; 
  79 typedef struct _XmGaugeRec
*       XmGaugeWidget
; 
  82 extern "C" WidgetClass xmGaugeWidgetClass
; 
  84 extern WidgetClass xmGaugeWidgetClass
; 
  87 typedef struct _XmGaugeCallbackStruct
{ 
  91 } XmGaugeCallbackStruct
; 
  95 XmGaugeSetValue(Widget w
, int value
); 
  98 XmGaugeGetValue(Widget w
); 
 100 #endif // !wxCHECK_MOTIF_VERSION( 2, 0 ) || wxCHECK_LESSTIF() 
 102 bool wxGauge::Create(wxWindow 
*parent
, wxWindowID id
, 
 107                      const wxValidator
& validator
, 
 108                      const wxString
& name
) 
 110     if( !CreateControl( parent
, id
, pos
, size
, style
, validator
, name 
) ) 
 114     Widget parentWidget 
= (Widget
) parent
->GetClientWidget(); 
 118     if (style 
& wxGA_HORIZONTAL
) 
 120         XtSetArg (args
[0], XmNorientation
, XmHORIZONTAL
); 
 121         XtSetArg (args
[1], XmNprocessingDirection
, XmMAX_ON_RIGHT
); 
 125         XtSetArg (args
[0], XmNorientation
, XmVERTICAL
); 
 126         XtSetArg (args
[1], XmNprocessingDirection
, XmMAX_ON_TOP
); 
 128     XtSetArg(args
[2], XmNminimum
, 0); 
 129     XtSetArg(args
[3], XmNmaximum
, range
); 
 130 #if wxCHECK_MOTIF_VERSION( 2, 0 ) && !wxCHECK_LESSTIF() 
 131     XtSetArg(args
[4], XmNeditable
, False
); ++count
; 
 132     XtSetArg(args
[5], XmNslidingMode
, XmTHERMOMETER
); ++count
; 
 133     // XtSetArg(args[6], XmNsliderVisual, XmFOREGROUND_COLOR ); ++count; 
 135         XtCreateManagedWidget("gauge", xmScaleWidgetClass
, 
 136                               parentWidget
, args
, count
); 
 139         XtCreateManagedWidget("gauge", xmGaugeWidgetClass
, 
 140                               parentWidget
, args
, count
); 
 142     m_mainWidget 
= (WXWidget
) gaugeWidget 
; 
 144     XtManageChild (gaugeWidget
); 
 146     int x 
= pos
.x
; int y 
= pos
.y
; 
 147     wxSize best 
= GetBestSize(); 
 148     if( size
.x 
!= wxDefaultCoord 
) best
.x 
= size
.x
; 
 149     if( size
.y 
!= wxDefaultCoord 
) best
.y 
= size
.y
; 
 152     AttachWidget (parent
, m_mainWidget
, (WXWidget
) NULL
, x
, y
, 
 158 wxSize 
wxGauge::DoGetBestSize() const 
 160     if( HasFlag(wxGA_HORIZONTAL
) ) 
 161         return wxSize( 100, 18 ); 
 163         return wxSize( 18, 100 ); 
 166 void wxGauge::SetShadowWidth(int w
) 
 170     XtVaSetValues((Widget
) m_mainWidget
, XmNshadowThickness
, w
, NULL
); 
 173 void wxGauge::SetRange(int r
) 
 175     XtVaSetValues((Widget
) m_mainWidget
, XmNmaximum
, r
, NULL
); 
 178 void wxGauge::SetValue(int pos
) 
 180     XtVaSetValues((Widget
) m_mainWidget
, XmNvalue
, pos
, NULL
); 
 183 int wxGauge::GetShadowWidth() const 
 186     XtVaGetValues((Widget
) m_mainWidget
, XmNshadowThickness
, &w
, NULL
); 
 190 int wxGauge::GetRange() const 
 193     XtVaGetValues((Widget
) m_mainWidget
, XmNmaximum
, &r
, NULL
); 
 197 int wxGauge::GetValue() const 
 200     XtVaGetValues((Widget
) m_mainWidget
, XmNvalue
, &pos
, NULL
); 
 204 void wxGauge::DoMoveWindow(int x
, int y
, int width
, int height
) 
 206     wxGaugeBase::DoMoveWindow( x
, y
, width
, height 
); 
 208     XtVaSetValues( (Widget
)m_mainWidget
, 
 209                    XmNscaleHeight
, height
, 
 214 #if !wxCHECK_MOTIF_VERSION( 2, 0 ) || wxCHECK_LESSTIF() 
 216 //// PRIVATE DECLARATIONS FOR XMGAUGE 
 218 #include <Xm/PrimitiveP.h> 
 219 #include <Xm/DrawP.h> 
 225 typedef struct _XmGaugeClassRec 
{ 
 226     CoreClassPart         core_class
; 
 227     XmPrimitiveClassPart  primitive_class
; 
 228     XmGaugeClassPart      gauge_class
; 
 232 typedef struct _XmGaugePart
{ 
 236     unsigned char orientation
; 
 237     unsigned char processingDirection
; 
 239     XtCallbackList dragCallback
; 
 240     XtCallbackList valueChangedCallback
; 
 243     Boolean dragging
; /* drag in progress ? */ 
 249 typedef struct _XmGaugeRec 
{ 
 251     XmPrimitivePart  primitive
; 
 255 extern XmGaugeClassRec xmGaugeClassRec
; 
 257 /* Copyright 1994 GROUPE BULL -- See license conditions in file COPYRIGHT */ 
 259 //// XMGAUGE IMPLEMENTATION 
 262 GaugePick(Widget w
, XEvent 
*e
, String 
*args
, Cardinal  
*num_args
); 
 264 GaugeDrag(Widget w
, XEvent 
*e
, String 
*args
, Cardinal  
*num_args
); 
 266 GaugeDrop(Widget w
, XEvent 
*e
, String 
*args
, Cardinal  
*num_args
); 
 270 static char translations
[] = 
 271 "<Btn1Down>: GaugePick()\n\ 
 272                             <Btn1Motion>: GaugeDrag()\n\ 
 273                             <Btn1Up>: GaugeDrop()\n\ 
 278 static XtActionsRec actions
[] = { 
 279     {"GaugePick", GaugePick
}, 
 280     {"GaugeDrag", GaugeDrag
}, 
 281     {"GaugeDrop", GaugeDrop
}, 
 285 DrawSlider(XmGaugeWidget gw
, Boolean clear
) 
 287 #define THIS gw->gauge 
 293     unsigned long backgr,foregr; 
 297     sht 
= gw
->primitive
.shadow_thickness
; 
 299     ratio 
=  (float)THIS
.value
/ 
 300         (float)(THIS
.maximum 
- THIS
.minimum
); 
 302         sprintf(string,"%-d%%",(int)(ratio*100)); 
 304         XtVaGetValues(gw,XmNbackground,&backgr,XmNforeground,&foregr,NULL); 
 308         XClearArea(XtDisplay(gw
), XtWindow(gw
), sht
, sht
, 
 309             gw
->core
.width 
- 2 * sht
, gw
->core
.height 
- 2 * sht
, False
); 
 311     switch(THIS
.orientation
) { 
 313         size 
= (int) ((gw
->core
.width 
- 2 * sht
)*ratio
); 
 315         XDrawString(XtDisplay(gw), XtWindow(gw), THIS.gc, sht+gw->core.width/2, 
 316         gw->core.height - 2 * sht, string, len); 
 318         switch(THIS
.processingDirection
) { 
 320         case XmMAX_ON_BOTTOM
: 
 321             XFillRectangle(XtDisplay(gw
), XtWindow(gw
), THIS
.gc
, 
 322                 sht
, sht
, size
, gw
->core
.height 
- 2 * sht
); 
 325                 rects[0].x = sht; rects[0].y = sht; 
 326                 rects[0].width = size; rects[0].height = gw->core.height - 2 * sht; 
 331             XFillRectangle(XtDisplay(gw
), XtWindow(gw
), THIS
.gc
, 
 332                 gw
->core
.width 
- size 
- sht
, sht
, 
 333                 size
, gw
->core
.height 
- 2 * sht
); 
 336                 rects[0].x = gw->core.width - size - sht; rects[0].y = sht; 
 337                 rects[0].width = size; rects[0].height = gw->core.height - 2 * sht; 
 342         XSetClipRectangles(XtDisplay(gw), THIS.gc, 0, 0, rects, 1, Unsorted); 
 343         XSetForeground(XtDisplay(gw), THIS.gc, backgr); 
 344         XDrawString(XtDisplay(gw), XtWindow(gw), THIS.gc, sht+gw->core.width/2, 
 345         gw->core.height - 2 * sht, string, len); 
 350             size 
= (int) ((gw
->core
.height 
- 2 * sht
)*ratio
); 
 352             XDrawString(XtDisplay(gw), XtWindow(gw), THIS.gc, sht, 
 353             sht+gw->core.height/2, string,len); 
 355             switch(THIS
.processingDirection
) { 
 357             case XmMAX_ON_BOTTOM
: 
 358                 XFillRectangle(XtDisplay(gw
), XtWindow(gw
), THIS
.gc
, 
 359                     sht
, sht
, gw
->core
.width 
- 2 * sht
, size
); 
 362                     rects[0].x = sht; rects[0].y = sht; 
 363                     rects[0].width = gw->core.width - 2 * sht; rects[0].height = size; 
 368                 XFillRectangle(XtDisplay(gw
), XtWindow(gw
), THIS
.gc
, 
 369                     sht
, gw
->core
.height 
- size 
- sht
, 
 370                     gw
->core
.width 
- 2 * sht
, size
); 
 373                     rects[0].x = sht; rects[0].y = gw->core.height - size - sht; 
 374                     rects[0].width = gw->core.width - 2 * sht; rects[0].height = size; 
 378             XSetClipRectangles(XtDisplay(gw), THIS.gc, 0, 0, rects, 1, Unsorted); 
 379             XSetForeground(XtDisplay(gw), THIS.gc, backgr); 
 380             XDrawString(XtDisplay(gw), XtWindow(gw), THIS.gc, sht, 
 381             sht+gw->core.height/2, string,len); 
 386     XSetClipMask(XtDisplay(gw), THIS.gc, None); 
 387     XSetForeground(XtDisplay(gw), THIS.gc, foregr); 
 396 DrawSlider(XmGaugeWidget gw
, Boolean clear
) 
 398 #define THIS gw->gauge 
 402     sht 
= gw
->primitive
.shadow_thickness
; 
 403     /* See fix comment below: can cause divide by zero error. 
 404     ratio = (float)((float)THIS.maximum - 
 405     (float)THIS.minimum) / (float)THIS.value; 
 408         XClearArea(XtDisplay(gw
), XtWindow(gw
), sht
, sht
, 
 409             gw
->core
.width 
- 2 * sht
, gw
->core
.height 
- 2 * sht
, False
); 
 411     switch(THIS
.orientation
) { 
 413         /* size = (gw->core.width - 2 * sht) / ratio; */ 
 414         /* A fix suggested by Dmitri Chubraev */ 
 415         size 
= (gw
->core
.width 
- 2 * sht
) /((float)THIS
.maximum
-(float)THIS
.minimum
)*(float)THIS
.value
; 
 416         switch(THIS
.processingDirection
) { 
 418         case XmMAX_ON_BOTTOM
: 
 419             XFillRectangle(XtDisplay(gw
), XtWindow(gw
), THIS
.gc
, 
 420                 sht
, sht
, size
, gw
->core
.height 
- 2 * sht
); 
 424             XFillRectangle(XtDisplay(gw
), XtWindow(gw
), THIS
.gc
, 
 425                 gw
->core
.width 
- size 
- sht
, sht
, 
 426                 size
, gw
->core
.height 
- 2 * sht
); 
 431             size 
= (gw
->core
.height 
- 2 * sht
) /((float)THIS
.maximum
-(float)THIS
.minimum
)*(float)THIS
.value
; 
 432             /* size = (gw->core.height - 2 * sht)/ ratio; */ 
 433             switch(THIS
.processingDirection
) { 
 435             case XmMAX_ON_BOTTOM
: 
 436                 XFillRectangle(XtDisplay(gw
), XtWindow(gw
), THIS
.gc
, 
 437                     sht
, sht
, gw
->core
.width 
- 2 * sht
, size
); 
 441                 XFillRectangle(XtDisplay(gw
), XtWindow(gw
), THIS
.gc
, 
 442                     sht
, gw
->core
.height 
- size 
- sht
, 
 443                     gw
->core
.width 
- 2 * sht
, size
); 
 452 Initialize(Widget 
WXUNUSED(req
), Widget new_w
, ArgList 
WXUNUSED(args
), Cardinal 
*WXUNUSED(num_args 
)) 
 454     XmGaugeWidget gw 
= (XmGaugeWidget
)new_w
; 
 455 #define THIS gw->gauge 
 458     values
.foreground 
= gw
->primitive
.foreground
; 
 459     THIS
.gc 
= XtGetGC(new_w
, GCForeground
, &values
); 
 470     XmGaugeWidget gw 
= (XmGaugeWidget
)w
; 
 471 #define THIS gw->gauge 
 472     XtReleaseGC(w
, THIS
.gc
); 
 484           ArgList 
WXUNUSED(args
), 
 485           Cardinal 
*WXUNUSED(num_args
) ) 
 487     XmGaugeWidget cgw 
= (XmGaugeWidget
)cw
; 
 488     XmGaugeWidget ngw 
= (XmGaugeWidget
)nw
; 
 490     Boolean redraw 
= False
; 
 491     if(cgw
->primitive
.foreground 
!= ngw
->primitive
.foreground
) { 
 495         XtReleaseGC(nw
, ngw
->gauge
.gc
); 
 496         values
.foreground 
= ngw
->primitive
.foreground
; 
 497         ngw
->gauge
.gc 
= XtGetGC(nw
, GCForeground
, &values
); 
 499     if(cgw
->gauge
.value 
!= ngw
->gauge
.value
) { 
 509 ExposeProc(Widget w
, XEvent 
*WXUNUSED(event
), Region 
WXUNUSED(r
)) 
 511     XmGaugeWidget gw 
= (XmGaugeWidget
)w
; 
 512 #define THIS gw->gauge 
 515     sht 
= gw
->primitive
.shadow_thickness
; 
 516     _XmDrawShadows(XtDisplay(w
), XtWindow(w
), 
 517         gw
->primitive
.top_shadow_GC
, 
 518         gw
->primitive
.bottom_shadow_GC
, 
 519         0, 0, w
->core
.width
, w
->core
.height
, 
 520         (Dimension
)sht
, XmSHADOW_IN
); 
 521     DrawSlider(gw
, False
); 
 531 #define offset(field) XtOffset(XmGaugeWidget, gauge.field) 
 532     {XmNvalue
, XmCValue
, XtRInt
, sizeof(int), 
 533         offset(value
), XtRImmediate
, (caddr_t
)10}, 
 535     {XmNminimum
, XmCValue
, XtRInt
, sizeof(int), 
 536     offset(minimum
), XtRImmediate
, (caddr_t
)0}, 
 538     {XmNmaximum
, XmCValue
, XtRInt
, sizeof(int), 
 539     offset(maximum
), XtRImmediate
, (caddr_t
)100}, 
 541     {XmNorientation
, XmCOrientation
, XmROrientation
, sizeof(unsigned char), 
 542     offset(orientation
), XtRImmediate
, (caddr_t
)XmVERTICAL
}, 
 544     {XmNprocessingDirection
, XmCProcessingDirection
, 
 545     XmRProcessingDirection
, sizeof(unsigned char), 
 546     offset(processingDirection
), XtRImmediate
, (caddr_t
)XmMAX_ON_RIGHT
}, 
 548     {XmNdragCallback
, XmCCallback
, XmRCallback
, sizeof(XtCallbackList
), 
 549     offset(dragCallback
), XtRImmediate
, (caddr_t
)NULL
}, 
 551     {XmNvalueChangedCallback
, XmCCallback
, XmRCallback
, sizeof(XtCallbackList
), 
 552     offset(valueChangedCallback
), XtRImmediate
, (caddr_t
)NULL
}, 
 559 XmGaugeClassRec xmGaugeClassRec 
= { 
 561         (WidgetClass
) &xmPrimitiveClassRec
, /* superclass */ 
 562         "XmGauge",            /* class_name */ 
 563         sizeof(XmGaugeRec
),   /* widget_size */ 
 564         NULL
,                 /* class_initialize */ 
 565         NULL
,                 /* class_part_initialize */ 
 566         False
,                /* class_inited */ 
 567         Initialize
,           /* initialize */ 
 568         NULL
,                 /* initialize_hook */ 
 569         XtInheritRealize
,     /* realize */ 
 570         actions
,              /* actions */ 
 571         XtNumber(actions
),    /* num_actions */ 
 572         resources
,            /* resources */ 
 573         XtNumber(resources
),  /* num_resources */ 
 574         NULLQUARK
,            /* xrm_class */ 
 575         True
,                 /* compress_motion */ 
 576         True
,                 /* compress_exposure */ 
 577         True
,                 /* compress_enterleave */ 
 578         False
,                /* visible_interest */ 
 579         Destroy
,              /* destroy */ 
 581         ExposeProc
,           /* expose */ 
 582         SetValues
,            /* set_values */ 
 583         NULL
,                 /* set_values_hook */ 
 584         XtInheritSetValuesAlmost
, /* set_values_almost */ 
 585         NULL
,                 /* get_values_hook */ 
 586         NULL
,                 /* accept_focus */ 
 587         XtVersion
,            /* version */ 
 588         NULL
,                 /* callback_private */ 
 589         translations
,         /* tm_table */ 
 590         NULL
,                 /* query_geometry */ 
 591         NULL
,                 /* display_accelerator */ 
 594     /* primitive_class fields */ 
 596         NULL
,                 /* border_highlight */ 
 597         NULL
,                 /* border_unhighlight */ 
 598         NULL
,                 /* translations */ 
 599         NULL
,                 /* arm_and_activate */ 
 600         NULL
,                 /* syn_resources */ 
 601         0,                    /* num_syn_resources */ 
 609 WidgetClass xmGaugeWidgetClass 
= (WidgetClass
)&xmGaugeClassRec
; 
 615 GaugePick(Widget 
WXUNUSED(w
), XEvent 
*WXUNUSED(e
), String 
*WXUNUSED(args
), Cardinal  
*WXUNUSED(num_args
)) 
 617     /* Commented out for a read-only gauge in wxWidgets */ 
 619     XmGaugeWidget gw 
= (XmGaugeWidget
)w
; 
 620 #define THIS gw->gauge 
 623     Boolean dragging 
= False
; 
 624     XButtonEvent 
*event 
= (XButtonEvent 
*)e
; 
 629     sht 
= gw
->primitive
.shadow_thickness
; 
 630     _XmDrawShadows(XtDisplay(w
), XtWindow(w
), 
 631         gw
->primitive
.top_shadow_GC
, 
 632         gw
->primitive
.bottom_shadow_GC
, 
 633         0, 0, w
->core
.width
, w
->core
.height
, 
 637     ratio 
= (float)((float)THIS
.maximum 
- 
 638         (float)THIS
.minimum
) / (float)THIS
.value
; 
 639     switch(THIS
.orientation
) { 
 641         size 
= (w
->core
.width 
- 2 * sht
) / ratio
; 
 642         switch(THIS
.processingDirection
) { 
 644         case XmMAX_ON_BOTTOM
: 
 645             dragging 
= (x 
> sht
) && (y 
> sht
) && 
 646                 (x 
< sht 
+ size
) && (y 
< w
->core
.height 
- sht
); 
 650             dragging 
= (x 
> w
->core
.width 
- size 
- sht
) && (y 
> sht
) && 
 651                 (x 
< w
->core
.width 
- sht
) && (y 
< w
->core
.height 
+ sht
); 
 656             size 
= (w
->core
.height 
- 2 * sht
) / ratio
; 
 657             switch(THIS
.processingDirection
) { 
 659             case XmMAX_ON_BOTTOM
: 
 660                 dragging 
= (x 
> sht
) && (y 
> sht
) && 
 661                     (x 
< w
->core
.width 
- sht
) && 
 662                     (y 
< w
->core
.width 
- 2 * sht 
+ size
); 
 666                 dragging 
= (x 
> sht
) && (y 
> w
->core
.height 
- size 
- sht
) && 
 667                     (x 
< w
->core
.width 
- sht
) && (y 
< w
->core
.height 
- sht
); 
 671     THIS
.dragging 
= dragging
; 
 679 GaugeDrag(Widget 
WXUNUSED(w
), XEvent 
*WXUNUSED(e
), String 
*WXUNUSED(args
), Cardinal  
*WXUNUSED(num_args
)) 
 681     /* Commented out for a read-only gauge in wxWidgets */ 
 683     XmGaugeWidget gw 
= (XmGaugeWidget
)w
; 
 684 #define THIS gw->gauge 
 685     int sht
, x
, y
, max
, value
; 
 686     float ratio
, nratio
, size
, nsize
, fvalue
, delta
; 
 687     XMotionEvent 
*event 
= (XMotionEvent 
*)e
; 
 689     if( ! THIS
.dragging
) return; 
 693     sht 
= gw
->primitive
.shadow_thickness
; 
 695     ratio 
= (float)THIS
.value 
/ (float)((float)THIS
.maximum 
- 
 696         (float)THIS
.minimum
); 
 697     switch(THIS
.orientation
) { 
 699         max 
= (w
->core
.width 
- 2 * sht
); 
 700         size 
= (float)max 
* ratio
; 
 701         delta 
=  (float)x 
- (float)THIS
.oldx
; 
 704         max 
= (w
->core
.height 
- 2 * sht
); 
 705         size 
= (float) max 
* ratio
; 
 706         delta 
=  (float)y 
- (float)THIS
.oldy
; 
 709     switch(THIS
.processingDirection
) { 
 711     case XmMAX_ON_BOTTOM
: 
 712         nsize 
= size 
+ delta
; 
 715         nsize 
= size 
- delta
; 
 717     if(nsize 
> (float)max
) nsize 
= (float)max
; 
 718     if(nsize 
< (float)0 ) nsize 
= (float)0; 
 719     nratio 
=  nsize 
/ (float)max
; 
 721     fvalue 
= (int)((float)THIS
.maximum 
- 
 722         (float)THIS
.minimum
) * (float)nsize 
/ (float)max
; 
 723     value 
= wxRound(fvalue
); 
 729     /* clear old slider only if it was larger */ 
 730     DrawSlider(gw
, (nsize 
< size
)); 
 733         XmGaugeCallbackStruct call
; 
 735         if(NULL  
!= THIS
.dragCallback
) { 
 736             call
.reason 
= XmCR_DRAG
; 
 738             call
.value 
= THIS
.value
; 
 739             XtCallCallbacks(w
, XmNdragCallback
, &call
); 
 748 GaugeDrop(Widget 
WXUNUSED(w
), XEvent 
*WXUNUSED(e
), String 
*WXUNUSED(args
), Cardinal  
*WXUNUSED(num_args
)) 
 750     /* Commented out for a read-only gauge in wxWidgets */ 
 752     XmGaugeWidget gw 
= (XmGaugeWidget
)w
; 
 753 #define THIS gw->gauge 
 754     if( ! THIS
.dragging
) return; 
 756     if(NULL  
!= THIS
.valueChangedCallback
) { 
 757         XmGaugeCallbackStruct call
; 
 758         call
.reason 
= XmCR_VALUE_CHANGED
; 
 760         call
.value 
= THIS
.value
; 
 761         XtCallCallbacks(w
, XmNvalueChangedCallback
, &call
); 
 763     THIS
.dragging 
= False
; 
 769 XmGaugeSetValue(Widget w
, int value
) 
 771     XmGaugeWidget gw 
= (XmGaugeWidget
)w
; 
 773     gw
->gauge
.value 
= value
; 
 774     DrawSlider(gw
, True
); 
 775     XFlush(XtDisplay(w
)); 
 779 XmGaugeGetValue(Widget w
) 
 781     XmGaugeWidget gw 
= (XmGaugeWidget
)w
; 
 783     return gw
->gauge
.value
; 
 786 #endif // !wxCHECK_MOTIF_VERSION( 2, 0 ) || wxCHECK_LESSTIF()