/****************************************************************************
** ui.h extension file, included from the uic-generated form implementation.
**
** If you wish to add, delete or rename functions or slots use
** Qt Designer which will update this file, preserving your code. Create an
** init() function in place of a constructor, and a destroy() function in
** place of a destructor.
*****************************************************************************/
#include "CMDI_ChoixPatient.h"
#include "CMDI_Ident.h"

//-------------------------- initDialog ---------------------------------------------------------------------------------------
void Dock_TabRubrique::initDialog(int mode)
{   //m_QPtrButtonList.setAutoDelete(TRUE);
    int i = 0;
    for ( QStringList::Iterator it = G_pCApp->m_ListRubName.begin(); it != G_pCApp->m_ListRubName.end(); ++it )
        {if (  ( (mode==NO_PATIENT_CHOICE) && ( *it == CMDI_ChoixPatient::S_GetRubName()) )  )
            {//qDebug(QString::number(mode)+" Voila  #"+GlobalListRubName[i] + "# #" + RUB_CHOIX_PATIENT_NAME+"#");
            }
         else
            {
             CMyButton* qw = new CMyButton( this, *it );
             if (qw)
                {m_QPtrButtonList.append(qw);
                 qw->setMaximumSize( QSize( 110, 18 ) );
                 Dock_TabRubriqueLayout->addWidget( qw, i++, 0 );
                 //................ Lorsqu'il est cliqué Le bouton emet le signal: Sign_ButtonClicked .........................
                 //                 Nous connectons directement ce signal à celui qu'envoie notre formulaire: Sign_ActiverOrCreateRubrique
                 //                 à celui qui est connecté (DrTux)
                 connect( qw, SIGNAL( Sign_ButtonClicked(const char* ) ), this, SLOT( On_ButtonClicked(const char*) ) );
                }
            }
     }
}
//-------------------------- On_ButtonClicked ---------------------------------------------------------------------------------------
void Dock_TabRubrique::On_ButtonClicked(const char* butTxt )
{emit Sign_ActiverOrCreateRubrique(butTxt , 0);
}

//-------------------------- SetInterfaceOnDroits ---------------------------------------------------------------------------------------
void Dock_TabRubrique::SetInterfaceOnDroits(const QString &droits)
{CMyButton* pCMyButton = 0;
 for ( pCMyButton = m_QPtrButtonList.first(); pCMyButton; pCMyButton = m_QPtrButtonList.next() )
     {if (pCMyButton->getName() ==  CMDI_Ident::S_GetRubName())
         { if (G_pCApp->IsThisDroitExist(droits,"idv")) pCMyButton->setEnabled(TRUE);
           else                                         pCMyButton->setEnabled(FALSE);
         }
     }
}


