Index: trunk/SophyaPI/PI/pistdwdgx.cc
===================================================================
--- trunk/SophyaPI/PI/pistdwdgx.cc	(revision 23)
+++ trunk/SophyaPI/PI/pistdwdgx.cc	(revision 30)
@@ -221,4 +221,59 @@
 
 
+/************* PICheckBoxX ************/
+#include <Xm/ToggleB.h>
+
+// Fonction prive (CallBack)
+static void toggb_action(Widget w, XtPointer *usd, XtPointer *calld);
+
+/* Nouvelle-Fonction */
+void  toggb_action(Widget , XtPointer *usd, XtPointer *)
+{
+PICheckBoxX *picb;
+picb = (PICheckBoxX *) usd ;
+picb->Send(picb->Msg(), PIMsg_DataChanged, (void *)picb->GetState());
+return;
+}
+
+/* --Methode-- */
+PICheckBoxX::PICheckBoxX(PIContainerGen *par, char *nom, PIMessage msg,
+                         int sx, int sy, int px, int py)
+: PICheckBoxGen(par, nom, msg, sx, sy, px, py)
+{
+CreateXtWdg(nom, xmToggleButtonWidgetClass, NULL, sx, sy, px, py);
+XtAddCallback(XtWdg(), XmNvalueChangedCallback,
+              toggb_action, (XtPointer)this);
+Arg warg[2];
+XtSetArg(warg[0],XmNhighlightThickness, 0);
+XtSetValues(XtWdg(), warg, 1);
+Manage();
+}
+
+
+/* --Methode-- */
+PICheckBoxX::~PICheckBoxX()
+{}
+
+
+/* --Methode-- */
+void PICheckBoxX::SetState(bool st)
+{
+Arg warg[2];
+XtSetArg(warg[0],XmNset, st);
+XtSetValues(XtWdg(), warg, 1);
+return;
+}
+
+/* --Methode-- */
+bool PICheckBoxX::GetState()
+{
+int val;
+Arg warg[2];
+XtSetArg(warg[0], XmNset, &val); 
+XtGetValues(XtWdg(), warg, 1);
+return ((bool)val);
+}
+
+
 /************* PIScaleX ************/
 #include <Xm/Scale.h>
@@ -241,6 +296,6 @@
 /* --Methode-- */
 PIScaleX::PIScaleX(PIContainerGen *par, char *nom, PIMessage msg,
-                   int min, int max, int sx, int sy, int px, int py)
-: PIScaleGen(par, nom, msg, min, max, sx, sy, px, py)
+                   bool horiz, int sx, int sy, int px, int py)
+: PIScaleGen(par, nom, msg, horiz, sx, sy, px, py)
 {
 int n=0;
@@ -248,5 +303,5 @@
 CreateXtWdg(nom, xmScaleWidgetClass, NULL, sx, sy, px, py);
 XtSetArg(warg[n], XmNshowValue, TRUE); n++;
-if (sx > sy)
+if (horiz)
   {
   XtSetArg(warg[n], XmNorientation, XmHORIZONTAL); n++;
@@ -263,6 +318,6 @@
 
 XtSetValues(XtWdg(), warg, n);
-SetMinMax(min, max);
-SetValue(min);
+SetMinMax(1, 10);
+SetValue(1);
 XtAddCallback(XtWdg(), XmNvalueChangedCallback, 
               scale_action, (XtPointer)this);
@@ -312,5 +367,5 @@
 XtGetValues(this->sdw, warg, n);
 mVal = val;
-return(val);
+return(mVal);
 }
 
@@ -322,55 +377,172 @@
 }
 
-/************* PICheckBoxX ************/
-#include <Xm/ToggleB.h>
+
+
+/************* PIScrollBarX ************/
+
+#include <Xm/ScrollBar.h>
 
 // Fonction prive (CallBack)
-static void toggb_action(Widget w, XtPointer *usd, XtPointer *calld);
-
-/* Nouvelle-Fonction */
-void  toggb_action(Widget , XtPointer *usd, XtPointer *)
-{
-PICheckBoxX *picb;
-picb = (PICheckBoxX *) usd ;
-picb->Send(picb->Msg(), PIMsg_DataChanged, (void *)picb->GetState());
-return;
-}
-
-/* --Methode-- */
-PICheckBoxX::PICheckBoxX(PIContainerGen *par, char *nom, PIMessage msg,
-                         int sx, int sy, int px, int py)
-: PICheckBoxGen(par, nom, msg, sx, sy, px, py)
-{
-CreateXtWdg(nom, xmToggleButtonWidgetClass, NULL, sx, sy, px, py);
-XtAddCallback(XtWdg(), XmNvalueChangedCallback,
-              toggb_action, (XtPointer)this);
-Arg warg[2];
-XtSetArg(warg[0],XmNhighlightThickness, 0);
-XtSetValues(XtWdg(), warg, 1);
+static void scrollbar_action(Widget w, XtPointer *usd, 
+                             XmScrollBarCallbackStruct *calld);
+static void scrollbar_drag(Widget w, XtPointer *usd, 
+                           XmScrollBarCallbackStruct *calld);
+
+void  scrollbar_action(Widget, XtPointer *usd, 
+                       XmScrollBarCallbackStruct *calld)
+{
+PIScrollBar *pis;
+
+pis = (PIScrollBar *) usd ;
+pis->CBSetVal(calld->value);
+pis->Send(pis->Msg(), PIMsg_DataChanged, (void *)calld->value);
+return;
+}
+
+void  scrollbar_drag(Widget, XtPointer *usd, 
+                       XmScrollBarCallbackStruct *calld)
+{
+PIScrollBar *pis;
+
+pis = (PIScrollBar *) usd ;
+pis->CBSetVal(calld->value);
+pis->Send(pis->Msg(), PIMsg_Drag, (void *)calld->value);
+return;
+}
+
+/* --Methode-- */
+PIScrollBarX::PIScrollBarX(PIContainerGen *par, char *nom, PIMessage msg,
+                           bool vert, int sx, int sy, int px, int py)
+: PIScrollBarGen(par, nom, msg, vert, sx, sy, px, py)
+{
+int n=0;
+Arg warg[3];
+
+CreateXtWdg(nom, xmScrollBarWidgetClass, NULL, sx, sy, px, py);
+if (vert)
+  {
+  XtSetArg(warg[n], XmNorientation, XmVERTICAL); n++;
+  XtSetArg(warg[n], XmNprocessingDirection, XmMAX_ON_BOTTOM); n++;
+  }
+else
+  { 
+  XtSetArg(warg[n], XmNorientation, XmHORIZONTAL); n++;
+  XtSetArg(warg[n], XmNprocessingDirection, XmMAX_ON_RIGHT); n++;
+  }
+XtSetValues(XtWdg(), warg, n);
+mAcD = false;
+mVal = -1;
+mMin = mMax = 0;
+mSz = 0;
+SetMinMax(0, 100);
+SetSize(10);
+SetValue(0);
+XtAddCallback(XtWdg(), XmNvalueChangedCallback, 
+              scrollbar_action, (XtPointer)this);
 Manage();
 }
 
-
-/* --Methode-- */
-PICheckBoxX::~PICheckBoxX()
+/* --Methode-- */
+PIScrollBarX::~PIScrollBarX()
 {}
 
 
 /* --Methode-- */
-void PICheckBoxX::SetState(bool st)
-{
-Arg warg[2];
-XtSetArg(warg[0],XmNset, st);
-XtSetValues(XtWdg(), warg, 1);
-return;
-}
-
-/* --Methode-- */
-bool PICheckBoxX::GetState()
+void PIScrollBarX::ActivateDrag(bool acd)
+{
+if (mAcD == acd)  return; 
+    
+if (mAcD)
+  XtRemoveCallback(XtWdg(), XmNdragCallback, 
+                   scrollbar_drag, (XtPointer)this);
+else 
+  XtAddCallback(XtWdg(), XmNdragCallback, 
+                scrollbar_drag, (XtPointer)this);
+mAcD = acd;
+return;
+}       
+
+/* --Methode-- */
+void PIScrollBarX::SetMinMax(int min, int max)
+{
+if (min >= max)  max = min+100;
+if (mVal < min)  mVal = min;
+if (mVal > max)  mVal = max;
+int n=0;
+Arg warg[3];
+XtSetArg(warg[n], XmNminimum, min); n++;
+XtSetArg(warg[n], XmNmaximum, max); n++;
+XtSetArg(warg[n], XmNvalue, mVal); n++;
+XtSetValues(XtWdg(), warg, n);
+mMin = min;   mMax = max;
+return;
+}
+
+
+/* --Methode-- */
+void PIScrollBarX::SetValue(int val)
+{
+int n=0;
+if (val < mMin)  val = mMin;
+if (val > mMax)  val = mMax;
+Arg warg[2];
+XtSetArg(warg[n], XmNvalue, val); n++;
+XtSetValues(this->sdw, warg, n);
+mVal = val;
+return;
+}
+
+/* --Methode-- */
+int  PIScrollBarX::GetValue()
 {
 int val;
-Arg warg[2];
-XtSetArg(warg[0], XmNset, &val); 
-XtGetValues(XtWdg(), warg, 1);
-return ((bool)val);
-}
+int n=0;
+Arg warg[2];
+XtSetArg(warg[n], XmNvalue, &val); n++;
+XtGetValues(this->sdw, warg, n);
+mVal = val;
+return(mVal);
+}
+
+/* --Methode-- */
+void PIScrollBarX::SetSize(int sz)
+{
+int n=0;
+Arg warg[3];
+int szl;
+
+szl = mMax-mMin;
+if (sz > szl)  sz = szl;
+szl /= 100;
+if (szl < 1)  szl = 1;
+if (sz < szl)  sz = szl;
+szl = sz/10;
+if (szl < 1)  szl = 1;
+XtSetArg(warg[n], XmNsliderSize, sz); n++;
+XtSetArg(warg[n], XmNpageIncrement, sz); n++;
+XtSetArg(warg[n], XmNincrement, szl); n++;
+XtSetValues(this->sdw, warg, n);
+mSz = sz;
+return;
+}
+
+/* --Methode-- */
+int  PIScrollBarX::GetSize()
+{
+int sz;
+int n=0;
+Arg warg[2];
+XtSetArg(warg[n], XmNsliderSize, &sz); n++;
+XtGetValues(this->sdw, warg, n);
+mSz = sz;
+return(mSz);
+}
+
+
+/* --Methode-- */
+void  PIScrollBarX::CBSetVal(int val)
+{
+mVal = val;
+return;
+}
+
