| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 
 | #include "CCasenoire.h"
#include "CEchiquier.h"
 
//Constructeurs et destructeur
 
CCasenoire::CCasenoire(int col,int rang):m_col(col),m_rang(rang),m_etat(false),m_case("cn")
{
    m_ppixbuf=Gdk::Pixbuf::create_from_file(m_case+".jpg");
    m_image.set(m_ppixbuf);
    add(m_image);
    signal_button_press_event().connect(sigc::mem_fun(*this,&CCasenoire::_appui));
    signal_button_release_event().connect(sigc::mem_fun(*this,&CCasenoire::_relache));
}
CCasenoire::CCasenoire(int col,int rang,std::string s):m_col(col),m_rang(rang),m_etat(true),m_case("cn")
{
    m_ppixbuf=Gdk::Pixbuf::create_from_file(m_case+s+".jpg");
    m_ppixbuftemp=m_ppixbuf->scale_simple(60,60,Gdk::INTERP_BILINEAR);
    m_image.set(m_ppixbuftemp);
    add(m_image);
    signal_button_press_event().connect(sigc::mem_fun(*this,&CCasenoire::_appui));
    signal_button_release_event().connect(sigc::mem_fun(*this,&CCasenoire::_relache));
    signal_expose_event().connect(sigc::mem_fun(*this,&CCasenoire::_redim));//signal de re-dimension
}
CCasenoire::~CCasenoire(){}
 
//fonction d'acces
int CCasenoire::col() const{return m_col;}
int CCasenoire::rang()const{return m_rang;}
bool CCasenoire::est_occupe()const{return m_etat;}
 
//fonctions signal
bool CCasenoire::_appui(GdkEventButton* event)
{
    //TODO
    std::cout<<col()<<rang()<<std::endl;
    return true;
}
bool CCasenoire::_relache(GdkEventButton* event)
{
    //TODO
    std::cout<<col()<<rang()<<std::endl;
    return true;
}
bool CCasenoire::_redim(GdkEventExpose* event)
{
    if(!m_etat){return false;}
    int l,h;
    l=get_width();h=get_height();
    m_ppixbuftemp=m_ppixbuf->scale_simple(l,h,Gdk::INTERP_BILINEAR);
    m_image.set(m_ppixbuftemp);
    return true;
} | 
Partager