comparison engine/core/gui/widgets/clicklabel.cpp @ 154:d29593182f40

- modified clicklabel to provide a mouse listener for hover events - modified clicklabel.i to make new methods available for python - added LabelListener to pychan wrapper, as well as two new methods to Label class to set enter / exit callbacks NOTE:
author chewie@33b003aa-7bff-0310-803a-e67f0ece8222
date Sat, 11 Oct 2008 14:13:56 +0000
parents 90005975cdbb
children bb9902910067
comparison
equal deleted inserted replaced
153:d8e32b4adc5c 154:d29593182f40
38 ClickLabel::ClickLabel() { 38 ClickLabel::ClickLabel() {
39 mGuiFont = static_cast<FIFE::GuiFont*> (getFont()); 39 mGuiFont = static_cast<FIFE::GuiFont*> (getFont());
40 // setAlignment(Graphics::LEFT); 40 // setAlignment(Graphics::LEFT);
41 setTextWrapping(false); 41 setTextWrapping(false);
42 setFrameSize(0); 42 setFrameSize(0);
43 43 m_listener = NULL;
44 addMouseListener(this); 44 addMouseListener(this);
45 addKeyListener(this); 45 addKeyListener(this);
46 addFocusListener(this); 46 addFocusListener(this);
47 47
48 } 48 }
51 mGuiFont = static_cast<FIFE::GuiFont*> (getFont()); 51 mGuiFont = static_cast<FIFE::GuiFont*> (getFont());
52 // setAlignment(Graphics::LEFT); 52 // setAlignment(Graphics::LEFT);
53 setTextWrapping(false); 53 setTextWrapping(false);
54 setCaption(caption); 54 setCaption(caption);
55 setFrameSize(0); 55 setFrameSize(0);
56 56 m_listener = NULL;
57 addMouseListener(this); 57 addMouseListener(this);
58 addKeyListener(this); 58 addKeyListener(this);
59 addFocusListener(this); 59 addFocusListener(this);
60 60
61 wrapText(); 61 wrapText();
139 } 139 }
140 } 140 }
141 141
142 void ClickLabel::mouseExited(MouseEvent& mouseEvent) 142 void ClickLabel::mouseExited(MouseEvent& mouseEvent)
143 { 143 {
144 // taken from TwoButton.cpp
145 if (m_listener) {
146 m_listener->mouseExited(*this);
147 }
144 mHasMouse = false; 148 mHasMouse = false;
145 } 149 }
146 150
147 void ClickLabel::mouseEntered(MouseEvent& mouseEvent) 151 void ClickLabel::mouseEntered(MouseEvent& mouseEvent)
148 { 152 {
153 // taken from TwoButton.cpp
154 if (m_listener) {
155 m_listener->mouseEntered(*this);
156 }
149 mHasMouse = true; 157 mHasMouse = true;
150 } 158 }
151 159
152 void ClickLabel::mouseReleased(MouseEvent& mouseEvent) 160 void ClickLabel::mouseReleased(MouseEvent& mouseEvent)
153 { 161 {