Index: /trunk/SophyaPI/PI/Quartz/PIApplQuartz.cpp
===================================================================
--- /trunk/SophyaPI/PI/Quartz/PIApplQuartz.cpp	(revision 3326)
+++ /trunk/SophyaPI/PI/Quartz/PIApplQuartz.cpp	(revision 3326)
@@ -0,0 +1,96 @@
+/*
+ *  PIApplQuartz.cpp
+ *  PI
+ *
+ *  Created by Bruno MANSOUX on Wed Jun 09 2004.
+ *  Copyright (c) 2004 __MyCompanyName__. All rights reserved.
+ *
+ */
+
+#include "PIApplQuartz.h"
+
+static OSErr QuitAppleEventHandler(const AppleEvent *appleEvt, AppleEvent* reply, UInt32 refcon);
+
+
+PIApplicationQuartz::PIApplicationQuartz()
+:PIApplicationGen()
+{
+    OSErr	err;
+   
+    err = AEInstallEventHandler( kCoreEventClass, kAEQuitApplication, 
+								NewAEEventHandlerUPP((AEEventHandlerProcPtr)QuitAppleEventHandler), 
+								0, false );
+    if (err != noErr)
+        ExitToShell();
+        
+    menubar = new PIMenubar(this, "DefMenubar");
+}
+
+
+PIApplicationQuartz::PIApplicationQuartz(int width, int height,int narg, char *arg[])
+:PIApplicationGen()
+{
+  OSErr	err;
+  
+  err = AEInstallEventHandler( kCoreEventClass, kAEQuitApplication, 
+							NewAEEventHandlerUPP((AEEventHandlerProcPtr)QuitAppleEventHandler),
+							0, false );
+  if (err != noErr)
+        ExitToShell();
+		
+  topcont = new PIContainer((PIContainer*)this,(const char*)"Main Window",width,height,10,10);
+  menubar = new PIMenubar(this, "DefMenubar");
+  mainWindow = new PIWindow(this,(const char*)"Main Window",PIWK_normal,width,height,10,10);
+  mainWindow->Refresh();
+}
+
+PIApplicationQuartz::~PIApplicationQuartz()
+{
+}
+
+
+void PIApplicationQuartz::Run()
+{
+    RunApplicationEventLoop ();
+    return;
+}
+
+void PIApplicationQuartz::Stop()
+{
+    ExitToShell ();
+    return;
+}
+
+void PIApplicationQuartz::SetReady()
+{
+mState = kReadyState;
+}
+
+/* There's no default window in MacOSX */
+void PIApplicationQuartz::PrefCompSize(int& szx, int& szy)
+{
+    return;
+}
+
+void PIApplicationQuartz::ScreenSize(int& szx, int& szy)
+{
+    return;
+}
+
+void PIApplicationQuartz::ScreenSizeMM(int& szx, int& szy)
+{
+    return;
+}
+
+void PIApplicationQuartz::ScreenResolution(int& resolx, int& resoly)
+{
+    return;
+}
+
+static OSErr QuitAppleEventHandler( const AppleEvent *appleEvt, AppleEvent* reply, UInt32 refcon )
+{
+    ExitToShell ();
+    return noErr;
+}
+
+
Index: /trunk/SophyaPI/PI/Quartz/PIApplQuartz.h
===================================================================
--- /trunk/SophyaPI/PI/Quartz/PIApplQuartz.h	(revision 3326)
+++ /trunk/SophyaPI/PI/Quartz/PIApplQuartz.h	(revision 3326)
@@ -0,0 +1,39 @@
+/*
+ *  PIApplQuartz.h
+ *  PI
+ *
+ *  Created by Bruno MANSOUX on Wed Jun 09 2004.
+ *  Copyright (c) 2004 __MyCompanyName__. All rights reserved.
+ *
+ */
+
+#include <Carbon/Carbon.h>
+#include <piapplgen.h>
+#include <PIContainerQuartz.h>
+#include <PIWindowQuartz.h>
+
+class PIApplicationQuartz : public PIApplicationGen {
+public:
+    PIApplicationQuartz();
+	PIApplicationQuartz(int width, int height,int narg, char *arg[]);
+    ~PIApplicationQuartz();
+
+    virtual void	Run();
+    virtual void	Stop();
+
+	virtual void	SetReady();
+
+    virtual PIMenubar*	 Menubar() {return menubar;}
+	virtual PIContainer* MainWin() {return mainWindow;}	
+
+
+    virtual void	PrefCompSize(int& szx, int& szy);
+    virtual void	ScreenSize(int& szx, int& szy);
+    virtual void	ScreenSizeMM(int& szx, int& szy);
+    virtual void	ScreenResolution(int& resolx, int& resoly);
+
+protected:
+    PIWindow* mainWindow;
+};
+
+typedef PIApplicationQuartz PIApplication;
Index: /trunk/SophyaPI/PI/Quartz/PIButtonQuartz.cpp
===================================================================
--- /trunk/SophyaPI/PI/Quartz/PIButtonQuartz.cpp	(revision 3326)
+++ /trunk/SophyaPI/PI/Quartz/PIButtonQuartz.cpp	(revision 3326)
@@ -0,0 +1,58 @@
+/*
+ *  PIButtonQuartz.cpp
+ *  PI
+ *
+ *  Created by Bruno MANSOUX on Tue Aug 17 2004.
+ *  Copyright (c) 2004 __MyCompanyName__. All rights reserved.
+ *
+ */
+
+#include "PIButtonQuartz.h"
+
+EventTypeSpec controlEvents[] = {{kEventClassControl, kEventControlHit}};
+
+vector<PIButton*> vpib;
+
+static void MyControlActionCallback (ControlRef theControl, ControlPartCode partCode);
+
+PIButtonQuartz::PIButtonQuartz(PIContainerQuartz *par,const char *nom, PIMessage msg,int sx, int sy, int px, int py)
+:PIButtonGen(par,nom,msg,sx,sy,px,py)
+{
+    CreatePushButtonControl (par->GetWindowPtr(),&wdgRect,title,&contH);
+    SetControlTitleWithCFString (contH, title);
+	_actionProc = NewControlActionUPP (MyControlActionCallback);
+	SetControlAction (contH, _actionProc);
+	vpib.push_back(this);
+}
+
+
+PIButtonQuartz::~PIButtonQuartz()
+{
+}
+
+void PIButtonQuartz::ActivatePress(bool acp)
+{
+	return;
+}	
+
+void PIButtonQuartz::SetLabel(string const& sText)
+{
+    title = CFStringCreateWithCString (NULL, sText.c_str(), kCFStringEncodingMacRoman);
+	SetControlTitleWithCFString(contH,title);
+	return;
+}
+
+static void MyControlActionCallback (ControlRef theControl, ControlPartCode partCode)
+{
+	vector<PIButton*>::iterator it;
+	for(it = vpib.begin(); it != vpib.end(); it++)
+        {
+            if (((*it)->GetControlRef())==theControl)
+            {
+                (*it)->Send((*it)->Msg(),PIMsg_Click,NULL);
+				printf ("click : %d \n",(*it)->Msg());
+                break;
+            }
+        }
+}
+
Index: /trunk/SophyaPI/PI/Quartz/PIButtonQuartz.h
===================================================================
--- /trunk/SophyaPI/PI/Quartz/PIButtonQuartz.h	(revision 3326)
+++ /trunk/SophyaPI/PI/Quartz/PIButtonQuartz.h	(revision 3326)
@@ -0,0 +1,37 @@
+/*
+ *  PIButtonQuartz.h
+ *  PI
+ *
+ *  Created by Bruno MANSOUX on Tue Aug 17 2004.
+ *  Copyright (c) 2004 __MyCompanyName__. All rights reserved.
+ *
+ */
+
+#include <Carbon/Carbon.h>
+
+#ifndef PIBUTTON_QUARTZ_SEEN
+#define PIBUTTON_QUARTZ_SEEN
+
+
+#include "pistdwdgmosx.h"
+#include "PIContainerQuartz.h"
+
+
+class PIButtonQuartz : public PIButtonGen
+{
+public:
+    PIButtonQuartz(PIContainerQuartz *par, const char *nom, PIMessage msg = PIMsg_Click, 
+					int sx=10, int sy=10, int px=0, int py=0);
+    virtual	~PIButtonQuartz();
+	virtual void       ActivatePress(bool acp=false);
+	virtual void       SetLabel(string const&);
+
+	ControlRef GetControlRef() {return contH;}
+
+private:
+	ControlActionUPP _actionProc;
+};
+
+typedef PIButtonQuartz PIButton;
+
+#endif  /* PIBUTTON_QUARTZ_SEEN */
Index: /trunk/SophyaPI/PI/Quartz/PIContainerQuartz.cpp
===================================================================
--- /trunk/SophyaPI/PI/Quartz/PIContainerQuartz.cpp	(revision 3326)
+++ /trunk/SophyaPI/PI/Quartz/PIContainerQuartz.cpp	(revision 3326)
@@ -0,0 +1,43 @@
+/*
+ *  PIContainerQuartz.cpp
+ *  PI
+ *
+ *  Created by Bruno MANSOUX on Tue May 04 2004.
+ *  Copyright (c) 2004 __MyCompanyName__. All rights reserved.
+ *
+ */
+
+#include "PIContainerQuartz.h"
+
+
+/* --Methode-- */
+PIContainerQuartz::PIContainerQuartz(PIContainerGen *par, const char *nom, 
+                           int sx, int sy, int px, int py) 
+:PIContainerGen(par, nom, sx, sy, px, py)
+{
+}
+
+
+/* --Methode-- */
+PIContainerQuartz::~PIContainerQuartz()
+{
+}
+
+
+/* --Methode-- */
+void PIContainerQuartz::Process(PIMessage msg, PIMsgHandler* sender, void* data)
+{
+}
+
+/* --Methode-- */
+ControlHandle PIContainerQuartz::GetControlHandle()
+{
+    return contH;
+}
+
+/* --Methode-- */
+WindowPtr PIContainerQuartz::GetWindowPtr()
+{
+    return wPtr;
+}
+
Index: /trunk/SophyaPI/PI/Quartz/PIContainerQuartz.h
===================================================================
--- /trunk/SophyaPI/PI/Quartz/PIContainerQuartz.h	(revision 3326)
+++ /trunk/SophyaPI/PI/Quartz/PIContainerQuartz.h	(revision 3326)
@@ -0,0 +1,32 @@
+/*
+ *  PIContainerQuartz.h
+ *  PI
+ *
+ *  Created by Bruno MANSOUX on Tue May 04 2004.
+ *  Copyright (c) 2004 __MyCompanyName__. All rights reserved.
+ *
+ */
+#include  <Carbon/Carbon.h>
+
+#ifndef PICONTAINERQUARTZ_SEEN
+#define PICONTAINERQUARTZ_SEEN
+
+#include "picontainergen.h"
+
+
+class PIContainerQuartz : public PIContainerGen 
+{
+public:
+    PIContainerQuartz(PIContainerGen *par, const char *nom,
+        int sx=10, int sy=10, int px=0, int py=0);
+    virtual	~PIContainerQuartz();
+
+    virtual void        Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
+
+    virtual ControlHandle GetControlHandle();
+    virtual WindowPtr GetWindowPtr();
+};
+
+typedef PIContainerQuartz PIContainer;
+
+#endif  /* PICONTAINERQUARTZ_SEEN */
Index: /trunk/SophyaPI/PI/Quartz/PIControl.cpp
===================================================================
--- /trunk/SophyaPI/PI/Quartz/PIControl.cpp	(revision 3326)
+++ /trunk/SophyaPI/PI/Quartz/PIControl.cpp	(revision 3326)
@@ -0,0 +1,130 @@
+/*
+ *  PIControl.cpp
+ *  PI
+ *
+ *  Created by Bruno MANSOUX on Wed Apr 07 2004.
+ *  Copyright (c) 2004 __MyCompanyName__. All rights reserved.
+ *
+ */
+
+#include "PIControl.h"
+
+PIControl::PIControl(PIContainerGen *par, const char *nom,int sx, int sy, int px, int py)
+:PIWdgQuartz(par, nom, sx, sy, px, py) 
+{
+    contH = NULL;
+}
+
+PIControl::~PIControl()
+{
+
+}
+
+void PIControl::SetSize(int sx, int sy)
+{
+    SizeControl (contH, sx, sy);
+    return;
+}
+
+void PIControl::SetPos(int px, int py)
+{
+    MoveControl (contH, px, py);
+    return;
+}
+
+void PIControl::Manage()
+{
+    return;	
+}
+
+void PIControl::UnManage()
+{
+    return;
+}
+
+bool PIControl::IfManaged()
+{
+    return true;
+}
+ 
+bool PIControl::IsVisible()
+{
+    return (IsControlVisible(contH));
+}
+
+//  Fonction qui doit etre appelee pour rafraichir la fenetre 
+void PIControl::Refresh()
+{
+    return (Draw1Control(contH));
+}
+
+//  Pour rendre un composant graphique (PIWdg) sensible/insensible 
+void PIControl::SetSensitive()
+{
+    EnableControl (contH);
+    return;
+}
+
+void PIControl::SetUnSensitive()
+{
+    DisableControl (contH);
+    return;
+}
+
+bool PIControl::IfSensitive()
+{
+    return (IsControlActive(contH));
+}
+
+//  Gestion des EventHandler
+void PIControl::AddDrawHandler(PIEventHandler* drwh, bool ad)
+{
+/*
+    InstallControlEventHandler (contH, 
+                                NewEventHandlerUPP (drwh),
+                                GetEventTypeCount(drawEvents),
+                                drawEvents,
+                                contH,
+                                NULL);
+*/
+    return;
+}
+
+void PIControl::RemoveDrawHandler(PIEventHandler* drwh)
+{
+    RemoveEventHandler(drwh);
+    return;
+}
+
+void PIControl::AddEventHandler(PIEventHandler* evh, unsigned long evtmask, bool ad)
+{
+/*
+    InstallControlEventHandler (contH, 
+                                NewEventHandlerUPP (evh),
+                                GetEventTypeCount(evtmask),
+                                evtmask,
+                                contH,
+                                NULL);
+*/
+    return;
+}
+
+void PIControl::RemoveEventHandler(PIEventHandler* evh)
+{
+    RemoveEventHandler(evh);
+    return;
+}
+
+
+// En public, pour permettre l'acces depuis call-back Xt
+void PIControl::CallDrawHandlers(int x0, int y0, int dx, int dy)
+{
+    return;
+}
+
+void PIControl::CallEventHandlers(unsigned long evt, int px, int py,
+                                    int k, int km, unsigned long tm)
+{
+    return;
+}
+
Index: /trunk/SophyaPI/PI/Quartz/PIControl.h
===================================================================
--- /trunk/SophyaPI/PI/Quartz/PIControl.h	(revision 3326)
+++ /trunk/SophyaPI/PI/Quartz/PIControl.h	(revision 3326)
@@ -0,0 +1,61 @@
+/*
+ *  PIControl.h
+ *  PI
+ *
+ *  Created by Bruno MANSOUX on Wed Apr 07 2004.
+ *  Copyright (c) 2004 __MyCompanyName__. All rights reserved.
+ *
+ */
+
+#include <Carbon/Carbon.h>
+
+#ifndef PICONTROL_SEEN
+#define PICONTROL_SEEN
+
+#include "piwdgmosx.h"
+
+/*
+EventTypeSpec controlEvents[] = {{kEventClassControl, kEventControlHit}};
+*/
+
+class PIControl : public PIWdgQuartz
+{
+public:
+// Les methodes ...
+    PIControl(PIContainerGen *par, const char *nom, 
+                int sx=10, int sy=10, int px=0, int py=0);
+
+  virtual 	 ~PIControl();
+
+  virtual void   SetSize(int sx, int sy);
+  virtual void   SetPos(int px, int py);
+
+  virtual void   Manage();
+  virtual void   UnManage();
+  virtual bool   IfManaged();
+  virtual bool   IsVisible();
+
+//  Fonction qui doit etre appelee pour rafraichir la fenetre 
+  virtual void       	 Refresh();
+
+//  Pour rendre un composant graphique (PIControl) sensible/insensible 
+  virtual void           SetSensitive();
+  virtual void           SetUnSensitive();
+  virtual bool           IfSensitive();
+
+//  Gestion des EventHandler
+  virtual void		 AddEventHandler(PIEventHandler* evh, unsigned long evtmask, bool ad=false);
+  virtual void		 RemoveEventHandler(PIEventHandler* evh);
+  virtual void		 AddDrawHandler(PIEventHandler* drwh, bool ad=false);
+  virtual void		 RemoveDrawHandler(PIEventHandler* drwh);
+
+
+// En public, pour permettre l'acces depuis call-back Xt
+  virtual void		 CallDrawHandlers(int x0, int y0, int dx, int dy); 
+  virtual void		 CallEventHandlers(unsigned long evt, int px, int py,
+                                           int k, int km, unsigned long tm);
+
+};
+
+#endif
+
Index: /trunk/SophyaPI/PI/Quartz/PIMenuBarQuartz.cpp
===================================================================
--- /trunk/SophyaPI/PI/Quartz/PIMenuBarQuartz.cpp	(revision 3326)
+++ /trunk/SophyaPI/PI/Quartz/PIMenuBarQuartz.cpp	(revision 3326)
@@ -0,0 +1,125 @@
+/*
+ *  PIMenuBarQuartz.cpp
+ *  PI
+ *
+ *  Created by Bruno MANSOUX on Fri May 28 2004.
+ *  Copyright (c) 2004 __MyCompanyName__. All rights reserved.
+ *
+ */
+ 
+#include "PIMenuBarQuartz.h"
+#include PIAPP_H
+
+static PIMenubar* MainMenuBar;
+
+PIMenuBarQuartz::PIMenuBarQuartz(PIApplicationGen* par, const char* nom)
+: PIMenubarGen(par, nom)
+{
+    EventTypeSpec menuEvent = {kEventClassCommand, kEventCommandProcess};
+    
+    DrawMenuBar();
+    InstallApplicationEventHandler(NewEventHandlerUPP(MenuEventHandler),1,&menuEvent,0,NULL);
+    MainMenuBar = this;
+	piApp = par;
+}
+
+PIMenuBarQuartz::~PIMenuBarQuartz()
+{
+}
+
+void PIMenuBarQuartz::AppendMenu(PIMenu *pdm)
+{
+    InsertMenu (pdm->GetMenuRef(),0);
+    vPIMenu.push_back(pdm);
+    return;
+}
+
+void PIMenuBarQuartz::RemoveMenu(PIMenu *pdm)
+{
+    vector<PIMenu*>::iterator it;
+
+    for(it = vPIMenu.begin(); it != vPIMenu.end(); it++)
+        {
+            if ((*it)->GetMenuID()==(pdm->GetMenuID()))
+            {
+                vPIMenu.erase(it);
+                break;
+            }
+        }
+    DeleteMenu (pdm->GetMenuID());
+    return;
+}
+
+void PIMenuBarQuartz::SetSensitivity(PIMenu *pdm, bool sens)
+{
+    // Not relevant in Carbon/MACOSX
+    return;
+}
+
+bool PIMenuBarQuartz::IsSensitive(PIMenu *pdm)
+{
+    // Not relevant in Carbon/MACOSX
+    return true;
+}
+
+PIMessage PIMenuBarQuartz::GetMsg(MenuRef menuRef, int commandID)
+{
+    vector<PIMenu*>::iterator it;
+    for(it = vPIMenu.begin(); it != vPIMenu.end(); it++)
+        {
+            if ((*it)->GetMenuRef() == menuRef)
+            {
+                return (*it)->GetMsgItem(commandID);
+            }
+        }
+	return 0;
+} 
+
+void PIMenuBarQuartz::Dispatch(HICommand commandStruct, void* userData)
+{
+	PIMessage msg;
+	
+	msg = GetMsg(commandStruct.menu.menuRef,commandStruct.commandID);
+	Process(BuildMsg(msg,PIMsg_Click), piApp, userData);
+		
+	return;
+}
+
+/* ========== Common Handler for Menu Events ========== */
+OSStatus MenuEventHandler (EventHandlerCallRef myHandler, EventRef event, void* userData)
+{
+    OSStatus result = eventNotHandledErr;
+    HICommand commandStruct; 
+    short itemHit;
+
+    GetEventParameter (event, kEventParamDirectObject, 
+                        typeHICommand, NULL, sizeof(HICommand), 
+                        NULL, &commandStruct);
+    
+    if ((commandStruct.commandID) == kHICommandAbout)
+    {
+        /*        RunStandardAlert (aboutBox, NULL, &itemIndex);*/
+        StandardAlert (kAlertStopAlert, 
+                        "\pQuartz Test",
+                        "\pPeida Interactive based",
+                        NULL,
+                        &itemHit);
+
+        result = noErr;
+    }
+    else if ((commandStruct.commandID) == kHICommandQuit)
+    {
+        ExitToShell ();
+        result = noErr;
+    }
+    else
+    {
+		printf("Menu Item selected %u \n", commandStruct.commandID);
+		fflush (stdout);		
+		MainMenuBar->Dispatch(commandStruct, userData);
+		result = noErr;
+    }
+
+    return (result);
+}
+
Index: /trunk/SophyaPI/PI/Quartz/PIMenuBarQuartz.h
===================================================================
--- /trunk/SophyaPI/PI/Quartz/PIMenuBarQuartz.h	(revision 3326)
+++ /trunk/SophyaPI/PI/Quartz/PIMenuBarQuartz.h	(revision 3326)
@@ -0,0 +1,37 @@
+/*
+ *  PIMenuBarQuartz.h
+ *  PI
+ *
+ *  Created by Bruno MANSOUX on Fri May 28 2004.
+ *  Copyright (c) 2004 __MyCompanyName__. All rights reserved.
+ *
+ */
+#ifndef PIMBARX_H_SEEN
+#define PIMBARX_H_SEEN
+
+#include <Carbon/Carbon.h>
+#include "pimenubargen.h"
+#include <vector>
+
+
+class PIMenuBarQuartz : public PIMenubarGen {
+ public:
+    PIMenuBarQuartz(PIApplicationGen* par, const char* nom);
+    ~PIMenuBarQuartz();
+    virtual void AppendMenu(PIMenu *pdm);
+    virtual void RemoveMenu(PIMenu *pdm);
+    virtual void SetSensitivity(PIMenu *pdm, bool sens=true);
+    virtual bool IsSensitive(PIMenu *pdm);
+	PIMessage GetMsg(MenuRef menuRef, int commandID);
+	void Dispatch(HICommand commandStruct, void* userData);
+
+ protected:
+    vector<PIMenu*> vPIMenu;
+	PIApplicationGen* piApp;
+};
+
+OSStatus MenuEventHandler (EventHandlerCallRef myHandler, EventRef event, void* userData);
+
+typedef PIMenuBarQuartz PIMenubar;
+
+#endif
Index: /trunk/SophyaPI/PI/Quartz/PIMenuQuartz.cpp
===================================================================
--- /trunk/SophyaPI/PI/Quartz/PIMenuQuartz.cpp	(revision 3326)
+++ /trunk/SophyaPI/PI/Quartz/PIMenuQuartz.cpp	(revision 3326)
@@ -0,0 +1,297 @@
+/*
+ *  PIMenuQuartz.cpp
+ *  PI
+ *
+ *  Created by Bruno MANSOUX on Fri May 28 2004.
+ *  Copyright (c) 2004 __MyCompanyName__. All rights reserved.
+ *
+ */
+
+#include "PIMenuQuartz.h"
+
+
+PIMenuQuartz::PIMenuQuartz(PIWdg* par, const char* nom, PIMenuType pdpu)
+:PIMenuGen(par, nom, pdpu)
+{
+    static int mMenuIdentificateur = 130;
+    Str255 menuTitle;
+
+//  Popupmenu are associated with ButtonControl
+    if (pdpu == k_PopupMenu)
+        {        
+        }
+    
+    mNItem = 0;  mNItemMax = 0;     
+    mMenuID = mMenuIdentificateur++;
+
+//    Beware with using this attribute, no place for check mark!
+//    CreateNewMenu (mMenuID, kMenuAttrExcludesMarkColumn, &mMenu);
+
+    CreateNewMenu (mMenuID,kMenuAttrAutoDisable, &mMenu);
+    
+    CopyCStringToPascal (nom, menuTitle);
+    SetMenuTitle (mMenu, menuTitle);
+    mItems = NULL;
+}
+
+PIMenuQuartz::~PIMenuQuartz()
+{
+    delete[] mItems;
+}
+				   
+void PIMenuQuartz::AppendItem(const char* nom, PIMessage msg, char* sc)
+{
+	static int mMenuItemIdentificateur = 300;
+	static int mNumberOfItemMax = 0;
+    pistring itemTitle;
+    _pimqit_ *mItemsLoc;
+    int mNItemsPrev;
+
+    /* Mise a jour de la liste des items */
+    mItemsLoc = mItems;
+    mNItemsPrev = mNItemMax;
+    mNItemMax++;
+    mItems = new _pimqit_[mNItemMax];
+    for (int i = 0; i < mNItemsPrev; i++)
+    {	
+        mItems[i] = mItemsLoc[i];
+    }
+    /* Ajout du nouvel Item */
+    CopyCStringToPascal (nom, itemTitle);
+    InsertMenuItem(mMenu, itemTitle, mNItemMax);
+    SetMenuItemCommandID (mMenu, mNItemMax, mMenuItemIdentificateur);
+
+    mItems[mNItemsPrev].itemId = mMenuItemIdentificateur;
+    mItems[mNItemsPrev].pim = this;
+    mItems[mNItemsPrev].msg = msg ;
+    mItems[mNItemsPrev].itemString = CFStringCreateWithPascalString (NULL, itemTitle, kCFStringEncodingMacRoman);
+    mItems[mNItemsPrev].itemIndex = mNItemMax; /* Attention, les items pour un Menu commencent a 1 et pas a 0 */
+    
+    if (mItemsLoc)
+        delete[] mItemsLoc;
+
+    mMenuItemIdentificateur++;
+
+    return;
+}
+				   
+void PIMenuQuartz::AppendCheckItem(const char* nom, PIMessage msg, char* sc)
+{
+    int item;
+    AppendItem(nom,msg,sc);
+    item = GetNumItem(nom);
+    CheckMenuItem (this->GetMenuRef(),mItems[item].itemIndex,true);
+    return;	
+}
+
+void PIMenuQuartz::AppendPDMenu(PIMenuGen *pdm, char* sc)
+{
+//    CreatePopupButtonControl();
+    return;	
+}
+
+
+void PIMenuQuartz::AppendCascadeMenu(PIMenuQuartz* cascadeMenu, PIMessage msg)
+{
+    int item;
+    item = GetNumItemMsg(msg);
+    
+	SetMenuItemHierarchicalMenu (GetMenuRef(), 
+								mItems[item].itemIndex, cascadeMenu->GetMenuRef());
+								
+    return;
+}
+
+void PIMenuQuartz::AppendSeparator()
+{
+    static int mMenuItemSeparator = 100000;
+    AppendItem(" ",mMenuItemSeparator++);
+    ChangeMenuItemAttributes(mMenu,mNItemMax,kMenuItemAttrSeparator,kMenuItemAttrCustomDraw);
+    return;	
+}
+
+
+void PIMenuQuartz::DeleteItem(const char *nom)
+{
+    int itemNum;
+    itemNum = GetNumItem(nom);
+    
+    if (itemNum > 0)
+        DeleteItemNum(itemNum);
+
+    return;
+}
+
+void PIMenuQuartz::DeleteItemMsg(PIMessage msg)
+{
+    return;	
+}
+
+void PIMenuQuartz::DeleteItemNum(int n)
+{
+    DeleteMenuItem (mMenu, mItems[n].itemIndex);
+    return;	
+}
+
+
+void PIMenuQuartz::SetSensitivity(const char *nom, bool sens)
+{
+    int itemNumber;
+    itemNumber = GetNumItem (nom);
+    SetSensitivityNum (itemNumber, sens);
+    return;	
+}
+
+void PIMenuQuartz::SetSensitivityMsg(PIMessage msg, bool sens) 
+{
+    int itemNumber;
+    itemNumber = GetNumItemMsg (msg);
+    SetSensitivityNum (itemNumber, sens);    
+    return;	
+}
+
+void PIMenuQuartz::SetSensitivityNum(int n, bool sens)
+{
+    if (sens)
+        EnableMenuItem(mMenu,mItems[n].itemIndex);
+    else
+        DisableMenuItem(mMenu,mItems[n].itemIndex);
+    return;	
+}
+
+bool PIMenuQuartz::IsSensitive(const char *nom)
+{
+    int itemNumber;
+    itemNumber = GetNumItem (nom);
+    return (IsSensitiveNum(itemNumber));	
+}
+
+bool PIMenuQuartz::IsSensitiveMsg(PIMessage msg)
+{
+    int itemNumber;
+    itemNumber = GetNumItemMsg (msg);
+    return (IsSensitiveNum(itemNumber));	
+}
+
+bool PIMenuQuartz::IsSensitiveNum(int n)
+{
+    return(IsMenuItemEnabled(mMenu,mItems[n].itemIndex));	
+}
+
+void PIMenuQuartz::SetState(const char *nom, bool st)
+{
+    int itemNumber;
+    itemNumber = GetNumItem (nom);
+    SetStateNum(itemNumber,st);
+    return;	
+}
+
+void PIMenuQuartz::SetStateMsg(PIMessage msg, bool st)
+{
+    int itemNumber;
+    itemNumber = GetNumItemMsg (msg);
+    SetStateNum(itemNumber,st);
+    return;	
+}
+
+void PIMenuQuartz::SetStateNum(int n, bool st)
+{
+    return;	
+}
+ 
+bool PIMenuQuartz::GetState(const char *nom)
+{
+    int itemNumber;
+    itemNumber = GetNumItem (nom);
+    
+    return (GetStateNum(itemNumber));	
+}
+
+bool PIMenuQuartz::GetStateMsg(PIMessage msg)
+{
+    int itemNumber;
+    itemNumber = GetNumItemMsg (msg);
+
+    return (GetStateNum(itemNumber));	
+}
+
+bool PIMenuQuartz::GetStateNum(int n)
+{
+    return (true);	
+}
+
+void PIMenuQuartz::Show()
+{
+    /* Useful for PopupMenu */
+    return;
+}
+
+void PIMenuQuartz::Show(PIWdg *w, int px, int py)
+{
+    /* Useful for PopupMenu */
+    return;	
+}
+
+PIMessage PIMenuQuartz::GetMsgItem(int itemID)
+{
+    int itemNumber;
+	
+    for (itemNumber = 0 ; itemNumber < mNItemMax; itemNumber++)
+	{
+		if(mItems[itemNumber].itemId == (MenuCommand)itemID)
+			return (mItems[itemNumber].msg);
+	}
+	
+	return 0;
+}
+
+int PIMenuQuartz::GetNumItem(const char* nom)
+{
+    int itemNumber;
+    CFStringRef cfNom;
+    CFComparisonResult result;
+    bool find = FALSE;
+    
+    cfNom = CFStringCreateWithCString (NULL, nom,  kCFStringEncodingMacRoman);
+    for (itemNumber = 0 ; itemNumber < mNItemMax; itemNumber++)
+    {
+        result = CFStringCompare (cfNom, mItems[itemNumber].itemString, 0);
+        if (result == kCFCompareEqualTo)
+        {
+            find = TRUE;
+            break;
+        }
+    }
+    if (find)
+        return (itemNumber);
+    else
+        return (-1);
+}
+
+int PIMenuQuartz::GetNumItemMsg(PIMessage msg)
+{
+    int itemNumber;
+    
+    for (itemNumber = 0 ; itemNumber < mNItemMax; itemNumber++)
+    {
+        if (mItems[itemNumber].msg == msg) return itemNumber;
+    }
+    return (-1);
+}
+
+char*  PIMenuQuartz::ItemName(int n)
+{
+    char* name;
+    name = (char *)CFStringGetCStringPtr(mItems[n].itemString,kCFStringEncodingMacRoman);
+    return (name);
+}
+
+MenuRef PIMenuQuartz::GetMenuRef()
+{
+    return (mMenu);
+}
+
+MenuID PIMenuQuartz::GetMenuID()
+{
+    return (mMenuID);
+}
Index: /trunk/SophyaPI/PI/Quartz/PIMenuQuartz.h
===================================================================
--- /trunk/SophyaPI/PI/Quartz/PIMenuQuartz.h	(revision 3326)
+++ /trunk/SophyaPI/PI/Quartz/PIMenuQuartz.h	(revision 3326)
@@ -0,0 +1,79 @@
+/*
+ *  PIMenuQuartz.h
+ *  PI
+ *
+ *  Created by Bruno MANSOUX on Fri May 28 2004.
+ *  Copyright (c) 2004 __MyCompanyName__. All rights reserved.
+ *
+ */
+#ifndef PIMENUX_H_SEEN
+#define PIMENUX_H_SEEN
+
+#include <Carbon/Carbon.h>
+#include "pimenugen.h"
+
+class PIMenuQuartz;
+
+struct _pimqit_
+{
+    MenuCommand itemId;
+    PIMenuQuartz *pim;
+    PIMessage msg;
+    CFStringRef	itemString;
+    int itemIndex;
+};
+
+class PIMenuQuartz : public PIMenuGen {
+public:
+	          PIMenuQuartz(PIWdg* par, const char* nom, PIMenuType pdpu=k_UTMenu);
+	          ~PIMenuQuartz();
+				   
+  virtual void	  AppendItem(const char* nom, PIMessage msg, char* sc=NULL);
+  virtual void	  AppendCheckItem(const char* nom, PIMessage msg, char* sc=NULL);
+  virtual void	  AppendPDMenu(PIMenuGen* pdm, char* sc=NULL);
+  virtual void    AppendCascadeMenu(PIMenuQuartz* cascadeMenu, PIMessage msg);
+  virtual void	  AppendSeparator();
+
+  virtual void    DeleteItem(const char *nom);
+  virtual void    DeleteItemMsg(PIMessage msg);
+  virtual void    DeleteItemNum(int n);
+
+  virtual void    SetSensitivity(const char *nom, bool sens=true); 
+  virtual void    SetSensitivityMsg(PIMessage msg, bool sens=true); 
+  virtual void    SetSensitivityNum(int n, bool sens=true);
+
+  virtual bool    IsSensitive(const char *nom);
+  virtual bool    IsSensitiveMsg(PIMessage msg);
+  virtual bool    IsSensitiveNum(int n);
+
+  virtual void    SetState(const char *nom, bool st=false); 
+  virtual void    SetStateMsg(PIMessage msg, bool st=false); 
+  virtual void    SetStateNum(int n, bool st=false);
+ 
+  virtual bool    GetState(const char *nom); 
+  virtual bool    GetStateMsg(PIMessage msg); 
+  virtual bool    GetStateNum(int n); 
+
+  virtual void    Show();
+  virtual void    Show(PIWdg *w, int px, int py);
+
+  PIMessage	GetMsgItem(int ItemID);
+  int		GetNumItem(const char *nom);
+  int		GetNumItemMsg(PIMessage msg);
+  char*		ItemName(int n);
+
+  MenuRef	GetMenuRef ();
+  MenuID	GetMenuID ();
+    
+  protected:
+    MenuRef mMenu;
+    int     mMenuID;
+    _pimqit_ * mItems;
+    int mNItem;
+	int mNItemMax;
+};
+
+
+typedef PIMenuQuartz        PIMenu;
+
+#endif
Index: /trunk/SophyaPI/PI/Quartz/PIWindowQuartz.cpp
===================================================================
--- /trunk/SophyaPI/PI/Quartz/PIWindowQuartz.cpp	(revision 3326)
+++ /trunk/SophyaPI/PI/Quartz/PIWindowQuartz.cpp	(revision 3326)
@@ -0,0 +1,140 @@
+/*
+ *  PIWindowQuartz.cpp
+ *  PI
+ *
+ *  Created by Bruno MANSOUX on Tue Apr 13 2004.
+ *  Copyright (c) 2004 __MyCompanyName__. All rights reserved.
+ *
+ */
+
+#include "PIWindowQuartz.h"
+
+PIWindowQuartz::PIWindowQuartz(PIMsgHandler *par, const char *nom, PIWindowKind k, int sx, int sy, int px, int py)
+:PIWindowGen(par, nom, k, sx, sy, px, py) 
+{
+    OSStatus err = 0;
+    WindowAttributes windowAttributes;
+    
+    printf ("New Window Quartz %s \n",nom);
+    fflush (stdout);
+    windowAttributes = kWindowStandardDocumentAttributes | kWindowCompositingAttribute ;
+
+    err = CreateNewWindow (kDocumentWindowClass,windowAttributes,&wdgRect,&wPtr);
+    if (err)
+        printf ("PIWindowQuartz Create Err = %d \n",err);
+    fflush (stdout);
+    
+    err = SetWindowTitleWithCFString (wPtr,title);
+    
+    if (err)
+        printf ("PIWindowQuartz Title Err = %d \n",err);
+    fflush (stdout);
+    InstallStandardEventHandler(GetWindowEventTarget(wPtr)); /* installs the default */    
+    printf("Window installed with title %s\n",nom);
+    fflush (stdout);
+}
+
+PIWindowQuartz::~PIWindowQuartz()
+{
+
+}
+
+void PIWindowQuartz::SetSize(int sx, int sy)
+{
+    SizeWindow (wPtr, sx, sy, true);
+    return;
+}
+
+void PIWindowQuartz::SetPos(int px, int py)
+{
+    MoveWindow (wPtr, px, py, false);
+    return;
+}
+
+void PIWindowQuartz::Manage()
+{
+    return;	
+}
+
+void PIWindowQuartz::UnManage()
+{
+	HideWindow(wPtr);
+    return;
+}
+
+bool PIWindowQuartz::IfManaged()
+{
+    return true;
+}
+ 
+bool PIWindowQuartz::IsVisible()
+{
+    return (IsWindowVisible(wPtr));
+}
+
+//  Fonction qui doit etre appelee pour rafraichir la fenetre 
+void PIWindowQuartz::Refresh()
+{
+    SetPortWindowPort(wPtr);
+    ShowWindow (wPtr);
+    BeginUpdate(wPtr);
+ //   EraseRect(GetWindowPortBounds(window, &tempRect));
+    DrawControls(wPtr);
+    DrawGrowIcon(wPtr);
+    EndUpdate(wPtr);
+
+    return ;
+}
+
+//  Pour rendre un composant graphique (PIWdg) sensible/insensible 
+void PIWindowQuartz::SetSensitive()
+{
+    ActivateWindow (wPtr, true);
+    return;
+}
+
+void PIWindowQuartz::SetUnSensitive()
+{
+    ActivateWindow (wPtr, false);
+    return;
+}
+
+bool PIWindowQuartz::IfSensitive()
+{
+    return (IsWindowActive(wPtr));
+}
+
+//  Gestion des EventHandler
+void PIWindowQuartz::AddEventHandler(PIEventHandler* evh, unsigned long evtmask, bool ad)
+{
+/*
+    InstallWindowEventHandler (contH, 
+                                NewEventHandlerUPP (evh),
+                                GetEventTypeCount(evtmask),
+                                evtmask,
+                                contH,
+                                NULL);
+                                
+*/
+    return;
+}
+
+void PIWindowQuartz::RemoveEventHandler(PIEventHandler* evh)
+{
+    RemoveEventHandler(evh);
+    return;
+}
+
+
+// En public, pour permettre l'acces depuis call-back Xt
+void PIWindowQuartz::CallDrawHandlers(int x0, int y0, int dx, int dy)
+{
+    return;
+}
+
+void PIWindowQuartz::CallEventHandlers(unsigned long evt, int px, int py,
+                                    int k, int km, unsigned long tm)
+{
+    return;
+}
+
Index: /trunk/SophyaPI/PI/Quartz/PIWindowQuartz.h
===================================================================
--- /trunk/SophyaPI/PI/Quartz/PIWindowQuartz.h	(revision 3326)
+++ /trunk/SophyaPI/PI/Quartz/PIWindowQuartz.h	(revision 3326)
@@ -0,0 +1,60 @@
+/*
+ *  PIWindowQuartz.h
+ *  PI
+ *
+ *  Created by Bruno MANSOUX on Tue Apr 13 2004.
+ *  Copyright (c) 2004 __MyCompanyName__. All rights reserved.
+ *
+ */
+
+#include <Carbon/Carbon.h>
+
+#ifndef PIWINDOW_QUARTZ_SEEN
+#define PIWINDOW_QUARTZ_SEEN
+
+#include "piwindowgen.h"
+
+/*
+EventTypeSpec windowEvents[] = {{kEventClassWindow, kEventWindowUpdate}};
+*/
+
+class PIWindowQuartz : public PIWindowGen
+{
+public:
+// Les methodes ...
+    PIWindowQuartz(PIMsgHandler *par, const char *nom, PIWindowKind k=PIWK_normal, 
+                int sx=10, int sy=10, int px=0, int py=0);
+
+  virtual 	 ~PIWindowQuartz();
+
+  virtual void   SetSize(int sx, int sy);
+  virtual void   SetPos(int px, int py);
+
+  virtual void   Manage();
+  virtual void   UnManage();
+  virtual bool   IfManaged();
+  virtual bool   IsVisible();
+
+//  Fonction qui doit etre appelee pour rafraichir la fenetre 
+  virtual void       	 Refresh();
+
+//  Pour rendre un composant graphique (PIWindowQuartz) sensible/insensible 
+  virtual void           SetSensitive();
+  virtual void           SetUnSensitive();
+  virtual bool           IfSensitive();
+
+//  Gestion des EventHandler
+  virtual void		 AddEventHandler(PIEventHandler* evh, unsigned long evtmask, bool ad=false);
+  virtual void		 RemoveEventHandler(PIEventHandler* evh);
+
+// En public, pour permettre l'acces depuis call-back Xt
+  virtual void		 CallDrawHandlers(int x0, int y0, int dx, int dy); 
+  virtual void		 CallEventHandlers(unsigned long evt, int px, int py,
+                                           int k, int km, unsigned long tm);
+
+};
+
+
+typedef PIWindowQuartz PIWindow;
+
+#endif
Index: /trunk/SophyaPI/PI/Quartz/PI_Prefix.h
===================================================================
--- /trunk/SophyaPI/PI/Quartz/PI_Prefix.h	(revision 3326)
+++ /trunk/SophyaPI/PI/Quartz/PI_Prefix.h	(revision 3326)
@@ -0,0 +1,14 @@
+//
+// Prefix header for all source files of the 'PI' target in the 'PI' project.
+//
+
+#include <Carbon/Carbon.h>
+
+//typedef WindowPtr Widget;
+typedef ControlHandle Widget;
+
+typedef WindowClass WidgetClass;
+
+typedef PixMapHandle Pixmap;
+
+typedef CFStringRef Arg;
Index: /trunk/SophyaPI/PI/Quartz/QuartzAppTest.cpp
===================================================================
--- /trunk/SophyaPI/PI/Quartz/QuartzAppTest.cpp	(revision 3326)
+++ /trunk/SophyaPI/PI/Quartz/QuartzAppTest.cpp	(revision 3326)
@@ -0,0 +1,68 @@
+/*
+    QuartzAppTest.cpp
+    
+    BMX 14/06/04 
+    
+    Test Program for PI4Mac validation
+    
+*/
+
+#include <PIApplQuartz.h>
+#include <PIMenuBarQuartz.h>
+#include <PIWindowQuartz.h>
+#include <PIButtonQuartz.h>
+#include <pistdwdgmosx.h>
+
+
+int main(int argc, char *argv[])
+{
+    PIApplication* mainApp;
+    PIMenu* firstMenu;
+    PIMenu* underMenu;    
+    PIMenubar* mBar;
+    PIWindow* windowFirst;				
+    PIContainer* piCont;
+    PIWindowGen* wGen;
+    PIContainer* piContQ; 
+    PIWdg* piWdg;
+	PILabel *piLabel;
+    PIButton* piButton;
+    vector<int> points;
+
+    /* Creation of general objects */
+
+    mainApp = new PIApplication();
+    piCont = mainApp->MainWin();
+
+    firstMenu = new PIMenu((PIWdg *)mainApp, (const char *)"First Menu");
+    firstMenu->AppendItem("One from first", 1000);
+    firstMenu->AppendSeparator();
+    firstMenu->AppendItem("Two from first", 1001);
+    firstMenu->AppendCheckItem("Three from first", 1002);
+	
+	underMenu = new PIMenu((PIWdg *)firstMenu,(const char *)"submenu");
+    firstMenu->AppendCascadeMenu(underMenu,1001);
+    printf ("Menus created \n");
+    fflush (stdout);
+	underMenu->AppendItem("Sub from 2",2001);
+	printf ("SubMenus created \n");
+    fflush (stdout);
+
+    mBar = mainApp->Menubar();
+    mBar->AppendMenu(firstMenu);
+    
+    windowFirst = new PIWindow((PIMsgHandler *)piCont, (const char *)"Window First",PIWK_normal,50,50,600,200);
+    wGen = new PIWindowGen((PIMsgHandler *)piCont,(const char *)"Window Gen",PIWK_normal,50,50,600,20);
+    piContQ = new PIContainer (piCont,(const char *)"Container First",50,50,600,20);
+    piWdg = new PIWdg (piCont,(const char *)"Wdg First",50,50,600,20);
+	piLabel = new PILabel(windowFirst,(const char *)"Label",80,80,150,150);
+
+	piButton = new PIButton(windowFirst, "Hello",777,20,40,80,80);
+
+    windowFirst->Refresh();
+	piLabel->SetLabel("Etiquette");
+
+    mainApp->Run(); // Main loop
+
+    return 0;
+}
Index: /trunk/SophyaPI/PI/Quartz/pistdwdgmosx.cpp
===================================================================
--- /trunk/SophyaPI/PI/Quartz/pistdwdgmosx.cpp	(revision 3326)
+++ /trunk/SophyaPI/PI/Quartz/pistdwdgmosx.cpp	(revision 3326)
@@ -0,0 +1,143 @@
+/*
+ *  pistdwdgmosx.cpp
+ *  PI
+ *
+ *  Created by Bruno MANSOUX on 24/08/07.
+ *  Copyright 2007 __MyCompanyName__. All rights reserved.
+ *
+ */
+
+#include "pistdwdgmosx.h"
+
+
+/* ========== PILabelQuartz ========== */
+
+/* --Methode-- */
+PILabelQuartz::PILabelQuartz(PIContainerGen *par, const char *nom, int sx, int sy, int px, int py)
+: PILabelGen(par, nom, sx, sy, px, py)
+{
+}
+
+/* --Methode-- */
+PILabelQuartz::~PILabelQuartz()
+{
+}
+
+/* --Methode-- */
+void PILabelQuartz::SetLabel(string const& sLabel)
+{
+	OSStatus err;
+	
+	cfsrLabel = CFStringCreateWithCString(kCFAllocatorDefault,sLabel.c_str(),kCFStringEncodingMacRoman);
+	err = DrawThemeTextBox (cfsrLabel,
+							kThemeSystemFont,
+							kThemeStateInactive,
+							false,
+							&wdgRect,
+							teJustLeft,
+							NULL);
+			
+	return;
+} 
+
+
+/* ========== PITextQuartz ========== */
+
+/* --Methode-- */
+PITextQuartz::PITextQuartz(PIContainerGen *par, const char *nom, int sx, int sy, int px, int py)
+: PITextGen(par, nom, sx, sy, px, py)
+{
+	OSStatus err;
+	HIRect	hiRect; // = { { 0, 0 }, { 100, 100 } };
+	int ox,oy,fx,fy;
+	int mx,my;
+	wParent = ((PIContainer *)par)->GetWindowPtr();
+	mx = sx/50;
+	my = sy/50; 
+	ox = px+mx;
+	oy = py+my;
+	fx = px+sx-mx;
+	fy = py+sy-my;
+	
+	SetRect(&userPaneRect,ox,oy,fx,fy);
+	hiRect.origin.x = ox;
+	hiRect.origin.y = oy;
+	hiRect.size.width = fx-ox;
+	hiRect.size.height = fy-oy;
+	err = HITextViewCreate (&hiRect,0,0,&outTextView);
+	err = CreateUserPaneControl (wParent, &userPaneRect,kControlSupportsEmbedding,&fUserPane);
+	err = SetControlVisibility(fUserPane, true, true );
+}
+
+/* --Methode-- */
+PITextQuartz::PITextQuartz(PIContainerGen* par, const char* nom, bool vsb, bool hsb,
+         		     int sx, int sy, int px, int py)
+: PITextGen(par, nom, vsb, hsb, sx, sy, px, py)
+{
+}
+
+/* --Methode-- */
+PITextQuartz::~PITextQuartz()
+{
+}
+
+
+/* --Methode-- */
+void PITextQuartz::SetText(string const& s)
+{	
+	OSStatus err;
+	CFStringRef cfsrText;
+	
+	cfsrText = CFStringCreateWithCString (NULL,(char *)s.c_str(), kCFStringEncodingMacRoman);
+
+	TXNObject txn = HITextViewGetTXNObject(outTextView);
+	textLength = CFStringGetLength(cfsrText);
+	uniChars = (UniChar*) malloc( sizeof( UniChar ) * textLength );
+	CFStringGetCharacters(cfsrText, CFRangeMake( 0, textLength ), uniChars );
+	err = TXNSetData(txn,kTXNUnicodeTextData, uniChars, textLength * sizeof( UniChar ), 0, 0 );
+	err = HIViewAddSubview (fUserPane, outTextView);
+	HIViewPlaceInSuperviewAt (outTextView,10,10);
+	ShowControl (fUserPane);
+	err = HIViewSetVisible (outTextView, true);
+
+	return;
+}
+
+/* --Methode-- */
+string PITextQuartz::GetText() const
+{
+	CFStringRef str;
+	char* cText;
+
+	GetControlData(outTextView, kControlEditTextPart, kControlEditTextCFStringTag, sizeof(str),&str,NULL);
+	cText = (char *)CFStringGetCStringPtr(str,kCFStringEncodingMacRoman);
+	/*
+	textLength = CFStringGetLength(str);
+	uniChars = (UniChar*) realloc( sizeof( UniChar ) * textLength );
+	CFStringGetCharacters(str, CFRangeMake( 0, textLength ), uniChars );
+	*/
+	
+	string sText(cText);	
+	return (sText);
+}
+
+
+/* --Methode-- */
+void PITextQuartz::SetMutiLineMode(bool mlm)
+{
+	return;
+}
+
+
+/* --Methode-- */
+void PITextQuartz::SetTextEditable(bool te)
+{
+	return;
+}
+
+
+/* --Methode-- */
+void PITextQuartz::SetMsg(PIMessage msg)
+{
+
+}
Index: /trunk/SophyaPI/PI/Quartz/pistdwdgmosx.h
===================================================================
--- /trunk/SophyaPI/PI/Quartz/pistdwdgmosx.h	(revision 3326)
+++ /trunk/SophyaPI/PI/Quartz/pistdwdgmosx.h	(revision 3326)
@@ -0,0 +1,54 @@
+#ifndef PISTDWDGMOSX_H_SEEN
+#define PISTDWDGMOSX_H_SEEN
+
+#include "piwdgmosx.h"
+#include "pistdwdggen.h"
+#include "PIContainerQuartz.h"
+
+// #include <PIButtonQuartz.h>
+
+class PILabelQuartz : public PILabelGen
+{
+public:
+	PILabelQuartz(PIContainerGen* par, const char* nom,int sx=10, int sy=10, int px=0, int py=0);
+	
+	~PILabelQuartz();
+	
+	virtual void SetLabel(string const& sLabel);
+	
+protected:
+	CFStringRef cfsrLabel;
+};
+
+typedef PILabelQuartz PILabel;
+
+class PITextQuartz : public PITextGen
+{
+public:
+	PITextQuartz(PIContainerGen *par, const char *nom, 
+				int sx=10, int sy=10, int px=0, int py=0);
+
+	PITextQuartz(PIContainerGen* par, const char* nom, bool vsb, bool hsb,
+         		     int sx=100, int sy=100, int px=0, int py=0);
+  virtual           ~PITextQuartz();
+  virtual void      SetText(string const&);
+  virtual string    GetText() const;
+
+  virtual void      SetMutiLineMode(bool mlm=false);
+  virtual void      SetTextEditable(bool te=true);
+
+  virtual void		SetMsg(PIMessage msg=0);
+  	
+protected:
+	UniChar* uniChars;
+	CFIndex textLength;
+	HIViewRef outTextView;
+	WindowRef wParent;
+	HIRect hiRect;
+	ControlRef fUserPane;
+	Rect userPaneRect;
+};
+
+typedef PITextQuartz PIText;
+
+#endif
Index: /trunk/SophyaPI/PI/Quartz/piwdgmosx.cpp
===================================================================
--- /trunk/SophyaPI/PI/Quartz/piwdgmosx.cpp	(revision 3326)
+++ /trunk/SophyaPI/PI/Quartz/piwdgmosx.cpp	(revision 3326)
@@ -0,0 +1,271 @@
+/*
+ *  piwdgmosx.cpp
+ *  PI
+ *
+ *  Created by Bruno MANSOUX on Tue Mar 30 2004.
+ *  Copyright (c) 2004 __MyCompanyName__. All rights reserved.
+ *
+ */
+
+#include "piwdgmosx.h"
+
+PIWdgQuartz::PIWdgQuartz(PIContainerGen *par, const char *nom,int sx, int sy, int px, int py)
+:PIWdgGen(par, nom, sx, sy, px, py) 
+{
+    printf ("Create WdgQuartz %s \n",nom);
+    fflush (stdout);
+    title = CFStringCreateWithCString (NULL, nom, kCFStringEncodingMacRoman);
+    SetRect(&wdgRect,px,py,px+sx,py+sy);
+    contH = NULL;
+    wPtr = NULL;
+    mFCol = mBCol = PI_NotDefColor;
+}
+
+
+PIWdgQuartz::~PIWdgQuartz()
+{
+
+}
+
+void PIWdgQuartz::FinishCreate()
+{
+    return;
+}
+
+void PIWdgQuartz::SetSize(int sx, int sy)
+{
+    /* Not Yet Implemented */
+    return;
+}
+
+void PIWdgQuartz::SetPos(int px, int py)
+{
+    /* Not Yet Implemented */
+    return;
+}
+
+
+void PIWdgQuartz::SetBorderWidth(int bw)
+{
+    return;
+}
+
+void PIWdgQuartz::SetBackgroundColor(PIColors col)
+{    
+    return;
+}
+
+void PIWdgQuartz::SetForegroundColor(PIColors col)
+{
+    return;
+}
+
+void PIWdgQuartz::EraseWindow(int x0, int y0, int dx, int dy)
+{
+    return;
+}
+
+PIColors PIWdgQuartz::GetBackgroundColor()
+{
+    return (mBCol);
+}
+ 
+PIColors PIWdgQuartz::GetForegroundColor()
+{
+    return (mFCol);
+}
+
+void PIWdgQuartz::SetBinding(PIBindingKind left, PIBindingKind top, 
+                    PIBindingKind right, PIBindingKind bottom)
+{
+    return;
+}
+
+bool PIWdgQuartz::GetBinding(PIBindingKind& left, PIBindingKind& top, 
+                    PIBindingKind& right, PIBindingKind& bottom)
+{
+    return false;
+}
+
+int PIWdgQuartz::XSize()
+{
+    return(wdgRect.bottom-wdgRect.top);
+}
+
+int PIWdgQuartz::YSize()
+{
+    return(wdgRect.right-wdgRect.left);
+}
+
+int PIWdgQuartz::XPos()
+{
+    return((wdgRect.bottom+wdgRect.top)/2);
+}
+
+int PIWdgQuartz::YPos()
+{
+    return((wdgRect.right+wdgRect.left)/2);
+}
+
+
+string PIWdgQuartz::Nom()
+{
+    char* cTitle;
+    string cppTitle;
+
+    cTitle = (char *)CFStringGetCStringPtr(title, kCFStringEncodingMacRoman);
+    
+    cppTitle = cTitle;
+    return (cppTitle);
+}
+
+void PIWdgQuartz::GetScreenPos(int & spx, int & spy)
+{
+    spx = 0; spy = 0;
+    return ;
+}
+
+void PIWdgQuartz::Manage()
+{
+    return;
+}
+
+void PIWdgQuartz::UnManage()
+{
+    return;
+}
+
+bool PIWdgQuartz::IfManaged()
+{
+    return true;
+}
+
+bool PIWdgQuartz::IsVisible()
+{
+    return true;
+}
+
+
+void PIWdgQuartz::Refresh()
+{
+    return;
+}
+
+void PIWdgQuartz::SetSensitive()
+{
+    return;
+}
+
+void PIWdgQuartz::SetUnSensitive()
+{
+    return;
+}
+
+bool PIWdgQuartz::IfSensitive()
+{
+    return true;
+}
+
+
+//  Gestion de copier-coller
+bool PIWdgQuartz::ClaimSelection(unsigned int typ)
+{
+    return true;
+}
+
+void PIWdgQuartz::SelectionLost()
+{
+    return;
+}
+
+unsigned int   PIWdgQuartz::RequestSelection(unsigned int typ)
+{
+    return (typ);
+}
+
+void* PIWdgQuartz::ProvideSelection(unsigned int& typ, unsigned int& len)
+{
+    return NULL;
+}
+
+void PIWdgQuartz::SelectionTransferEnd()
+{
+    return;
+}
+
+void PIWdgQuartz::PasteSelection(unsigned int typ, void *, unsigned int l)
+{
+    return;
+}
+
+//  Copie depuis un PIWdgGen
+void PIWdgQuartz::CopyFrom(PIWdgGen* wdg, int ox, int oy, int dx, int dy, int x, int y)
+{
+    return;
+}
+
+//  Gestion des EventHandler
+void PIWdgQuartz::AddDrawHandler(PIEventHandler* drwh, bool ad)
+{
+/*
+    if (contH)
+    {
+        InstallControlEventHandler (contH, 
+                                    NewEventHandlerUPP (drwh),
+                                    GetEventTypeCount(drawEvents),
+                                    drawEvents,
+                                    contH,
+                                    NULL);
+    }
+    if(wPtr)
+    {
+        InstallWindowEventHandler (wPtr, 
+                                    NewEventHandlerUPP (drwh),
+                                    GetEventTypeCount(drawEvents),
+                                    drawEvents,
+                                    wPtr,
+                                    NULL);
+        
+    }
+*/
+    return;
+}
+
+void PIWdgQuartz::RemoveDrawHandler(PIEventHandler* drwh)
+{
+    RemoveEventHandler(drwh);
+    return;
+}
+
+void PIWdgQuartz::AddEventHandler(PIEventHandler* evh, unsigned long evtmask, bool ad)
+{
+/*
+    InstallControlEventHandler (contH, 
+                                NewEventHandlerUPP (evh),
+                                GetEventTypeCount(evtmask),
+                                evtmask,
+                                contH,
+                                NULL);
+*/
+    return;
+}
+
+void PIWdgQuartz::RemoveEventHandler(PIEventHandler* evh)
+{
+    RemoveEventHandler(evh);
+    return;
+}
+
+
+// En public, pour permettre l'acces depuis call-back Xt
+void PIWdgQuartz::CallDrawHandlers(int x0, int y0, int dx, int dy)
+{
+    return;
+}
+
+void PIWdgQuartz::CallEventHandlers(unsigned long evt, int px, int py,
+                                    int k, int km, unsigned long tm)
+{
+    return;
+}
+
Index: /trunk/SophyaPI/PI/Quartz/piwdgmosx.h
===================================================================
--- /trunk/SophyaPI/PI/Quartz/piwdgmosx.h	(revision 3326)
+++ /trunk/SophyaPI/PI/Quartz/piwdgmosx.h	(revision 3326)
@@ -0,0 +1,111 @@
+/*
+ *  piwdgmosx.h
+ *  PI
+ *
+ *  Created by Bruno MANSOUX on Tue Mar 30 2004.
+ *  Copyright (c) 2004 __MyCompanyName__. All rights reserved.
+ *
+ */
+
+#include <Carbon/Carbon.h>
+
+#ifndef PIWDG_QUARTZ_SEEN
+#define PIWDG_QUARTZ_SEEN
+
+#include "piwdggen.h"
+
+
+
+/*
+EventTypeSpec drawEvents[] = {{kEventClassControl, kEventControlDraw},
+                            {kEventClassWindow,kEventWindowDrawFrame},
+                            {kEventClassWindow,kEventWindowDrawPart},
+                            };
+
+*/
+
+
+class PIWdgQuartz : public PIWdgGen 
+{
+public:
+// Les methodes ...
+        PIWdgQuartz(PIContainerGen *par, const char *nom, 
+                int sx=10, int sy=10, int px=0, int py=0);
+
+  virtual 	 ~PIWdgQuartz();
+
+  virtual void	 FinishCreate(); // apres avoir installe les sous-vues
+
+  virtual void   SetSize(int sx, int sy);
+  virtual void   SetPos(int px, int py);
+  virtual void   SetBorderWidth(int bw);
+
+
+//  Divers : couleur de fond, et d'avant plan Effacement fenetre,
+  virtual void           SetBackgroundColor(PIColors col=PI_White);
+  virtual void           SetForegroundColor(PIColors col=PI_Black);
+  virtual void           EraseWindow(int x0=0, int y0=0, int dx=0, int dy=0);
+  virtual PIColors       GetBackgroundColor();
+  virtual PIColors       GetForegroundColor();
+
+  virtual void   SetBinding(PIBindingKind left, PIBindingKind top, 
+                            PIBindingKind right, PIBindingKind bottom);
+  virtual bool   GetBinding(PIBindingKind& left, PIBindingKind& top, 
+                            PIBindingKind& right, PIBindingKind& bottom);
+
+  virtual int    XSize();
+  virtual int    YSize();
+  virtual int    XPos();
+  virtual int    YPos();
+
+  virtual string Nom();  
+  virtual void   GetScreenPos(int & spx, int & spy);
+
+  virtual void   Manage();
+  virtual void   UnManage();
+  virtual bool   IfManaged();
+  virtual bool   IsVisible();
+
+//  Fonction qui doit etre appelee pour rafraichir la fenetre 
+  virtual void       	 Refresh();
+
+//  Pour rendre un composant graphique (PIWdg) sensible/insensible 
+  virtual void           SetSensitive();
+  virtual void           SetUnSensitive();
+  virtual bool           IfSensitive();
+
+//  Gestion de copier-coller
+  virtual bool           ClaimSelection(unsigned int typ=PICP_string);
+  virtual void           SelectionLost();
+  virtual unsigned int   RequestSelection(unsigned int typ=PICP_string);
+  virtual void*          ProvideSelection(unsigned int& typ, unsigned int& len);
+  virtual void           SelectionTransferEnd();
+  virtual void           PasteSelection(unsigned int typ, void *, unsigned int l);
+
+//  Copie depuis un PIWdgGen
+  virtual void		 CopyFrom(PIWdgGen* wdg, int ox, int oy, int dx, int dy, int x, int y);
+
+//  Gestion des EventHandler
+  virtual void		 AddDrawHandler(PIEventHandler* drwh, bool ad=false);
+  virtual void		 RemoveDrawHandler(PIEventHandler* drwh);
+  virtual void		 AddEventHandler(PIEventHandler* evh, unsigned long evtmask, bool ad=false);
+  virtual void		 RemoveEventHandler(PIEventHandler* evh);
+
+// En public, pour permettre l'acces depuis call-back Xt
+  virtual void		 CallDrawHandlers(int x0, int y0, int dx, int dy); 
+  virtual void		 CallEventHandlers(unsigned long evt, int px, int py,
+                                           int k, int km, unsigned long tm);
+
+protected:
+    Rect	wdgRect;
+    CFStringRef	title;
+    ControlRef	contH;
+    WindowPtr	wPtr;
+//  pas utilisable dans MOSX/Carbon
+    PIColors mFCol, mBCol;
+};
+
+typedef PIWdgQuartz PIWdg;
+
+#endif/* PIWDG_QUARTZ_SEEN */
+
