/[enigma]/enigma/src/gui.cc
ViewVC logotype

Diff of /enigma/src/gui.cc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.11 by reallysoft, Sun Jun 22 08:11:10 2003 UTC revision 1.12 by dheck, Tue Jun 24 07:53:06 2003 UTC
# Line 186  Container::boundingbox() Line 186  Container::boundingbox()
186  Label::Label (const std::string &text)  Label::Label (const std::string &text)
187  : m_text (text),  : m_text (text),
188    m_font(enigma::GetFont("menufont")),    m_font(enigma::GetFont("menufont")),
189    m_halign(ALIGN_CENTER),    m_halign(HALIGN_CENTER),
190    m_valign(ALIGN_CENTER)    m_valign(VALIGN_CENTER)
191  {}  {}
192    
193    
# Line 215  void Label::draw (px::GC &gc, const px:: Line 215  void Label::draw (px::GC &gc, const px::
215    
216      int x = get_x(), y=get_y();      int x = get_x(), y=get_y();
217      switch (m_halign) {      switch (m_halign) {
218      case ALIGN_LEFT: break;      case HALIGN_LEFT: break;
219      case ALIGN_RIGHT: x += get_w() - w; break;      case HALIGN_RIGHT: x += get_w() - w; break;
220      case ALIGN_CENTER: x += (get_w()-w)/2; break;      case HALIGN_CENTER: x += (get_w()-w)/2; break;
221      }      }
222      switch (m_valign) {      switch (m_valign) {
223      case ALIGN_LEFT: break;      case VALIGN_TOP: break;
224      case ALIGN_RIGHT: y += get_h() - h; break;      case VALIGN_BOTTOM: y += get_h() - h; break;
225      case ALIGN_CENTER: y += (get_h()-h)/2; break;      case VALIGN_CENTER: y += (get_h()-h)/2; break;
226      }      }
227    
228      f->render (gc, x, y, m_text.c_str());      f->render (gc, x, y, m_text.c_str());
229  }  }
230    
231  void Label::set_alignment (Alignment horizontal, Alignment vertical)  void Label::set_alignment (HAlignment halign, VAlignment valign)
232  {  {
233      if (horizontal != m_halign || vertical != m_valign) {      if (halign != m_halign || valign != m_valign) {
234          m_halign = horizontal;          m_halign = halign;
235          m_valign = vertical;          m_valign = valign;
236          redraw();          redraw();
237      }      }
238  }  }

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26