Beispiel #1
0
GtkWidget* wxPizza::New(long windowStyle)
{
    GtkWidget* widget = GTK_WIDGET(g_object_new(type(), NULL));
    wxPizza* pizza = WX_PIZZA(widget);
    pizza->m_children = NULL;
    pizza->m_scroll_x = 0;
    pizza->m_scroll_y = 0;
    pizza->m_windowStyle = windowStyle;
#ifdef __WXGTK3__
    gtk_widget_set_has_window(widget, true);
#else
    gtk_fixed_set_has_window(GTK_FIXED(widget), true);
#endif
    gtk_widget_add_events(widget,
        GDK_EXPOSURE_MASK |
        GDK_SCROLL_MASK |
        GDK_POINTER_MOTION_MASK |
        GDK_POINTER_MOTION_HINT_MASK |
        GDK_BUTTON_MOTION_MASK |
        GDK_BUTTON1_MOTION_MASK |
        GDK_BUTTON2_MOTION_MASK |
        GDK_BUTTON3_MOTION_MASK |
        GDK_BUTTON_PRESS_MASK |
        GDK_BUTTON_RELEASE_MASK |
        GDK_KEY_PRESS_MASK |
        GDK_KEY_RELEASE_MASK |
        GDK_ENTER_NOTIFY_MASK |
        GDK_LEAVE_NOTIFY_MASK |
        GDK_FOCUS_CHANGE_MASK);
    return widget;
}
Beispiel #2
0
GtkWidget* wxPizza::New(long windowStyle)
{
    GtkWidget* widget = GTK_WIDGET(g_object_new(type(), NULL));
    wxPizza* pizza = WX_PIZZA(widget);
    pizza->m_scroll_x = 0;
    pizza->m_scroll_y = 0;
    pizza->m_is_scrollable = (windowStyle & (wxHSCROLL | wxVSCROLL)) != 0;
    // mask off border styles not useable with wxPizza
    pizza->m_border_style = int(windowStyle & BORDER_STYLES);
#if GTK_CHECK_VERSION(3,0,0) || defined(GTK_DISABLE_DEPRECATED)
    gtk_widget_set_has_window(widget, true);
#else
    gtk_fixed_set_has_window(GTK_FIXED(widget), true);
#endif
    gtk_widget_add_events(widget,
        GDK_EXPOSURE_MASK |
        GDK_SCROLL_MASK |
        GDK_POINTER_MOTION_MASK |
        GDK_POINTER_MOTION_HINT_MASK |
        GDK_BUTTON_MOTION_MASK |
        GDK_BUTTON1_MOTION_MASK |
        GDK_BUTTON2_MOTION_MASK |
        GDK_BUTTON3_MOTION_MASK |
        GDK_BUTTON_PRESS_MASK |
        GDK_BUTTON_RELEASE_MASK |
        GDK_KEY_PRESS_MASK |
        GDK_KEY_RELEASE_MASK |
        GDK_ENTER_NOTIFY_MASK |
        GDK_LEAVE_NOTIFY_MASK |
        GDK_FOCUS_CHANGE_MASK);
    return widget;
}
Beispiel #3
0
static void
glide_window_insert_stage (GlideWindow *w)
{
  ClutterColor cblack = {0x00, 0x00, 0x00, 0xff};
  GtkWidget *fixed = GTK_WIDGET (gtk_builder_get_object (w->priv->builder, "embed-fixed"));
  GtkWidget *embed = glide_window_make_embed ();
  GdkColor black;
  
  gtk_fixed_set_has_window (GTK_FIXED (fixed), TRUE); 

  // Nasty hack.
  g_signal_connect (fixed, "key-press-event",
		    G_CALLBACK (glide_window_fixed_key_press_event),
		    NULL);


  gdk_color_parse ("black", &black);
  gtk_widget_modify_bg (fixed, GTK_STATE_NORMAL, &black);
  
  w->priv->embed = embed;
  
  w->priv->stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (embed));
  clutter_actor_set_size (w->priv->stage, DEFAULT_PRESENTATION_WIDTH, DEFAULT_PRESENTATION_HEIGHT);
  
  clutter_actor_show (w->priv->stage);
  
  clutter_stage_set_color (CLUTTER_STAGE (w->priv->stage), &cblack);
  
  gtk_fixed_put (GTK_FIXED (fixed), embed, 0, 0);
  gtk_widget_set_size_request (fixed, DEFAULT_PRESENTATION_WIDTH, DEFAULT_PRESENTATION_HEIGHT);
  gtk_widget_set_size_request (embed, DEFAULT_PRESENTATION_WIDTH, DEFAULT_PRESENTATION_HEIGHT);
  
  g_signal_connect_after (fixed, "size-allocate", G_CALLBACK (glide_window_fixed_embed_size_allocate), w);
}
Beispiel #4
0
GtkWidget* wxPizza::New(long windowStyle,void* owner)
{
    GtkWidget* widget = GTK_WIDGET(g_object_new(type(), NULL));
    wxPizza* pizza = WX_PIZZA(widget);
    pizza->m_owner = owner;
    pizza->m_backing_window = NULL;
    pizza->m_scroll_x = 0;
    pizza->m_scroll_y = 0;
    pizza->m_is_scrollable = (windowStyle & (wxHSCROLL | wxVSCROLL)) != 0;
    // mask off border styles not useable with wxPizza
    pizza->m_border_style = int(windowStyle & BORDER_STYLES);
    gtk_fixed_set_has_window(GTK_FIXED(widget), true);
    gtk_widget_add_events(widget,
        GDK_EXPOSURE_MASK |
        GDK_SCROLL_MASK |
        GDK_POINTER_MOTION_MASK |
        GDK_POINTER_MOTION_HINT_MASK |
        GDK_BUTTON_MOTION_MASK |
        GDK_BUTTON1_MOTION_MASK |
        GDK_BUTTON2_MOTION_MASK |
        GDK_BUTTON3_MOTION_MASK |
        GDK_BUTTON_PRESS_MASK |
        GDK_BUTTON_RELEASE_MASK |
        GDK_KEY_PRESS_MASK |
        GDK_KEY_RELEASE_MASK |
        GDK_ENTER_NOTIFY_MASK |
        GDK_LEAVE_NOTIFY_MASK |
        GDK_FOCUS_CHANGE_MASK);
    return widget;
}
Beispiel #5
0
int
clip_GTK_FIXEDSETHASWINDOW(ClipMachine * cm)
{
	C_widget *cfix = _fetch_cw_arg(cm);
        gboolean  hasw = _clip_parl(cm, 2);

        CHECKCWID(cfix,GTK_IS_FIXED);
        CHECKARG(2, LOGICAL_t);

        gtk_fixed_set_has_window(GTK_FIXED(cfix->widget), hasw);

	return 0;
err:
	return 1;
}
Beispiel #6
0
GtkWidget *
hex_document_add_view (HexDocument *doc)
{
  GtkWidget *new_view;

  new_view = gtk_hex_new(doc);

#if GTK_CHECK_VERSION (2,18,0)
  gtk_widget_set_has_window (GTK_WIDGET (new_view), TRUE);
#else
  gtk_fixed_set_has_window (GTK_FIXED(new_view), TRUE);
#endif

  g_object_ref(new_view);

  doc->views = g_list_append(doc->views, new_view);

  return new_view;
}
Beispiel #7
0
static int gtkFrameMapMethod(Ihandle* ih)
{
  char *value, *title;
  GtkWidget *fixed;

  if (!ih->parent)
    return IUP_ERROR;

  title = iupAttribGet(ih, "TITLE");

  ih->handle = gtk_frame_new(NULL);
  if (!ih->handle)
    return IUP_ERROR;

  if (title)
    iupAttribSetStr(ih, "_IUPFRAME_HAS_TITLE", "1");
  else
  {
    value = iupAttribGetStr(ih, "SUNKEN");
    if (iupStrBoolean(value))
      gtk_frame_set_shadow_type((GtkFrame*)ih->handle, GTK_SHADOW_IN);
    else
      gtk_frame_set_shadow_type((GtkFrame*)ih->handle, GTK_SHADOW_ETCHED_IN);

    if (iupAttribGet(ih, "BGCOLOR"))
      iupAttribSetStr(ih, "_IUPFRAME_HAS_BGCOLOR", "1");
  }

  /* the container that will receive the child element. */
  fixed = gtk_fixed_new();
  if (iupAttribGet(ih, "_IUPFRAME_HAS_BGCOLOR"))
    gtk_fixed_set_has_window((GtkFixed*)fixed, TRUE);
  gtk_container_add((GtkContainer*)ih->handle, fixed);
  gtk_widget_show(fixed);

  /* Add to the parent, all GTK controls must call this. */
  iupgtkBaseAddToParent(ih);

  gtk_widget_realize(ih->handle);

  return IUP_NOERROR;
}
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkPanelPeer_create
(JNIEnv *env, jobject obj)
{
    GtkWidget *widget;

    gdk_threads_enter ();

    gtkpeer_set_global_ref (env, obj);

    widget = gtk_fixed_new ();

    gtk_fixed_set_has_window (GTK_FIXED (widget), TRUE);

    GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_FOCUS);

    gtkpeer_set_widget (env, obj, widget);

    gdk_threads_leave ();
}
Beispiel #9
0
static int gtkButtonMapMethod(Ihandle* ih)
{
  int impress;
  char* value;

  value = iupAttribGet(ih, "IMAGE");
  if (value)
  {
    ih->data->type = IUP_BUTTON_IMAGE;

    value = iupAttribGet(ih, "TITLE");
    if (value && *value!=0)
      ih->data->type |= IUP_BUTTON_TEXT;
  }
  else
    ih->data->type = IUP_BUTTON_TEXT;

  if (ih->data->type == IUP_BUTTON_IMAGE &&
      iupAttribGet(ih, "IMPRESS") &&
      !iupAttribGetBoolean(ih, "IMPRESSBORDER"))
  {
    GtkWidget *img = gtk_image_new();
    ih->handle = gtk_event_box_new();
    gtk_container_add((GtkContainer*)ih->handle, img);
    gtk_widget_show(img);
    iupAttribSetStr(ih, "_IUPGTK_EVENTBOX", "1");
  }
  else
    ih->handle = gtk_button_new();

  if (!ih->handle)
    return IUP_ERROR;

  if (ih->data->type & IUP_BUTTON_IMAGE)
  {
    if (!iupAttribGet(ih, "_IUPGTK_EVENTBOX"))
    {
      gtk_button_set_image((GtkButton*)ih->handle, gtk_image_new());

      if (ih->data->type & IUP_BUTTON_TEXT)
      {
        GtkSettings* settings = gtk_widget_get_settings(ih->handle);
        g_object_set(settings, "gtk-button-images", (int)TRUE, NULL);

        gtk_button_set_label((GtkButton*)ih->handle, iupgtkStrConvertToUTF8(iupAttribGet(ih, "TITLE")));
      
#if GTK_CHECK_VERSION(2, 10, 0)
        gtk_button_set_image_position((GtkButton*)ih->handle, ih->data->img_position);  /* IUP and GTK have the same Ids */
#endif
      }
    }
  }
  else
  {
    char* title = iupAttribGet(ih, "TITLE");
    if (!title) 
    {
      if (iupAttribGet(ih, "BGCOLOR"))
      {
        int x=0, y=0;
        GtkWidget* frame = gtk_frame_new(NULL);
#if GTK_CHECK_VERSION(2, 18, 0)
        GtkWidget* drawarea = gtk_drawing_area_new();
        gtk_widget_set_has_window(drawarea, TRUE);
#else
        GtkWidget* drawarea = gtk_fixed_new();
        gtk_fixed_set_has_window(GTK_FIXED(drawarea), TRUE);
#endif
        gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN);
        iupdrvButtonAddBorders(&x, &y);
        gtk_widget_set_size_request (frame, ih->currentwidth-x, ih->currentheight-y);
        gtk_container_add(GTK_CONTAINER(frame), drawarea);
        gtk_widget_show(drawarea);

        gtk_button_set_image((GtkButton*)ih->handle, frame);
      }
      else
        gtk_button_set_label((GtkButton*)ih->handle, "");
    }
    else
      gtk_button_set_label((GtkButton*)ih->handle, iupgtkStrConvertToUTF8(title));
  }

  /* add to the parent, all GTK controls must call this. */
  iupgtkAddToParent(ih);

  if (!iupAttribGetBoolean(ih, "CANFOCUS"))
    iupgtkSetCanFocus(ih->handle, 0);

  value = iupAttribGet(ih, "IMPRESS");
  impress = (ih->data->type & IUP_BUTTON_IMAGE && value)? 1: 0;
  if (!impress && iupAttribGetBoolean(ih, "FLAT"))
  {
    gtk_button_set_relief((GtkButton*)ih->handle, GTK_RELIEF_NONE);

    g_signal_connect(G_OBJECT(ih->handle), "enter-notify-event", G_CALLBACK(gtkButtonEnterLeaveEvent), ih);
    g_signal_connect(G_OBJECT(ih->handle), "leave-notify-event", G_CALLBACK(gtkButtonEnterLeaveEvent), ih);
  }
  else
  {
    if (!iupAttribGet(ih, "_IUPGTK_EVENTBOX"))
    {
      if (impress && !iupAttribGetStr(ih, "IMPRESSBORDER"))
        gtk_button_set_relief((GtkButton*)ih->handle, GTK_RELIEF_NONE);
      else
        gtk_button_set_relief((GtkButton*)ih->handle, GTK_RELIEF_NORMAL);
    }

    g_signal_connect(G_OBJECT(ih->handle), "enter-notify-event", G_CALLBACK(iupgtkEnterLeaveEvent), ih);
    g_signal_connect(G_OBJECT(ih->handle), "leave-notify-event", G_CALLBACK(iupgtkEnterLeaveEvent), ih);
  }

  g_signal_connect(G_OBJECT(ih->handle), "focus-in-event",     G_CALLBACK(iupgtkFocusInOutEvent), ih);
  g_signal_connect(G_OBJECT(ih->handle), "focus-out-event",    G_CALLBACK(iupgtkFocusInOutEvent), ih);
  g_signal_connect(G_OBJECT(ih->handle), "key-press-event",    G_CALLBACK(iupgtkKeyPressEvent), ih);
  g_signal_connect(G_OBJECT(ih->handle), "show-help",          G_CALLBACK(iupgtkShowHelp), ih);

  if (!iupAttribGet(ih, "_IUPGTK_EVENTBOX"))
    g_signal_connect(G_OBJECT(ih->handle), "clicked", G_CALLBACK(gtkButtonClicked), ih);

  g_signal_connect(G_OBJECT(ih->handle), "button-press-event", G_CALLBACK(gtkButtonEvent), ih);
  g_signal_connect(G_OBJECT(ih->handle), "button-release-event",G_CALLBACK(gtkButtonEvent), ih);

  gtk_widget_realize(ih->handle);

  /* update a mnemonic in a label if necessary */
  iupgtkUpdateMnemonic(ih);

  return IUP_NOERROR;
}
Beispiel #10
0
static void egg_tray_icon_update_manager_window (EggTrayIcon *icon) {

	static GdkPixbuf *background_pixbuf;
	const gchar *window_manager=NULL;

	if (icon->manager_window != None) {
		GdkWindow *gdkwin;
		gdkwin = gdk_window_lookup (icon->manager_window);
		gdk_window_remove_filter (gdkwin, egg_tray_icon_manager_filter, icon);
	}

	XGrabServer (GDK_DISPLAY());

	icon->manager_window = XGetSelectionOwner (GDK_DISPLAY(),
			icon->selection_atom);

	if (icon->manager_window != None)
		XSelectInput (GDK_DISPLAY(), icon->manager_window, StructureNotifyMask);

	XUngrabServer (GDK_DISPLAY());
	XFlush (GDK_DISPLAY());

	if (icon->manager_window == None)
		return;

	window_manager=gdk_x11_screen_get_window_manager_name (gdk_screen_get_default());

	if ( !g_ascii_strcasecmp(window_manager, kde_window_manger) && kde_dock (icon)) {

		if ((background_pixbuf=kde_dock_background(icon)) !=NULL) {

			icon->box= gtk_fixed_new ();
			gtk_fixed_set_has_window(GTK_FIXED (icon->box),TRUE);
			gtk_container_add(GTK_CONTAINER(icon), icon->box);

			icon->image=gtk_image_new ();
			gtk_image_set_from_pixbuf(GTK_IMAGE(icon->image), icon->default_pix);

			icon->background =gtk_image_new ();
			gtk_image_set_from_pixbuf(GTK_IMAGE(icon->background), background_pixbuf);

			gtk_fixed_put (GTK_FIXED (icon->box), GTK_WIDGET(icon->background), 0, 0);
			gtk_fixed_put (GTK_FIXED (icon->box), GTK_WIDGET(icon->image), 0, 0);

			gtk_widget_show (icon->background);
			gtk_widget_show (icon->image);
			gtk_widget_show(icon->box);

			icon->ready=TRUE;
		}
	} else {

		icon->box=gtk_event_box_new ();
		gtk_container_add(GTK_CONTAINER(icon), icon->box);

		icon->image=gtk_image_new ();
		gtk_image_set_from_pixbuf(GTK_IMAGE(icon->image),icon->default_pix);
		gtk_container_add(GTK_CONTAINER(icon->box), icon->image);

		gtk_widget_show (icon->image);
		gtk_widget_show(icon->box);

		GdkWindow *gdkwin;

		gdkwin = gdk_window_lookup (icon->manager_window);
		gdk_window_add_filter (gdkwin, egg_tray_icon_manager_filter, icon);

		/* Send a request that we'd like to dock */
		egg_tray_icon_send_dock_request (icon);
	}
}
Beispiel #11
0
void Create_system_NB_T( void *parent )
{
	GtkWidget* pageSystemEventBox;
	GtkWidget* model_label;
	GtkWidget* fixed_pageSystem, *fixed;
	GtkWidget *eventbox;
	gchar* markup;
	static GtkWidget *label;
	int i = 0;
	int len = 0;

	int pos_x = 30;
	int pos_y = 15;



	pageSystemEventBox = gtk_event_box_new();
	gtk_widget_set_usize((GtkWidget *)pageSystemEventBox,88,57);
	label = gtk_label_new(_("System"));
	markup = g_markup_printf_escaped (MENUTITLESTYLE,\
		_("System"));
	gtk_label_set_markup (GTK_LABEL (label), markup);
	g_free (markup);
	gtk_container_add (GTK_CONTAINER (pageSystemEventBox), label);
	fixed_pageSystem = gtk_fixed_new();
	gtk_fixed_set_has_window((GtkFixed *)fixed_pageSystem,1);
	gtk_widget_set_usize((GtkWidget *)fixed_pageSystem,783,358);
	
	set_widget_bc_pixmap((GtkWidget *)fixed_pageSystem,TP2_TAB_CONTANT_BG_IMG,NULL,NULL);
	ZJ_TabView_append_page((TABVIEW*)parent,fixed_pageSystem,pageSystemEventBox);


#if 1

	fixed = fixed_pageSystem;



	eventbox = gtk_event_box_new ();
	gtk_widget_set_app_paintable (GTK_WIDGET (eventbox), TRUE);
	
	set_widget_bc_pixmap((GtkWidget*)eventbox,TP2_MENUBUTTON_IMG,NULL,NULL);	
	gtk_widget_set_size_request (GTK_WIDGET (eventbox), TP2EVENTBOX_W, TP2EVENTBOX_H);
	gtk_widget_set_uposition(eventbox,pos_x,pos_y);

	gtk_container_add (GTK_CONTAINER (fixed_pageSystem), eventbox);
	label = gtk_label_new(_("Language"));
	markup = g_markup_printf_escaped (UNACTBTNPARASTYLE, \
		g_locale_to_utf8(_("Language"), -1, NULL, NULL, NULL));
	gtk_label_set_markup (GTK_LABEL (label), markup);
	g_free (markup);
	gtk_container_add (GTK_CONTAINER (eventbox), label);

	g_signal_connect (G_OBJECT (eventbox), "enter-notify-event",G_CALLBACK (mouse_event_handle), SYS_LANGUAGE);
	g_signal_connect (G_OBJECT (eventbox), "leave-notify-event",G_CALLBACK (mouse_event_handle), SYS_LANGUAGE);
	g_signal_connect (G_OBJECT (eventbox), "button-press-event",G_CALLBACK (mouse_event_handle), SYS_LANGUAGE);
	g_signal_connect (G_OBJECT (eventbox), "button-release-event",G_CALLBACK (mouse_event_handle), SYS_LANGUAGE);
	if(pos_x<550)
	{
		pos_x+=TP2EVENTBOX_W+30;
	}
	else
	{
		pos_x = 30;
		pos_y += TP2EVENTBOX_H+16;
	}


	eventbox = gtk_event_box_new ();
	gtk_widget_set_app_paintable (GTK_WIDGET (eventbox), TRUE);
	gtk_container_add (GTK_CONTAINER (fixed), eventbox);
	set_widget_bc_pixmap((GtkWidget*)eventbox,TP2_MENUBUTTON_IMG,NULL,NULL);	
	gtk_widget_set_size_request (GTK_WIDGET (eventbox), TP2EVENTBOX_W, TP2EVENTBOX_H);
	gtk_widget_set_uposition(eventbox,pos_x,pos_y);

	label = gtk_label_new(_("Desktop"));
	//markup = g_markup_printf_escaped (BTNPARASTYLE,
	//	g_locale_to_utf8(_("Desktop"), -1, NULL, NULL, NULL));
	markup = g_markup_printf_escaped (BTNPARASTYLE,
		_("Desktop"));
	gtk_label_set_markup (GTK_LABEL (label), markup);
	g_free (markup);
	gtk_container_add (GTK_CONTAINER (eventbox), label);

	g_signal_connect (G_OBJECT (eventbox), "enter-notify-event",G_CALLBACK (mouse_event_handle), SYS_RETURN2DESKTOP);
	g_signal_connect (G_OBJECT (eventbox), "leave-notify-event",G_CALLBACK (mouse_event_handle), SYS_RETURN2DESKTOP);
	g_signal_connect (G_OBJECT (eventbox), "button-press-event",G_CALLBACK (mouse_event_handle), SYS_RETURN2DESKTOP);
	g_signal_connect (G_OBJECT (eventbox), "button-release-event",G_CALLBACK (mouse_event_handle), SYS_RETURN2DESKTOP);
	if(pos_x<550)
	{
		pos_x+=TP2EVENTBOX_W+30;
	}
	else
	{
		pos_x = 30;
		pos_y += TP2EVENTBOX_H+16;
	}



	eventbox = gtk_event_box_new ();
	gtk_widget_set_app_paintable (GTK_WIDGET (eventbox), TRUE);
	gtk_container_add (GTK_CONTAINER (fixed), eventbox);
	set_widget_bc_pixmap((GtkWidget*)eventbox,TP2_MENUBUTTON_IMG,NULL,NULL);	
	gtk_widget_set_size_request (GTK_WIDGET (eventbox), TP2EVENTBOX_W, TP2EVENTBOX_H);
	gtk_widget_set_uposition(eventbox,pos_x,pos_y);

	label = gtk_label_new(_("Zoom"));
	markup = g_markup_printf_escaped (UNACTBTNPARASTYLE, \
		_("Zoom"));
	gtk_label_set_markup (GTK_LABEL (label), markup);
	g_free (markup);
	gtk_container_add (GTK_CONTAINER (eventbox), label);

	g_signal_connect (G_OBJECT (eventbox), "enter-notify-event",G_CALLBACK (mouse_event_handle), NULL);
	g_signal_connect (G_OBJECT (eventbox), "leave-notify-event",G_CALLBACK (mouse_event_handle), NULL);
	g_signal_connect (G_OBJECT (eventbox), "button-press-event",G_CALLBACK (mouse_event_handle), NULL);
	g_signal_connect (G_OBJECT (eventbox), "button-release-event",G_CALLBACK (mouse_event_handle), NULL);
	if(pos_x<550)
	{
		pos_x+=TP2EVENTBOX_W+30;
	}
	else
	{
		pos_x = 30;
		pos_y += TP2EVENTBOX_H+16;
	}


	eventbox = gtk_event_box_new ();
	gtk_widget_set_app_paintable (GTK_WIDGET (eventbox), TRUE);
	gtk_container_add (GTK_CONTAINER (fixed), eventbox);
	set_widget_bc_pixmap((GtkWidget*)eventbox,TP2_MENUBUTTON_IMG,NULL,NULL);	
	gtk_widget_set_size_request (GTK_WIDGET (eventbox), TP2EVENTBOX_W, TP2EVENTBOX_H);
	gtk_widget_set_uposition(eventbox,pos_x,pos_y);

	label = gtk_label_new(_("Report"));
	markup = g_markup_printf_escaped (UNACTBTNPARASTYLE, \
		_("Report"));
	gtk_label_set_markup (GTK_LABEL (label), markup);
	g_free (markup);
	gtk_container_add (GTK_CONTAINER (eventbox), label);

	g_signal_connect (G_OBJECT (eventbox), "enter-notify-event",G_CALLBACK (mouse_event_handle), NULL);
	g_signal_connect (G_OBJECT (eventbox), "leave-notify-event",G_CALLBACK (mouse_event_handle), NULL);
	g_signal_connect (G_OBJECT (eventbox), "button-press-event",G_CALLBACK (mouse_event_handle), NULL);
	g_signal_connect (G_OBJECT (eventbox), "button-release-event",G_CALLBACK (mouse_event_handle), NULL);
	if(pos_x<550)
	{
		pos_x+=TP2EVENTBOX_W+30;
	}
	else
	{
		pos_x = 30;
		pos_y += TP2EVENTBOX_H+16;
	}

	eventbox = gtk_event_box_new ();
	gtk_widget_set_app_paintable (GTK_WIDGET (eventbox), TRUE);
	gtk_container_add (GTK_CONTAINER (fixed), eventbox);
	set_widget_bc_pixmap((GtkWidget*)eventbox,TP2_MENUBUTTON_IMG,NULL,NULL);	
	gtk_widget_set_size_request (GTK_WIDGET (eventbox), TP2EVENTBOX_W, TP2EVENTBOX_H);
	gtk_widget_set_uposition(eventbox,pos_x,pos_y);

	label = gtk_label_new(_("iTouch"));
	markup = g_markup_printf_escaped (UNACTBTNPARASTYLE, \
		_("iTouch"));
	gtk_label_set_markup (GTK_LABEL (label), markup);
	g_free (markup);
	gtk_container_add (GTK_CONTAINER (eventbox), label);

	g_signal_connect (G_OBJECT (eventbox), "enter-notify-event",G_CALLBACK (mouse_event_handle), NULL);
	g_signal_connect (G_OBJECT (eventbox), "leave-notify-event",G_CALLBACK (mouse_event_handle), NULL);
	g_signal_connect (G_OBJECT (eventbox), "button-press-event",G_CALLBACK (mouse_event_handle), NULL);
	g_signal_connect (G_OBJECT (eventbox), "button-release-event",G_CALLBACK (mouse_event_handle), NULL);
	if(pos_x<550)
	{
		pos_x+=TP2EVENTBOX_W+30;
	}
	else
	{
		pos_x = 30;
		pos_y += TP2EVENTBOX_H+16;
	}


	eventbox = gtk_event_box_new ();
	gtk_widget_set_app_paintable (GTK_WIDGET (eventbox), TRUE);
	gtk_container_add (GTK_CONTAINER (fixed), eventbox);
	set_widget_bc_pixmap((GtkWidget*)eventbox,TP2_MENUBUTTON_IMG,NULL,NULL);	
	gtk_widget_set_size_request (GTK_WIDGET (eventbox), TP2EVENTBOX_W, TP2EVENTBOX_H);
	gtk_widget_set_uposition(eventbox,pos_x,pos_y);

	label = gtk_label_new(_("Patient"));
	markup = g_markup_printf_escaped (UNACTBTNPARASTYLE, \
		_("Patient"));
	gtk_label_set_markup (GTK_LABEL (label), markup);
	g_free (markup);
	gtk_container_add (GTK_CONTAINER (eventbox), label);

	g_signal_connect (G_OBJECT (eventbox), "enter-notify-event",G_CALLBACK (mouse_event_handle), NULL);
	g_signal_connect (G_OBJECT (eventbox), "leave-notify-event",G_CALLBACK (mouse_event_handle), NULL);
	g_signal_connect (G_OBJECT (eventbox), "button-press-event",G_CALLBACK (mouse_event_handle), NULL);
	g_signal_connect (G_OBJECT (eventbox), "button-release-event",G_CALLBACK (mouse_event_handle), NULL);
	if(pos_x<550)
	{
		pos_x+=TP2EVENTBOX_W+30;
	}
	else
	{
		pos_x = 30;
		pos_y += TP2EVENTBOX_H+16;
	}



	eventbox = gtk_event_box_new ();
	gtk_widget_set_app_paintable (GTK_WIDGET (eventbox), TRUE);
	gtk_container_add (GTK_CONTAINER (fixed), eventbox);
	set_widget_bc_pixmap((GtkWidget*)eventbox,TP2_MENUBUTTON_IMG,NULL,NULL);	
	gtk_widget_set_size_request (GTK_WIDGET (eventbox), TP2EVENTBOX_W, TP2EVENTBOX_H);
	gtk_widget_set_uposition(eventbox,pos_x,pos_y);

	label = gtk_label_new(_("Preset"));
	markup = g_markup_printf_escaped (UNACTBTNPARASTYLE, \
		_("Preset"));
	gtk_label_set_markup (GTK_LABEL (label), markup);
	g_free (markup);
	gtk_container_add (GTK_CONTAINER (eventbox), label);

	g_signal_connect (G_OBJECT (eventbox), "enter-notify-event",G_CALLBACK (mouse_event_handle), NULL);
	g_signal_connect (G_OBJECT (eventbox), "leave-notify-event",G_CALLBACK (mouse_event_handle), NULL);
	g_signal_connect (G_OBJECT (eventbox), "button-press-event",G_CALLBACK (mouse_event_handle), NULL);
	g_signal_connect (G_OBJECT (eventbox), "button-release-event",G_CALLBACK (mouse_event_handle), NULL);
	if(pos_x<550)
	{
		pos_x+=TP2EVENTBOX_W+30;
	}
	else
	{
		pos_x = 30;
		pos_y += TP2EVENTBOX_H+16;
	}


	eventbox = gtk_event_box_new ();
	gtk_widget_set_app_paintable (GTK_WIDGET (eventbox), TRUE);
	gtk_container_add (GTK_CONTAINER (fixed), eventbox);
	set_widget_bc_pixmap((GtkWidget*)eventbox,TP2_MENUBUTTON_IMG,NULL,NULL);	
	gtk_widget_set_size_request (GTK_WIDGET (eventbox), TP2EVENTBOX_W, TP2EVENTBOX_H);
	gtk_widget_set_uposition(eventbox,pos_x,pos_y);

	label = gtk_label_new(_("Probe"));
	markup = g_markup_printf_escaped (UNACTBTNPARASTYLE, \
		_("Probe"));
	gtk_label_set_markup (GTK_LABEL (label), markup);
	g_free (markup);
	gtk_container_add (GTK_CONTAINER (eventbox), label);

	g_signal_connect (G_OBJECT (eventbox), "enter-notify-event",G_CALLBACK (mouse_event_handle), NULL);
	g_signal_connect (G_OBJECT (eventbox), "leave-notify-event",G_CALLBACK (mouse_event_handle), NULL);
	g_signal_connect (G_OBJECT (eventbox), "button-press-event",G_CALLBACK (mouse_event_handle), NULL);
	g_signal_connect (G_OBJECT (eventbox), "button-release-event",G_CALLBACK (mouse_event_handle), NULL);
	if(pos_x<550)
	{
		pos_x+=TP2EVENTBOX_W+30;
	}
	else
	{
		pos_x = 30;
		pos_y += TP2EVENTBOX_H+16;
	}
#endif
}
Beispiel #12
0
void
CMark::show ()
{
	init ();

	fixed = gtk_fixed_new ();
	gtk_fixed_set_has_window(GTK_FIXED(fixed),TRUE);
	gtk_widget_set_size_request (fixed, Skin->mark.mark.w,
			      Skin->mark.mark.h);
	if (g_pReciteWord->status==STATUS_REVISE_TEST)
	{
		gtk_fixed_put (GTK_FIXED (g_pReciteWord->fixed), fixed, Skin->mark.mark.x[0], Skin->mark.mark.y[0]);
	}
	else
	{
		gtk_fixed_put (GTK_FIXED (g_pReciteWord->fixed), fixed,
		       (Skin->reciteword.width - Skin->mark.mark.w) / 2,
		       (Skin->reciteword.height -
			Skin->mark.mark.h) / 2);
	}
	gtk_widget_show (fixed);
	SetBackPixmap (fixed, Skin->mark.mark.p[0]);

	ok_button.create (fixed, Skin->mark.ok_button.x[0],
			  Skin->mark.ok_button.y[0],
			  Skin->mark.ok_button.p[0],
			  Skin->mark.ok_button.p[1],
			  Skin->mark.ok_button.p[2],
			  NULL, on_mark_ok_clicked);
	gchar tmpstr[256];
	if (g_pReciteWord->status==STATUS_REVISE_TEST)
	{
		gint wrongcount=0;
		for (int i = 0;i < g_pReciteWord->now_zu_wordcount; i++)
		{
			if (g_pReciteWord->revise_test->tested_wordlist_item_status[i] == S_right_2)
			{
				wrongcount++;
			}
		}		
		gint score=(((g_pReciteWord->now_zu_wordcount-wrongcount)*100)/g_pReciteWord->now_zu_wordcount);
		sprintf(tmpstr,"%2d",score);

		mark_label = gtk_label_new (tmpstr);
		gtk_widget_set_name (mark_label, "mark-mark_label");
		gtk_fixed_put (GTK_FIXED (fixed), mark_label,
		       Skin->mark.revise_test_mark_label.x[0],
		       Skin->mark.revise_test_mark_label.y[0]);
		gtk_widget_show (mark_label);
		sprintf(tmpstr,_("%d minutes and %d seconds"),(g_pReciteWord->revise_test->timecount / 60),(g_pReciteWord->revise_test->timecount % 60));
		info_label = gtk_label_new (tmpstr);
		gtk_fixed_put (GTK_FIXED (fixed), info_label,
		       Skin->mark.revise_test_time_label.x[0],
		       Skin->mark.revise_test_time_label.y[0]);
		gtk_widget_show (info_label);
	}
	else if (g_pReciteWord->status==STATUS_TYPING)
	{
		typing_pixmap = gtk_image_new_from_pixmap (Skin->mark.typing_pixmap.p[0], NULL);
		gtk_fixed_put (GTK_FIXED (fixed), typing_pixmap,
		       Skin->mark.typing_pixmap.x[0],
		       Skin->mark.typing_pixmap.y[0]);
		gtk_widget_show(typing_pixmap);
		
		sprintf(tmpstr,"%3d",g_pReciteWord->typing->speed_value);
		mark_label = gtk_label_new (tmpstr);
		gtk_widget_set_name (mark_label, "mark-mark_label");
		gtk_fixed_put (GTK_FIXED (fixed), mark_label,
		       Skin->mark.typing_mark_label.x[0],
		       Skin->mark.typing_mark_label.y[0]);
		gtk_widget_show (mark_label);
	}

}
Beispiel #13
0
int _tmain(int argc, _TCHAR* argv[])
{

	TABVIEW* my_tabview;
	GtkWidget *label;
	gchar *markup;
	int m_argc=1;
	char* commandLine={"gtkApplication"};
	char** m_argv = &commandLine;

	GtkWidget* page1EventBox,*page2EventBox,*page3EventBox,*fixed,*fixed2,*fixed3;
	int i = 0;
	int pos_x = 0;
	int pos_y = 0;

	GtkWidget* window,*windowfixed;

	GdkColor black;	
	GdkColor white;
	GdkColor blue;
	GdkColor yellow;
	GdkColor custom;

  


	gdk_color_parse("black", &black);
	gdk_color_parse("white", &white);
	gdk_color_parse("yellow", &yellow);	
	gdk_color_parse("#09181F", &blue);
	gdk_color_parse("#063087", &active);	
	gdk_color_parse("#060087", &prelight);
	gdk_color_parse("#203087", &selected);
	gdk_color_parse("#300006", &insensitive);


	gtk_init (&m_argc, &m_argv);

	window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_window_set_title(GTK_WINDOW(window),"tab");

	windowfixed = gtk_fixed_new();
	gtk_widget_set_usize(window,400,300);

	my_tabview = ZJ_Create_TabView(50,10,200,280);
	
	set_widget_bc_pixmap(window,"./pixmaps/bg.png",NULL,NULL);

	
	gtk_fixed_put((GtkFixed*)windowfixed,my_tabview->TabViewFixed,50,10);
	//gtk_widget_set_uposition(my_tabview->TabViewFixed,50,10);
	gtk_container_add((GtkContainer*)window,windowfixed);
	gtk_fixed_set_has_window((GtkFixed *)my_tabview->TabViewFixed,1);
	set_widget_bc_pixmap((GtkWidget *)my_tabview->TabViewFixed,"./pixmaps/bg.png",NULL,NULL);


	page1EventBox = gtk_event_box_new();
	gtk_widget_set_usize((GtkWidget *)page1EventBox,80,80);
	label = gtk_label_new("andrews");
	markup = g_markup_printf_escaped ("<span font_desc='Microsoft YaHei 12'  foreground=\"#00FF00\">%s</span>",\
		g_locale_to_utf8("andrews", -1, NULL, NULL, NULL));
	gtk_label_set_markup (GTK_LABEL (label), markup);
	g_free (markup);
	gtk_container_add (GTK_CONTAINER (page1EventBox), label);

	page2EventBox = gtk_event_box_new();
	gtk_widget_set_usize((GtkWidget *)page2EventBox,80,80);
	label = gtk_label_new("pack");
	markup = g_markup_printf_escaped ("<span font_desc='Microsoft YaHei 12'  foreground=\"#00FF00\">%s</span>",\
		g_locale_to_utf8("pack", -1, NULL, NULL, NULL));
	gtk_label_set_markup (GTK_LABEL (label), markup);
	g_free (markup);
	gtk_container_add (GTK_CONTAINER (page2EventBox), label);


	page3EventBox = gtk_event_box_new();
	gtk_widget_set_usize((GtkWidget *)page3EventBox,80,80);
	label = gtk_label_new("mj");
	markup = g_markup_printf_escaped ("<span font_desc='Microsoft YaHei 12'  foreground=\"#00FF00\">%s</span>",\
		g_locale_to_utf8("mj", -1, NULL, NULL, NULL));
	gtk_label_set_markup (GTK_LABEL (label), markup);
	g_free (markup);
	gtk_container_add (GTK_CONTAINER (page3EventBox), label);
	//gtk_widget_modify_bg(my_tabview->TabViewWindow, GTK_STATE_NORMAL, &custom);

	//newWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	fixed = gtk_fixed_new();
	//gtk_fixed_set_has_window((GtkFixed *)fixed,1);
	///gtk_widget_set_usize((GtkWidget *)fixed,200,200);
	//set_widget_bc_pixmap((GtkWidget *)fixed,"./pixmaps/tvbg.png",NULL,NULL);
	ZJ_TabView_append_page(my_tabview,fixed,page1EventBox);
	
	//gtk_widget_set_uposition((GtkWidget *)(fixed),0,40);
	//gtk_container_add((GtkContainer *)my_tabview->TabViewFixed,fixed);
	//gtk_fixed_put((GtkFixed*)my_tabview->TabViewFixed,fixed,0,40);
	//gtk_widget_modify_base(page1EventBox, GTK_STATE_NORMAL, &prelight);
	//gtk_widget_modify_bg(page1EventBox, GTK_STATE_ACTIVE, &active);
	//gtk_widget_modify_bg(page1EventBox, GTK_STATE_PRELIGHT, &prelight);
	//gtk_widget_modify_bg(page1EventBox, GTK_STATE_SELECTED, &selected);
	//gtk_widget_modify_bg(page1EventBox, GTK_STATE_INSENSITIVE, &insensitive);
	////gtk_widget_modify_bg(fixed, GTK_STATE_NORMAL, &white);
	for(i = 0;i<1;i++)
	{
		gchar *markup;
		GtkWidget *eventbox = gtk_event_box_new ();
		gtk_widget_set_app_paintable (GTK_WIDGET (eventbox), TRUE);
		gtk_container_add (GTK_CONTAINER (fixed), eventbox);
		//set_widget_bc_pixmap((GtkWidget*)eventbox,TP_COMMON_BTN_NORMAL_IMG,NULL,NULL);	
		gtk_widget_set_size_request (GTK_WIDGET (eventbox), 80, 80);
		gtk_widget_modify_bg(eventbox, GTK_STATE_NORMAL, &yellow);
		//gtk_widget_set_uposition(eventbox,pos_x,pos_y);
		gtk_fixed_put((GtkFixed*)fixed,eventbox,pos_x,pos_y);
		
		label = gtk_label_new("test");
		markup = g_markup_printf_escaped ("<span font_desc='Microsoft YaHei 12'  foreground=\"#00FF00\">%s</span>",\
			g_locale_to_utf8("test", -1, NULL, NULL, NULL));
		gtk_label_set_markup (GTK_LABEL (label), markup);
		g_free (markup);
		gtk_container_add (GTK_CONTAINER (eventbox), label);
		if(pos_x<400)
		{
			pos_x+=120+20;
		}
		else
		{
			pos_x = 125;
			pos_y += 80+20;
		}
	}

	fixed2 = gtk_fixed_new();
	ZJ_TabView_append_page(my_tabview,fixed2,page2EventBox);
	
	for(i = 0;i<1;i++)
	{
		GtkStyle* style;
		gchar *markup;
		GtkWidget *eventbox = gtk_button_new ();
		pos_x = 0;
		pos_y = 0;
		gtk_widget_set_app_paintable (GTK_WIDGET (eventbox), TRUE);
		gtk_container_add (GTK_CONTAINER (fixed2), eventbox);
		//set_widget_bc_pixmap((GtkWidget*)eventbox,TP_COMMON_BTN_NORMAL_IMG,NULL,NULL);	
		gtk_widget_set_size_request (GTK_WIDGET (eventbox), 80, 80);
		gtk_widget_modify_bg(eventbox, GTK_STATE_NORMAL, &yellow);
		//gtk_widget_set_uposition(eventbox,pos_x,pos_y);
		//gtk_fixed_put((GtkFixed*)fixed2,eventbox,pos_x,pos_y);
		

		gtk_widget_modify_bg(eventbox, GTK_STATE_ACTIVE, &active);
		gtk_widget_modify_bg(eventbox, GTK_STATE_PRELIGHT, &prelight);
		gtk_widget_modify_bg(eventbox, GTK_STATE_SELECTED, &selected);
		gtk_widget_modify_bg(eventbox, GTK_STATE_INSENSITIVE, &insensitive);
		/*
		label = gtk_label_new("pack");
		markup = g_markup_printf_escaped ("<span font_desc='Microsoft YaHei 12'  foreground=\"#00FF00\">%s</span>",\
			g_locale_to_utf8("pack", -1, NULL, NULL, NULL));
		gtk_label_set_markup (GTK_LABEL (label), markup);
		g_free (markup);
		gtk_container_add (GTK_CONTAINER (eventbox), label);*/
		if(pos_x<400)
		{
			pos_x+=120+20;
		}
		else
		{
			pos_x = 125;
			pos_y += 80+20;
		}
	}
	//	fixed3 = gtk_fixed_new();
	//ZJ_TabView_append_page(my_tabview,fixed3,page3EventBox);
	//
	//for(i = 0;i<1;i++)
	//{
	//	GtkStyle* style;
	//	gchar *markup;
	//	GtkWidget *eventbox = gtk_event_box_new ();
	//	pos_x = 0;
	//	pos_y = 0;
	//	gtk_widget_set_app_paintable (GTK_WIDGET (eventbox), TRUE);
	//	gtk_container_add (GTK_CONTAINER (fixed3), eventbox);
	//	//set_widget_bc_pixmap((GtkWidget*)eventbox,TP_COMMON_BTN_NORMAL_IMG,NULL,NULL);	
	//	gtk_widget_set_size_request (GTK_WIDGET (eventbox), 80, 80);
	//	gtk_widget_modify_bg(eventbox, GTK_STATE_NORMAL, &yellow);
	//	//gtk_widget_set_uposition(eventbox,pos_x,pos_y);
	//	gtk_fixed_put((GtkFixed*)fixed3,eventbox,pos_x,pos_y);
	//	
	//
	//	label = gtk_label_new("mj");
	//	markup = g_markup_printf_escaped ("<span font_desc='Microsoft YaHei 12'  foreground=\"#00FF00\">%s</span>",\
	//		g_locale_to_utf8("mj", -1, NULL, NULL, NULL));
	//	gtk_label_set_markup (GTK_LABEL (label), markup);
	//	g_free (markup);
	//	gtk_container_add (GTK_CONTAINER (eventbox), label);
	//	if(pos_x<400)
	//	{
	//		pos_x+=120+20;
	//	}
	//	else
	//	{
	//		pos_x = 125;
	//		pos_y += 80+20;
	//	}
	//}

	gtk_widget_show_all(window);
	gdk_threads_enter();
	gtk_main ();
	gdk_threads_leave();
	return 0;
}
Beispiel #14
0
int ZJ_TabView_append_page(TABVIEW* tabview, GtkWidget* child, GtkWidget* tab_EventBox)
{
	int len = 0;
	int tabview_w = 0;
	int tabview_h = 0;
	int pageeventbox_w = 0;
	int pageeventbox_h = 0;
	ptabpage newtabpage = (PAGE *)malloc(sizeof(PAGE));
	
	newtabpage->child = child;
	newtabpage->tab_EventBox = tab_EventBox;
	len = g_list_length(tabview->fistlist);
	len = len--;
	newtabpage->npage = len;
	if(!tabview->fistlist->data)
		tabview->fistlist = g_list_insert(tabview->fistlist,newtabpage,0);
	else
		tabview->fistlist = g_list_append(tabview->fistlist,newtabpage);

	if(!tabview->focuslist)
		tabview->focuslist = tabview->fistlist;
	
		
	if(!tabview->current_page)
		tabview->current_page = newtabpage;

	gtk_widget_get_size_request(tab_EventBox,&pageeventbox_w,&pageeventbox_h);
	if(pageeventbox_w <= 0 && pageeventbox_h <=0)
	{
		gtk_widget_set_usize((GtkWidget *)tab_EventBox,DEFAULT_EVENTBOX_W,DEFAULT_EVENTBOX_H);
		pageeventbox_w = DEFAULT_EVENTBOX_W;
		pageeventbox_h = DEFAULT_EVENTBOX_H;
	}

	gtk_widget_get_size_request(tabview->TabViewFixed,&tabview_w,&tabview_h);
	
	switch(tabview->pos)
	{
	case TV_POS_TOP:
		if(len == 0 )
		{
			gtk_fixed_set_has_window((GtkFixed *)(tabview->PageFixed),1);
			//gtk_widget_modify_bg(tabview->PageFixed, GTK_STATE_NORMAL, &active);
			gtk_widget_set_usize((GtkWidget *)(tabview->PageFixed),tabview_w-tabview->offset1-tabview->offset2,pageeventbox_h);
			gtk_widget_set_uposition((GtkWidget *)(tabview->PageFixed),tabview->offset1,0);
			set_widget_bc_pixmap(tab_EventBox,tabview->active_bg_Img_file,NULL,NULL);
			//gtk_fixed_put((GtkFixed *)(tabview->TabViewFixed),tabview->PageFixed,20,20);
		}
		else
		{
			set_widget_bc_pixmap(tab_EventBox,tabview->normal_bg_Img_file,NULL,NULL);
		}
		gtk_widget_set_uposition((GtkWidget *)(tab_EventBox),len*pageeventbox_w,0);
		gtk_widget_set_uposition((GtkWidget *)(child),0,pageeventbox_h);
		gtk_fixed_put((GtkFixed*)tabview->TabViewFixed,child,0,pageeventbox_h);
		break;
	case TV_POS_BOTTOM:
		
		if(len == 0 )
		{	
			gtk_fixed_set_has_window((GtkFixed *)(tabview->PageFixed),1);
			gtk_widget_set_usize((GtkWidget *)(tabview->PageFixed),tabview_w-tabview->offset1-tabview->offset2,pageeventbox_h);
			gtk_widget_set_uposition((GtkWidget *)(tabview->PageFixed),tabview->offset1,tabview_h-pageeventbox_h);
			set_widget_bc_pixmap(tab_EventBox,tabview->active_bg_Img_file,NULL,NULL);
		}
		else
		{
			set_widget_bc_pixmap(tab_EventBox,tabview->normal_bg_Img_file,NULL,NULL);
		}
		gtk_widget_set_uposition((GtkWidget *)(tab_EventBox),len*pageeventbox_w,tabview_h-pageeventbox_h);
		gtk_widget_set_uposition((GtkWidget *)(child),0,0);
		gtk_fixed_put((GtkFixed*)tabview->TabViewFixed,child,0,0);
		break;
	case TV_POS_LEFT:
		if(len == 0 )
		{	
			gtk_fixed_set_has_window((GtkFixed *)(tabview->PageFixed),1);
				
			gtk_widget_set_usize((GtkWidget *)(tabview->PageFixed),pageeventbox_w,tabview_h-tabview->offset1-tabview->offset2);
			gtk_widget_set_uposition((GtkWidget *)(tabview->PageFixed),0,tabview->offset1);
			set_widget_bc_pixmap(tab_EventBox,tabview->active_bg_Img_file,NULL,NULL);
		}
		else
		{
			set_widget_bc_pixmap(tab_EventBox,tabview->normal_bg_Img_file,NULL,NULL);
		}
		gtk_widget_set_uposition((GtkWidget *)(tab_EventBox),0,len*pageeventbox_h);
		gtk_widget_set_uposition((GtkWidget *)(child),pageeventbox_w,0);
		gtk_fixed_put((GtkFixed*)tabview->TabViewFixed,child,pageeventbox_w,0);
		break;
	case TV_POS_RIGHT:
		if(len == 0 )
		{
			gtk_fixed_set_has_window((GtkFixed *)(tabview->PageFixed),1);
			gtk_widget_set_usize((GtkWidget *)(tabview->PageFixed),pageeventbox_w,tabview_h-tabview->offset1-tabview->offset2);
			gtk_widget_set_uposition((GtkWidget *)(tabview->PageFixed),tabview_w-pageeventbox_w,tabview->offset1);
			set_widget_bc_pixmap(tab_EventBox,tabview->active_bg_Img_file,NULL,NULL);
		}
		else
		{
			set_widget_bc_pixmap(tab_EventBox,tabview->normal_bg_Img_file,NULL,NULL);
		}
		
		gtk_widget_set_uposition((GtkWidget *)(tab_EventBox),tabview_w-pageeventbox_w,len*pageeventbox_h);
		gtk_widget_set_uposition((GtkWidget *)(child),0,0);
		gtk_fixed_put((GtkFixed*)tabview->TabViewFixed,child,0,0);
		break;
	}
	
	//gtk_container_add((GtkContainer *)tabview->TabViewFixed,tab_EventBox);

	gtk_container_add((GtkContainer *)tabview->PageFixed,tab_EventBox);

	g_signal_connect (G_OBJECT (tab_EventBox), "enter-notify-event",G_CALLBACK (mouse_event_handle), tabview);

	g_signal_connect (G_OBJECT (tab_EventBox), "leave-notify-event",G_CALLBACK (mouse_event_handle), tabview);

	g_signal_connect (G_OBJECT (tab_EventBox), "button-press-event",G_CALLBACK (mouse_event_handle), tabview);


	gtk_container_add((GtkContainer *)tabview->TabViewFixed,child);

	if(((PAGE*)(tabview->focuslist->data))->child != child)
		GTK_WIDGET_SET_FLAGS(child,GTK_NO_SHOW_ALL);
	return len;
}
Beispiel #15
0
static void
create_fixed (GtkTable *table, gint row, gchar *text, gchar *id)
{
  GtkWidget *label, *fixed, *drawing_area;
  char *view_id;

  label = gtk_label_new (text);
  gtk_table_attach (table, label, 0, 1, row, row + 1,
		    0, 0, 0, 0);
  gtk_widget_show (label);

  fixed = gtk_fixed_new ();
  gtk_fixed_set_has_window (GTK_FIXED (fixed), TRUE);
  gtk_widget_set_events (fixed,
			 GDK_EXPOSURE_MASK
			 | GDK_BUTTON_PRESS_MASK
			 | GDK_BUTTON_RELEASE_MASK
			 | GDK_POINTER_MOTION_MASK
			 | GDK_POINTER_MOTION_HINT_MASK
			 | GDK_KEY_PRESS_MASK
			 | GDK_KEY_RELEASE_MASK
			 | GDK_ENTER_NOTIFY_MASK
			 | GDK_LEAVE_NOTIFY_MASK
			 | GDK_FOCUS_CHANGE_MASK);
  gtk_widget_set_size_request (fixed, 200, 100);
  gtk_table_attach (GTK_TABLE (table), fixed, 1, 2, row, row + 1,
		    0, 0, 0, 0);
  gtk_widget_show (fixed);

  view_id = g_strdup_printf ("%s-background", id);
  g_signal_connect (fixed, "expose_event",
		    G_CALLBACK (on_widget_expose), view_id);

  g_signal_connect (fixed, "enter_notify_event",
		    G_CALLBACK (on_widget_enter_notify), view_id);
  g_signal_connect (fixed, "leave_notify_event",
		    G_CALLBACK (on_widget_leave_notify), view_id);
  g_signal_connect (fixed, "motion_notify_event",
		    G_CALLBACK (on_widget_motion_notify), view_id);
  g_signal_connect (fixed, "button_press_event",
		    G_CALLBACK (on_widget_button_press), view_id);
  g_signal_connect (fixed, "button_release_event",
		    G_CALLBACK (on_widget_button_release), view_id);


  drawing_area = gtk_drawing_area_new ();
  gtk_widget_set_events (drawing_area,
			 GDK_EXPOSURE_MASK
			 | GDK_BUTTON_PRESS_MASK
			 | GDK_BUTTON_RELEASE_MASK
			 | GDK_POINTER_MOTION_MASK
			 | GDK_POINTER_MOTION_HINT_MASK
			 | GDK_KEY_PRESS_MASK
			 | GDK_KEY_RELEASE_MASK
			 | GDK_ENTER_NOTIFY_MASK
			 | GDK_LEAVE_NOTIFY_MASK
			 | GDK_FOCUS_CHANGE_MASK);
			 
  gtk_widget_set_size_request (drawing_area, 60, 60);
  gtk_fixed_put (GTK_FIXED (fixed), drawing_area, 20, 20);
  gtk_widget_show (drawing_area);

  view_id = g_strdup_printf ("%s-left", id);
  g_signal_connect (drawing_area, "expose_event",
		    G_CALLBACK (on_widget_expose), view_id);

  g_signal_connect (drawing_area, "enter_notify_event",
		    G_CALLBACK (on_widget_enter_notify), view_id);
  g_signal_connect (drawing_area, "leave_notify_event",
		    G_CALLBACK (on_widget_leave_notify), view_id);
  g_signal_connect (drawing_area, "motion_notify_event",
		    G_CALLBACK (on_widget_motion_notify), view_id);
  g_signal_connect (drawing_area, "button_press_event",
		    G_CALLBACK (on_widget_button_press), view_id);
  g_signal_connect (drawing_area, "button_release_event",
		    G_CALLBACK (on_widget_button_release), view_id);


  drawing_area = gtk_drawing_area_new ();
  gtk_widget_set_events (drawing_area,
			 GDK_EXPOSURE_MASK
			 | GDK_BUTTON_PRESS_MASK
			 | GDK_BUTTON_RELEASE_MASK
			 | GDK_POINTER_MOTION_MASK
			 | GDK_POINTER_MOTION_HINT_MASK
			 | GDK_KEY_PRESS_MASK
			 | GDK_KEY_RELEASE_MASK
			 | GDK_ENTER_NOTIFY_MASK
			 | GDK_LEAVE_NOTIFY_MASK
			 | GDK_FOCUS_CHANGE_MASK);
			 
  gtk_widget_set_size_request (drawing_area, 60, 60);
  gtk_fixed_put (GTK_FIXED (fixed), drawing_area, 120, 20);
  gtk_widget_show (drawing_area);

  view_id = g_strdup_printf ("%s-right", id);
  g_signal_connect (drawing_area, "expose_event",
		    G_CALLBACK (on_widget_expose), view_id);

  g_signal_connect (drawing_area, "enter_notify_event",
		    G_CALLBACK (on_widget_enter_notify), view_id);
  g_signal_connect (drawing_area, "leave_notify_event",
		    G_CALLBACK (on_widget_leave_notify), view_id);
  g_signal_connect (drawing_area, "motion_notify_event",
		    G_CALLBACK (on_widget_motion_notify), view_id);
  g_signal_connect (drawing_area, "button_press_event",
		    G_CALLBACK (on_widget_button_press), view_id);
  g_signal_connect (drawing_area, "button_release_event",
		    G_CALLBACK (on_widget_button_release), view_id);
}
Beispiel #16
0
void CMenu::show ()
{

	if (fixed)
		return;
	playsound (SND_MENUSHOW);
	make_pause();
	
	fixed = gtk_fixed_new ();
	gtk_fixed_set_has_window(GTK_FIXED(fixed),TRUE);
	gtk_widget_set_events(fixed,GDK_LEAVE_NOTIFY_MASK);
	gtk_widget_set_size_request (fixed, Skin->face.menu.w, Skin->face.menu.h);
	gtk_fixed_put (GTK_FIXED (g_pReciteWord->fixed), fixed,Skin->face.menu.x[0],Skin->face.menu.y[0]);
	gtk_widget_show (fixed);
	SetBackPixmap (fixed, Skin->face.menu.p[0]);

	choosebook_button.create (fixed, Skin->face.choosebook_button.x[0],
				   Skin->face.choosebook_button.y[0],
				   Skin->face.choosebook_button.p[0],
				   Skin->face.choosebook_button.p[1],
				   Skin->face.choosebook_button.p[2],
				   Skin->face.choosebook_button.p[3],
				   on_menu_choosebook_clicked);
	firstrecite_button.create (fixed, Skin->face.firstrecite_button.x[0],
				   Skin->face.firstrecite_button.y[0],
				   Skin->face.firstrecite_button.p[0],
				   Skin->face.firstrecite_button.p[1],
				   Skin->face.firstrecite_button.p[2],
				   Skin->face.firstrecite_button.p[3],
				   on_menu_firstrecite_clicked);
	revise_button.create (fixed, Skin->face.revise_button.x[0],
			      Skin->face.revise_button.y[0],
			      Skin->face.revise_button.p[0],
			      Skin->face.revise_button.p[1],
			      Skin->face.revise_button.p[2],
			      Skin->face.revise_button.p[3],
			      on_menu_revise_clicked);
	rest_button.create (fixed, Skin->face.rest_button.x[0],
			      Skin->face.rest_button.y[0],
			      Skin->face.rest_button.p[0],
			      Skin->face.rest_button.p[1],
			      Skin->face.rest_button.p[2],
			      Skin->face.rest_button.p[3],
			      on_menu_rest_clicked);
	know_button.create (fixed, Skin->face.know_button.x[0],
			      Skin->face.know_button.y[0],
			      Skin->face.know_button.p[0],
			      Skin->face.know_button.p[1],
			      Skin->face.know_button.p[2],
			      Skin->face.know_button.p[3],
			      on_menu_know_clicked);
	shooting_button.create (fixed, Skin->face.shooting_button.x[0],
				Skin->face.shooting_button.y[0],
				Skin->face.shooting_button.p[0],
				Skin->face.shooting_button.p[1],
				Skin->face.shooting_button.p[2],
				Skin->face.shooting_button.p[3],
				on_menu_shooting_clicked);
	typing_button.create (fixed, Skin->face.typing_button.x[0],
			      Skin->face.typing_button.y[0],
			      Skin->face.typing_button.p[0],
			      Skin->face.typing_button.p[1],
			      Skin->face.typing_button.p[2],
			      Skin->face.typing_button.p[3],
			      on_menu_typing_clicked);

	exit_button.create (fixed, Skin->face.menu_exit_button.x[0],
			    Skin->face.menu_exit_button.y[0],
			    Skin->face.menu_exit_button.p[0],
			    Skin->face.menu_exit_button.p[1], (GdkPixmap *) NULL,
			    on_menu_exit_clicked, NULL);

	if (g_pReciteWord->now_book)
	{
		switch (g_pReciteWord->status)
		{
		case STATUS_NORMAL:
			break;
		case STATUS_CHOOSEBOOK:
			choosebook_button.set_enable (FALSE);
			break;
		case STATUS_FIRSTRECITE_GROUP:
		case STATUS_FIRSTRECITE_SKIM:
		case STATUS_FIRSTRECITE_TEST:
			firstrecite_button.set_enable (FALSE);
			break;
		case STATUS_REVISE_GROUP:
		case STATUS_REVISE_TEST:
		case STATUS_REVISE_SKIM:
			revise_button.set_enable (FALSE);
			break;
		case STATUS_REST:
			rest_button.set_enable (FALSE);
			break;
		case STATUS_KNOW:
			know_button.set_enable (FALSE);
			break;
		case STATUS_SHOOTING:
			shooting_button.set_enable (FALSE);
			break;
		case STATUS_TYPING:
			typing_button.set_enable (FALSE);
			break;
		default:
			break;
		}
	}
	else
	{
		if (g_pReciteWord->status==STATUS_CHOOSEBOOK)
			choosebook_button.set_enable (FALSE);
		firstrecite_button.set_enable (FALSE);
		revise_button.set_enable (FALSE);
		rest_button.set_enable (FALSE);
		know_button.set_enable (FALSE);
		shooting_button.set_enable (FALSE);
		typing_button.set_enable (FALSE);
	}
	g_signal_connect (G_OBJECT (fixed), "leave_notify_event",
			  G_CALLBACK (on_menu_leave_notify), this);
}