예제 #1
0
void
cpanel_edgeedit_make (GGobiSession * gg)
{
  modepaneld *panel;
  GtkWidget *vb, *radio1, *radio2, *w;
  GSList *group;
  // This should be in an init routine
  gboolean adding_edges = true;

  panel = (modepaneld *) g_malloc (sizeof (modepaneld));
  gg->control_panels = g_list_append (gg->control_panels, (gpointer) panel);
  panel->name = g_strdup (ggobi_getIModeName (EDGEED));
  panel->w = gtk_vbox_new (false, VBOX_SPACING);
  gtk_container_set_border_width (GTK_CONTAINER (panel->w), 5);

 /*-- Radio group in a box: add edges or points buttons --*/
  vb = gtk_vbox_new (false, 1);
  gtk_container_set_border_width (GTK_CONTAINER (vb), 3);
  gtk_box_pack_start (GTK_BOX (panel->w), vb, false, false, 0);

  radio1 = gtk_radio_button_new_with_mnemonic (NULL, "Add _edges");
  gtk_widget_set_name (radio1, "EDGEEDIT:add_edges_radio_button");
  if (adding_edges)
    GTK_TOGGLE_BUTTON (radio1)->active = true;

  gtk_tooltips_set_tip (GTK_TOOLTIPS (gg->tips), radio1,
                        "Add new edges using the mouse. The right or middle button opens a dialog window; the left button adds an edge using defaults.",
                        NULL);
  g_signal_connect (G_OBJECT (radio1), "toggled",
                    G_CALLBACK (add_edges_or_points_cb), gg);
  gtk_box_pack_start (GTK_BOX (vb), radio1, false, false, 0);

  group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio1));

  radio2 = gtk_radio_button_new_with_mnemonic (group, "Add _points");
  gtk_widget_set_name (radio2, "EDGEEDIT:add_points_radio_button");
  gtk_tooltips_set_tip (GTK_TOOLTIPS (gg->tips), radio2,
                        "Add points using the mouse.  The right or button opens a dialog window; the left button adds a point using defaults.",
                        NULL);
  gtk_box_pack_start (GTK_BOX (vb), radio2, false, false, 0);

  w = gtk_label_new (tip_edges);
  gtk_label_set_line_wrap (GTK_LABEL (w), true);
  gtk_box_pack_start (GTK_BOX (vb), w, false, false, 0);
  gtk_widget_set_name (w, "EDGEEDIT:tip_label");

  /*-- Undo --*/
  /*   not implemented
     btn = gtk_button_new_with_label ("Undo");
     gtk_tooltips_set_tip (GTK_TOOLTIPS (gg->tips), btn,
     "Undo last action", NULL);
     gtk_box_pack_start (GTK_BOX (panel->w),
     btn, false, false, 1);
     g_signal_connect (G_OBJECT (btn), "clicked",
     G_CALLBACK (undo_last_cb), NULL);
   */

  gtk_widget_show_all (panel->w);
}
예제 #2
0
파일: tsdisplay.c 프로젝트: medmatix/ggobi
void
tsplotVarpanelTooltipsSet(displayd *dpy, GGobiSession *gg, GtkWidget *wx, GtkWidget *wy, GtkWidget *wz, GtkWidget *label)
{
  gtk_tooltips_set_tip (GTK_TOOLTIPS (gg->tips), wx,
    "Select to replace the horizontal (time) variable.",
    NULL);
  gtk_tooltips_set_tip (GTK_TOOLTIPS (gg->tips), wy,
    "Select to delete or append a Y variable; drag plots to reorder.",
    NULL);
  gtk_tooltips_set_tip (GTK_TOOLTIPS (gg->tips), label,
    "Click left to replace the horizontal (time) variable.  Click middle or right to append or delete a Y variable; drag plots to reorder.",
    NULL);
}
예제 #3
0
/* Adds a tooltip containing the message tip_text to the specified GtkWidget. */
int
clip_GTK_TOOLTIPSSETTIP(ClipMachine * ClipMachineMemory)
{
   C_widget *ctt = _fetch_cw_arg(ClipMachineMemory);

   C_widget *cwid = _fetch_cwidget(ClipMachineMemory, _clip_spar(ClipMachineMemory, 2));

   gchar    *tip_text = _clip_parc(ClipMachineMemory, 3);

   gchar    *tip_private = _clip_parc(ClipMachineMemory, 4);

   CHECKCWID(ctt, GTK_IS_TOOLTIPS);
   CHECKARG2(2, MAP_type_of_ClipVarType, NUMERIC_type_of_ClipVarType);
   CHECKCWID(cwid, GTK_IS_WIDGET);
   CHECKOPT(3, CHARACTER_type_of_ClipVarType);
   CHECKOPT(4, CHARACTER_type_of_ClipVarType);
   LOCALE_TO_UTF(tip_text);
   LOCALE_TO_UTF(tip_private);
   gtk_tooltips_set_tip(GTK_TOOLTIPS(ctt->widget), cwid->widget, tip_text, tip_private);
   FREE_TEXT(tip_text);
   FREE_TEXT(tip_private);
   return 0;
 err:
   return 1;
}
예제 #4
0
파일: utils.cpp 프로젝트: dyne/MuSE
GtkWidget *createpixmap(GtkWidget *w, GtkWidget *but, 
		const gchar **pippo, const gchar *tip, bool istoggled)
{
	/* create and return button with pixmap */

	GtkWidget *image;
	GtkTooltips *tooltip;
	GdkPixmap *pixmap;
	GdkBitmap *mask;
	GtkStyle *style;

	style=gtk_widget_get_style(w);
	gtk_widget_realize(w);
	pixmap=gdk_pixmap_create_from_xpm_d(w->window, &mask, 
			&style->bg[GTK_STATE_NORMAL], (gchar **)pippo);
	image = gtk_image_new_from_pixmap(pixmap, mask);
	
	if(!istoggled)
		but=gtk_button_new();
	else
		but=gtk_toggle_button_new();

	gtk_container_add(GTK_CONTAINER(but), image);
	tooltip = gtk_tooltips_new();
	gtk_tooltips_set_tip(GTK_TOOLTIPS(tooltip), but, tip, NULL);
	return but;
	
}
예제 #5
0
파일: utils.cpp 프로젝트: dyne/MuSE
void set_tip(GtkWidget *w, gchar *tip)
{
	GtkTooltips *tooltip;

	tooltip = gtk_tooltips_new();
	gtk_tooltips_set_tip(GTK_TOOLTIPS(tooltip), w, tip, NULL);
}
예제 #6
0
파일: trayicon.c 프로젝트: aufau/xqf
void tray_icon_set_tooltip(gchar * tip) {
	if (!tray_icon || !tray_icon->ready )
		return;

	if (!tray_icon_tips)
		tray_icon_tips = gtk_tooltips_new();

	gtk_tooltips_set_tip(GTK_TOOLTIPS(tray_icon_tips),
			GTK_WIDGET(tray_icon), tip, tip);
}
예제 #7
0
static VALUE
menutoolbutton_set_arrow_tooltip(int argc, VALUE *argv, VALUE self)
{
    VALUE tooltips, tip_text, tip_private;

    rb_scan_args(argc, argv, "12", &tooltips, &tip_text, &tip_private);
    gtk_menu_tool_button_set_arrow_tooltip(_SELF(self), GTK_TOOLTIPS(RVAL2GOBJ(self)),
                                           NIL_P(tip_text) ? NULL : RVAL2CSTR(tip_text),
                                           NIL_P(tip_private) ? NULL : RVAL2CSTR(tip_private));
    return self;
}
예제 #8
0
/* Causes all tooltips in tooltips to become inactive. Any widgets that have
 * tips associated with that group will no longer display their tips until
 * they are enabled again with gtk_tooltips_enable(). */
int
clip_GTK_TOOLTIPSDISABLE(ClipMachine * ClipMachineMemory)
{
   C_widget *ctt = _fetch_cw_arg(ClipMachineMemory);

   CHECKCWID(ctt, GTK_IS_TOOLTIPS);
   gtk_tooltips_disable(GTK_TOOLTIPS(ctt->widget));
   return 0;
 err:
   return 1;
}
예제 #9
0
/* Sets the time between the user moving the mouse over a widget and
 * the widget's tooltip appearing. */
int
clip_GTK_TOOLTIPSSETDELAY(ClipMachine * ClipMachineMemory)
{
   C_widget *ctt = _fetch_cw_arg(ClipMachineMemory);

   guint     delay = _clip_parni(ClipMachineMemory, 2);

   CHECKCWID(ctt, GTK_IS_TOOLTIPS);
   CHECKOPT(2, NUMERIC_type_of_ClipVarType);
   gtk_tooltips_set_delay(GTK_TOOLTIPS(ctt->widget), delay);
   return 0;
 err:
   return 1;
}
예제 #10
0
파일: tray.c 프로젝트: Explorer09/hime
gboolean create_tray(gpointer data)
{
  if (tray_icon)
    return FALSE;

  destroy_other_tray();

  tray_icon = gtk_status_icon_new();

  g_signal_connect (G_OBJECT (tray_icon), "button-press-event",
                    G_CALLBACK (tray_button_press_event_cb), NULL);

  g_signal_connect (G_OBJECT (tray_icon), "size-changed",
                    G_CALLBACK (tray_size_changed_cb), NULL);

  g_signal_connect (G_OBJECT (tray_icon), "notify::embedded",
                  G_CALLBACK (tray_embedded_cb), NULL);

#if GTK_CHECK_VERSION(2,12,0)
  gtk_status_icon_set_tooltip_text (tray_icon, _("左:中英切換 中:小鍵盤 右:選項"));
#else
  GtkTooltips *tips = gtk_tooltips_new ();
  gtk_status_icon_set_tooltip (GTK_TOOLTIPS (tips), tray_icon, _("左:中英切換 中:小鍵盤 右:選項"), NULL);
#endif

// Initiate Pango for drawing texts from default setting
  GtkWidget *wi = gtk_label_new (NULL); // for reference
  PangoContext *context = gtk_widget_get_pango_context(wi);
  PangoFontDescription* desc = pango_font_description_copy(pango_context_get_font_description(context)); // Copy one from wi for pango
  pango_font_description_set_size(desc, 9 * PANGO_SCALE);
  pango = gtk_widget_create_pango_layout(wi, NULL);
  pango_layout_set_font_description(pango, desc);
 
  gdk_color_parse("red", &red_color_fg);
  gdk_color_parse("blue", &blue_color_fg);

  gtk_widget_destroy(wi);

  load_tray_icon();
  return FALSE;
}
예제 #11
0
파일: main.c 프로젝트: larstobi/ddccontrol
/* Create a new button with an image and a label packed into it
 * and return the button. */
GtkWidget *stock_label_button(const gchar * stockid, const gchar *label_text, const gchar *tool_tip)
{
	GtkWidget *box;
	GtkWidget *label = NULL;
	GtkWidget *image;
	GtkWidget *button;
	
	button = gtk_button_new();
	
	/* Create box for image and label */
	box = gtk_hbox_new(FALSE, 0);
	gtk_container_set_border_width(GTK_CONTAINER (box), 1);
	
	/* Now on to the image stuff */
	image = gtk_image_new_from_stock(stockid, GTK_ICON_SIZE_BUTTON);
	gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 3);
	gtk_widget_show(image);

	if (label_text) {
		/* Create a label for the button */
		label = gtk_label_new(label_text);
		
		/* Pack the image and label into the box */
		gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 3);
		
		gtk_widget_show(label);
	}
	
	gtk_widget_show(box);
	
	gtk_container_add (GTK_CONTAINER(button), box);
	
	g_object_set_data(G_OBJECT(button), "button_label", label);
	
	if (tool_tip) {
		gtk_tooltips_set_tip(GTK_TOOLTIPS(tooltips), button, tool_tip, NULL);
	}
	
	return button;
}
예제 #12
0
static ClipmanPlugin *
clipman_new (XfcePanelPlugin *plugin)
{
    ClipmanPlugin *clipman;
    clipman = g_new0 (ClipmanPlugin, 1);
    
    clipman->clips = g_ptr_array_new ();
    clipman->plugin = plugin;
    
    clipman->tooltip = gtk_tooltips_new ();
    g_object_ref (clipman->tooltip);
    
    clipman_read (clipman);
    
    clipman->button = gtk_toggle_button_new ();
        gtk_widget_show (clipman->button);
        gtk_button_set_relief (GTK_BUTTON (clipman->button), GTK_RELIEF_NONE);
        gtk_button_set_focus_on_click (GTK_BUTTON (clipman->button), FALSE);
        
    gtk_tooltips_set_tip (GTK_TOOLTIPS(clipman->tooltip),
                          clipman->button, _("Clipboard Manager"),
                          NULL);
    
    g_signal_connect(clipman->button, "button_press_event",
            G_CALLBACK(clipman_clicked), clipman);
    
    /* Start the clipman_check function */
    clipman->TimeoutId = g_timeout_add_full(G_PRIORITY_LOW,
                                            TIMER_INTERVAL,
                                            (GSourceFunc) clipman_check,
                                            clipman,
                                            (GDestroyNotify) clipman_reset_timeout);
    
    /* Connect to the clipboards */
    defaultClip = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
    primaryClip = gtk_clipboard_get (GDK_SELECTION_PRIMARY);
            
    return clipman;
}
예제 #13
0
GtkWidget *
sp_find_types_checkbox (GtkWidget *w, const gchar *data, gboolean active,
                        GtkTooltips *tt, const gchar *tip,
                        const gchar *label,
                        void (*toggled)(GtkToggleButton *, gpointer))
{
    GtkWidget *hb = gtk_hbox_new (FALSE, 0);
    gtk_widget_show (hb);

    {
        GtkWidget *b  = gtk_check_button_new_with_label (label);
        gtk_widget_show (b);
        gtk_toggle_button_set_active ((GtkToggleButton *) b, active);
        gtk_object_set_data (GTK_OBJECT (w), data, b);
        gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), b, tip, NULL);
        if (toggled)
            gtk_signal_connect (GTK_OBJECT (b), "toggled", GTK_SIGNAL_FUNC (toggled), w);
        gtk_box_pack_start (GTK_BOX (hb), b, FALSE, FALSE, 0);
    }

    return hb;
}
예제 #14
0
/* This function is unimplemented because tooltip colors are
 * instead determined by the theme. */
int
clip_GTK_TOOLTIPSSETCOLORS(ClipMachine * ClipMachineMemory)
{
   C_widget *ctt = _fetch_cw_arg(ClipMachineMemory);

   ClipVar  *mback = _clip_spar(ClipMachineMemory, 2);

   ClipVar  *mfore = _clip_spar(ClipMachineMemory, 3);

   GdkColor  back, fore, *pback = NULL, *pfore = NULL;

   CHECKCWID(ctt, GTK_IS_TOOLTIPS);
   CHECKOPT(2, MAP_type_of_ClipVarType);
   CHECKOPT(3, MAP_type_of_ClipVarType);
   if (mback && mback->ClipType_t_of_ClipVar.ClipVartype_type_of_ClipType == MAP_type_of_ClipVarType)
      _map_colors_to_gdk(ClipMachineMemory, mback, pback = &back);
   if (mfore && mfore->ClipType_t_of_ClipVar.ClipVartype_type_of_ClipType == MAP_type_of_ClipVarType)
      _map_colors_to_gdk(ClipMachineMemory, mfore, pfore = &fore);
   gtk_tooltips_set_colors(GTK_TOOLTIPS(ctt->widget), pback, pfore);
   return 0;
 err:
   return 1;
}
예제 #15
0
파일: dspdesc.c 프로젝트: medmatix/ggobi
GtkWidget *
create_dspdesc_window(ggobid *gg, PluginInstance *inst)
{
  GtkWidget *window, *hb, *label, *entry;
  GtkTooltips *tips = gtk_tooltips_new ();
  dspdescd *desc = dspdescFromInst (inst); 

  window = gtk_file_chooser_dialog_new("Save display description", NULL, 
  	GTK_FILE_CHOOSER_ACTION_SAVE, GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, 
	GTK_STOCK_CLOSE, GTK_RESPONSE_REJECT, NULL);
	
  desc->window = window;

  /* label and entry widget for main title */
  hb = gtk_hbox_new (false, 1);
  
  label = gtk_label_new_with_mnemonic ("Figure _title: ");
  gtk_box_pack_start (GTK_BOX (hb), label, false, false, 2);

  entry = gtk_entry_new ();
  gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry);
  g_object_set_data(G_OBJECT(window), "TITLE", entry);
  gtk_tooltips_set_tip (GTK_TOOLTIPS (tips), entry,
    "Type in the figure title", NULL);
  gtk_box_pack_start (GTK_BOX (hb), entry, true, true, 2);
  gtk_widget_show_all(hb);
  
  gtk_file_chooser_set_extra_widget(GTK_FILE_CHOOSER(window), hb);
	
  if (gtk_dialog_run(GTK_DIALOG(window)) == GTK_RESPONSE_ACCEPT)
	desc_write(inst);
	
  plugin_destroy(inst);
	
  return(window);
}
예제 #16
0
static void update_hist_button()
{
  int i;

  for(i=0;i<gcb_history_n;i++) {
    char tstr[16];

    if (!hist_strArr[i])
      continue;

    utf8ncpy(tstr, sizeof(tstr), hist_strArr[i]);

    del_nl(tstr);
    gtk_button_set_label(GTK_BUTTON(hist_buttonArr[i]),tstr);
#if 0
#if GTK_CHECK_VERSION(2,12,0)
    gtk_widget_set_tooltip_text (hist_buttonArr[i], hist_strArr[i]);
#else
    gtk_tooltips_set_tip (GTK_TOOLTIPS (button_bar_tips),hist_buttonArr[i],
      hist_strArr[i],NULL);
#endif
#endif
  }
}
/*----------------- mounter_create_options -------------*/
static void mounter_create_options (Control * control, GtkContainer * container, GtkWidget * done)
{
	GtkWidget *vbox, *label, *label2, *label3, *label4;
	GtkSizeGroup *sg = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
	t_mounter_dialog * md;
	t_mounter * mt;
	
	/* xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8"); */
	
	md = g_new0(t_mounter_dialog, 1);
	
	md->mt = mt = (t_mounter *) control->data;
	
	md->dialog = gtk_widget_get_toplevel (done);
	
	/* don't set a border width, the dialog will take care of that */
	
	vbox = gtk_vbox_new (FALSE, BORDER);
	gtk_widget_show (vbox);
	
	/* entries */
	GtkWidget *eventbox = gtk_event_box_new ();
	gtk_widget_show (eventbox);
	gtk_container_set_border_width (GTK_CONTAINER (eventbox), BORDER);
	gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (eventbox), FALSE, FALSE, 
	                   0);
	
	GtkWidget *hbox = gtk_hbox_new (FALSE, BORDER);
	gtk_widget_show (hbox);
	gtk_container_add (GTK_CONTAINER (eventbox), hbox);
	
	label = gtk_label_new (_("Execute after mounting:"));
	gtk_widget_show (label);
	gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
	
	GtkTooltips *tip = gtk_tooltips_new ();
	gtk_tooltips_enable (tip);
    gtk_tooltips_set_tip ( GTK_TOOLTIPS(tip), eventbox, 
        _("This command will be executed after mounting the device with the "
          "mount point of the device as argument. \n"
          "If you are unsure what to insert, try \"xffm\" or \"rox\" or "
          "\"thunar\"."), 
        NULL );
	
	md->string_cmd = gtk_entry_new ();
	if (mt->on_mount_cmd != NULL)
		gtk_entry_set_text (GTK_ENTRY(md->string_cmd), 
		                    g_strdup(mt->on_mount_cmd));
    gtk_entry_set_width_chars (GTK_ENTRY(md->string_cmd), 21);
    gtk_widget_show (md->string_cmd);
	gtk_box_pack_start (GTK_BOX(hbox), md->string_cmd, FALSE, FALSE, 0);

    GtkWidget *innervbox = gtk_vbox_new (FALSE, 0);
    gtk_container_set_border_width (GTK_CONTAINER (innervbox), BORDER);
    gtk_widget_show (innervbox);
    gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (innervbox), FALSE, FALSE, 
	                    0);

	eventbox = gtk_event_box_new ();
	gtk_widget_show (eventbox);
	gtk_box_pack_start (GTK_BOX (innervbox), GTK_WIDGET (eventbox), FALSE, FALSE, 
	                    0);
	
	md->specify_commands = gtk_check_button_new_with_label ( 
	                               _("Specify own commands") );

    #ifdef DEBUG	                               
        printf ("mc: %s, uc: %s; dmc: %s, duc: %s \n", mt->mount_command, 
            mt->umount_command, DEFAULT_MOUNT_COMMAND, DEFAULT_UMOUNT_COMMAND);
    #endif
            
    gboolean set_active;
    
    if (mt->mount_command==NULL && mt->umount_command==NULL)
      set_active = FALSE;
    else
      set_active = 
           ( strcmp(mt->mount_command, DEFAULT_MOUNT_COMMAND)!=0 || 
             strcmp(mt->umount_command, DEFAULT_UMOUNT_COMMAND)!=0 ) ? 
             TRUE : FALSE;
                                    
    gtk_widget_show (md->specify_commands);
    gtk_container_add (GTK_CONTAINER (eventbox), md->specify_commands );
    
    gtk_tooltips_set_tip ( GTK_TOOLTIPS(tip), eventbox, 
        _("WARNING: These options are for experts only! If you do not know "
          "what they may be good for, keep your hands off!"), 
        NULL );
        
    eventbox = gtk_event_box_new ();
	gtk_widget_show (eventbox);
	gtk_box_pack_start (GTK_BOX (innervbox), GTK_WIDGET (eventbox), FALSE, FALSE,
	                    0);
	
    md->box_mount_commands = gtk_table_new (2, 2, FALSE);
    gtk_widget_show (md->box_mount_commands);
    gtk_container_add (GTK_CONTAINER (eventbox), md->box_mount_commands);
	                  
    /* FIXME: labels are centered.
        gtk_label_set_justify does not work,
        adding alignment containers does not do s, either.
        so it must be something with the table: GTK_FILL doesn't do it. */
	label = gtk_label_new (_("Mount command:"));
	gtk_label_set_justify (GTK_LABEL(label), GTK_JUSTIFY_LEFT);
	gtk_widget_show (label);
	gtk_table_attach (GTK_TABLE(md->box_mount_commands), label, 0, 1, 0, 1, 
	                  GTK_SHRINK, GTK_SHRINK, BORDER, 0);
	
	                  
	label = gtk_label_new (_("Unmount command:"));
	gtk_label_set_justify (GTK_LABEL(label), GTK_JUSTIFY_LEFT);
	gtk_widget_show (label);
	gtk_table_attach (GTK_TABLE(md->box_mount_commands), label, 0, 1, 1, 2, 
	                  GTK_SHRINK, GTK_SHRINK, BORDER, 0);
	                  
	md->string_mount_command = gtk_entry_new ();
	gtk_entry_set_text (GTK_ENTRY(md->string_mount_command ), 
	                    g_strdup(mt->mount_command ));
	gtk_widget_show (md->string_mount_command );
	gtk_table_attach (GTK_TABLE(md->box_mount_commands),
	                  md->string_mount_command , 1, 2,
	                  0, 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
	
	md->string_umount_command = gtk_entry_new ();
	gtk_entry_set_text (GTK_ENTRY(md->string_umount_command ), 
	                    g_strdup(mt->umount_command ));
	gtk_widget_show (md->string_umount_command );
	gtk_table_attach (GTK_TABLE(md->box_mount_commands), 
	                  md->string_umount_command , 1, 2,
	                  1, 2, GTK_SHRINK, GTK_SHRINK, 0, 0);
	
	gtk_tooltips_set_tip ( GTK_TOOLTIPS(tip), eventbox, 
        _("Most users will only want to prepend \"sudo\" to both "
          "commands."), 
        NULL );
	
	/* label = gtk_label_new (_("command to execute after mounting a device"));
	gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
	gtk_size_group_add_widget (sg, label);
	gtk_widget_show (label);
	gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
	
	label2 = gtk_label_new (_("(mount directory is added to the command)"));
	gtk_misc_set_alignment (GTK_MISC (label2), 0, 0.5);
	gtk_size_group_add_widget (sg, label2);
	gtk_widget_show (label2);
	gtk_box_pack_start (GTK_BOX (vbox), label2, FALSE, FALSE, 0);
	
	label3 = gtk_label_new (_("eg. konqueror"));
	gtk_misc_set_alignment (GTK_MISC (label3), 0, 0.5);
	gtk_size_group_add_widget (sg, label3);
	gtk_widget_show (label3);
	gtk_box_pack_start (GTK_BOX (vbox), label3, FALSE, FALSE, 0);
	
	label4 = gtk_label_new (_("eg. xffm"));
	gtk_misc_set_alignment (GTK_MISC (label4), 0, 0.5);
	gtk_size_group_add_widget (sg, label4);
	gtk_widget_show (label4);
	gtk_box_pack_start (GTK_BOX (vbox), label4, FALSE, FALSE, 0);
	
	md->string_cmd = gtk_entry_new ();
	if (mt->on_mount_cmd != NULL)
		gtk_entry_set_text(GTK_ENTRY(md->string_cmd), g_strdup(mt->on_mount_cmd));
	gtk_widget_show(md->string_cmd);
	gtk_box_pack_start (GTK_BOX(vbox), md->string_cmd, FALSE, FALSE, 0); */
	
	/* uh no, never ever save before we hit "close"! */
	/* g_signal_connect_swapped (md->string_cmd, "focus-out-event",
			G_CALLBACK(entry_lost_focus), md); */
	
	/* update settings when dialog is closed */
	
	g_signal_connect ( G_OBJECT(md->specify_commands), "toggled",
			G_CALLBACK(specify_command_toggled), md);
			
	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(md->specify_commands),
                                  set_active);
    if (!set_active) /* following command wasn't executed by signal handler! */
        gtk_widget_set_sensitive ( md->box_mount_commands, FALSE );
	
	g_signal_connect_swapped (done, "clicked",
				G_CALLBACK (mounter_apply_options), md);
	
	g_signal_connect_swapped (md->dialog, "destroy-event",
				G_CALLBACK (free_mounter_dialog), md);
	
	/* add widgets to dialog */
	
	gtk_container_add (container, vbox);
}
예제 #18
0
static int
wincmd_constructor(plugin *p)
{
    line s;
    gchar *tooltip, *fname;
    wincmd *wc;
    //GdkPixbuf *gp, *gps;
    GtkWidget *button;
    int w, h;

    ENTER;
    s.len = 256;
    wc = g_new0(wincmd, 1);
    g_return_val_if_fail(wc != NULL, 0);
    wc->tips = gtk_tooltips_new();
    p->priv = wc;
    tooltip = fname = 0;
    while (get_line(p->fp, &s) != LINE_BLOCK_END) {
        if (s.type == LINE_NONE) {
            ERR( "wincmd: illegal token %s\n", s.str);
            goto error;
        }
        if (s.type == LINE_VAR) {
            if (!g_ascii_strcasecmp(s.t[0], "Button1")) 
                wc->button1 = str2num(wincmd_pair, s.t[1], WC_ICONIFY);
            else if (!g_ascii_strcasecmp(s.t[0], "Button2")) 
                wc->button2 = str2num(wincmd_pair, s.t[1], WC_SHADE);
            else if (!g_ascii_strcasecmp(s.t[0], "tooltip"))
                tooltip = g_strdup(s.t[1]);
            else if (!g_ascii_strcasecmp(s.t[0], "image"))
                fname = expand_tilda(s.t[1]); 
            else {
                ERR( "wincmd: unknown var %s\n", s.t[0]);
                goto error;
            }
        } else {
            ERR( "wincmd: illegal in this context %s\n", s.str);
            goto error;
        }
    }
    if (p->panel->orientation == ORIENT_HORIZ) {
        w = 10000;
        h = p->panel->ah;
    } else {
        w = p->panel->aw;
        h = 10000;
    }
    button = fb_button_new_from_file(fname, w, h, 0x202020, TRUE);
    gtk_container_set_border_width(GTK_CONTAINER(button), 0);
    g_signal_connect(G_OBJECT(button), "button_press_event",
          G_CALLBACK(clicked), (gpointer)wc);
  
    gtk_widget_show(button);
    gtk_container_add(GTK_CONTAINER(p->pwid), button);
    if (p->panel->transparent) 
        gtk_bgbox_set_background(button, BG_ROOT, p->panel->tintcolor, p->panel->alpha);
    
    g_free(fname);
    if (tooltip) {
        gtk_tooltips_set_tip(GTK_TOOLTIPS (wc->tips), button, tooltip, NULL);
        g_free(tooltip);
    }
    RET(1);

 error:
    g_free(fname);
    g_free(tooltip);
    wincmd_destructor(p);
    ERR( "%s - exit\n", __FUNCTION__);
    RET(0);
}
예제 #19
0
static GtkWidget *
create_window (int confirm_mode)
{
  GtkWidget *w;
  GtkWidget *win, *box;
  GtkWidget *wvbox, *chbox, *bbox;
  GtkAccelGroup *acc;
  gchar *msg;

  tooltips = gtk_tooltips_new ();

  /* FIXME: check the grabbing code against the one we used with the
     old gpg-agent */
  win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  acc = gtk_accel_group_new ();

  g_signal_connect (G_OBJECT (win), "delete_event",
		    G_CALLBACK (delete_event), NULL);

#if 0
  g_signal_connect (G_OBJECT (win), "destroy", G_CALLBACK (gtk_main_quit),
		    NULL);
#endif
  g_signal_connect (G_OBJECT (win), "size-request",
		    G_CALLBACK (constrain_size), NULL);
  if (!confirm_mode)
    {
      if (pinentry->grab)
	g_signal_connect (G_OBJECT (win),
			  "realize", G_CALLBACK (make_transient), NULL);

      /* We need to grab the keyboard when its visible! not when its
         mapped (there is a difference)  */
      g_object_set (G_OBJECT(win), "events",
                    GDK_VISIBILITY_NOTIFY_MASK | GDK_STRUCTURE_MASK, NULL);

      g_signal_connect (G_OBJECT (win),
			pinentry->grab
                        ? "visibility-notify-event"
                        : "focus-in-event",
			G_CALLBACK (grab_keyboard), NULL);
      g_signal_connect (G_OBJECT (win),
			pinentry->grab ? "unmap-event" : "focus-out-event",
			G_CALLBACK (ungrab_keyboard), NULL);
    }
  gtk_window_add_accel_group (GTK_WINDOW (win), acc);

  wvbox = gtk_vbox_new (FALSE, HIG_LARGE * 2);
  gtk_container_add (GTK_CONTAINER (win), wvbox);
  gtk_container_set_border_width (GTK_CONTAINER (wvbox), HIG_LARGE);

  chbox = gtk_hbox_new (FALSE, HIG_LARGE);
  gtk_box_pack_start (GTK_BOX (wvbox), chbox, FALSE, FALSE, 0);

  w = gtk_image_new_from_stock (GTK_STOCK_DIALOG_AUTHENTICATION,
					       GTK_ICON_SIZE_DIALOG);
  gtk_misc_set_alignment (GTK_MISC (w), 0.0, 0.0);
  gtk_box_pack_start (GTK_BOX (chbox), w, FALSE, FALSE, 0);

  box = gtk_vbox_new (FALSE, HIG_SMALL);
  gtk_box_pack_start (GTK_BOX (chbox), box, TRUE, TRUE, 0);

  if (pinentry->title)
    {
      msg = pinentry_utf8_validate (pinentry->title);
      gtk_window_set_title (GTK_WINDOW(win), msg);
    }
  if (pinentry->description)
    {
      msg = pinentry_utf8_validate (pinentry->description);
      w = gtk_label_new (msg);
      g_free (msg);
      gtk_misc_set_alignment (GTK_MISC (w), 0.0, 0.5);
      gtk_label_set_line_wrap (GTK_LABEL (w), TRUE);
      gtk_box_pack_start (GTK_BOX (box), w, TRUE, FALSE, 0);
    }
  if (pinentry->error && !confirm_mode)
    {
      GdkColor color = { 0, 0xffff, 0, 0 };

      msg = pinentry_utf8_validate (pinentry->error);
      w = gtk_label_new (msg);
      g_free (msg);
      gtk_misc_set_alignment (GTK_MISC (w), 0.0, 0.5);
      gtk_label_set_line_wrap (GTK_LABEL (w), TRUE);
      gtk_box_pack_start (GTK_BOX (box), w, TRUE, FALSE, 0);
      gtk_widget_modify_fg (w, GTK_STATE_NORMAL, &color);
    }

  qualitybar = NULL;

  if (!confirm_mode)
    {
      GtkWidget* table = gtk_table_new (pinentry->quality_bar ? 2 : 1, 2,
					FALSE);
      gtk_box_pack_start (GTK_BOX (box), table, FALSE, FALSE, 0);

      if (pinentry->prompt)
	{
	  msg = pinentry_utf8_validate (pinentry->prompt);
	  w = gtk_label_new_with_mnemonic (msg);
	  g_free (msg);
	  gtk_misc_set_alignment (GTK_MISC (w), 1.0, 0.5);
	  gtk_table_attach (GTK_TABLE (table), w, 0, 1, 0, 1,
			    GTK_FILL, GTK_FILL, 4, 0);
	}

      entry = gtk_secure_entry_new ();
      gtk_widget_set_size_request (entry, 200, -1);
      g_signal_connect (G_OBJECT (entry), "activate",
			G_CALLBACK (enter_callback), entry);
      g_signal_connect (G_OBJECT (entry), "changed",
                        G_CALLBACK (changed_text_handler), entry);
      gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 0, 1,
                        GTK_EXPAND|GTK_FILL, GTK_EXPAND|GTK_FILL, 0, 0);
      gtk_widget_grab_focus (entry);
      gtk_widget_show (entry);

      if (pinentry->quality_bar)
	{
          msg = pinentry_utf8_validate (pinentry->quality_bar);
	  w = gtk_label_new (msg);
          g_free (msg);
	  gtk_misc_set_alignment (GTK_MISC (w), 1.0, 0.5);
	  gtk_table_attach (GTK_TABLE (table), w, 0, 1, 1, 2,
			    GTK_FILL, GTK_FILL, 4, 0);
	  qualitybar = gtk_progress_bar_new();
	  gtk_widget_add_events (qualitybar,
				 GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK);
	  gtk_progress_bar_set_text (GTK_PROGRESS_BAR (qualitybar),
				     QUALITYBAR_EMPTY_TEXT);
	  gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (qualitybar), 0.0);
          if (pinentry->quality_bar_tt)
            gtk_tooltips_set_tip (GTK_TOOLTIPS (tooltips), qualitybar,
                                  pinentry->quality_bar_tt, "");
	  gtk_table_attach (GTK_TABLE (table), qualitybar, 1, 2, 1, 2,
	  		    GTK_EXPAND|GTK_FILL, GTK_EXPAND|GTK_FILL, 0, 0);
	}

#ifdef ENABLE_ENHANCED
      if (pinentry->enhanced)
	{
	  GtkWidget *sbox = gtk_hbox_new (FALSE, HIG_SMALL);
	  gtk_box_pack_start (GTK_BOX (box), sbox, FALSE, FALSE, 0);

	  w = gtk_label_new ("Forget secret after");
	  gtk_box_pack_start (GTK_BOX (sbox), w, FALSE, FALSE, 0);
	  gtk_widget_show (w);

	  time_out = gtk_spin_button_new
	    (GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, HUGE_VAL, 1, 60, 60)),
	     2, 0);
	  gtk_box_pack_start (GTK_BOX (sbox), time_out, FALSE, FALSE, 0);
	  gtk_widget_show (time_out);

	  w = gtk_label_new ("seconds");
	  gtk_box_pack_start (GTK_BOX (sbox), w, FALSE, FALSE, 0);
	  gtk_widget_show (w);
	  gtk_widget_show (sbox);

	  insure = gtk_check_button_new_with_label ("ask before giving out "
						    "secret");
	  gtk_box_pack_start (GTK_BOX (box), insure, FALSE, FALSE, 0);
	  gtk_widget_show (insure);
	}
#endif
    }

  bbox = gtk_hbutton_box_new ();
  gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_END);
  gtk_box_set_spacing (GTK_BOX (bbox), 6);
  gtk_box_pack_start (GTK_BOX (wvbox), bbox, TRUE, FALSE, 0);

  if (!pinentry->one_button)
    {
      if (pinentry->cancel)
        {
          msg = pinentry_utf8_validate (pinentry->cancel);
          w = gtk_button_new_with_mnemonic (msg);
          g_free (msg);
        }
      else if (pinentry->default_cancel)
        {
          GtkWidget *image;

          msg = pinentry_utf8_validate (pinentry->default_cancel);
          w = gtk_button_new_with_mnemonic (msg);
          g_free (msg);
          image = gtk_image_new_from_stock (GTK_STOCK_CANCEL,
                                            GTK_ICON_SIZE_BUTTON);
          if (image)
            gtk_button_set_image (GTK_BUTTON (w), image);
        }
      else
          w = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
      gtk_container_add (GTK_CONTAINER (bbox), w);
      g_signal_connect (G_OBJECT (w), "clicked",
                        G_CALLBACK (confirm_mode ? confirm_button_clicked
                                    : button_clicked),
			(gpointer) CONFIRM_CANCEL);
      GTK_WIDGET_SET_FLAGS (w, GTK_CAN_DEFAULT);
    }

  if (confirm_mode && !pinentry->one_button && pinentry->notok)
    {
      msg = pinentry_utf8_validate (pinentry->notok);
      w = gtk_button_new_with_mnemonic (msg);
      g_free (msg);

      gtk_container_add (GTK_CONTAINER (bbox), w);
      g_signal_connect (G_OBJECT (w), "clicked",
                        G_CALLBACK (confirm_button_clicked),
			(gpointer) CONFIRM_NOTOK);
      GTK_WIDGET_SET_FLAGS (w, GTK_CAN_DEFAULT);
    }

  if (pinentry->ok)
    {
      msg = pinentry_utf8_validate (pinentry->ok);
      w = gtk_button_new_with_mnemonic (msg);
      g_free (msg);
    }
  else if (pinentry->default_ok)
    {
      GtkWidget *image;

      msg = pinentry_utf8_validate (pinentry->default_ok);
      w = gtk_button_new_with_mnemonic (msg);
      g_free (msg);
      image = gtk_image_new_from_stock (GTK_STOCK_OK,
                                        GTK_ICON_SIZE_BUTTON);
      if (image)
        gtk_button_set_image (GTK_BUTTON (w), image);
    }
  else
    w = gtk_button_new_from_stock (GTK_STOCK_OK);
  gtk_container_add (GTK_CONTAINER(bbox), w);
  if (!confirm_mode)
    {
      g_signal_connect (G_OBJECT (w), "clicked",
			G_CALLBACK (button_clicked), "ok");
      GTK_WIDGET_SET_FLAGS (w, GTK_CAN_DEFAULT);
      gtk_widget_grab_default (w);
      g_signal_connect_object (G_OBJECT (entry), "focus_in_event",
				G_CALLBACK (gtk_widget_grab_default),
			       G_OBJECT (w), 0);
    }
  else
    {
      g_signal_connect (G_OBJECT (w), "clicked",
			G_CALLBACK(confirm_button_clicked),
			(gpointer) CONFIRM_OK);
      GTK_WIDGET_SET_FLAGS (w, GTK_CAN_DEFAULT);
    }

  gtk_window_set_position (GTK_WINDOW (win), GTK_WIN_POS_CENTER);
  gtk_window_set_keep_above (GTK_WINDOW (win), TRUE);
  gtk_widget_show_all (win);
  gtk_window_present (GTK_WINDOW (win));  /* Make sure it has the focus.  */

  if (pinentry->timeout > 0)
    g_timeout_add (pinentry->timeout*1000, timeout_cb, NULL);

  return win;
}
예제 #20
0
GtkWidget *
sp_find_dialog_old (void)
{
    if  (!dlg)
    {
        gchar title[500];
        sp_ui_dialog_title_string (Inkscape::Verb::get(SP_VERB_DIALOG_FIND), title);
        Inkscape::Preferences *prefs = Inkscape::Preferences::get();

        dlg = sp_window_new (title, TRUE);
        if (x == -1000 || y == -1000) {
            x = prefs->getInt(prefs_path + "x", -1000);
            y = prefs->getInt(prefs_path + "y", -1000);
        }
        if (w ==0 || h == 0) {
            w = prefs->getInt(prefs_path + "w", 0);
            h = prefs->getInt(prefs_path + "h", 0);
        }
        
//        if (x<0) x=0;
//        if (y<0) y=0;

        if (w && h)
            gtk_window_resize ((GtkWindow *) dlg, w, h);
        if (x >= 0 && y >= 0 && (x < (gdk_screen_width()-MIN_ONSCREEN_DISTANCE)) && (y < (gdk_screen_height()-MIN_ONSCREEN_DISTANCE))) {
            gtk_window_move ((GtkWindow *) dlg, x, y);
        } else {
            gtk_window_set_position(GTK_WINDOW(dlg), GTK_WIN_POS_CENTER);
        }

        sp_transientize (dlg);
        wd.win = dlg;
        wd.stop = 0;
        g_signal_connect   ( G_OBJECT (INKSCAPE), "activate_desktop", G_CALLBACK (sp_transientize_callback), &wd );

        gtk_signal_connect ( GTK_OBJECT (dlg), "event", GTK_SIGNAL_FUNC (sp_dialog_event_handler), dlg);

        gtk_signal_connect ( GTK_OBJECT (dlg), "destroy", G_CALLBACK (sp_find_dialog_destroy), NULL );
        gtk_signal_connect ( GTK_OBJECT (dlg), "delete_event", G_CALLBACK (sp_find_dialog_delete), dlg);
        g_signal_connect   ( G_OBJECT (INKSCAPE), "shut_down", G_CALLBACK (sp_find_dialog_delete), dlg);

        g_signal_connect   ( G_OBJECT (INKSCAPE), "dialogs_hide", G_CALLBACK (sp_dialog_hide), dlg);
        g_signal_connect   ( G_OBJECT (INKSCAPE), "dialogs_unhide", G_CALLBACK (sp_dialog_unhide), dlg);

        GtkTooltips *tt = gtk_tooltips_new ();

        gtk_container_set_border_width (GTK_CONTAINER (dlg), 4);

        /* Toplevel vbox */
        GtkWidget *vb = gtk_vbox_new (FALSE, 0);
        gtk_container_add (GTK_CONTAINER (dlg), vb);

        sp_find_new_searchfield (dlg, vb, _("_Text: "), "text", tt, _("Find objects by their text content (exact or partial match)"));
        sp_find_new_searchfield (dlg, vb, _("_ID: "), "id", tt, _("Find objects by the value of the id attribute (exact or partial match)"));
        sp_find_new_searchfield (dlg, vb, _("_Style: "), "style", tt, _("Find objects by the value of the style attribute (exact or partial match)"));
        sp_find_new_searchfield (dlg, vb, _("_Attribute: "), "attr", tt ,_("Find objects by the name of an attribute (exact or partial match)"));

        gtk_widget_show_all (vb);

        GtkWidget *types = sp_find_types ();
        gtk_object_set_data (GTK_OBJECT (dlg), "types", types);
        gtk_box_pack_start (GTK_BOX (vb), types, FALSE, FALSE, 0);

        {
            GtkWidget *w = gtk_hseparator_new ();
            gtk_widget_show (w);
            gtk_box_pack_start (GTK_BOX (vb), w, FALSE, FALSE, 3);

            {
            GtkWidget *b  = gtk_check_button_new_with_mnemonic (_("Search in s_election"));
            gtk_widget_show (b);
            gtk_toggle_button_set_active ((GtkToggleButton *) b, FALSE);
            gtk_object_set_data (GTK_OBJECT (dlg), "inselection", b);
            gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), b, _("Limit search to the current selection"), NULL);
            gtk_box_pack_start (GTK_BOX (vb), b, FALSE, FALSE, 0);
            }

            {
            GtkWidget *b  = gtk_check_button_new_with_mnemonic (_("Search in current _layer"));
            gtk_widget_show (b);
            gtk_toggle_button_set_active ((GtkToggleButton *) b, FALSE);
            gtk_object_set_data (GTK_OBJECT (dlg), "inlayer", b);
            gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), b, _("Limit search to the current layer"), NULL);
            gtk_box_pack_start (GTK_BOX (vb), b, FALSE, FALSE, 0);
            }

            {
            GtkWidget *b  = gtk_check_button_new_with_mnemonic (_("Include _hidden"));
            gtk_widget_show (b);
            gtk_toggle_button_set_active ((GtkToggleButton *) b, FALSE);
            gtk_object_set_data (GTK_OBJECT (dlg), "includehidden", b);
            gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), b, _("Include hidden objects in search"), NULL);
            gtk_box_pack_start (GTK_BOX (vb), b, FALSE, FALSE, 0);
            }

            {
            GtkWidget *b  = gtk_check_button_new_with_mnemonic (_("Include l_ocked"));
            gtk_widget_show (b);
            gtk_toggle_button_set_active ((GtkToggleButton *) b, FALSE);
            gtk_object_set_data (GTK_OBJECT (dlg), "includelocked", b);
            gtk_tooltips_set_tip (GTK_TOOLTIPS (tt), b, _("Include locked objects in search"), NULL);
            gtk_box_pack_start (GTK_BOX (vb), b, FALSE, FALSE, 0);
            }
        }

        {
            GtkWidget *hb = gtk_hbox_new (FALSE, 0);
            gtk_widget_show (hb);
            gtk_box_pack_start (GTK_BOX (vb), hb, FALSE, FALSE, 0);

            // TRANSLATORS: "Clear" is a verb here
            sp_find_new_button (dlg, hb, _("_Clear"), tt, _("Clear values"), sp_find_dialog_reset);
            sp_find_new_button (dlg, hb, _("_Find"), tt, _("Select objects matching all of the fields you filled in"), sp_find_dialog_find);
        }
    }

    gtk_widget_show((GtkWidget *) dlg);
    gtk_window_present ((GtkWindow *) dlg);
    sp_find_dialog_reset (NULL, G_OBJECT (dlg));

    return dlg;
}
예제 #21
0
파일: win-sym.cpp 프로젝트: gogonkt/gcin
void create_win_sym()
{
  if (!current_CS) {
    dbg("create_win_sym, null CS\n");
    return;
  }

  if (current_CS->in_method < 0 || current_CS->in_method >= MAX_GTAB_NUM_KEY) {
    p_err("bad current_CS %d\n", current_CS->in_method);
  }

  if (current_method_type() != method_type_PHO && current_method_type() != method_type_TSIN && current_method_type() != method_type_ANTHY && !cur_inmd)
    return;

  if (read_syms() || cur_in_method != current_CS->in_method) {
    destory_win();
  } else {
    if (!syms)
      return;
  }


  if (gwin_sym) {
    if (win_sym_enabled)
      show_win_sym();
    else
      hide_win_sym();

    return;
  }

  gwin_sym = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_has_resize_grip(GTK_WINDOW(gwin_sym), FALSE);
#if WIN32
  set_no_focus(gwin_sym);
#endif

  cur_in_method = current_CS->in_method;

  GtkWidget *hbox_top = gtk_hbox_new (FALSE, 0);
  gtk_container_add (GTK_CONTAINER (gwin_sym), hbox_top);

  GtkWidget *vbox_top = gtk_vbox_new (FALSE, 0);
  gtk_box_pack_start (GTK_BOX (hbox_top), vbox_top, TRUE, TRUE, 0);

  gtk_container_set_border_width (GTK_CONTAINER (vbox_top), 0);

  int i;
  for(i=0; i < symsN; i++) {
    SYM_ROW *psym = &syms[i];
    GtkWidget *hbox_row = gtk_hbox_new (FALSE, 0);
    gtk_box_pack_start (GTK_BOX (vbox_top), hbox_row, FALSE, FALSE, 0);
    gtk_container_set_border_width (GTK_CONTAINER (hbox_row), 0);

    int j;
    for(j=0; j < psym->symN; j++) {
      char *str = psym->sym[j];

      if (!str[0])
         continue;

      GtkWidget *button = gtk_button_new();
      GtkWidget *label = gtk_label_new(str);

      gtk_container_add(GTK_CONTAINER(button), label);
      set_label_font_size(label, gcin_font_size_symbol);

      gtk_container_set_border_width (GTK_CONTAINER (button), 0);
      gtk_box_pack_start (GTK_BOX (hbox_row), button, FALSE, FALSE, 0);

      if (utf8_str_N(str) > 0) {
        char phos[512];

        sym_lookup_key(str, phos);

        int phos_len = strlen(phos);

        if (phos_len) {
#if GTK_CHECK_VERSION(2,12,0)
          gtk_widget_set_tooltip_text (button, phos);
#else
          GtkTooltips *button_pho_tips = gtk_tooltips_new ();
          gtk_tooltips_set_tip (GTK_TOOLTIPS (button_pho_tips), button, phos, NULL);
#endif
        }
      }

      g_signal_connect (G_OBJECT (button), "clicked",  G_CALLBACK (cb_button_sym), label);
    }
  }

  gtk_box_pack_start (GTK_BOX (hbox_top), gtk_vseparator_new(), FALSE, FALSE, 0);

  GtkWidget *vbox_arrow = gtk_vbox_new (TRUE, 0);
  gtk_box_pack_start (GTK_BOX (hbox_top), vbox_arrow, TRUE, TRUE, 0);
  GtkWidget *eve_up=gtk_event_box_new(), *eve_down=gtk_event_box_new();
  gtk_box_pack_start (GTK_BOX (vbox_arrow), eve_up, TRUE, TRUE, 0);
  gtk_container_add(GTK_CONTAINER(eve_up), gtk_arrow_new(GTK_ARROW_UP, GTK_SHADOW_IN));
  gtk_box_pack_start (GTK_BOX (vbox_arrow), eve_down, TRUE, TRUE, 0);
  gtk_container_add(GTK_CONTAINER(eve_down), gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_IN));

  g_signal_connect(G_OBJECT(eve_up),"button-press-event", G_CALLBACK(mouse_button_callback_up_down), (gpointer)1);
  g_signal_connect(G_OBJECT(eve_down),"button-press-event", G_CALLBACK(mouse_button_callback_up_down), NULL);


  gtk_widget_realize (gwin_sym);
#if UNIX
  GdkWindow *gdkwin_sym = gtk_widget_get_window(gwin_sym);
  set_no_focus(gwin_sym);
#else
  win32_init_win(gwin_sym);
#endif

  if (win_sym_enabled)
    gtk_widget_show_all(gwin_sym);

  g_signal_connect (G_OBJECT (gwin_sym), "scroll-event", G_CALLBACK (button_scroll_event), NULL);

  move_win_sym();
#if 0
  dbg("in_method:%d\n", current_CS->in_method);
#endif
  return;
}
예제 #22
0
파일: fileview.c 프로젝트: dimkr/emelfm
GtkWidget *
create_file_view(FileView *view)
{
  GtkWidget *vbox;
  GtkWidget *hbox;
  GtkWidget *menu_bar;
  GtkWidget *button;
  GtkWidget *pixmapwid;
  GdkPixmap *pixmap;
  GdkBitmap *mask;
  GtkStyle *style;
  GdkFont *font;
  GtkWidget *sw;
  gint i;

  /* Top Pane */
  vbox = gtk_vbox_new(FALSE, 0);
  gtk_widget_show(vbox);

  menu_bar = create_filelist_menu_bar(view);
  gtk_widget_show(menu_bar);
  gtk_box_pack_start(GTK_BOX(vbox), menu_bar, FALSE, FALSE, 0);

  hbox = gtk_hbox_new(FALSE, 0);
  gtk_widget_show(hbox);

  /* Show/Hide Button */
  if (view == &app.right_view)
    button = gtk_button_new_with_label("<");
  else
    button = gtk_button_new_with_label(">");
  GTK_WIDGET_UNSET_FLAGS(button, GTK_CAN_FOCUS);
  gtk_signal_connect(GTK_OBJECT(button), "button_press_event", 
                    GTK_SIGNAL_FUNC(show_hide_file_view_cb), view);
  gtk_tooltips_set_tip(GTK_TOOLTIPS(app.tooltips), button,
                       _("Left Click: Maximize/Minimize File View\n"
                         "Right Click: Sync Dirs"), NULL);
  gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
  gtk_widget_show(button);

  /* Hidden files toggle button */
  view->hidden_toggle = gtk_toggle_button_new_with_label("H");
  GTK_WIDGET_UNSET_FLAGS(view->hidden_toggle, GTK_CAN_FOCUS);
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(view->hidden_toggle),
                               view->show_hidden);
  gtk_signal_connect(GTK_OBJECT(view->hidden_toggle), "toggled",
                     GTK_SIGNAL_FUNC(toggle_show_hidden_cb), view);
  gtk_tooltips_set_tip(GTK_TOOLTIPS(app.tooltips), view->hidden_toggle,
                       _("Show/Hide hidden files"), NULL);
  gtk_box_pack_start(GTK_BOX(hbox), view->hidden_toggle, FALSE, FALSE, 0);
  gtk_widget_show(view->hidden_toggle);

  /* Dir Entry Combo */
  view->dir_entry = gtk_combo_new();
  gtk_combo_disable_activate(GTK_COMBO(view->dir_entry));
  gtk_combo_set_use_arrows_always(GTK_COMBO(view->dir_entry), TRUE);
  gtk_combo_set_case_sensitive(GTK_COMBO(view->dir_entry), TRUE);
  gtk_signal_connect(GTK_OBJECT(GTK_COMBO(view->dir_entry)->entry), 
              "activate", GTK_SIGNAL_FUNC(dir_entry_cb), view);
  gtk_signal_connect(GTK_OBJECT(GTK_COMBO(view->dir_entry)->popwin),
              "hide", GTK_SIGNAL_FUNC(dir_popwin_cb), view);
  gtk_box_pack_start(GTK_BOX(hbox), view->dir_entry, TRUE, TRUE, 0);
  gtk_widget_show(view->dir_entry);

  /* Up Dir Button */
  button = gtk_button_new();
  GTK_WIDGET_UNSET_FLAGS(button, GTK_CAN_FOCUS);
  gtk_signal_connect(GTK_OBJECT(button), "button_press_event",
                     GTK_SIGNAL_FUNC(updir_click_cb), view);
  gtk_tooltips_set_tip(GTK_TOOLTIPS(app.tooltips), button,
                       _("Left Click: Up Dir   Right Click: Home"), NULL);
  gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
  gtk_widget_show(button);

  style = gtk_widget_get_style(app.main_window);
  pixmap = gdk_pixmap_create_from_xpm_d(app.main_window->window, &mask, 
                                        &style->bg[GTK_STATE_NORMAL], 
                                        icon_dirparent_xpm);
  pixmapwid = gtk_pixmap_new(pixmap, mask);
  gtk_container_add(GTK_CONTAINER(button), pixmapwid);
  gtk_widget_show(pixmapwid);

  gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);

  sw = gtk_scrolled_window_new(NULL, NULL);
  gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
          GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
  gtk_scrolled_window_set_placement(GTK_SCROLLED_WINDOW(sw), cfg.scrollbar_pos);
  gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0);
  gtk_widget_show(sw);

  /* File List */
  view->clist = gtk_clist_new(MAX_COLUMNS);
  for (i = 0; i < MAX_COLUMNS; i++)
  {
    GtkWidget *hbox = gtk_hbox_new(FALSE, 0);
    GtkWidget *label = gtk_label_new(all_columns[i].title);

    view->sort_arrows[i] = gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_IN);
    gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 0);
    gtk_box_pack_end(GTK_BOX(hbox), view->sort_arrows[i], FALSE, TRUE, 0);

    gtk_widget_show(label);
    gtk_widget_show(hbox);
    gtk_clist_set_column_widget(GTK_CLIST(view->clist), i, hbox);
    GTK_WIDGET_UNSET_FLAGS(GTK_CLIST(view->clist)->column[i].button,
                           GTK_CAN_FOCUS);
  } 
  gtk_clist_column_titles_show(GTK_CLIST(view->clist));
  gtk_clist_set_shadow_type(GTK_CLIST(view->clist), GTK_SHADOW_ETCHED_IN);
  gtk_clist_set_selection_mode(GTK_CLIST(view->clist), GTK_SELECTION_EXTENDED);
  gtk_clist_set_use_drag_icons(GTK_CLIST(view->clist), TRUE);
  gtk_clist_set_row_height(GTK_CLIST(view->clist), 0);
  
  font = gdk_font_load(cfg.list_font);
  if (font != NULL)
  {
    style = gtk_style_copy(gtk_widget_get_style(view->clist));
    style->font = font;
    gtk_widget_set_style(view->clist, style);
  }

  for (i = 0; i < MAX_COLUMNS; i++)
  {
    gtk_clist_set_column_width(GTK_CLIST(view->clist), i, all_columns[i].size);
    gtk_clist_set_column_visibility(GTK_CLIST(view->clist), i,
                                    all_columns[i].is_visible);
  }

  gtk_signal_connect(GTK_OBJECT(view->clist), "select_row",
                     GTK_SIGNAL_FUNC(select_row_cb), view);
  gtk_signal_connect(GTK_OBJECT(view->clist), "button_press_event",
                     GTK_SIGNAL_FUNC(mouse_click_cb), view);
  gtk_signal_connect(GTK_OBJECT(view->clist), "key_press_event",
                     GTK_SIGNAL_FUNC(file_list_key_press_cb), view);
  gtk_signal_connect(GTK_OBJECT(view->clist), "click_column",
                     GTK_SIGNAL_FUNC(column_button_cb), view);
  gtk_signal_connect(GTK_OBJECT(view->clist), "drag_data_get",
                     GTK_SIGNAL_FUNC(clist_drag_data_get), view);
  gtk_signal_connect(GTK_OBJECT(view->clist), "drag_motion",
                     GTK_SIGNAL_FUNC(clist_drag_motion), view);
  gtk_signal_connect(GTK_OBJECT(view->clist), "drag_leave",
                     GTK_SIGNAL_FUNC(clist_drag_leave), view);
  gtk_signal_connect(GTK_OBJECT(view->clist), "drag_data_received",
                     GTK_SIGNAL_FUNC(clist_drag_data_received), view);
  gtk_drag_dest_set(view->clist, GTK_DEST_DEFAULT_MOTION |
    GTK_DEST_DEFAULT_HIGHLIGHT | GTK_DEST_DEFAULT_DROP, target_table,
    n_targets, GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK |
    GDK_ACTION_ASK);

  gtk_container_add(GTK_CONTAINER(sw), view->clist);
  gtk_widget_show(view->clist);

  /* Set the CLIST_COLOR for resetting from the DRAG_HILIGHT color */
  {
    GtkStyle *style = gtk_widget_get_style(view->clist);
    CLIST_COLOR.red   = style->base[GTK_STATE_NORMAL].red;
    CLIST_COLOR.green = style->base[GTK_STATE_NORMAL].green;
    CLIST_COLOR.blue  = style->base[GTK_STATE_NORMAL].blue;
  }

  return vbox;
}
예제 #23
0
파일: win-gtab.c 프로젝트: duomaxwellr/hime
void create_win_gtab_gui_simple()
{
//  dbg("create_win_gtab_gui ..... %d, %d\n", current_CS->use_preedit, hime_edit_display);

  destroy_if_necessary();

  if (top_bin)
    return;

//  dbg("create_win_gtab_gui_simple\n");

  last_cursor_off = FALSE;

  GtkWidget *vbox_top = gtk_vbox_new (FALSE, 0);
  gtk_orientable_set_orientation(GTK_ORIENTABLE(vbox_top), GTK_ORIENTATION_VERTICAL);

  GtkWidget *event_box_gtab;
  if (gtab_in_area_button) {
    event_box_gtab = gtk_button_new();
#if 0
    GtkStyle *style = gtk_widget_get_style(event_box_gtab);
    style->xthickness =0;
    style->ythickness =0;
#endif
  } else {
    event_box_gtab = gtk_event_box_new();
    gtk_event_box_set_visible_window (GTK_EVENT_BOX(event_box_gtab), FALSE);
  }

  gtk_container_set_border_width (GTK_CONTAINER (event_box_gtab), 0);

  if (hime_inner_frame) {
    GtkWidget *frame = top_bin = gtk_frame_new(NULL);
    gtk_container_set_border_width (GTK_CONTAINER (frame), 0);
    gtk_container_add (GTK_CONTAINER(gwin_gtab), frame);
    gtk_container_set_border_width (GTK_CONTAINER (gwin_gtab), 0);
    gtk_container_add (GTK_CONTAINER (frame), vbox_top);
    gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_OUT);
  } else {
    gtk_container_add (GTK_CONTAINER(gwin_gtab), vbox_top);
    top_bin = vbox_top;
  }

  GtkWidget *hbox_edit = NULL;

  gboolean b_need_label_edit = need_label_edit();

  if (b_need_label_edit) {
    hbox_edit = gtk_hbox_new (FALSE, 0);
    gtk_container_add (GTK_CONTAINER (vbox_top), hbox_edit);
    GtkWidget *align_edit = gtk_alignment_new (0, 0.0, 0, 0);
    gtk_box_pack_start (GTK_BOX (hbox_edit), align_edit, FALSE, FALSE, 0);
    label_edit = gtk_label_new(NULL);
    gtk_container_add (GTK_CONTAINER (align_edit), label_edit);
  }

  GtkWidget *align = gtk_alignment_new (0, 0.0, 0, 0);

  label_gtab_sele = gtk_label_new(NULL);
  gtk_container_add (GTK_CONTAINER (align), label_gtab_sele);

  if (!gtab_in_row1) {
    if (!gtab_vertical_select_on())
      gtk_box_pack_start (GTK_BOX (vbox_top), align, FALSE, FALSE, 0);
  } else {
    GtkWidget *hbox_row1 = gtk_hbox_new (FALSE, 0);
    gtk_box_pack_start (GTK_BOX (vbox_top), hbox_row1, FALSE, FALSE, 0);

//    dbg("zzz %d zzz %d %d\n", b_need_label_edit, gtab_phrase_on(), hime_edit_display_ap_only());

    if (b_need_label_edit) {
      last_cursor_off = TRUE;
      gtk_box_pack_start (GTK_BOX (hbox_edit), event_box_gtab, FALSE, FALSE, 0);
    } else
      gtk_box_pack_start (GTK_BOX (hbox_row1), event_box_gtab, FALSE, FALSE, 0);

    if (!gtab_vertical_select_on())
      gtk_box_pack_start (GTK_BOX (hbox_row1), align, FALSE, FALSE, 0);
  }

  if (gtab_phrase_pre_select && !use_tsin_sel_win()) {
    label_gtab_pre_sel = gtk_label_new(NULL);
    set_label_font_size(label_gtab_pre_sel, hime_font_size_tsin_presel);
    gtk_box_pack_start (GTK_BOX (vbox_top), label_gtab_pre_sel, FALSE, FALSE, 0);
  }

  hbox_row2 = gtk_hbox_new (FALSE, 0);
  gtk_container_add (GTK_CONTAINER (vbox_top), hbox_row2);

  label_full = gtk_label_new(NULL);
  gtk_label_set_markup(GTK_LABEL(label_full), _(cht_full_str));

  gtk_box_pack_start (GTK_BOX (hbox_row2), label_full, FALSE, FALSE, 0);


  if (gtab_disp_im_name) {
    GtkWidget *event_box_input_method_name;
    if (gtab_in_area_button)
      event_box_input_method_name = gtk_button_new();
    else {
      event_box_input_method_name = gtk_event_box_new();
      gtk_event_box_set_visible_window (GTK_EVENT_BOX(event_box_input_method_name), FALSE);
    }

    gtk_box_pack_start (GTK_BOX (hbox_row2), event_box_input_method_name, FALSE, FALSE, 0);
    gtk_container_set_border_width (GTK_CONTAINER (event_box_input_method_name), 0);

    GtkWidget *frame_input_method_name = NULL;
    if (!gtab_in_area_button) {
    frame_input_method_name = gtk_frame_new(NULL);
    gtk_frame_set_shadow_type(GTK_FRAME(frame_input_method_name), GTK_SHADOW_OUT);
    gtk_container_add (GTK_CONTAINER (event_box_input_method_name), frame_input_method_name);
    gtk_container_set_border_width (GTK_CONTAINER (frame_input_method_name), 0);
    }

    label_input_method_name = gtk_label_new("");
  //  dbg("gtk_label_new label_input_method_name\n");

    gtk_container_add (GTK_CONTAINER (gtab_in_area_button?event_box_input_method_name:frame_input_method_name), label_input_method_name);
    g_signal_connect_swapped (GTK_OBJECT (event_box_input_method_name), "button-press-event",
          G_CALLBACK (inmd_switch_popup_handler), NULL);

    box_gtab_im_name = event_box_input_method_name;
  }

  if (!gtab_in_row1)
    gtk_box_pack_start (GTK_BOX (hbox_row2), event_box_gtab, FALSE, FALSE, 0);


  if (!hime_display_on_the_spot_key()) {
    GtkWidget *frame_gtab = NULL;
    if (!gtab_in_area_button) {
      frame_gtab = gtk_frame_new(NULL);
      gtk_frame_set_shadow_type(GTK_FRAME(frame_gtab), GTK_SHADOW_OUT);
      gtk_container_set_border_width (GTK_CONTAINER (frame_gtab), 0);
      gtk_container_add (GTK_CONTAINER (event_box_gtab), frame_gtab);
    }
    g_signal_connect(G_OBJECT(event_box_gtab),"button-press-event",
                     G_CALLBACK(mouse_button_callback), NULL);

#if 0
    if (left_right_button_tips) {
#if GTK_CHECK_VERSION(2,12,0)
      gtk_widget_set_tooltip_text (event_box_gtab, _("左鍵符號,右鍵設定"));
#else
      GtkTooltips *button_gtab_tips = gtk_tooltips_new ();
      gtk_tooltips_set_tip (GTK_TOOLTIPS (button_gtab_tips), event_box_gtab, _("左鍵符號,右鍵設定"),NULL);
#endif
    }
#endif


    label_gtab = gtk_label_new(NULL);

    if (gtab_in_area_button)
      gtk_container_add (GTK_CONTAINER (event_box_gtab), label_gtab);
    else
      gtk_container_add (GTK_CONTAINER (frame_gtab), label_gtab);
  }

  label_key_codes  = gtk_label_new(NULL);
#if 0
  gtk_label_set_selectable(GTK_LABEL(label_key_codes), TRUE);
  mod_bg_all(label_key_codes, NULL);
#endif
  gtk_box_pack_start (GTK_BOX (hbox_row2), label_key_codes, FALSE, FALSE, 2);

  label_page  = gtk_label_new(NULL);
  gtk_box_pack_start (GTK_BOX (hbox_row2), label_page, FALSE, FALSE, 2);

  if (gtab_vertical_select_on()) {
    gtk_box_pack_start (GTK_BOX (vbox_top), align, FALSE, FALSE, 0);
  }

  change_gtab_font_size();

  gtk_widget_show_all (gwin_gtab);
  gtk_widget_hide (gwin_gtab);
  gtk_widget_hide(label_gtab_sele);
  gtk_widget_hide(label_key_codes);
  gtk_widget_hide(label_page);
  if (label_gtab_pre_sel)
    gtk_widget_hide(label_gtab_pre_sel);

  show_hide_label_edit();

  set_disp_im_name();
  gtk_widget_hide(label_full);

  if (gtab_hide_row2)
    gtk_widget_hide(hbox_row2);

  minimize_win_gtab();
}
예제 #24
0
static void
add_record_dialog_open (GGobiStage * d, GGobiStage * e, displayd * dsp,
                        GGobiSession * gg)
{
  GtkWidget *dialog, *table;
  GtkWidget *entry, *w;
  gchar *lbl;
  cpaneld *cpanel = &dsp->cpanel;
  /*  GtkAttachOptions table_opt = GTK_SHRINK|GTK_FILL|GTK_EXPAND; */
  GtkAttachOptions table_opt = GTK_SHRINK;
  gint row = 0;
  GGobiStage *dtarget;

  edgeedit_event_handlers_toggle (gg->current_splot, false);

  if (cpanel->ee_mode == ADDING_EDGES)
    dtarget = e;
  else
    dtarget = d;

  dialog = gtk_dialog_new ();
  gtk_window_set_title (GTK_WINDOW (dialog), "Add a Record");

  table = gtk_table_new (5, 2, false);
  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),
                      table, false, false, 5);

  w = gtk_label_new ("Record number");
  gtk_misc_set_alignment (GTK_MISC (w), 1, .5);
  gtk_table_attach (GTK_TABLE (table),
                    w, 0, 1, row, row + 1, table_opt, table_opt, 1, 1);
  lbl = g_strdup_printf ("%d", dtarget->n_rows);
  w = gtk_label_new (lbl);
  gtk_misc_set_alignment (GTK_MISC (w), .5, .5);
  gtk_table_attach (GTK_TABLE (table),
                    w, 1, 2, row, row + 1, table_opt, table_opt, 1, 1);
  g_free (lbl);
  row++;

  if (cpanel->ee_mode == ADDING_EDGES) {
    w = gtk_label_new ("Edge source");
    gtk_misc_set_alignment (GTK_MISC (w), 1, .5);
    gtk_table_attach (GTK_TABLE (table),
                      w, 0, 1, row, row + 1, table_opt, table_opt, 1, 1);
    /* This label should include both the rowlab and the rowId */
    lbl = ggobi_stage_get_row_id(d, gg->edgeedit.a);
    w = gtk_label_new (lbl);
    gtk_misc_set_alignment (GTK_MISC (w), .5, .5);
    gtk_table_attach (GTK_TABLE (table),
                      w, 1, 2, row, row + 1, table_opt, table_opt, 1, 1);
    row++;

    w = gtk_label_new ("Edge destination");
    gtk_misc_set_alignment (GTK_MISC (w), 1, .5);
    gtk_table_attach (GTK_TABLE (table),
                      w, 0, 1, row, row + 1, table_opt, table_opt, 1, 1);
    lbl = ggobi_stage_get_row_id(d, d->nearest_point);
    w = gtk_label_new (lbl);
    gtk_misc_set_alignment (GTK_MISC (w), .5, .5);
    gtk_table_attach (GTK_TABLE (table),
                      w, 1, 2, row, row + 1, table_opt, table_opt, 1, 1);
    row++;
  }

  w = gtk_label_new_with_mnemonic ("Record _label");
  gtk_misc_set_alignment (GTK_MISC (w), 1, .5);
  gtk_table_attach (GTK_TABLE (table),
                    w, 0, 1, row, row + 1, table_opt, table_opt, 1, 1);
  entry = gtk_entry_new ();
  gtk_label_set_mnemonic_widget (GTK_LABEL (w), entry);
  lbl = g_strdup_printf ("%d", dtarget->n_rows + 1);
  gtk_entry_set_text (GTK_ENTRY (entry), lbl);
  g_free (lbl);

  gtk_widget_set_name (entry, "EE:rowlabel");
  gtk_table_attach (GTK_TABLE (table),
                    entry, 1, 2, row, row + 1, table_opt, table_opt, 1, 1);
  row++;

  if ((cpanel->ee_mode == ADDING_POINTS) ||
      (cpanel->ee_mode == ADDING_EDGES)) {
    w = gtk_label_new_with_mnemonic ("Record _id");
    gtk_misc_set_alignment (GTK_MISC (w), 1, .5);
    gtk_table_attach (GTK_TABLE (table),
                      w, 0, 1, row, row + 1, table_opt, table_opt, 1, 1);
    entry = gtk_entry_new ();
    gtk_label_set_mnemonic_widget (GTK_LABEL (w), entry);
    lbl = g_strdup_printf ("%d", dtarget->n_rows + 1);
    gtk_entry_set_text (GTK_ENTRY (entry), lbl);
    g_free (lbl);
    gtk_widget_set_name (entry, "EE:recordid");
    gtk_table_attach (GTK_TABLE (table),
                      entry, 1, 2, row, row + 1, table_opt, table_opt, 1, 1);
    row++;
  }

  /*-- Another table to contain variable name-value pairs --*/
  if (ggobi_stage_has_vars(dtarget)) {
    gint j;
    GtkWidget *tablev;
    gchar **vals = (gchar **) g_malloc (dtarget->n_cols * sizeof (gchar *));

    extern void fetch_default_record_values (gchar ** vals,
                                             GGobiStage *, displayd *,
                                             GGobiSession * gg);
    fetch_default_record_values (vals, dtarget, dsp, gg);

    tablev = gtk_table_new (dtarget->n_cols, 2, false);
    gtk_widget_set_name (tablev, "EE:tablev");
    gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),
                        tablev, false, false, 5);

    for (j = 0; j < dtarget->n_cols; j++) {
      w = gtk_label_new (ggobi_stage_get_col_name(d, j));
      gtk_table_attach (GTK_TABLE (tablev),
                        w, 0, 1, j, j + 1, table_opt, table_opt, 1, 1);

      entry = gtk_entry_new ();
      gtk_entry_set_text (GTK_ENTRY (entry), vals[j]);
      gtk_table_attach (GTK_TABLE (tablev),
                        entry, 1, 2, j, j + 1, table_opt, table_opt, 1, 1);
    }

    /* free vals, I think */
    for (j = 0; j < dtarget->n_cols; j++)
      g_free (vals[j]);
    g_free (vals);
  }

  /*-- ok button --*/
  w = gtk_button_new_from_stock (GTK_STOCK_APPLY);
  gtk_tooltips_set_tip (GTK_TOOLTIPS (gg->tips), w,
                        "Add the point or edge.  To avoid seeing this dialog, use the left button.",
                        NULL);
  g_signal_connect (G_OBJECT (w), "clicked",
                    G_CALLBACK (add_record_dialog_apply), dsp);
  gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), w);

  /*-- cancel button --*/
  w = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
  g_signal_connect (G_OBJECT (w), "clicked",
                    G_CALLBACK (add_record_dialog_cancel), gg);
  gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), w);


  gtk_widget_show_all (dialog);
}
예제 #25
0
static void create_win0_gui()
{
  if (top_bin)
    return;

  GtkWidget *vbox_top = gtk_vbox_new (FALSE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (gwin0), 0);

  if (gcin_inner_frame) {
    GtkWidget *frame;
    top_bin = frame = gtk_frame_new(NULL);
    gtk_container_set_border_width (GTK_CONTAINER (frame), 0);
    gtk_container_add (GTK_CONTAINER(gwin0), frame);
    gtk_container_add (GTK_CONTAINER (frame), vbox_top);
  } else {
    top_bin = vbox_top;
    gtk_container_add (GTK_CONTAINER (gwin0), vbox_top);
  }

  bzero(chars, sizeof(chars));

  GtkWidget *hbox_row1 = gtk_hbox_new (FALSE, 0);
  /* This packs the button into the gwin0 (a gtk container). */
  gtk_box_pack_start (GTK_BOX (vbox_top), hbox_row1, FALSE, FALSE, 0);

  hbox_edit = gtk_hbox_new (FALSE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (hbox_edit), 0);
  /* This packs the button into the gwin0 (a gtk container). */
  gtk_box_pack_start (GTK_BOX (hbox_row1), hbox_edit, FALSE, FALSE, 0);

  create_cursor_attr();

  button_pho = gtk_button_new();
  gtk_container_set_border_width (GTK_CONTAINER (button_pho), 0);
  gtk_box_pack_start (GTK_BOX (hbox_row1), button_pho, FALSE, FALSE, 0);

  g_signal_connect(G_OBJECT(button_pho),"button-press-event",
                   G_CALLBACK(mouse_button_callback), NULL);
#if GTK_CHECK_VERSION(2,18,0)
   gtk_widget_set_can_focus(button_pho, FALSE);
   gtk_widget_set_can_default(button_pho, FALSE);
#else
  GTK_WIDGET_UNSET_FLAGS(button_pho,  GTK_CAN_FOCUS|GTK_CAN_DEFAULT);
#endif

  if (left_right_button_tips) {
#if GTK_CHECK_VERSION(2,12,0)
    gtk_widget_set_tooltip_text (button_pho, _(_L("左鍵符號,右鍵設定")));
#else
    GtkTooltips *button_pho_tips = gtk_tooltips_new ();
    gtk_tooltips_set_tip (GTK_TOOLTIPS (button_pho_tips), button_pho, _(_L("左鍵符號,右鍵設定")),NULL);
#endif
  }

  label_pho = gtk_label_new("");
  set_label_font_size(label_pho, gcin_font_size_tsin_pho_in);
  gtk_container_add (GTK_CONTAINER (button_pho), label_pho);

  clr_in_area_pho_tsin();

  gtk_widget_show_all (gwin0);
//  gdk_flush();
  gtk_widget_hide(gwin0);

  init_tsin_selection_win();

  set_win0_bg();

//  change_win1_font();
}
예제 #26
0
void create_win_pho_gui_simple()
{
//  dbg("create_win_pho .....\n");

  if (top_bin)
    return;

  GtkWidget *vbox_top = gtk_vbox_new (FALSE, 0);
  gtk_orientable_set_orientation(GTK_ORIENTABLE(vbox_top), GTK_ORIENTATION_VERTICAL);

  GtkWidget *event_box_pho;
  if (gtab_in_area_button)
	event_box_pho = gtk_button_new();
  else {
	event_box_pho = gtk_event_box_new();
	gtk_event_box_set_visible_window (GTK_EVENT_BOX(event_box_pho), FALSE);
  }

  gtk_container_set_border_width (GTK_CONTAINER (event_box_pho), 0);

  if (hime_inner_frame) {
    GtkWidget *frame = top_bin = gtk_frame_new(NULL);
    gtk_container_set_border_width (GTK_CONTAINER (frame), 0);
    gtk_container_add (GTK_CONTAINER(gwin_pho), frame);
    gtk_container_add (GTK_CONTAINER (frame), vbox_top);
    gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_OUT);
  } else {
    gtk_container_add (GTK_CONTAINER(gwin_pho), vbox_top);
    top_bin = vbox_top;
  }


  GtkWidget *align = gtk_alignment_new (0, 0, 0, 0);
  label_pho_sele = gtk_label_new(NULL);

  if (!pho_in_row1) {
    gtk_box_pack_start (GTK_BOX (vbox_top), align, FALSE, FALSE, 0);
    gtk_container_add (GTK_CONTAINER (align), label_pho_sele);
  } else {
    GtkWidget *hbox_row1 = gtk_hbox_new (FALSE, 0);
    gtk_box_pack_start (GTK_BOX (vbox_top), hbox_row1, FALSE, FALSE, 0);
    gtk_box_pack_start (GTK_BOX (hbox_row1), event_box_pho, FALSE, FALSE, 0);

    gtk_box_pack_start (GTK_BOX (hbox_row1), align, FALSE, FALSE, 0);
    gtk_container_add (GTK_CONTAINER (align), label_pho_sele);
  }


  hbox_row2 = gtk_hbox_new (FALSE, 0);
  /* This packs the button into the gwin_pho (a gtk container). */
  gtk_container_add (GTK_CONTAINER (vbox_top), hbox_row2);
  label_full = gtk_label_new(_("全"));
  gtk_container_add (GTK_CONTAINER (hbox_row2), label_full);


  if (!pho_in_row1)
    gtk_box_pack_start (GTK_BOX (hbox_row2), event_box_pho, FALSE, FALSE, 0);

  g_signal_connect(G_OBJECT(event_box_pho),"button-press-event",
                   G_CALLBACK(mouse_button_callback), NULL);


  label_pho = gtk_label_new(NULL);

  GtkWidget *frame_pho;
  if (gtab_in_area_button) {
	gtk_container_add (GTK_CONTAINER (event_box_pho), label_pho);
  }
  else {
	frame_pho = gtk_frame_new(NULL);
	gtk_frame_set_shadow_type(GTK_FRAME(frame_pho), GTK_SHADOW_OUT);
	gtk_container_add (GTK_CONTAINER (event_box_pho), frame_pho);
	gtk_container_set_border_width (GTK_CONTAINER (frame_pho), 0);
	gtk_container_add (GTK_CONTAINER (frame_pho), label_pho);
  }

#if 0
  if (left_right_button_tips) {
#if GTK_CHECK_VERSION(2,12,0)
    gtk_widget_set_tooltip_text (event_box_pho, _("左鍵符號,右鍵設定"));
#else
    GtkTooltips *button_gtab_tips = gtk_tooltips_new ();
    gtk_tooltips_set_tip (GTK_TOOLTIPS (button_gtab_tips), event_box_pho, _("左鍵符號,右鍵設定"),NULL);
#endif
  }
#endif

  label_key_codes  = gtk_label_new(NULL);
  gtk_label_set_selectable(GTK_LABEL(label_key_codes), TRUE);
  gtk_box_pack_start (GTK_BOX (hbox_row2), label_key_codes, FALSE, FALSE, 2);

  change_pho_font_size();

  gtk_widget_show_all (gwin_pho);

  gtk_widget_hide(label_key_codes);

  gtk_widget_hide(label_full);
}
예제 #27
0
파일: routes.c 프로젝트: Jalakas/gpsdrive
/* ******************************************************************
 *
 */
gint
create_route_cb (GtkWidget * widget, guint datum)
{
	GtkWidget *window;
	gchar *tabeltitel1[] = { "#",
		_("Waypoint"), _("Latitude"), _("Longitude"), _("Distance"),
		NULL
	};
	GtkWidget *scrwindow, *vbox, *button, *button3, *hbox, *hbox_displays, *l1;
	gint i, j;
	gchar *text[5], text0[20], text1[20], text2[20], text3[20];
	GtkTooltips *tooltips;

	route.edit = TRUE;
	window = gtk_dialog_new ();
	routewindow = window;
	/*    gtk_window_set_policy(GTK_WINDOW(window), TRUE, TRUE, TRUE); */

	gtk_window_set_title (GTK_WINDOW (window), _("Define route"));
	gtk_window_set_default_size (GTK_WINDOW (window), 320, 320);
	myroutelist = gtk_clist_new_with_titles (5, tabeltitel1);
	gtk_signal_connect (GTK_OBJECT (GTK_CLIST (myroutelist)),
			    "select-row",
			    GTK_SIGNAL_FUNC (setroutetarget),
			    GTK_OBJECT (myroutelist));

	select_route_button = gtk_button_new_with_label (_("Start route"));
	gtk_widget_set_sensitive (select_route_button, FALSE);

	GTK_WIDGET_SET_FLAGS (select_route_button, GTK_CAN_DEFAULT);
	gtk_signal_connect (GTK_OBJECT (select_route_button), "clicked",
			    GTK_SIGNAL_FUNC (do_route_cb), 0);
	gtk_window_set_default (GTK_WINDOW (window), select_route_button);

	create_route2_button =
		gtk_button_new_with_label (_("Take all WP as route"));
	GTK_WIDGET_SET_FLAGS (create_route2_button, GTK_CAN_DEFAULT);
	gtk_signal_connect (GTK_OBJECT (create_route2_button), "clicked",
			    GTK_SIGNAL_FUNC (insertallroutepoints), 0);

	button = gtk_button_new_with_label (_("Abort route"));
	GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
	gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
				   GTK_SIGNAL_FUNC
				   (sel_routecancel_cb), GTK_OBJECT (window));
	gtk_signal_connect_object (GTK_OBJECT (window),
				   "delete_event",
				   GTK_SIGNAL_FUNC
				   (sel_routeclose_cb), GTK_OBJECT (window));

	/*   button3 = gtk_button_new_with_label (_("Close")); */
	button3 = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
	GTK_WIDGET_SET_FLAGS (button3, GTK_CAN_DEFAULT);
	gtk_signal_connect_object (GTK_OBJECT (button3), "clicked",
				   GTK_SIGNAL_FUNC
				   (sel_routeclose_cb), GTK_OBJECT (window));

	/* Font �ndern falls PDA-Mode und Touchscreen */
	if (local_config.guimode == GUI_PDA)
	{
		if (onemousebutton)
		{

			/* Change default font throughout the widget */
			PangoFontDescription *font_desc;
			font_desc =
				pango_font_description_from_string
				("Sans 10");
			gtk_widget_modify_font (myroutelist, font_desc);
			pango_font_description_free (font_desc);
		}
	}

	gtk_clist_set_column_justification (GTK_CLIST (myroutelist), 4,
					    GTK_JUSTIFY_RIGHT);
	gtk_clist_set_column_justification (GTK_CLIST (myroutelist), 0,
					    GTK_JUSTIFY_RIGHT);
	gtk_clist_set_column_auto_resize (GTK_CLIST (myroutelist), 0, TRUE);
	gtk_clist_set_column_auto_resize (GTK_CLIST (myroutelist), 1, TRUE);
	gtk_clist_set_column_auto_resize (GTK_CLIST (myroutelist), 2, TRUE);
	gtk_clist_set_column_auto_resize (GTK_CLIST (myroutelist), 3, TRUE);
	gtk_clist_set_column_auto_resize (GTK_CLIST (myroutelist), 4, TRUE);

	scrwindow = gtk_scrolled_window_new (NULL, NULL);
	gtk_container_add (GTK_CONTAINER (scrwindow), myroutelist);
	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW
					(scrwindow),
					(GtkPolicyType)
					GTK_POLICY_AUTOMATIC,
					(GtkPolicyType) GTK_POLICY_AUTOMATIC);
	vbox = gtk_vbox_new (FALSE, 2);
	/*   gtk_container_add (GTK_CONTAINER (window), vbox); */
	gtk_box_pack_start (GTK_BOX
			    (GTK_DIALOG (window)->vbox), vbox, TRUE, TRUE, 2);

	gtk_box_pack_start (GTK_BOX (vbox), scrwindow, TRUE, TRUE, 2);
	hbox = gtk_hbox_new (TRUE, 2);
	hbox_displays = gtk_hbox_new (TRUE, 2);
	if (!route.active)
		l1 = gtk_label_new (_
				    ("Click on waypoints list\nto add waypoints"));
	else
		l1 = gtk_label_new (_
				    ("Click on list item\nto select next waypoint"));
	gtk_box_pack_start (GTK_BOX (vbox), l1, FALSE, FALSE, 2);
	/*   gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 2); */
	gtk_box_pack_start (GTK_BOX
			    (GTK_DIALOG (window)->action_area),
			    hbox, TRUE, TRUE, 2);

	gtk_box_pack_start (GTK_BOX (hbox), select_route_button, TRUE, TRUE,
			    2);
	gtk_box_pack_start (GTK_BOX (hbox), create_route2_button, TRUE, TRUE,
			    2);
	gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 2);
	gtk_box_pack_start (GTK_BOX (vbox), hbox_displays, FALSE, FALSE, 2);
	gtk_box_pack_start (GTK_BOX (hbox), button3, TRUE, TRUE, 2);
	gtk_widget_set_sensitive (create_route_button, FALSE);

	if (route.active)
	{
		gtk_widget_set_sensitive (select_route_button, FALSE);
		gtk_clist_clear (GTK_CLIST (myroutelist));
		for (i = 0; i < route.items; i++)
		{
			(routelist + i)->dist =
				calcdist ((routelist + i)->lon,
					  (routelist + i)->lat);
			text[1] = (routelist + i)->name;
			g_snprintf (text0, sizeof (text0), "%d", i + 1);
			g_snprintf (text1, sizeof (text1), "%8.5f",
				    (routelist + i)->lat);
			g_snprintf (text2, sizeof (text2), "%8.5f",
				    (routelist + i)->lon);
			g_snprintf (text3, sizeof (text3), "%9.3f",
				    (routelist + i)->dist);
			text[0] = text0;
			text[2] = text1;
			text[3] = text2;
			text[4] = text3;
			j = gtk_clist_append (GTK_CLIST (myroutelist),
					      (gchar **) text);
			gtk_clist_set_foreground (GTK_CLIST (myroutelist), j,
						  &colors.black);
		}
	}
	else
		route.items = 0;
	tooltips = gtk_tooltips_new ();
	gtk_tooltips_set_tip (GTK_TOOLTIPS (tooltips), create_route2_button,
			      _
			      ("Create a route from all waypoints. Sorted with order in file, not distance."),
			      NULL);
	gtk_tooltips_set_tip (GTK_TOOLTIPS (tooltips), select_route_button,
			      _
			      ("Click here to start your journey. GpsDrive guides you through the waypoints in this list."),
			      NULL);
	gtk_tooltips_set_tip (GTK_TOOLTIPS (tooltips), button,
			      _("Abort your journey"), NULL);

	gtk_widget_show_all (window);

	return TRUE;
}
예제 #28
0
void
CRevise_skim::show ()
{
	init ();

	SetBackPixmap (g_pReciteWord->fixed, Skin->revise_skim.revise_skim.p[0]);

	viewer.create (g_pReciteWord->fixed, Skin->revise_skim.viewer.x[0],
		       Skin->revise_skim.viewer.y[0], Skin->revise_skim.viewer.w,
		       Skin->revise_skim.viewer.h,
		       g_pReciteWord->now_zu_words.w,
		       g_pReciteWord->now_zu_words.m,
		       g_pReciteWord->now_zu_wordcount, on_revise_skim_over);

	start_button.create (g_pReciteWord->fixed,
			     Skin->revise_skim.stop_button.x[0],
			     Skin->revise_skim.stop_button.y[0],
			     Skin->revise_skim.stop_button.p[0],
			     Skin->revise_skim.stop_button.p[1],
			     Skin->revise_skim.stop_button.p[2],
			     (GdkPixmap *) NULL,
			     on_revise_skim_start_clicked);
	gtk_tooltips_set_tip (GTK_TOOLTIPS (g_pReciteWord->tooltips), start_button.event_box,"Ctrl-S","");
	pause_button.create (g_pReciteWord->fixed,
			     Skin->revise_skim.pause_button.x[0],
			     Skin->revise_skim.pause_button.y[0],
			     Skin->revise_skim.pause_button.p[0],
			     Skin->revise_skim.pause_button.p[1],
			     Skin->revise_skim.pause_button.p[2],
			     Skin->revise_skim.pause_button.p[3],
			     on_revise_skim_pause_clicked);
	gtk_tooltips_set_tip (GTK_TOOLTIPS (g_pReciteWord->tooltips), pause_button.event_box,"Ctrl-P","");
	group_button.create (g_pReciteWord->fixed,
			     Skin->revise_skim.group_button.x[0],
			     Skin->revise_skim.group_button.y[0],
			     Skin->revise_skim.group_button.p[0],
			     Skin->revise_skim.group_button.p[1],
			     Skin->revise_skim.group_button.p[2],
			     (GdkPixmap *) NULL,
			     on_revise_skim_group_clicked);
	gtk_tooltips_set_tip (GTK_TOOLTIPS (g_pReciteWord->tooltips), group_button.event_box,"Ctrl-C","");
	test_button.create (g_pReciteWord->fixed,
			    Skin->revise_skim.test_button.x[0],
			    Skin->revise_skim.test_button.y[0],
			    Skin->revise_skim.test_button.p[0],
			    Skin->revise_skim.test_button.p[1],
			    Skin->revise_skim.test_button.p[2],
			    (GdkPixmap *) NULL, on_revise_skim_test_clicked);
	gtk_tooltips_set_tip (GTK_TOOLTIPS (g_pReciteWord->tooltips), test_button.event_box,"Ctrl-B","");
	return_button.create (g_pReciteWord->fixed,
			      Skin->revise_skim.return_button.x[0],
			      Skin->revise_skim.return_button.y[0],
			      Skin->revise_skim.return_button.p[0],
			      Skin->revise_skim.return_button.p[1],
			      Skin->revise_skim.return_button.p[2],
			      (GdkPixmap *) NULL,
			      on_revise_skim_return_clicked);
	word_index_label = gtk_label_new ("");
	gtk_fixed_put (GTK_FIXED (g_pReciteWord->fixed), word_index_label,
		       Skin->revise_skim.word_index_label.x[0],
		       Skin->revise_skim.word_index_label.y[0]);
	gtk_widget_show (word_index_label);
	gchar aa[5];
	sprintf(aa,"%2d",g_pReciteWord->now_zu_wordcount);
	word_count_label = gtk_label_new (aa);
	gtk_fixed_put (GTK_FIXED (g_pReciteWord->fixed), word_count_label,
		       Skin->revise_skim.word_count_label.x[0],
		       Skin->revise_skim.word_count_label.y[0]);
	gtk_widget_show (word_count_label);
	readword_ckbutton.create (g_pReciteWord->fixed, Skin->revise_skim.readword_ckbutton.x[0],
			      Skin->revise_skim.readword_ckbutton.y[0],
			      Skin->revise_skim.readword_ckbutton.p[0],
			      Skin->revise_skim.readword_ckbutton.p[1],
			      Skin->revise_skim.readword_ckbutton.p[2],
				  Skin->revise_skim.readword_ckbutton.p[3],
			      on_revise_skim_readword_ckbutton_clicked);
   	gboolean tmp_b;
	rw_cfg_read_boolean(usercfgfile,
			     "revise_skim", "readword",
			     &tmp_b);
	readword_ckbutton.set_status(tmp_b);
	meaning_ckbutton.create (g_pReciteWord->fixed, Skin->revise_skim.meaning_ckbutton.x[0],
			      Skin->revise_skim.meaning_ckbutton.y[0],
			      Skin->revise_skim.meaning_ckbutton.p[0],
			      Skin->revise_skim.meaning_ckbutton.p[1],
			      Skin->revise_skim.meaning_ckbutton.p[2],
				  Skin->revise_skim.meaning_ckbutton.p[3],
			      on_revise_skim_meaning_ckbutton_clicked);
	rw_cfg_read_boolean(usercfgfile,
			     "revise_skim", "showmean",
			     &tmp_b);
	meaning_ckbutton.set_status(tmp_b);
	animate_ckbutton.create (g_pReciteWord->fixed, Skin->revise_skim.animate_ckbutton.x[0],
			      Skin->revise_skim.animate_ckbutton.y[0],
			      Skin->revise_skim.animate_ckbutton.p[0],
			      Skin->revise_skim.animate_ckbutton.p[1],
			      Skin->revise_skim.animate_ckbutton.p[2],
				  Skin->revise_skim.animate_ckbutton.p[3],
			      on_revise_skim_animate_ckbutton_clicked);
	rw_cfg_read_boolean(usercfgfile,
			     "revise_skim", "animate",
			     &tmp_b);
	animate_ckbutton.set_status(tmp_b);
	readword_button.create (g_pReciteWord->fixed, Skin->revise_skim.readword_button.x[0],
			      Skin->revise_skim.readword_button.y[0],
			      Skin->revise_skim.readword_button.p[0],
			      Skin->revise_skim.readword_button.p[1],
			      Skin->revise_skim.readword_button.p[2],
			      on_revise_skim_readword_button_clicked,this);
	gtk_tooltips_set_tip (GTK_TOOLTIPS (g_pReciteWord->tooltips), readword_button.event_box,"Tab","");
	chooseword_button.create (g_pReciteWord->fixed, Skin->revise_skim.chooseword_button.x[0],
			      Skin->revise_skim.chooseword_button.y[0],
			      Skin->revise_skim.chooseword_button.p[0],
			      Skin->revise_skim.chooseword_button.p[1],
			      Skin->revise_skim.chooseword_button.p[2],
			      on_revise_skim_chooseword_button_clicked,this);
	gtk_tooltips_set_tip (GTK_TOOLTIPS (g_pReciteWord->tooltips), chooseword_button.event_box,"Ctrl-W","");
	on_revise_skim_start_clicked ();
}
예제 #29
0
/* Signal handler called when the selections owner returns the data */
void disp_gcb_selection(const gchar *text)
{
  // dbg("selection_received '%s'\n", text);
  char *tmpstr;
  GtkWidget *button = snoop_button;
  int i;
  int textlen;
  static char bombom[]="\xef\xbb\xbf\xef\xbb\xbf";

  if (!text || !text[0])
     return;

  textlen=strlen(text);
  if (textlen==1 && text[0] <= ' ')
    return;
  // google chrome
  if (!strcmp(text,bombom))
    return;

#if 0
  dbg("textlen %d\n", textlen);
  for(i=0; i < textlen;i++)
    dbg("%x ", (unsigned char)text[i]);
  dbg("\n");
#endif

  if (!buttonArr)
    return;


  for(i=0;i<gcb_button_n;i++) {
    if (buttonStr[i] && !strcmp(buttonStr[i],text))
      return;
  }

   tmpstr=(char *)g_malloc(maxButtonStrlen);
   utf8ncpy(tmpstr, maxButtonStrlen, (char *)text);

   del_nl(tmpstr);

   for(i=0;i<gcb_button_n;i++) {
     if (buttonArr[i]==button) {
       if (buttonStr[i])
         g_free(buttonStr[i]);
       buttonStr[i]=g_strdup(text);
     }
   }

   gtk_button_set_label(GTK_BUTTON(button),tmpstr);

   set_win_title(text);

#if GTK_CHECK_VERSION(2,12,0)
   gtk_widget_set_tooltip_text (button, text);
#else
   gtk_tooltips_set_tip (GTK_TOOLTIPS (button_bar_tips), button, text,NULL);
#endif

   g_free(tmpstr);

   gtk_window_resize(GTK_WINDOW(mainwin), 100, 24);

   // remove the duplicate item if any
   for(i=0;i< gcb_history_n; i++) {
     if (!hist_strArr[i])
       continue;
     int len = strlen(hist_strArr[i]);
     if (strncmp(hist_strArr[i], text, len))
       continue;

     g_free(hist_strArr[i]);

     memmove(&hist_strArr[i],&hist_strArr[i+1],
             sizeof(hist_strArr[0])*(gcb_history_n - i - 1));

     hist_strArr[gcb_history_n-1]=NULL;
     break;
   }

   g_free(hist_strArr[gcb_history_n-1]);
   memmove(&hist_strArr[1],&hist_strArr[0],
           sizeof(hist_strArr[0])*(gcb_history_n-1));

   hist_strArr[0]=g_strdup(text);

   update_hist_button();
}
예제 #30
0
GtkWidget *create_main_toolbar(GtkWidget *parent, MainToolbar *toolbar) {
  GtkWidget *toolbar1;
  GtkWidget *toolbar_newf;
  GtkWidget *toolbar_open;
  GtkWidget *toolbar_save;
  GtkWidget *toolbar_zplus;
  GtkWidget *toolbar_yplus;
  GtkWidget *toolbar_yminus;
  GtkWidget *toolbar_xplus;
  GtkWidget *toolbar_xminus;
  GtkWidget *toolbar_iso;
  GtkWidget *toolbar_target;
  GtkWidget *toolbar_abox;
  GtkWidget *toolbar_apyr;
  GtkWidget *toolbar_atel;
  GtkWidget *toolbar_alnk;
  GtkWidget *toolbar_abas;
  GtkWidget *toolbar_slider;

  GtkTooltips *tooltips;
  GtkWidget *tmp_toolbar_icon;
  GtkAdjustment *sa;

  tooltips = gtk_tooltips_new();

  toolbar1 = gtk_toolbar_new();
  gtk_toolbar_set_orientation(GTK_TOOLBAR(toolbar1), GTK_ORIENTATION_HORIZONTAL);
  gtk_widget_ref(toolbar1);
  gtk_widget_show(toolbar1);

  tmp_toolbar_icon = gtk_image_new_from_stock(GTK_STOCK_NEW, GTK_ICON_SIZE_SMALL_TOOLBAR);
  toolbar_newf = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar1), GTK_TOOLBAR_CHILD_BUTTON, NULL, NULL, _("Create a new BZFlag world"), NULL, tmp_toolbar_icon, NULL, NULL);
  gtk_widget_ref(toolbar_newf);
  gtk_widget_show(toolbar_newf);

  tmp_toolbar_icon = gtk_image_new_from_stock(GTK_STOCK_OPEN, GTK_ICON_SIZE_SMALL_TOOLBAR);
  toolbar_open = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar1), GTK_TOOLBAR_CHILD_BUTTON, NULL, NULL, _("Open a BZFlag world"), NULL, tmp_toolbar_icon, NULL, NULL);
  gtk_widget_ref(toolbar_open);
  gtk_widget_show(toolbar_open);

  tmp_toolbar_icon = gtk_image_new_from_stock(GTK_STOCK_SAVE, GTK_ICON_SIZE_SMALL_TOOLBAR);
  toolbar_save = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar1), GTK_TOOLBAR_CHILD_BUTTON, NULL, NULL, _("Save the current world"), NULL, tmp_toolbar_icon, NULL, NULL);
  gtk_widget_ref(toolbar_save);
  gtk_widget_show(toolbar_save);

  gtk_toolbar_append_space(GTK_TOOLBAR(toolbar1));

  tmp_toolbar_icon = gnome_pixmap_new_from_xpm_d(TB::zplus_xpm);
  toolbar_zplus = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar1), GTK_TOOLBAR_CHILD_BUTTON, NULL, NULL, _("View from above"), NULL, tmp_toolbar_icon, NULL, NULL);
  gtk_widget_ref(toolbar_zplus);
  gtk_widget_show(toolbar_zplus);

  gtk_toolbar_append_space(GTK_TOOLBAR(toolbar1));

  tmp_toolbar_icon = gnome_pixmap_new_from_xpm_d(TB::yplus_xpm);
  toolbar_yplus = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar1), GTK_TOOLBAR_CHILD_BUTTON, NULL, NULL, _("View from +Y"), NULL, tmp_toolbar_icon, NULL, NULL);
  gtk_widget_ref(toolbar_yplus);
  gtk_widget_show(toolbar_yplus);

  tmp_toolbar_icon = gnome_pixmap_new_from_xpm_d(TB::yminus_xpm);
  toolbar_yminus = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar1), GTK_TOOLBAR_CHILD_BUTTON, NULL, NULL, _("View from -Y"), NULL, tmp_toolbar_icon, NULL, NULL);
  gtk_widget_ref(toolbar_yminus);
  gtk_widget_show(toolbar_yminus);

  gtk_toolbar_append_space(GTK_TOOLBAR(toolbar1));

  tmp_toolbar_icon = gnome_pixmap_new_from_xpm_d(TB::xplus_xpm);
  toolbar_xplus = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar1), GTK_TOOLBAR_CHILD_BUTTON, NULL, NULL, _("View from +X"), NULL, tmp_toolbar_icon, NULL, NULL);
  gtk_widget_ref(toolbar_xplus);
  gtk_widget_show(toolbar_xplus);

  tmp_toolbar_icon = gnome_pixmap_new_from_xpm_d(TB::xminus_xpm);
  toolbar_xminus = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar1), GTK_TOOLBAR_CHILD_BUTTON, NULL, NULL, _("View from -X"), NULL, tmp_toolbar_icon, NULL, NULL);
  gtk_widget_ref(toolbar_xminus);
  gtk_widget_show(toolbar_xminus);

  gtk_toolbar_append_space(GTK_TOOLBAR(toolbar1));

  tmp_toolbar_icon = gnome_pixmap_new_from_xpm_d(TB::iso_xpm);
  toolbar_iso = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar1), GTK_TOOLBAR_CHILD_BUTTON, NULL, NULL, _("Isometric view"), NULL, tmp_toolbar_icon, NULL, NULL);
  gtk_widget_ref(toolbar_iso);
  gtk_widget_show(toolbar_iso);

  gtk_toolbar_append_space(GTK_TOOLBAR(toolbar1));

  tmp_toolbar_icon = gnome_pixmap_new_from_xpm_d(TB::target_xpm);
  toolbar_target = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar1), GTK_TOOLBAR_CHILD_BUTTON, NULL, NULL, _("Center view on (0, 0, 0)"), NULL, tmp_toolbar_icon, NULL, NULL);
  gtk_widget_ref(toolbar_target);
  gtk_widget_show(toolbar_target);

  gtk_toolbar_append_space(GTK_TOOLBAR(toolbar1));

  tmp_toolbar_icon = gnome_pixmap_new_from_xpm_d(TB::addbox_xpm);
  toolbar_abox = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar1), GTK_TOOLBAR_CHILD_BUTTON, NULL, NULL, _("Add a box"), NULL, tmp_toolbar_icon, NULL, NULL);
  gtk_widget_ref(toolbar_abox);
  gtk_widget_show(toolbar_abox);

  tmp_toolbar_icon = gnome_pixmap_new_from_xpm_d(TB::addpyr_xpm);
  toolbar_apyr = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar1), GTK_TOOLBAR_CHILD_BUTTON, NULL, NULL, _("Add a pyramid"), NULL, tmp_toolbar_icon, NULL, NULL);
  gtk_widget_ref(toolbar_apyr);
  gtk_widget_show(toolbar_apyr);

  tmp_toolbar_icon = gnome_pixmap_new_from_xpm_d(TB::addtele_xpm);
  toolbar_atel = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar1), GTK_TOOLBAR_CHILD_BUTTON, NULL, NULL, _("Add a teleporter"), NULL, tmp_toolbar_icon, NULL, NULL);
  gtk_widget_ref(toolbar_atel);
  gtk_widget_show(toolbar_atel);
 
  tmp_toolbar_icon = gnome_pixmap_new_from_xpm_d(TB::addlink_xpm);
  toolbar_alnk = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar1), GTK_TOOLBAR_CHILD_BUTTON, NULL, NULL, _("Add a link"), NULL, tmp_toolbar_icon, NULL, NULL);
  gtk_widget_ref(toolbar_alnk);
  gtk_widget_show(toolbar_alnk);
 
  tmp_toolbar_icon = gnome_pixmap_new_from_xpm_d(TB::addbase_xpm);
  toolbar_abas = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar1), GTK_TOOLBAR_CHILD_BUTTON, NULL, NULL, _("Add a base"), NULL, tmp_toolbar_icon, NULL, NULL);
  gtk_widget_ref(toolbar_abas);
  gtk_widget_show(toolbar_abas);

  sa = GTK_ADJUSTMENT(gtk_adjustment_new(100.0, 0.0, 100.0, 1.0, 10.0, 0.0));
  toolbar_slider = gtk_hscale_new(sa);
  gtk_widget_set_size_request(toolbar_slider, 75, -1);
  gtk_scale_set_draw_value(GTK_SCALE(toolbar_slider), FALSE);
  gtk_toolbar_append_widget(GTK_TOOLBAR(toolbar1), toolbar_slider, NULL, NULL);
  gtk_tooltips_set_tip(GTK_TOOLTIPS(tooltips), toolbar_slider, _("Transparency"), NULL);
  gtk_widget_ref(toolbar_slider);
  gtk_widget_show(toolbar_slider);

  gtk_signal_connect(GTK_OBJECT(toolbar_newf), "clicked", GTK_SIGNAL_FUNC(CB::MW::newf), NULL);
  gtk_signal_connect(GTK_OBJECT(toolbar_open), "clicked", GTK_SIGNAL_FUNC(CB::MW::open), NULL);
  gtk_signal_connect(GTK_OBJECT(toolbar_save), "clicked", GTK_SIGNAL_FUNC(CB::MW::save), NULL);
  gtk_signal_connect(GTK_OBJECT(toolbar_zplus), "clicked", GTK_SIGNAL_FUNC(CB::MW::tb_zplus), NULL);
  gtk_signal_connect(GTK_OBJECT(toolbar_yplus), "clicked", GTK_SIGNAL_FUNC(CB::MW::tb_yplus), NULL);
  gtk_signal_connect(GTK_OBJECT(toolbar_yminus), "clicked", GTK_SIGNAL_FUNC(CB::MW::tb_yminus), NULL);
  gtk_signal_connect(GTK_OBJECT(toolbar_xplus), "clicked", GTK_SIGNAL_FUNC(CB::MW::tb_xplus), NULL);
  gtk_signal_connect(GTK_OBJECT(toolbar_xminus), "clicked", GTK_SIGNAL_FUNC(CB::MW::tb_xminus), NULL);
  gtk_signal_connect(GTK_OBJECT(toolbar_iso), "clicked", GTK_SIGNAL_FUNC(CB::MW::tb_iso), NULL);
  gtk_signal_connect(GTK_OBJECT(toolbar_target), "clicked", GTK_SIGNAL_FUNC(CB::MW::tb_target), NULL);
  gtk_signal_connect(GTK_OBJECT(toolbar_abox), "clicked", GTK_SIGNAL_FUNC(CB::MW::tb_addbox), NULL);
  gtk_signal_connect(GTK_OBJECT(toolbar_apyr), "clicked", GTK_SIGNAL_FUNC(CB::MW::tb_addpyr), NULL);
  gtk_signal_connect(GTK_OBJECT(toolbar_atel), "clicked", GTK_SIGNAL_FUNC(CB::MW::tb_addtel), NULL);
  gtk_signal_connect(GTK_OBJECT(toolbar_alnk), "clicked", GTK_SIGNAL_FUNC(CB::MW::tb_addlnk), NULL);
  gtk_signal_connect(GTK_OBJECT(toolbar_abas), "clicked", GTK_SIGNAL_FUNC(CB::MW::tb_addbas), NULL);
  gtk_signal_connect(GTK_OBJECT(sa), "value_changed", GTK_SIGNAL_FUNC(CB::MW::tb_trans), NULL);
  gtk_signal_connect(GTK_OBJECT(sa), "changed", GTK_SIGNAL_FUNC(CB::MW::tb_trans), NULL);

  toolbar->toolbar = toolbar1;
  toolbar->newf = toolbar_newf;
  toolbar->open = toolbar_open;
  toolbar->save = toolbar_save;
  toolbar->zplus = toolbar_zplus;
  toolbar->yplus = toolbar_yplus;
  toolbar->yminus = toolbar_yminus;
  toolbar->xplus = toolbar_xplus;
  toolbar->xminus = toolbar_xminus;
  toolbar->iso = toolbar_iso;
  toolbar->target = toolbar_target;
  toolbar->abox = toolbar_abox;
  toolbar->apyr = toolbar_apyr;
  toolbar->atel = toolbar_atel;
  toolbar->alnk = toolbar_alnk;
  toolbar->abas = toolbar_abas;
  toolbar->slider = toolbar_slider;

  return toolbar1;
}