Example #1
0
static void
set_font(glw_t *w, rstr_t *font)
{
  glw_text_bitmap_t *gtb = (glw_text_bitmap_t *)w;
  rstr_set(&gtb->gtb_font, font);
  gtb_update_epilogue(gtb, GTB_UPDATE_REALIZE);
}
Example #2
0
static void
mod_text_flags(glw_t *w, int set, int clr, glw_style_t *origin)
{
  glw_text_bitmap_t *gtb = (glw_text_bitmap_t *)w;
  gtb->gtb_flags = (gtb->gtb_flags | set) & ~clr;

  gtb_update_epilogue(gtb, GTB_UPDATE_REALIZE);
}
Example #3
0
void
glw_gtb_set_caption_raw(glw_t *w, uint32_t *uc, int len)
{
  glw_text_bitmap_t *gtb = (glw_text_bitmap_t *)w;
  free(gtb->gtb_uc_buffer);

  gtb->gtb_uc_buffer = uc;
  gtb->gtb_uc_len = len;

  gtb_update_epilogue(gtb, GTB_UPDATE_REALIZE);
}
Example #4
0
static int
gtb_set_rstr(glw_t *w, glw_attribute_t a, rstr_t *str, glw_style_t *origin)
{
  glw_text_bitmap_t *gtb = (glw_text_bitmap_t *)w;
  switch(a) {
  case GLW_ATTRIB_FONT:
    if(rstr_eq(gtb->gtb_font, str))
      return 0;

    rstr_set(&gtb->gtb_font, str);
    break;
  default:
    return -1;
  }

  gtb_update_epilogue(gtb, GTB_UPDATE_REALIZE);
  return 1;
}
Example #5
0
static void
caption_set_internal(glw_text_bitmap_t *gtb, const char *str, int type)
{
  int len;
  int flags = 0;

  gtb_caption_refresh(gtb);

  if(gtb->gtb_caption && !strcmp(str ?: "", gtb->gtb_caption) &&
     type == gtb->gtb_caption_type)
    return;

  free(gtb->gtb_caption);
  gtb->gtb_caption = strdup(str ?: "");
  gtb->gtb_caption_type = type;

  assert(gtb->gtb_caption_type == 0 || gtb->gtb_caption_type == 1);

  if(gtb->w.glw_flags2 & GLW2_AUTOHIDE) {
    if(str == NULL || *str == 0)
      glw_hide(&gtb->w);
    else
      glw_unhide(&gtb->w);
  }

  if(gtb->gtb_caption_type == PROP_STR_RICH)
    flags |= TEXT_PARSE_HTML_TAGS | TEXT_PARSE_HTML_ENTITIES;

  free(gtb->gtb_uc_buffer);
  gtb->gtb_uc_buffer = text_parse(gtb->gtb_caption ?: "", &len, flags,
				  NULL, 0, 0);
  gtb->gtb_caption_dirty = 0;
  gtb->gtb_uc_len = gtb->gtb_uc_size = len;

  if(gtb->w.glw_class == &glw_text) {
    gtb->gtb_edit_ptr = gtb->gtb_uc_len;
    gtb->gtb_update_cursor = 1;
  }

  gtb_update_epilogue(gtb, GTB_UPDATE_REALIZE);
}