Update of /cvsroot/plib/plib/src/pui
In directory usw-pr-cvs1:/tmp/cvs-serv22158
Modified Files:
pu.h puDial.cxx puRange.cxx puSlider.cxx puSpinBox.cxx
Log Message:
John F. Fay: Made puRange an independent class; puSpinBox is now a child of puGroup
Index: pu.h
===================================================================
RCS file: /cvsroot/plib/plib/src/pui/pu.h,v
retrieving revision 1.132
retrieving revision 1.133
diff -u -d -r1.132 -r1.133
--- pu.h 19 Sep 2002 23:32:58 -0000 1.132
+++ pu.h 21 Sep 2002 15:59:56 -0000 1.133
@@ -258,9 +258,8 @@
#define PUCLASS_LARGEINPUT 0x00400000
#define PUCLASS_COMBOBOX 0x00800000
#define PUCLASS_SELECTBOX 0x01000000
-#define PUCLASS_RANGE 0x02000000
-#define PUCLASS_SPINBOX 0x04000000
-#define PUCLASS_SCROLLBAR 0x08000000
+#define PUCLASS_SPINBOX 0x02000000
+#define PUCLASS_SCROLLBAR 0x04000000
/* This function is not required for GLUT programs */
void puSetWindowSize ( int width, int height ) ;
[...232 lines suppressed...]
+ int ymid = ( ibox->max[1] + ibox->min[1] ) / 2 ;
+ up_arrow->setPosition ( xpos, ymid ) ;
+ down_arrow->setPosition ( xpos, ymid - size ) ;
+ recalc_bbox() ;
}
- ~puSpinBox ()
+ float getArrowHeight ( void ) const
{
- puDeleteObject ( (puObject *)input_box ) ;
+ int awid, ahgt, iwid, ihgt ;
+ input_box->getSize ( &iwid, &ihgt ) ;
+ up_arrow->getSize ( &awid, &ahgt ) ;
+ return float(ahgt) / float(ihgt) ;
}
+
+ puSpinBox ( int minx, int miny, int maxx, int maxy, int arrow_pos = 1 ) ;
void setValue ( float f ) { puValue::setValue ( f ) ; input_box->setValue ( f ) ; }
void setValue ( int i ) { puValue::setValue ( i ) ; input_box->setValue ( i ) ; }
Index: puDial.cxx
===================================================================
RCS file: /cvsroot/plib/plib/src/pui/puDial.cxx,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- puDial.cxx 2 Sep 2002 06:05:45 -0000 1.24
+++ puDial.cxx 21 Sep 2002 15:59:56 -0000 1.25
@@ -24,7 +24,7 @@
#include "puLocal.h"
-UL_RTTI_DEF1(puDial,puRange)
+UL_RTTI_DEF2(puDial,puRange,puObject)
void puDial::draw ( int dx, int dy )
Index: puRange.cxx
===================================================================
RCS file: /cvsroot/plib/plib/src/pui/puRange.cxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- puRange.cxx 2 Sep 2002 06:05:46 -0000 1.3
+++ puRange.cxx 21 Sep 2002 15:59:56 -0000 1.4
@@ -23,5 +23,5 @@
#include "puLocal.h"
-UL_RTTI_DEF1(puRange,puObject)
+UL_RTTI_DEF(puRange)
Index: puSlider.cxx
===================================================================
RCS file: /cvsroot/plib/plib/src/pui/puSlider.cxx,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- puSlider.cxx 2 Sep 2002 06:05:46 -0000 1.25
+++ puSlider.cxx 21 Sep 2002 15:59:56 -0000 1.26
@@ -24,7 +24,7 @@
#include "puLocal.h"
-UL_RTTI_DEF1(puSlider,puRange)
+UL_RTTI_DEF2(puSlider,puRange,puObject)
void puSlider::draw_slider_box ( int dx, int dy, const puBox &box, float val, const char *box_label )
Index: puSpinBox.cxx
===================================================================
RCS file: /cvsroot/plib/plib/src/pui/puSpinBox.cxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- puSpinBox.cxx 2 Sep 2002 06:05:46 -0000 1.5
+++ puSpinBox.cxx 21 Sep 2002 15:59:56 -0000 1.6
@@ -24,116 +24,61 @@
#include "puLocal.h"
-UL_RTTI_DEF1(puSpinBox,puRange)
+UL_RTTI_DEF2(puSpinBox,puRange,puGroup)
-void puSpinBox::draw ( int dx, int dy )
+puSpinBox::puSpinBox ( int minx, int miny, int maxx, int maxy, int arrow_pos ) :
+ puRange ( 1.0f, 10.0f, 1.0f ), puGroup ( minx, miny )
{
[...126 lines suppressed...]
-
- invokeCallback () ;
- return TRUE ;
- }
- else
- return FALSE ;
+ puSpinBox *master = (puSpinBox *)(ob->getUserData ()) ;
+ float val = ob->getFloatValue () ;
+ if ( val > master->getMaxValue () ) val = master->getMaxValue () ;
+ if ( val < master->getMinValue () ) val = master->getMinValue () ;
+ master->setValue ( val ) ;
+ master->invokeCallback () ;
}
-void puSpinBox_handle_input (puObject *ob)
-{
- puObject *master = (puObject *)(ob->getUserData());
- master->setValue(ob->getFloatValue());
- master->invokeCallback();
-}
|