Ejemplo n.º 1
0
int super_textbox_proc(int msg, DIALOG *d, int c)
{
   int height, bar;
   int fg_color;
   int ret = D_O_K;
   FONT *old_font = font; // save current font in old_font

   if (d->dp2) // if custom font was loaded into dp2,
      font = (FONT *)d->dp2;  // make custom font the default font

   fg_color = (d->flags & D_DISABLED) ? gui_mg_color : d->fg;
   /* calculate the actual height */
   height = (d->h-8) / text_height(font);

   if (msg == MSG_DRAW)
   {
      /* tell the object to sort of draw, but only calculate the listsize */
      _draw_textbox(d->dp, &d->d1,
                    0, /* DONT DRAW anything */
                    d->d2, !(d->flags & D_SELECTED), 8,
                    d->x, d->y, d->w, d->h,
                    (d->flags & D_DISABLED),
                    0, 0, 0);

      if (d->d1 > height) {
         bar = 12;
      }
      else {
         bar = 0;
         d->d2 = 0;
      }

      /* now do the actual drawing */
      _draw_textbox(d->dp, &d->d1, 1, d->d2,
                    !(d->flags & D_SELECTED), 8,
                    d->x, d->y, d->w-bar, d->h,
                    (d->flags & D_DISABLED),
                    fg_color, d->bg, gui_mg_color);

      /* draw the frame around */
      if (d->key)
         _draw_scrollable_frame(d, d->d1, d->d2, height, fg_color, d->bg);
   }
   else
      ret = d_textbox_proc(msg, d, c);

   // make everything like it was before
   font = old_font;

   return ret;
}
Ejemplo n.º 2
0
int
d_abitmap_textbox_proc (int msg, DIALOG *d, int c)
{
	if (msg == MSG_DRAW) {
		int s = get_state (d);
		int height, bar = 1;
		int mode, x_anchor, y_anchor;
		BITMAP *pattern;
		height = (d->h - 8) / text_height (font);

		/* hack to make _draw_textbox draw transparent text */
		mode = _drawing_mode;
		pattern = _drawing_pattern;
		x_anchor = _drawing_x_anchor;
		y_anchor = _drawing_y_anchor;
		drawing_mode (DRAW_MODE_MASKED_PATTERN, none, 0, 0);

		/* tell the object to sort of draw, but only calculate the listsize */
								 /* DONT DRAW anything */
		_draw_textbox ((char *) d->dp, &d->d1, 0,
			d->d2, !(d->flags & D_SELECTED), 8,
			d->x, d->y, d->w - 2, d->h - 2,
			(d->flags & D_DISABLED), 0, 0, 0);

		if (d->d1 > height)
			bar = 11;
		else
			d->d2 = 0;

		abitmap_draw_area (d, B_TEXTBOX, 0, 0, bar == 11 ? d->w - 12 : d->w, d->h, 0, 0);
		if (bar == 11)
			abitmap_draw_scroller (d, d->d2, d->d1 + 1, height);

		/* now do the actual drawing */
		_draw_textbox ((char *) d->dp, &d->d1, 1, d->d2,
			!(d->flags & D_SELECTED), 8,
			d->x, d->y, d->w - 2 - bar, d->h - 2,
			(d->flags & D_DISABLED), theme->bitmaps[B_TEXTBOX][s].color,
			-1, theme->bitmaps[B_TEXTBOX][s].color);

		_drawing_mode = mode;
		_drawing_pattern = pattern;
		_drawing_x_anchor = x_anchor;
		_drawing_y_anchor = y_anchor;

		return D_O_K;
	}

	return d_textbox_proc (msg, d, c);
}
Ejemplo n.º 3
0
int d_aphoton_textbox_proc(int msg, DIALOG *d, int c)
{
    int height, bar, fg_color;
	
    if (msg == MSG_DRAW) {

	fg_color = (d->flags & D_DISABLED) ? aphoton_mg_color : black;
	height = (d->h-8) / text_height(font);

	/* tell the object to sort of draw, but only calculate the listsize */
	_draw_textbox((char *)d->dp, &d->d1, 
		      0, /* DONT DRAW anything */
		      d->d2, !(d->flags & D_SELECTED), 8,
		      d->x, d->y, d->w, d->h,
		      (d->flags & D_DISABLED),
		      0, 0, 0);

	if (d->d1 > height) {
	    bar = 11;
	}
	else {
	    bar = 0;
	    d->d2 = 0;
	}

	/* now do the actual drawing */
	_draw_textbox((char *)d->dp, &d->d1, 1, d->d2,
		      !(d->flags & D_SELECTED), 8,
		      d->x, d->y, d->w-bar, d->h,
		      (d->flags & D_DISABLED),
		      fg_color, white, aphoton_mg_color);

	/* draw the frame around */
	photon_draw_scrollable_frame(d, d->d1, d->d2, height);
	
	return D_O_K;
    }
    
    return d_textbox_proc(msg, d, c);
}