Exemplo n.º 1
0
static void
glw_segway_render(glw_t *w, const glw_rctx_t *rc)
{
  glw_t *c;
  glw_rctx_t rc0;
  glw_segway_t *s = (glw_segway_t *)w;

  if((c = TAILQ_FIRST(&w->glw_childs)) == NULL)
    return;

  if(s->req_width == 0 || s->direction == 0)
    return;

  rc0 = *rc;

  int displacement = s->req_width - s->actual_width_rounded;

  switch(s->direction) {

  case SEGWAY_DIRECTION_LEFT:
    glw_reposition(&rc0, -displacement, rc->rc_height,
                   rc->rc_width, 0);
    break;
  case SEGWAY_DIRECTION_RIGHT:
    glw_reposition(&rc0, displacement * 0, rc->rc_height,
                   rc->rc_width + 1 * displacement, 0);
    break;
  }
  rc0.rc_width = s->req_width;
  rc0.rc_alpha *= s->alpha;
  glw_render0(c, &rc0);
}
Exemplo n.º 2
0
static void
glw_linebox_render(glw_t *w, const glw_rctx_t *rc)
{
  glw_rctx_t rc0 = *rc;
  glw_reposition(&rc0, 1, rc->rc_height, rc->rc_width, 1);
  glw_wirebox(w->glw_root, &rc0);
}
Exemplo n.º 3
0
static void
popup_render(glw_t *w, const glw_rctx_t *rc)
{
  glw_rctx_t rc0;
  glw_popup_t *p = (glw_popup_t *)w;

  glw_store_matrix(w, rc);

  rc0 = *rc;
  rc0.rc_alpha *= w->glw_alpha;

  if(rc0.rc_alpha < GLW_ALPHA_EPSILON)
    return;

  glw_t *c = TAILQ_FIRST(&w->glw_childs);
  if(c == NULL || c->glw_flags & GLW_HIDDEN)
    return;

  Vec3 point, dir;

  glw_vec3_copy(point, glw_vec3_make(p->screen_x, p->screen_y, -2.41));
  glw_vec3_sub(dir, point, glw_vec3_make(p->screen_x * 42.38,
                                         p->screen_y * 42.38,
                                         -100));
  float x, y;

  glw_widget_unproject(w->glw_matrix, &x, &y, point, dir);

  int x1, y1;

  if(p->screen_cord_set) {
    x1 = (x + 1.0f) * 0.5f * rc->rc_width;
    y1 = (y + 1.0f) * 0.5f * rc->rc_height - p->height;
  } else {
    x1 = rc->rc_width / 2 - p->width / 2;
    y1 = rc->rc_height / 2 - p->height / 2;
  }

  int x2 = x1 + p->width;
  int y2 = y1 + p->height;


  if(x2 > rc->rc_width) {
    int spill = x2 - rc->rc_width;
    x1 -= spill;
    x2 -= spill;
  }

  if(y1 < 0) {
    y2 -= y1;
    y1 -= y1;
  }
  glw_reposition(&rc0, x1, y2, x2, y1);

  glw_render0(c, &rc0);
}
Exemplo n.º 4
0
static void 
render_child_autocentered(glw_image_t *gi, const glw_rctx_t *rc)
{
  glw_t *c;
  glw_rctx_t rc0;

  if((c = TAILQ_FIRST(&gi->w.glw_childs)) == NULL)
    return;

  rc0 = *rc;
  
  glw_reposition(&rc0, gi->gi_box_left, rc->rc_height - gi->gi_box_top,
		 rc->rc_width  - gi->gi_box_right, gi->gi_box_bottom);

  rc0.rc_alpha *= gi->w.glw_alpha;
  glw_render0(c, &rc0);
}
Exemplo n.º 5
0
static void
glw_slider_render_y(glw_t *w, const glw_rctx_t *rc)
{
  glw_slider_t *s = (glw_slider_t *)w;
  glw_t *c;
  glw_rctx_t rc0;

  if(glw_is_focusable_or_clickable(w))
    glw_store_matrix(w, rc);

  if((c = TAILQ_FIRST(&w->glw_childs)) == NULL)
    return;

  rc0 = *rc;
  rc0.rc_alpha *= w->glw_alpha;

  glw_reposition(&rc0,
		 0,
		 s->knob_pos_px + s->knob_size_px / 2,
		 rc->rc_width,
		 s->knob_pos_px - s->knob_size_px / 2);

  glw_render0(c, &rc0);
}