Пример #1
0
static int screen_gc(lua_State *L) {
  (void)L;
#if 0
  printf("bye, bye, screen = %p\n",
      (void*)to_screen(L, 1));
#endif
  return 0;
}
Пример #2
0
  /**
   * Returns the position on the screen.
   */
  gcc_pure
  const RECT get_screen_position() const
  {
    RECT rc;
#ifdef ENABLE_SDL
    rc = get_position();
    to_screen(rc);
#else
    ::GetWindowRect(hWnd, &rc);
#endif
    return rc;
  }
Пример #3
0
void	aff_coord(t_all **ll)
{
	static int		j = 0;
	t_all			*all;

	all = *ll;
	if (j == 0)
		j = get_line_max(&all->datas);
	to_screen(all, &all->datas);
	mlx_put_image_to_window(all->mlx->mlx, all->mlx->win, \
			all->mlx->infos_img->img, 0, 0);
	mlx_hook(all->mlx->win, KeyPress, KeyPressMask, key_hook, all);
	mlx_loop(all->mlx->mlx);
}
Пример #4
0
// --------------------------------------------------------
// check if a screen point is "owned" by this button
// --------------------------------------------------------
bool t_button::is_contained( t_screen_point point ) const
{
	if (!is_point_in_rect( point, get_client_rect() ))
		return false;
	if (!m_has_transparency)
		return true;
	if (m_current_image == 0)
		return false;

	t_window_list::const_reverse_iterator it;
	t_screen_point screen_point = to_screen( point );

	// We're going to check ALL our children when evaluating if we want to claim
	// a point so that when the button changes state (like when it is clicked)
	// the answer doesn't suddenly change.
	for (it = get_children_rbegin(); it != get_children_rend(); it++)
	{
		if ( (*it)->is_contained( (*it)->to_client( screen_point ) ) )
			return true;
	}

	return false;
}
Пример #5
0
// -----------------------------------------------------------------------
// find window from screen coordinates
// -----------------------------------------------------------------------
t_window* t_button::get_child( t_screen_point point, bool ignore_visibility ) // find window from client coordinates
{
	if (!is_visible() && !ignore_visibility)
		return 0;
	if (!is_contained( point ))
		return 0;

	t_window_list::const_reverse_iterator it;
	t_window*      result;
	t_screen_point screen_point = to_screen( point );

	// Since we passed the "is_contained" test, we're pretty sure we'll find
	// something.  That being the case, we're willing to spend the time to check
	// for a visible hit first, then fallback to a hit on an invisible child.
	// If we needed to speed things up we could just do the "ignore" test right
	// off and put up with possibility of getting an invisible child when a visible
	// one was available.
	for (it = get_children_rbegin(); it != get_children_rend(); it++)
	{
		result = (*it)->get_child( (*it)->to_client( screen_point ), false );
		if (result != 0)
			return result;
	}
	// Now look for an invisible hit
	for (it = get_children_rbegin(); it != get_children_rend(); it++)
	{
		result = (*it)->get_child( (*it)->to_client( screen_point ), true );
		if (result != 0)
			return result;
	}

	// I'm not sure we'll ever get here given the way is_contained is implemented
	// and the fact that we checked that first off, but just in case...
	if (m_has_transparency == k_completely_transparent)
		return 0;
	return this;
}