Пример #1
0
void
IconImpl::mouse_up  (const CL_InputEvent& event)
{
  if (is_enabled)
  {
    down         = false;
    parent->release_mouse();

    if (parent->has_mouse_over())
    {
      sig_on_click();
    }
  }
}
Пример #2
0
void
IconImpl::draw()
{
  CL_Display::push_translate(parent->get_screen_x(), parent->get_screen_y());
  CL_Rect rect(CL_Point(0, 0), CL_Size(parent->get_width()-4, parent->get_height()-4));

  sprite.set_alignment(origin_center);

  if (is_enabled)
  {
    if (is_down)
    {
      Box::draw_button_down(rect);
    }
    else
    {
      if (parent->has_mouse_over())
      {
        if (down)
          Box::draw_button_down(rect);
        else
          Box::draw_button_up(rect);
      }
      else
        Box::draw_button_neutral(rect);
    }
    sprite.set_alpha(1.0f);
  }
  else
  {
    Box::draw_button_neutral(rect);
    sprite.set_alpha(0.3f);
  }
  sprite.draw((rect.get_width()+1)/2, (rect.get_height()+1)/2);
  CL_Display::pop_modelview();
}