Exemplo n.º 1
0
void draw_window(window_t *window, vga_screen *screen) {
  // draw window drop shadow
  vga_fill_rect(screen, window->x + WINDOW_SHADOW_OFFSET, window->y + WINDOW_SHADOW_OFFSET, 
    window->width, window->height, COLOR_BLACK);

  // draw window
  vga_fill_rect(screen, window->x, window->y, 
    window->width, window->height, COLOR_LIGHT_GRAY);

  // draw window decoration bar
  vga_fill_rect(screen, window->x, window->y, 
    window->width, WINDOW_TITLE_BAR_HEIGHT, COLOR_LIGHT_BLUE);

  // draw title text
  font_draw_string(screen, window->font,
    window->x + 2, window->y + 2,
    window->title);

  // draw all widgets
  for (uint i = 0; i < MAX_WIDGETS_PER_WINDOW; i++) {
    if (window->widgets[i] != NULL) {
      draw_widget(window->widgets[i], screen, 
        window->x + WINDOW_CONTENT_PADDING_X, 
        window->y + WINDOW_TITLE_BAR_HEIGHT + WINDOW_CONTENT_PADDING_Y);
    }
  }

  // draw special widgets
  draw_widget(window->close_button, screen, 
    window->x + WINDOW_CONTENT_PADDING_X, 
    window->y + WINDOW_TITLE_BAR_HEIGHT + WINDOW_CONTENT_PADDING_Y);
}
Exemplo n.º 2
0
void kernel_load_enter(void) {
    graphics_location draw_system_logo_x=0;
    graphics_location draw_system_logo_y=0;
    unsigned long draw_system_logo_height=0;
    unsigned long draw_system_logo_width=0;
    window_widget picture_kernel_logo;
    widget_handle picture_kernel_logo_handle=INVALID_WIDGET_HANDLE;
    window_widget progress_load_rate;
    
    kernel_load_window=create_window("kernel load","kernel load",false,NULL);
    set_window_background_color(kernel_load_window,DEFAULT_COLOR_BACKGROUND);
    show_window(kernel_load_window);
    lcd_calcu_middle_location(0,0,SCREEN_HORIZONTAL_PIXEL,SCREEN_LONGITUDINAL_PIXEL,&draw_system_logo_x,&draw_system_logo_y);
    graphics_get_bitmap(kernel_logo,NULL,&draw_system_logo_height,&draw_system_logo_width);
    draw_system_logo_x-=draw_system_logo_width/2;
    draw_system_logo_y-=draw_system_logo_height/2;
    picture_kernel_logo.widget_type=widget_picture;
    picture_kernel_logo.x=draw_system_logo_x;
    picture_kernel_logo.y=draw_system_logo_y;
    picture_kernel_logo_handle=create_widget(kernel_load_window,&picture_kernel_logo);
    set_picture_bitmap(kernel_load_window,picture_kernel_logo_handle,kernel_logo);
    draw_widget(kernel_load_window,picture_kernel_logo_handle);
    progress_load_rate.widget_type=widget_progress;
    progress_load_rate.widget_height=PROGRESS_HEIGHT;
    progress_load_rate.widget_width=draw_system_logo_width;
    progress_load_rate.x=draw_system_logo_x;
    progress_load_rate.y=draw_system_logo_y+draw_system_logo_height+DISTANCE_PROGRESS_TO_LOGO;
    progress_load_rate_handle=create_widget(kernel_load_window,&progress_load_rate);
    set_progress_max_value(kernel_load_window,progress_load_rate_handle,MAX_KERNEL_LOAD_RATE);
    set_progress_value(kernel_load_window,progress_load_rate_handle,0);
    draw_widget(kernel_load_window,progress_load_rate_handle);
}
Exemplo n.º 3
0
/*-----------------------------------------------------------------------------------*/
static void
draw_window_contents(struct ctk_window *window, unsigned char focus,
		     unsigned char clipy1, unsigned char clipy2,
		     unsigned char x1, unsigned char x2,
		     unsigned char y1, unsigned char y2)
{
  struct ctk_widget *w;
  unsigned char wfocus;
  
  /* Draw inactive widgets. */
  for(w = window->inactive; w != NULL; w = w->next) {
    draw_widget(w, x1, y1, x2, y2, clipy1, clipy2, focus);
  }
  
  /* Draw active widgets. */
  for(w = window->active; w != NULL; w = w->next) {  
    wfocus = focus;
    if(w == window->focused) {
      wfocus |= CTK_FOCUS_WIDGET;
    }

   draw_widget(w, x1, y1, x2, y2, clipy1, clipy2, wfocus);
  }

#ifdef CTK_CONIO_CONF_UPDATE
  CTK_CONIO_CONF_UPDATE();
#endif /* CTK_CONIO_CONF_UPDATE */
}
/*--------------------------------------------------------------------------*/
static void
s_ctk_draw_dialog(struct ctk_window *window)
{
  struct ctk_widget *w;
  unsigned char wfocus, focus;
  int x, y, x1, y1, x2, y2;

  focus = CTK_FOCUS_DIALOG;

  x = window->x;
  y = window->y + MENU_HEIGHT;
  
  x1 = x + WINDOWBORDER_WIDTH;
  y1 = y + WINDOWTITLE_HEIGHT;
  x2 = x1 + window->w;
  y2 = y1 + window->h;
  
  /* Draw window border */
  gdk_draw_rectangle(ctk_gtksim_pixmap,
		     black,
		     FALSE,
		     x * RASTER_X,
		     y * RASTER_Y + MENUBAR_HEIGHT,
		     (window->w + 2 * WINDOWBORDER_WIDTH) * RASTER_X,
		     (window->h + WINDOWTITLE_HEIGHT +
		                  WINDOWBORDER_HEIGHT) * RASTER_Y);

  
  
  gdk_draw_rectangle(ctk_gtksim_pixmap,
		     white,
		     TRUE,
		     x * RASTER_X + 1,
		     y * RASTER_Y + 1 + MENUBAR_HEIGHT,
		     (window->w + 2 * WINDOWBORDER_WIDTH) * RASTER_X - 2,
		     (window->h + WINDOWTITLE_HEIGHT +
                                  WINDOWBORDER_HEIGHT) * RASTER_Y - 2);
  
  /* Draw inactive widgets. */
  for(w = window->inactive; w != NULL; w = w->next) {
    draw_widget(w, x1, y1, x2, y2,
		y1, y2,
		focus);
  }
  
  /* Draw active widgets. */
  for(w = window->active; w != NULL; w = w->next) {
    wfocus = focus;
    if(w == window->focused) {
      wfocus |= CTK_FOCUS_WIDGET;
    }

   draw_widget(w, x1, y1, x2, y2,
	       y1, y2,
	       wfocus);
  }

  ctk_gtksim_set_redrawflag();
  
}
Exemplo n.º 5
0
void scroller::handle_down(image *screen, InputManager *inm) {
	if (vert && sx < t - 1) {
		draw_widget(screen, 1);
		sx++;
		draw_widget(screen, 0);
		scroll_event(sx, screen);
	}
}
Exemplo n.º 6
0
void scroller::handle_up(image *screen, InputManager *inm) {
	if (vert && sx > 1) {
		draw_widget(screen, 1);
		sx--;
		draw_widget(screen, 0);
		scroll_event(sx, screen);
	}
}
Exemplo n.º 7
0
/*-----------------------------------------------------------------------------------*/
static void
s_ctk_draw_dialog(register struct ctk_window *dialog)
{
  register struct ctk_widget *w;

  hires_color(ctk_hires_theme.windowcolors[CTK_FOCUS_DIALOG]);

  /*  x = (SCREEN_WIDTH - dialog->w) / 2;
      y = (SCREEN_HEIGHT - 1 - dialog->h) / 2; */
  x = dialog->x;
  y = dialog->y + 1;


  x1 = x + 1;
  y1 = y + 1;
  x2 = x1 + dialog->w;
  y2 = y1 + dialog->h;


  /* Draw dialog frame. */
  
  hires_cvlinexy(x, y1, dialog->h);
  hires_cvlinexy(x2, y1, dialog->h);

  hires_chlinexy(x1, y, dialog->w);
  hires_chlinexy(x1, y2, dialog->w);

  hires_cputcxy(x, y, CH_ULCORNER);
  hires_cputcxy(x, y2, CH_LLCORNER);
  hires_cputcxy(x2, y, CH_URCORNER);
  hires_cputcxy(x2, y2, CH_LRCORNER);
  
  
  /* Clear window contents. */
  for(i = y1; i < y2; ++i) {
    hires_cclearxy(x1, i, dialog->w);
  }
  
  /* Draw inactive widgets. */
  for(w = dialog->inactive; w != NULL; w = w->next) {
    draw_widget(w, x1, y1,
		0, SCREEN_HEIGHT, CTK_FOCUS_DIALOG);
  }


  /* Draw active widgets. */
  for(w = dialog->active; w != NULL; w = w->next) {
    wfocus = CTK_FOCUS_DIALOG;
    if(w == dialog->focused) {
      wfocus |= CTK_FOCUS_WIDGET;
    }
    draw_widget(w, x1, y1, 
		0, SCREEN_HEIGHT, wfocus);
  }

}
Exemplo n.º 8
0
void scroller::set_x (int x, image *screen)
{
  if (x<0) x=0;
  if (x>=t) x=t-1;
  if (x!=sx)
  {
    draw_widget(screen,1);
    sx=x;
    draw_widget(screen,0);
    scroll_event(sx,screen);
  }
}
Exemplo n.º 9
0
void pick_list::handle_down(image *screen, InputManager *inm) {
	if (cur_sel < t - 1)
		cur_sel++;
	else
		return;
	if (cur_sel > sx + th - 1) {
		draw_widget(screen, 1);
		sx = cur_sel - th + 1;
		draw_widget(screen, 0);
	}
	scroll_event(sx, screen);
}
Exemplo n.º 10
0
void pick_list::handle_up(image *screen, InputManager *inm) {
	if (cur_sel > 0)
		cur_sel--;
	else
		return;
	if (cur_sel < sx) {
		draw_widget(screen, 1);
		sx = cur_sel;
		draw_widget(screen, 0);
	}
	scroll_event(sx, screen);
}
Exemplo n.º 11
0
void spicker::handle_down(image *screen, InputManager *inm) {
	if (vert && cur_sel < t - 1)
		cur_sel++;
	else
		return;
	if (cur_sel > sx + r - 1) {
		draw_widget(screen, 1);
		last_sel = sx = cur_sel - r + 1;
		draw_widget(screen, 0);
	}
	scroll_event(sx, screen);
	note_new_current(screen, inm, cur_sel);
}
Exemplo n.º 12
0
void spicker::handle_up(image *screen, InputManager *inm) {
	if (vert && cur_sel > 0) {
		cur_sel--;

		if (cur_sel < sx) {
			draw_widget(screen, 1);
			last_sel = sx = cur_sel;
			draw_widget(screen, 0);
		}
		scroll_event(last_sel, screen);
		note_new_current(screen, inm, cur_sel);
	}
}
/*-----------------------------------------------------------------------------------*/
static void
s_ctk_draw_widget(struct ctk_widget *w,
		  unsigned char focus,
		  unsigned char clipy1,
		  unsigned char clipy2)
{
  struct ctk_window *win = w->window;
  unsigned char posx, posy;

  posx = win->x + 1;
  posy = win->y + 2;

  if(w == win->focused) {
    focus |= CTK_FOCUS_WIDGET;
  }
  
  draw_widget(w, posx, posy,
	      posx + win->w,
	      posy + win->h,
	      clipy1, clipy2,
	      focus);
  
#ifdef CTK_CONIO_CONF_UPDATE
  CTK_CONIO_CONF_UPDATE();
#endif /* CTK_CONIO_CONF_UPDATE */
}
Exemplo n.º 14
0
/*-----------------------------------------------------------------------------------*/
void
ctk_draw_widget(struct ctk_widget *w, unsigned char focus,
		unsigned char clipy1, unsigned char clipy2)
{
  struct ctk_window *win = w->window;
  unsigned char posx, posy;

#if CTK_CONF_WINDOWS
  posx = win->x + 1;
  posy = win->y + 1 + CTK_CONF_MENUS;
#else /* CTK_CONF_WINDOWS */
  posx = 0;
  posy = 0;
#endif /* CTK_CONF_WINDOWS */

  if(w == win->focused) {
    focus |= CTK_FOCUS_WIDGET;
  }
  
  draw_widget(w, posx, posy, posx + win->w, posy + win->h, clipy1, clipy2, focus);
  
#ifdef CTK_CONIO_CONF_UPDATE
  CTK_CONIO_CONF_UPDATE();
#endif /* CTK_CONIO_CONF_UPDATE */
}
Exemplo n.º 15
0
void eqslider_button_press_cb(GtkWidget * w, GdkEventButton * event, gpointer data)
{
	EqSlider *es = (EqSlider *) data;
	gint y;

	if (inside_widget(event->x, event->y, &es->es_widget))
	{
		if (event->button == 1)
		{
			y = event->y - es->es_widget.y;
			es->es_isdragging = TRUE;
			if (y >= es->es_position && y < es->es_position + 11)
				es->es_drag_y = y - es->es_position;
			else
			{
				es->es_position = y - 5;
				es->es_drag_y = 5;
				if (es->es_position < 0)
					es->es_position = 0;
				if (es->es_position > 50)
					es->es_position = 50;
				if (es->es_position >= 24 && es->es_position <= 26)
					es->es_position = 25;
				equalizerwin_eq_changed();
			}
			eqslider_set_mainwin_text(es);
			draw_widget(es);
		}
		if (event->button == 4)
		{
			es->es_position -= 2;
			if (es->es_position < 0)
				es->es_position = 0;
			equalizerwin_eq_changed();
			draw_widget(es);
		}
		if (event->button == 5)
		{
			es->es_position += 2;
			if (es->es_position > 50)
				es->es_position = 50;
			equalizerwin_eq_changed();
			draw_widget(es);
		}
	}
}
Exemplo n.º 16
0
/*---------------------------------------------------------------------------*/
void draw_window_sub(struct ctk_window *window, unsigned char focus) {

  unsigned char x, y;
  unsigned char x1, y1, x2;
  struct ctk_widget *w;
  unsigned char wfocus;

  x = window->x;
  y = window->y + 1;

  x1 = x + 1;
  y1 = y + 1;
  x2 = x1 + window->w;

  // |_
  gotoxy(x, y1);
  cvline(window->h);
  cputc(CH_LLCORNER);
  chline(window->w);
  cputc(CH_LRCORNER);

  // -
  gotoxy(x, y);
  cputc(CH_ULCORNER);
  chline(window->w);
  cputc(CH_URCORNER);
  // |
  gotoxy(x2, y1);
  cvline(window->h);

  /* Draw inactive widgets. */
  for(w = window->inactive; w != NULL; w = w->next) {
    draw_widget(w, x1, y1, focus);
  }

  /* Draw active widgets. */
  for(w = window->active; w != NULL; w = w->next) {
    wfocus = focus;
    if(w == window->focused) {
      wfocus |= CTK_FOCUS_WIDGET;
    }
    draw_widget(w, x1, y1, wfocus);
  }
}
Exemplo n.º 17
0
void eqslider_button_release_cb(GtkWidget * w, GdkEventButton * event, gpointer data)
{
	EqSlider *es = (EqSlider *) data;

	if (es->es_isdragging)
	{
		es->es_isdragging = FALSE;
		mainwin_release_info_text();
		draw_widget(es);
	}
}
Exemplo n.º 18
0
void eqslider_set_position(EqSlider * es, gfloat pos)
{
	es->es_position = 25 - (int) ((pos * 25.0) / 20.0);
	if (es->es_position < 0)
		es->es_position = 0;
	if (es->es_position > 50)
		es->es_position = 50;
	if (es->es_position >= 24 && es->es_position <= 26)
		es->es_position = 25;
	draw_widget(es);
}
Exemplo n.º 19
0
void scroller::draw_first(image *screen) {
	if (sx >= t)
		sx = t - 1;
	draw(0, screen);
	screen->widget_bar(b1x(), b1y(), b1x() + bw() - 1, b1y() + bh() - 1,
			wm->bright_color(), wm->medium_color(), wm->dark_color());
	screen->widget_bar(b2x(), b2y(), b2x() + bw() - 1, b2y() + bh() - 1,
			wm->bright_color(), wm->medium_color(), wm->dark_color());
	show_icon(screen, b1x() + 2, b1y() + 2, bw() - 4, bh() - 4, b1());
	show_icon(screen, b2x() + 2, b2y() + 2, bw() - 4, bh() - 4, b2());

	int x1, y1, x2, y2;
	dragger_area(x1, y1, x2, y2);
	screen->bar(x1, y1, x2, y2, wm->black());
	screen->bar(x1 + 1, y1 + 1, x2 - 1, y2 - 1, wm->medium_color());
	draw_widget(screen, 0);
	scroll_event(sx, screen);
}
Exemplo n.º 20
0
/*---------------------------------------------------------------------------*/
void
ctk_draw_widget(struct ctk_widget *w,
		unsigned char focus,
		unsigned char clipy1,
		unsigned char clipy2) {

  struct ctk_window *win = w->window;
  unsigned char posx, posy;
  clip(clipy1, clipy2);

  posx = win->x + 1;
  posy = win->y + 2;

  if(w == win->focused) {
    focus |= CTK_FOCUS_WIDGET;
  }
  
  draw_widget(w, posx, posy, focus);
}
Exemplo n.º 21
0
/*-----------------------------------------------------------------------------------*/
void
ctk_draw_widget(struct ctk_widget *w,
		unsigned char focus,
		unsigned char clipy1,
		unsigned char clipy2)
{
  struct ctk_window *win = w->window;
  struct ctk_icon *icon;
  unsigned char posx, posy, x, len;

  posx = win->x + 1;
  posy = win->y + 2;

  if(w == win->focused) {
    focus |= CTK_FOCUS_WIDGET;
  }
  
  draw_widget(w, posx, posy,
	      posx + win->w,
	      posy + win->h,
	      clipy1, clipy2,
	      focus);

  if(w->type != CTK_WIDGET_ICON) {
    update_area(posx + w->x,
		posy + w->y, w->w + 2, w->h);
  } else {
    icon = (struct ctk_icon *)w;

    len = strlen(icon->title);
    x = posx + w->x;
    if(x + len >= sizex) {
      x = sizex - len;
    }

    update_area(x, posy + w->y, len > 4? len: 4, w->h);    
  }
  
#ifdef CTK_CONIO_CONF_UPDATE
  CTK_CONIO_CONF_UPDATE();
#endif /* CTK_CONIO_CONF_UPDATE */
}
Exemplo n.º 22
0
void eqslider_motion_cb(GtkWidget * w, GdkEventMotion * event, gpointer data)
{
	EqSlider *es = (EqSlider *) data;
	gint y;

	y = event->y - es->es_widget.y;
	if (es->es_isdragging)
	{
		es->es_position = y - es->es_drag_y;
		if (es->es_position < 0)
			es->es_position = 0;
		if (es->es_position > 50)
			es->es_position = 50;
		if (es->es_position >= 24 && es->es_position <= 26)
			es->es_position = 25;
		equalizerwin_eq_changed();
		eqslider_set_mainwin_text(es);
		draw_widget(es);
	}
}
Exemplo n.º 23
0
/*---------------------------------------------------------------------*/
void console( void )
{
    while( !init_cons ) {};

    get_timer( &l_time );

    draw_widget( &cons, true );

    s32 _i = 'Z';
    for( ; _i < 'c'/*_DEBUG_FONT_TBL_SIZE*/; ++_i ) {
        putc_console( _i );
        putc_console(' ');
        putn_console( _i );
        putc_console('\n');
    }

    for(;;) {
        update_console();
        draw_console();
    }
}
Exemplo n.º 24
0
static void draw_page(void)
{
	int n = ACTIVE_PAGE.total_widgets;

	if (ACTIVE_PAGE.draw_full) {
		ACTIVE_PAGE.draw_full();
	} else {

		draw_page_title();
		if (ACTIVE_PAGE.draw_const) ACTIVE_PAGE.draw_const();
		if (ACTIVE_PAGE.predraw_hook) ACTIVE_PAGE.predraw_hook();
	}

	/* this doesn't use widgets[] because it needs to draw the page's
	 * widgets whether or not a dialog is active */
	while (n--)
		draw_widget(ACTIVE_PAGE.widgets + n, n == ACTIVE_PAGE.selected_widget);

	/* redraw the area over the menu if there is one */
	if (status.dialog_type & DIALOG_MENU)
		menu_draw();
	else if (status.dialog_type & DIALOG_BOX)
		dialog_draw();
}
Exemplo n.º 25
0
/*-----------------------------------------------------------------------------------*/
static void
s_ctk_draw_window(register struct ctk_window *window,
		unsigned char focus,
		unsigned char clipy1, unsigned char clipy2,
		unsigned char draw_borders)
{
  register struct ctk_widget *w;

  x = window->x;
  y = window->y + 1;
  
  ++clipy2;
  
  if(clipy2 <= y) {
    return;
  }
  
  /*  hires_color(ctk_hires_theme.windowcolors[focus+1]);*/
  
  x1 = x + 1;
  y1 = y + 1;
  /*  x2 = x1 + window->w;
      y2 = y1 + window->h;*/
    
  hires_gotoxy(x, y);
  ctk_hires_windowparams.w = window->w;
  ctk_hires_windowparams.h = window->h;
  if(clipy1 < y) {
    ctk_hires_windowparams.clipy1 = 0;
  } else {
    ctk_hires_windowparams.clipy1 = clipy1 - y;
  }
  ctk_hires_windowparams.clipy2 = clipy2 - y;
  ctk_hires_windowparams.color1 = ctk_hires_theme.windowcolors[focus+1];
  ctk_hires_windowparams.color2 = ctk_hires_theme.windowcolors[focus];
  ctk_hires_windowparams.title = window->title;
  ctk_hires_windowparams.titlelen = window->titlelen;

  if(ctk_hires_windowparams.clipy1 < ctk_hires_windowparams.clipy2 &&
     ctk_hires_windowparams.clipy2 > 0) {
    ctk_hires_draw_windowborders();
  }
  
  /* Draw inactive widgets. */
  for(w = window->inactive; w != NULL; w = w->next) {
    draw_widget(w, x1, y1,
		clipy1, clipy2,
		focus);
  }
  
  /* Draw active widgets. */
  for(w = window->active; w != NULL; w = w->next) {  
    wfocus = focus;
    if(w == window->focused) {
      wfocus |= CTK_FOCUS_WIDGET;
    }
    draw_widget(w, x1, y1,
		clipy1, clipy2,
		wfocus);
  }
}
/*--------------------------------------------------------------------------*/
static void
s_ctk_draw_window(struct ctk_window *window,
		  unsigned char focus,
		  unsigned char clipy1,
		  unsigned char clipy2)
{
  struct ctk_widget *w;
  unsigned char wfocus;
  int x, y, x1, y1, x2, y2;

  x = window->x;
  y = window->y + MENU_HEIGHT;
  
  x1 = x + WINDOWBORDER_WIDTH;
  y1 = y + WINDOWTITLE_HEIGHT;
  x2 = x1 + window->w;
  y2 = y1 + window->h;

  /* Draw window border */
  gdk_draw_rectangle(ctk_gtksim_pixmap,
		     darkgray,
		     FALSE,
		     x * RASTER_X,
		     y * RASTER_Y + MENUBAR_HEIGHT,
		     (window->w + 2 * WINDOWBORDER_WIDTH) * RASTER_X,
		     (window->h + WINDOWTITLE_HEIGHT +
		                  WINDOWBORDER_HEIGHT) * RASTER_Y);

  if(ctk_mode_get() == CTK_MODE_WINDOWMOVE) {
    if(focus & CTK_FOCUS_WINDOW) {
      gdk_draw_rectangle(ctk_gtksim_pixmap,
			 white,
			 TRUE,
			 x * RASTER_X + 1,
			 y * RASTER_Y + MENUBAR_HEIGHT + 1,
			 (window->w + 2 * WINDOWBORDER_WIDTH) * RASTER_X - 2,
			 (window->h + WINDOWTITLE_HEIGHT +
			  WINDOWBORDER_HEIGHT) * RASTER_Y - 2);
    } else {
      gdk_draw_rectangle(ctk_gtksim_pixmap,
			 midgray,
			 TRUE,
			 x * RASTER_X + 1,
			 y * RASTER_Y + MENUBAR_HEIGHT + 1,
			 (window->w + 2 * WINDOWBORDER_WIDTH) * RASTER_X - 2,
			 (window->h + WINDOWTITLE_HEIGHT +
			  WINDOWBORDER_HEIGHT) * RASTER_Y - 2);
    }
    return;
  }
  
  if(windowborder == NULL) {
    gdk_draw_rectangle(ctk_gtksim_pixmap,
		       midgray,
		       TRUE,
		       x * RASTER_X,
		       y * RASTER_Y + MENUBAR_HEIGHT,
		       (window->w + 2 * WINDOWBORDER_WIDTH) * RASTER_X,
		       WINDOWTITLE_HEIGHT * RASTER_Y);
  } else {
    gdk_draw_pixbuf(ctk_gtksim_pixmap,
		    midgray,
		    windowborder,
		    0, 0,
		    x * RASTER_X,
		    y * RASTER_Y + MENUBAR_HEIGHT,
		    (window->w + 2 * WINDOWBORDER_WIDTH) * RASTER_X,
		    WINDOWTITLE_HEIGHT * RASTER_Y,
		    GDK_RGB_DITHER_NONE, 0, 0);
  }
  
  
  gdk_draw_line(ctk_gtksim_pixmap,
		darkgray,
		x * RASTER_X,
		(y + WINDOWTITLE_HEIGHT) * RASTER_Y - 1 + MENUBAR_HEIGHT,
		(x + window->w + 2 * WINDOWBORDER_WIDTH) * RASTER_X,
		(y + WINDOWTITLE_HEIGHT) * RASTER_Y - 1 + MENUBAR_HEIGHT);

  
  /* Draw inactive widgets. */
  for(w = window->inactive; w != NULL; w = w->next) {
    draw_widget(w, x1, y1, x2, y2,
		clipy1, clipy2,
		focus);
  }
  
  /* Draw active widgets. */
  for(w = window->active; w != NULL; w = w->next) {
    wfocus = focus;
    if(w == window->focused) {
      wfocus |= CTK_FOCUS_WIDGET;
    }

   draw_widget(w, x1, y1, x2, y2,
	       clipy1, clipy2,
	       wfocus);
  }

  ctk_gtksim_set_redrawflag();
}
Exemplo n.º 27
0
void scroller::handle_event(Event &ev, image *screen, InputManager *inm)
{
  int mx=ev.mouse_move.x,my=ev.mouse_move.y;
  switch (ev.type)
  {
    case EV_MOUSE_BUTTON :
    {
      if (ev.mouse_button && drag==-1)
      {
    if (mx>=b1x() && mx<b1x()+bw() && my>=b1y()-2 && my<b1y()+bh())
    {
      if (sx>0)
      {
        draw_widget(screen,1);
        sx--;
        draw_widget(screen,0);
        scroll_event(sx,screen);
      }
    } else if (mx>=b2x() && mx<b2x()+bw() && my>=b2y() && my<=b2y()+bh())
    {
      if (sx<t-1)
      {
        draw_widget(screen,1);
        sx++;
        draw_widget(screen,0);
        scroll_event(sx,screen);
      }
    }
    else
    {
      int dx1,dy1,dx2,dy2;
      dragger_area(dx1,dy1,dx2,dy2);
      if (mx>=dx1 && mx<=dx2 && my>=dy1 && my<=dy2)
      {
        int x1,y1,x2,y2;
        wig_area(x1,y1,x2,y2);
        if (mx>=x1 && mx<=x2 && my>=y1 && my<=y2)
        {
          drag=sx;
          inm->grab_focus(this);
        }
        else if (t>1)
        {
          int nx=mouse_to_drag(mx,my);
          if (nx!=sx && nx>=0 && nx<t)
          {
        draw_widget(screen,1);
        sx=nx;
        draw_widget(screen,0);
        scroll_event(sx,screen);
          }
        }
      } else handle_inside_event(ev,screen,inm);
    }
      } else if (!ev.mouse_button && drag!=-1)
      {
    inm->release_focus();
    drag=-1;
      }
    } break;

    case EV_MOUSE_MOVE :
    {
      if (drag!=-1)
      {
    int nx=mouse_to_drag(mx,my);
    if (nx<0) nx=0; else if (nx>=t) nx=t-1;
    if (nx!=sx)
    {
      draw_widget(screen,1);
      sx=nx;
      draw_widget(screen,0);
      scroll_event(sx,screen);
    }
      } else if ( activate_on_mouse_move())
      {
    int x1,y1,x2,y2;
    wig_area(x1,y1,x2,y2);
    if (mx>=m_pos.x && mx<=m_pos.x+l-1 && my>=m_pos.y && my<=m_pos.y+h-1)
      handle_inside_event(ev,screen,inm);
      }

    } break;
    case EV_KEY :
    {
      switch (ev.key)
      {
    case JK_LEFT :
    { handle_left(screen,inm); } break;
    case JK_RIGHT :
    { handle_right(screen,inm); } break;
    case JK_UP :
    { handle_up(screen,inm); } break;
    case JK_DOWN :
    { handle_down(screen,inm); } break;

    default :
      handle_inside_event(ev,screen,inm);
      }
    } break;
  }
}
Exemplo n.º 28
0
//========================================================== draw
//===============================================================
void TFWidgetRen::draw()
{
  if(gluvv.picking) fill();

  if(gluvv.tf.paintme){
    brush->rasterize(gluvv.tf.paintex);
    gluvv.tf.paintme = 0;
  }

  float dist = pos[2] - gluvv.env.eye[2];

  width  = ((gluvv.env.frustum[1]-gluvv.env.frustum[0]) * 
	    dist/gluvv.env.clip[0]) * screenwidth;
  height = ((gluvv.env.frustum[3]-gluvv.env.frustum[2]) * 
	    dist/gluvv.env.clip[0]) * screenheight;

  tris->setWH(width-ballRad*2, height-ballRad*2);
  brush->setWH(width-ballRad*2, height-ballRad*2);

  pos[0] = ((gluvv.env.frustum[1]-gluvv.env.frustum[0]) * 
	    dist/gluvv.env.clip[0]) * screenpos[0];
  pos[1] = ((gluvv.env.frustum[1]-gluvv.env.frustum[0]) * 
	    dist/gluvv.env.clip[0]) * screenpos[1];

  barRad = ((gluvv.env.frustum[1]-gluvv.env.frustum[0]) * 
  	    dist/gluvv.env.clip[0]) * screenbar;

  ballRad = ((gluvv.env.frustum[1]-gluvv.env.frustum[0]) * 
	     dist/gluvv.env.clip[0]) * screenball;

  tris->setBallBar(ballRad/2.0, barRad/2.0);
  brush->setBallBar(ballRad/2.0, barRad/2.0);
  
  glEnable(GL_LIGHTING);
  glEnable(GL_DEPTH_TEST);

  defaultMaterial();

  gluvvPushName();
  glPushName(22);
  glPushName(222);
  glPushName(2222);
  
  glPushMatrix();{

    glTranslatef(pos[0], pos[1], pos[2]);
    glRotatef(180, 0, 1, 0);
    glDrawBuffer(GL_BACK);
    draw_widget();
    glDrawBuffer(GL_FRONT);
    draw_widget();

  } glPopMatrix();

  gluvvPopNames();
  TFWidgetRenGlErr("draw");

  glFlush();

  if(gluvv.picking) transparent();
}