Пример #1
0
void
WindowImpl::draw()
{
  CL_Display::push_translate (parent->get_screen_x(), parent->get_screen_y());

  CL_Color highlight(255, 255, 255);
  CL_Color midtone(150, 150, 150);

  CL_Rect rect = parent->get_position() ;

  Box::draw_window(CL_Rect(CL_Point(0, 0), CL_Size(rect.get_width()-1, rect.get_height()-1)));
  Box::draw_panel_down(client_area->get_position());

  /*
    CL_Display::fill_rect(CL_Rect(CL_Point(0, 0), rect.get_size()), CL_Color(220, 220, 220));
    CL_Display::draw_rect(CL_Rect(CL_Point(0, 0), rect.get_size()), CL_Color(0, 0, 0));
 
    CL_Display::draw_line(1, rect.get_height()-2,
    rect.get_width()-2, rect.get_height()-2, midtone);
    CL_Display::draw_line(rect.get_width()-2, 1,
    rect.get_width()-2, rect.get_height()-2, midtone);

    CL_Display::draw_line(1, 1,
    rect.get_width()-2, 1, highlight);
    CL_Display::draw_line(1, 1,
    1, rect.get_height()-2, highlight);
  */

  CL_Display::pop_modelview();
}
Пример #2
0
void
WindowImpl::on_resize(int, int)
{
  titlebar->set_position(CL_Rect(CL_Point(3+16,3), CL_Size(parent->get_width()-6-18-18-18, 12+3)));
  close->set_position(3, 3);
  minimize->set_position(parent->get_width()-3-18-18, 3);
  maximize->set_position(parent->get_width()-3-18, 3);
  CL_Rect rect = parent->get_position();
  client_area->set_position(CL_Rect(CL_Point(4, 3+12+7), 
                                    CL_Size(rect.get_width()-10,
                                            rect.get_height()-28)));
}
Пример #3
0
void
TitlebarImpl::on_mouse_move(const CL_InputEvent& event)
{
  if(pressed)
  {
    CL_Rect rect = window->get_position();

    CL_Point move(old_pos.left - (click_pos.x - (rect.left + event.mouse_pos.x)),
                  old_pos.top  - (click_pos.y - (rect.top  + event.mouse_pos.y)));

    window->set_position(move.x, move.y);
  }
}
Пример #4
0
void
TitlebarImpl::on_mouse_down(const CL_InputEvent& event)
{
  if (event.id == CL_MOUSE_LEFT)
  {
    pressed   = true;
    click_pos = event.mouse_pos;
    parent->capture_mouse();
    window->raise();

    old_pos = window->get_position();
    click_pos.x += old_pos.left;
    click_pos.y += old_pos.top;
  }
}
Пример #5
0
void
WindowImpl::do_maximize()
{
  // FIXME: Move this to scripting language
  if (!is_maximized)
  {
    is_maximized = true;
    old_position = parent->get_position();
    parent->set_position(parent->get_parent()->get_position());
  }
  else
  {
    is_maximized = false;
    parent->set_position(old_position);
  }
}