Beispiel #1
0
static void
animation_done_cb (GstyleSlidein *self)
{
  GstyleSlideinDirectionType animation_direction;

  g_assert (GSTYLE_IS_SLIDEIN (self));

  if (self->is_opening)
    {
      animate_stop (self);
      animation_direction = self->direction_type;
      self->revealed = TRUE;

      gtk_grab_add (GTK_WIDGET (self));
      gtk_event_box_set_above_child (GTK_EVENT_BOX (self), TRUE);
      gtk_widget_set_can_focus (self->overlay_child, TRUE);
      gtk_widget_grab_focus (self->overlay_child);
    }
  else if (self->is_closing)
    {
      animate_stop (self);
      animation_direction = self->direction_type_reverse;
      self->revealed = FALSE;

      gtk_event_box_set_above_child (GTK_EVENT_BOX (self), FALSE);
    }
  else
    g_assert_not_reached ();

  self->is_closing = self->is_opening = FALSE;
  self->offset = self->dst_offset;

  g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_REVEALED]);
  g_signal_emit (self, signals [REVEALED], 0, animation_direction, self->revealed);
}
Beispiel #2
0
void
mc_create_command_entry (MCData *mc)
{

    mc->applet_box = icon_entry_new ();
    mc->entry= ICON_ENTRY(mc->applet_box)->entry;
    g_object_set_data (G_OBJECT (mc->applet_box), "mcdata", mc);
    gtk_entry_set_max_length (GTK_ENTRY (mc->entry), MC_MAX_COMMAND_LENGTH);
    
    mc->history_button = gtk_event_box_new ();
    gtk_event_box_set_visible_window (GTK_EVENT_BOX (mc->history_button), FALSE);
    mc->history_image = gtk_image_new_from_stock ("gtk-go-down", 
        GTK_ICON_SIZE_MENU);
    gtk_widget_show (mc->history_image);
    gtk_container_add (GTK_CONTAINER (mc->history_button), mc->history_image);
    icon_entry_pack_widget (ICON_ENTRY(mc->applet_box), mc->history_button, FALSE);
    
    mc->file_select_button = gtk_event_box_new ();
    gtk_event_box_set_visible_window (GTK_EVENT_BOX (mc->file_select_button), FALSE);
    mc->file_select_image = gtk_image_new_from_stock ("gtk-open", 
        GTK_ICON_SIZE_MENU);
    gtk_widget_show (mc->file_select_image);
    gtk_container_add (GTK_CONTAINER (mc->file_select_button), mc->file_select_image);
    icon_entry_pack_widget (ICON_ENTRY(mc->applet_box), 
        mc->file_select_button, FALSE);
    
    g_signal_connect (mc->entry, "key_press_event",
		      G_CALLBACK (command_key_event), mc);
   
    g_signal_connect (mc->entry, "button_press_event",
		      G_CALLBACK (button_press_cb), mc);

    g_signal_connect (mc->file_select_button, "button_press_event",
		      G_CALLBACK (button_press_hack), mc);
          
    g_signal_connect (mc->history_button, "button_press_event",
		      G_CALLBACK (button_press_hack), mc);

    if (!mc->preferences.show_default_theme)
    {
	    gtk_widget_set_name (mc->entry, "minicommander-applet-entry");
	    mc_command_update_entry_color (mc); 
    }
    else
	    gtk_widget_set_name (mc->entry,
			    "minicommander-applet-entry-default");

    mc_command_update_entry_size (mc);

    set_atk_name_description (mc->entry,
			      _("Command line"), 
			      _("Type a command here and Gnome will execute it for you"));
}
static GtkEventBox*
assign_cellbutton(UIMCandWinHorizontalGtk *horizontal_cwin,
		  gint cand_index, gint display_limit)
{
  struct index_button *idxbutton;
  int len;
  GPtrArray *buttons;

  buttons = horizontal_cwin->buttons;
  len = buttons->len;

  if (len <= cand_index) {
    GtkWidget *button;
    GtkWidget *label;

    button = gtk_event_box_new();
    gtk_event_box_set_above_child(GTK_EVENT_BOX(button), TRUE);
    label = gtk_label_new("");
    gtk_container_add(GTK_CONTAINER(button), label);
    scale_label(GTK_EVENT_BOX(button), PANGO_SCALE_LARGE);
    g_signal_connect(button, "button-press-event", G_CALLBACK(button_clicked), horizontal_cwin);
#if GTK_CHECK_VERSION(2, 90, 0)
    g_signal_connect_after(label, "draw", G_CALLBACK(label_draw), horizontal_cwin);
#else
    g_signal_connect_after(label, "expose-event", G_CALLBACK(label_exposed), horizontal_cwin);
#endif
#if GTK_CHECK_VERSION(3, 4, 0)
    gtk_widget_set_hexpand(button, TRUE);
    gtk_widget_set_vexpand(button, TRUE);
    gtk_grid_attach(GTK_GRID(UIM_CAND_WIN_GTK(horizontal_cwin)->view), button,
                    cand_index, 0, 1, 1);
#else
    gtk_table_attach_defaults(GTK_TABLE(UIM_CAND_WIN_GTK(horizontal_cwin)->view), button, cand_index, cand_index + 1, 0, 1);
#endif
    idxbutton = g_malloc(sizeof(struct index_button));
    if (idxbutton) {
      idxbutton->button = GTK_EVENT_BOX(button);
      clear_button(idxbutton, cand_index);
      idxbutton->cand_index_in_page = cand_index;
    }
    g_ptr_array_add(horizontal_cwin->buttons, idxbutton);
  } else {
    idxbutton = g_ptr_array_index(buttons, cand_index);
    idxbutton->cand_index_in_page = cand_index;
  }

  return idxbutton->button;
}
CCMCellExtension *
ccm_cell_extension_new (const gchar * path, int width)
{
    g_return_val_if_fail (path != NULL, NULL);

    CCMCellExtension *self = g_object_new (CCM_TYPE_CELL_EXTENSION, NULL);
    GtkWidget *vbox, *hbox, *button;

    self->priv->path = g_strdup (path);

    vbox = gtk_vbox_new (FALSE, 0);
    gtk_widget_show (vbox);
    gtk_container_add (GTK_CONTAINER (self), vbox);

    // Name/description label
    self->priv->name = gtk_label_new ("\n");
    gtk_widget_set_size_request (self->priv->name, width - 4, -1);
    gtk_label_set_use_markup (GTK_LABEL (self->priv->name), TRUE);
    gtk_label_set_line_wrap (GTK_LABEL (self->priv->name), TRUE);
    gtk_widget_show (self->priv->name);
    gtk_box_pack_start (GTK_BOX (vbox), self->priv->name, TRUE, TRUE, 0);

    // Add activation line
    hbox = gtk_hbox_new (FALSE, 5);
    gtk_widget_show (hbox);
    gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
    gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);

    self->priv->author = gtk_label_new ("");
    gtk_label_set_use_markup (GTK_LABEL (self->priv->author), TRUE);
    gtk_widget_show (self->priv->author);
    gtk_box_pack_start (GTK_BOX (hbox), self->priv->author, TRUE, TRUE, 0);

    self->priv->enable = gtk_label_new ("");
    gtk_label_set_use_markup (GTK_LABEL (self->priv->enable), TRUE);
    gtk_label_set_markup (GTK_LABEL (self->priv->enable), "<span size='small'>Enable</span>");
    gtk_widget_show (self->priv->enable);

    button = gtk_button_new ();
    gtk_widget_show (button);
    gtk_container_add (GTK_CONTAINER (button), self->priv->enable);
    gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);

    gtk_event_box_set_above_child (GTK_EVENT_BOX (self), FALSE);
    gtk_event_box_set_visible_window (GTK_EVENT_BOX (self), FALSE);

    return self;
}
Beispiel #5
0
void tabmanagergui_create_label (GuTabPage* tp, gchar* labeltext) {
    static unsigned count = 0;
    GtkRcStyle* rcstyle = NULL;
    GtkWidget* image = NULL;
    GtkHBox* hbox;

    tp->labelbox = gtk_event_box_new ();
    hbox = GTK_HBOX (gtk_hbox_new (FALSE, 0));
    tp->unsavednr = ++count;
    
    gtk_event_box_set_visible_window (GTK_EVENT_BOX (tp->labelbox), FALSE);
    gtk_container_add (GTK_CONTAINER(tp->labelbox), GTK_WIDGET (hbox));
    
    tp->label = GTK_LABEL (gtk_label_new (labeltext));

    gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (tp->label), TRUE, TRUE, 5);
    
    tp->button = GTK_BUTTON (gtk_button_new());
    image = gtk_image_new_from_stock (GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU);
    gtk_button_set_image (tp->button, image);
    g_object_set (tp->button, "relief", GTK_RELIEF_NONE, 
                         "focus-on-click", FALSE, NULL);
    gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (tp->button), FALSE,FALSE,0);
    
    rcstyle = gtk_rc_style_new ();
    rcstyle->xthickness = rcstyle->ythickness = 0;
    gtk_widget_modify_style (GTK_WIDGET (tp->button), rcstyle);
    g_object_unref (rcstyle);

    gtk_widget_show_all (GTK_WIDGET (hbox));
}
Beispiel #6
0
int main(int argc, char *argv[]){

	GtkWidget *window, *eventbox, *label;

	gtk_init (&argc,&argv);

	window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_window_set_title (GTK_WINDOW (window), "Event Box");
	gtk_container_set_border_width (GTK_CONTAINER (window),10);
	gtk_widget_set_size_request (window, 200, 50);
		
	g_signal_connect (G_OBJECT (window),"destroy",
					  G_CALLBACK(destroy), NULL);

	eventbox = gtk_event_box_new();
	label = gtk_label_new ("Double-Click it!");
	
	/* Set the order in which the widgets will recieve notification of events. */
	gtk_event_box_set_above_child (GTK_EVENT_BOX (eventbox), FALSE);

	g_signal_connect (G_OBJECT (eventbox), "button_press_event", G_CALLBACK (button_pressed), (gpointer) label);
	
	gtk_container_add (GTK_CONTAINER (eventbox), label);
	gtk_container_add (GTK_CONTAINER (window), eventbox);

	/* ALlow the event box to catch button presses, realize the widget, and set the cursor that will be displayed when the mouse is over the event box*/
	gtk_widget_set_events (eventbox, GDK_BUTTON_PRESS_MASK);
	gtk_widget_realize(eventbox);
	gdk_window_set_cursor (eventbox->window, gdk_cursor_new (GDK_HAND1));
	gtk_widget_show_all (window);

	gtk_main();
	return 0;

}
Beispiel #7
0
static void
gimp_color_bar_init (GimpColorBar *bar)
{
  gtk_event_box_set_visible_window (GTK_EVENT_BOX (bar), FALSE);

  bar->orientation = GTK_ORIENTATION_HORIZONTAL;
}
Beispiel #8
0
int
main (int argc, char *argv[])
{
	GtkWidget *window;
	GtkWidget *eventbox;
	GtkWidget *icon;

	gtk_init (&argc, &argv);

	window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
	g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (gtk_main_quit), NULL);

	icon = gtk_image_new_from_file ("bt-blocked.svg");
	eventbox = gtk_event_box_new ();
	gtk_widget_set_app_paintable(eventbox, TRUE);
	g_signal_connect (G_OBJECT (eventbox), "draw", G_CALLBACK (draw_box_back), NULL);
	gtk_event_box_set_visible_window (GTK_EVENT_BOX (eventbox), TRUE);

	gtk_container_add (GTK_CONTAINER (eventbox), icon);
	gtk_container_add (GTK_CONTAINER (window), eventbox);

	gtk_widget_show_all (window);

	gtk_main ();

	return 0;
}
Beispiel #9
0
Splash *oregano_splash_new (GError **error)
{
	GtkBuilder *gui;
	Splash *sp;
	GtkEventBox *event;

	if ((gui = gtk_builder_new ()) == NULL) {
		g_set_error_literal (error, OREGANO_ERROR, OREGANO_UI_ERROR_NO_BUILDER,
		                     _ ("Failed to spawn builder"));
		return NULL;
	}
	gtk_builder_set_translation_domain (gui, NULL);

	if (gtk_builder_add_from_file (gui, OREGANO_UIDIR "/splash.ui", error) <= 0) {
		return NULL;
	}

	sp = g_new0 (Splash, 1);
	sp->can_destroy = FALSE;

	sp->win = GTK_WINDOW (gtk_builder_get_object (gui, "splash"));
	sp->lbl = GTK_LABEL (gtk_builder_get_object (gui, "label"));
	sp->progress = GTK_WIDGET (gtk_builder_get_object (gui, "pbar"));

	event = GTK_EVENT_BOX (gtk_builder_get_object (gui, "event"));
	sp->event = GTK_WIDGET (event);

	gtk_progress_bar_set_pulse_step (GTK_PROGRESS_BAR (sp->progress), 0.07);
	gtk_widget_show_all (GTK_WIDGET (sp->win));

	while (gtk_events_pending ())
		gtk_main_iteration ();
	return sp;
}
static TimeOutPlugin*
time_out_new (XfcePanelPlugin *plugin)
{
  TimeOutPlugin *time_out;
  GtkOrientation orientation;

  /* Allocate memory for the plugin structure */
  time_out = panel_slice_new0 (TimeOutPlugin);

  /* Store pointer to the plugin */
  time_out->plugin = plugin;

  /* Create lock screen */
  time_out->lock_screen = time_out_lock_screen_new ();

  /* Connect to 'postpone' signal of the lock screen */
  g_signal_connect (G_OBJECT (time_out->lock_screen), "postpone", G_CALLBACK (time_out_postpone), time_out);

  /* Connect to 'resume' signal of the lock screen */
  g_signal_connect (G_OBJECT (time_out->lock_screen), "resume", G_CALLBACK (time_out_resume), time_out);

  /* Create countdowns */
  time_out->break_countdown = time_out_countdown_new ();
  time_out->lock_countdown = time_out_countdown_new ();

  /* Connect to break countdown signals */
  g_signal_connect (G_OBJECT (time_out->break_countdown), "update", G_CALLBACK (time_out_break_countdown_update), time_out);
  g_signal_connect (G_OBJECT (time_out->break_countdown), "finish", G_CALLBACK (time_out_break_countdown_finish), time_out);

  /* Connect to lock countdown signals */
  g_signal_connect (G_OBJECT (time_out->lock_countdown), "update", G_CALLBACK (time_out_lock_countdown_update), time_out);
  g_signal_connect (G_OBJECT (time_out->lock_countdown), "finish", G_CALLBACK (time_out_lock_countdown_finish), time_out);

  /* Get the current orientation */
  orientation = xfce_panel_plugin_get_orientation (plugin);

  /* Create event box to catch user events */
  time_out->ebox = gtk_event_box_new ();
  gtk_event_box_set_visible_window(GTK_EVENT_BOX(time_out->ebox), FALSE);
  gtk_widget_show (time_out->ebox);

  /* Create flexible box which can do both, horizontal and vertical layout */
  time_out->hvbox = xfce_hvbox_new (orientation, FALSE, 2);
  gtk_container_add (GTK_CONTAINER (time_out->ebox), time_out->hvbox);
  gtk_widget_show (time_out->hvbox);

  /* Create time out icon */
  time_out->panel_icon = gtk_image_new_from_icon_name ("xfce4-time-out-plugin", GTK_ICON_SIZE_DIALOG);
  gtk_image_set_pixel_size (GTK_IMAGE (time_out->panel_icon), xfce_panel_plugin_get_size (time_out->plugin) - 8);
  gtk_box_pack_start (GTK_BOX (time_out->hvbox), time_out->panel_icon, TRUE, TRUE, 0);
  gtk_widget_show (time_out->panel_icon);

  /* Create label for displaying the remaining time until the next break */
  time_out->time_label = gtk_label_new (_("Inactive"));
  gtk_misc_set_alignment (GTK_MISC (time_out->time_label), 0.5, 0.5);
  gtk_box_pack_start (GTK_BOX (time_out->hvbox), time_out->time_label, TRUE, TRUE, 0);
  gtk_widget_show (time_out->time_label);

  return time_out;
}
Beispiel #11
0
static GtkWidget *ui_make_img_btn(char *img_btn)
{
	GtkWidget *image;
	GtkWidget *eventbox;

	eventbox = gtk_event_box_new();

	gtk_widget_set_events(eventbox, GDK_MOTION_NOTIFY | GDK_BUTTON_RELEASE
	  				| GDK_BUTTON_PRESS
	  				| GDK_ENTER_NOTIFY
	  				| GDK_LEAVE_NOTIFY);

	image = gtk_image_new_from_file(img_btn);

	gtk_container_add(GTK_CONTAINER(eventbox), image);

	/* set eventbox not visible, only accept event */
	gtk_event_box_set_visible_window(GTK_EVENT_BOX(eventbox), FALSE);

	/* just change the mouse style */
	g_signal_connect(eventbox, "button_press_event", G_CALLBACK(e_img_btn_handle), NULL);
	g_signal_connect(eventbox, "button_release_event", G_CALLBACK(e_img_btn_handle), NULL);
	g_signal_connect(eventbox, "enter_notify_event", G_CALLBACK(e_img_btn_handle), NULL);
	g_signal_connect(eventbox, "leave_notify_event", G_CALLBACK(e_img_btn_handle), NULL);

	return eventbox;
}
Beispiel #12
0
static void
colorful_tabs_deactivate_cb (MidoriExtension* extension,
                             MidoriBrowser*   browser)
{
    guint i;
    GtkWidget* view;
    MidoriApp* app = midori_extension_get_app (extension);

    g_signal_handlers_disconnect_by_func (
        app, colorful_tabs_app_add_browser_cb, extension);
    g_signal_handlers_disconnect_by_func (
        browser, colorful_tabs_browser_add_tab_cb, extension);
    g_signal_handlers_disconnect_by_func (
        extension, colorful_tabs_deactivate_cb, browser);
    i = 0;
    while ((view = midori_browser_get_nth_tab (browser, i++)))
    {
        GtkWidget* label = midori_view_get_proxy_tab_label (MIDORI_VIEW (view));
        gtk_event_box_set_visible_window (GTK_EVENT_BOX (label), FALSE);
        gtk_widget_modify_bg (label, GTK_STATE_NORMAL, NULL);
        gtk_widget_modify_bg (label, GTK_STATE_ACTIVE, NULL);
        gtk_container_foreach (GTK_CONTAINER (gtk_bin_get_child (GTK_BIN (label))),
                               (GtkCallback) colorful_tabs_modify_fg,
                               NULL);
        g_signal_handlers_disconnect_by_func (
            view, colorful_tabs_view_notify_uri_cb, extension);
    }
}
Beispiel #13
0
void make_cancel_button(GtkWidget *fixed_base)
{
	GtkWidget *fixed;
	GtkWidget *event_box;
	GtkWidget *label;

	fixed = fixed_base;

	label = gtk_label_new(cancel_text);
	gtk_widget_set_size_request(label, cancel_label_width, cancel_label_height);
	gtk_widget_show(label);

	GdkColor white = {0, 65535, 65535, 65535};
	GtkRcStyle *rc_style = gtk_rc_style_new ();
	rc_style->fg[GTK_STATE_NORMAL] = white;
	rc_style->color_flags[GTK_STATE_NORMAL] |= GTK_RC_FG;
	gtk_widget_modify_style(label, rc_style);
	gtk_rc_style_unref(rc_style);

	event_box = gtk_event_box_new();
	gtk_container_add(GTK_CONTAINER(event_box), label);
	gtk_event_box_set_visible_window(GTK_EVENT_BOX(event_box), FALSE);
	gtk_widget_show(event_box);
	g_signal_connect(G_OBJECT(event_box), "enter_notify_event",
						G_CALLBACK(cancel_enter), NULL);
	g_signal_connect(G_OBJECT(event_box), "leave_notify_event",
						G_CALLBACK(cancel_leave), NULL);
	g_signal_connect(G_OBJECT(event_box), "button_press_event",
						G_CALLBACK(cancel_press), NULL);

	gtk_widget_show(event_box);
	gtk_fixed_put(GTK_FIXED(fixed), event_box, cancel_label_pos_x, cancel_label_pos_y);
}
Beispiel #14
0
// Public functions
GtkWidget *dtgtk_icon_new(DTGTKCairoPaintIconFunc paint, gint paintflags)
{
  GtkDarktableIcon *icon;
  icon = g_object_new(dtgtk_icon_get_type(), NULL);
  gtk_event_box_set_visible_window(GTK_EVENT_BOX(icon), FALSE);
  icon->icon = paint;
  icon->icon_flags = paintflags;
  return (GtkWidget *)icon;
}
static WindowckPlugin * windowck_new(XfcePanelPlugin *plugin)
{
    WindowckPlugin *wckp;

    GtkOrientation orientation;
    GtkWidget *label;

    /* allocate memory for the plugin structure */
    wckp = g_slice_new0 (WindowckPlugin);

    /* pointer to plugin */
    wckp->plugin = plugin;

    /* read the user settings */
    windowck_read(wckp);

    /* get the current orientation */
    orientation = xfce_panel_plugin_get_orientation(plugin);

    /* not needed for shrink mode */
    if (!wckp->prefs->size_mode == SHRINK)
        xfce_panel_plugin_set_shrink (plugin, TRUE);

    /* create some panel widgets */
    wckp->ebox = gtk_event_box_new();
    gtk_event_box_set_visible_window(GTK_EVENT_BOX(wckp->ebox), FALSE);
    gtk_widget_set_name(wckp->ebox, "XfceWindowckPlugin");

    wckp->alignment = gtk_alignment_new (0.5, 0.5, 0, 0);

    wckp->hvbox = xfce_hvbox_new(orientation, FALSE, 2);

    /* some wckp widgets */
    label = gtk_label_new("");
    wckp->title = GTK_LABEL (label);

    create_icon (wckp);

    gtk_box_pack_start (GTK_BOX(wckp->hvbox), label, TRUE, TRUE, 0);

    if (wckp->prefs->icon_on_right)
    {
        gtk_box_reorder_child (GTK_BOX (wckp->hvbox), GTK_WIDGET(wckp->icon->eventbox), 1);
    }

    gtk_container_add(GTK_CONTAINER(wckp->alignment), GTK_WIDGET(wckp->hvbox));
    gtk_container_add(GTK_CONTAINER(wckp->ebox), wckp->alignment);

    /* show widgets */
    gtk_widget_show(wckp->ebox);
    gtk_widget_show(wckp->alignment);
    gtk_widget_show(wckp->hvbox);
    gtk_widget_show(label);

    return wckp;
}
Beispiel #16
0
G_MODULE_EXPORT GtkWidget *
mb_panel_applet_create (const char *id, GtkOrientation orientation)
{
  GtkWidget *box, *image;

  box = gtk_event_box_new ();
  gtk_event_box_set_visible_window (GTK_EVENT_BOX (box), FALSE);
  gtk_event_box_set_above_child (GTK_EVENT_BOX (box), TRUE);
  gtk_widget_set_name (box, "MatchboxPanelKeyboard");

  image = mb_panel_scaling_image2_new (orientation, "matchbox-keyboard");
  gtk_container_add (GTK_CONTAINER (box), image);

  g_signal_connect (box, "button-release-event", G_CALLBACK (on_toggled), NULL);

  gtk_widget_show_all (box);

  return box;
}
Beispiel #17
0
void ArticleView::append_data_res_attachment(
	const std::string& key, const std::string& mark,
	bool& loaded)
{
	if (for_float_win) {
		loaded = true;
		if(mark.empty())
			pango_view_->append_widget(NULL);
		else
			pango_view_->insert_widget(NULL, mark.c_str());
	} else {
		GtkWidget *widget = NULL;
		if (dict_index.type == InstantDictType_LOCAL) {
			StorageType type = gpAppFrame->oLibs.GetStorageType(dict_index.index);
			if (type == StorageType_DATABASE || type == StorageType_FILE) {
				ResData *pResData
					= new ResData(dict_index.index, key);
				GtkWidget *button = NULL;
				GtkWidget *image = NULL;
				image = gtk_image_new_from_pixbuf(get_impl(
					gpAppFrame->oAppSkin.attachment));
				button = gtk_button_new();
				/* We need an event box to associate a custom cursor with the
				 * button. */
				widget = gtk_event_box_new();
				g_object_ref_sink(G_OBJECT(widget));
				gtk_container_add(GTK_CONTAINER(button), image);
				gtk_container_add(GTK_CONTAINER(widget), button);
#ifdef DEBUG
				/* when the tooltip appears a number of gtk-warnings are generated:
				 * Gtk-WARNING **: IA__gtk_text_view_window_to_buffer_coords: 
				 * can't get coords for private windows */
				gtk_widget_set_tooltip_text(GTK_WIDGET(widget),
					pResData->get_key().c_str());
#endif
				gtk_event_box_set_above_child(GTK_EVENT_BOX(widget), FALSE);
				gtk_widget_show_all(widget);
				g_signal_connect(G_OBJECT(button), "destroy",
					G_CALLBACK(on_resource_button_destroy), (gpointer)pResData);
				g_signal_connect(G_OBJECT(button), "clicked",
					G_CALLBACK(on_attachment_button_clicked), (gpointer)pResData);
				g_signal_connect(G_OBJECT(button), "realize",
					G_CALLBACK(on_resource_button_realize), (gpointer)widget);
			}
		}
		if(widget) {
			loaded = true;
			if(mark.empty())
				pango_view_->append_widget(widget);
			else
				pango_view_->insert_widget(widget, mark.c_str());
			g_object_unref(widget);
		}
	}
}
Beispiel #18
0
GtkWidget * MyEvent(char name[]){
		Widget eventBox;
		Widget childWidget;
		childWidget = gtk_image_new_from_file(name);
		eventBox = gtk_event_box_new();
		gtk_event_box_set_above_child(GTK_EVENT_BOX(eventBox), TRUE);
		gtk_widget_set_events(eventBox, GDK_BUTTON_PRESS_MASK);
		gtk_container_add(GTK_CONTAINER(eventBox), childWidget);	
		return eventBox;
	
}
Beispiel #19
0
GtkWidget * initialiseEventBox( GtkWidget *childWidget){
	GtkWidget* eventBox;
	eventBox = gtk_event_box_new();
	//gdk_window_set_cursor ( eventBox->window, gdk_cursor_new (GDK_HAND1));

	gtk_event_box_set_above_child( GTK_EVENT_BOX(eventBox), FALSE);
	gtk_widget_set_events(eventBox, GDK_BUTTON_PRESS_MASK);
	gtk_container_add( GTK_CONTAINER(eventBox), childWidget);

	return eventBox;
}
Beispiel #20
0
// Public functions
GtkWidget *dtgtk_icon_new(DTGTKCairoPaintIconFunc paint, gint paintflags, void *paintdata)
{
  GtkDarktableIcon *icon;
  icon = g_object_new(dtgtk_icon_get_type(), NULL);
  gtk_event_box_set_visible_window(GTK_EVENT_BOX(icon), FALSE);
  icon->icon = paint;
  icon->icon_flags = paintflags;
  icon->icon_data = paintdata;
  gtk_widget_set_name(GTK_WIDGET(icon), "dt-icon");
  return (GtkWidget *)icon;
}
Beispiel #21
0
void create_tray_icon(struct _tray_icon *tray, gboolean runned)
{
	gchar *hint;
	char *image_file;
	if (runned == TRUE)
	{
		hint = _("X Neural Switcher RUNNED");
		image_file = "gxneur-run.png";
	}
	else
	{
		hint = _("X Neural Switcher STOPPED");
		image_file = "gxneur-stop.png";
	}
	
	if (tray != NULL)
	{
		gtk_object_destroy (GTK_OBJECT (tray->tooltip));
		tray->tooltip = NULL;
		gtk_widget_destroy (GTK_WIDGET (tray->popup_menu));
		tray->popup_menu = NULL;
		gtk_widget_destroy (GTK_WIDGET (tray->image));
		tray->image = NULL;
		gtk_widget_destroy (GTK_WIDGET (tray->evbox));
		tray->evbox = NULL;
	}
	else
	{
		tray = g_new0(struct _tray_icon, 1);	
			
		tray->clock = egg_clock_new();
		g_signal_connect (G_OBJECT(tray->clock), "time-changed", G_CALLBACK (clock_check_xneur), tray);
		
		tray->eggtray = egg_tray_icon_new(_("X Neural Switcher"));
		g_signal_connect(G_OBJECT(tray->eggtray), "button_press_event", G_CALLBACK(tray_icon_press), tray);
		g_signal_connect(G_OBJECT(tray->eggtray), "button_release_event", G_CALLBACK(tray_icon_release), tray);
	}
		
	tray->tooltip		= gtk_tooltips_new();
	tray->popup_menu	= create_menu_icon(tray);
	tray->evbox		= gtk_event_box_new();

	gtk_event_box_set_visible_window(GTK_EVENT_BOX(tray->evbox), 0);
	gtk_widget_set_size_request(tray->evbox, 25, 20);

	gtk_tooltips_set_tip(tray->tooltip, GTK_WIDGET(tray->eggtray), hint, NULL);	
	tray->image = create_pixmap(tray->evbox, image_file);
		
	gtk_container_add(GTK_CONTAINER(tray->evbox), tray->image);
	gtk_container_add(GTK_CONTAINER(tray->eggtray), tray->evbox);
	gtk_widget_show_all (GTK_WIDGET (tray->eggtray));
	return;
}
Beispiel #22
0
static void
nemo_location_bar_init (NemoLocationBar *bar)
{
	GtkWidget *entry;
	GtkWidget *event_box;

	bar->details = G_TYPE_INSTANCE_GET_PRIVATE (bar, NEMO_TYPE_LOCATION_BAR,
						    NemoLocationBarDetails);

	gtk_orientable_set_orientation (GTK_ORIENTABLE (bar),
					GTK_ORIENTATION_HORIZONTAL);


    event_box = gtk_event_box_new ();
    gtk_event_box_set_visible_window (GTK_EVENT_BOX (event_box), FALSE);
    gtk_container_set_border_width (GTK_CONTAINER (event_box), 2);

	entry = nemo_location_entry_new ();

	g_signal_connect_object (entry, "activate",
				 G_CALLBACK (editable_activate_callback), bar, G_CONNECT_AFTER);
    g_signal_connect_object (entry, "changed",
                             G_CALLBACK (editable_changed_callback), bar, 0);

    gtk_container_add (GTK_CONTAINER (event_box), entry);

	gtk_box_pack_start (GTK_BOX (bar), event_box, TRUE, TRUE, 4);

	/* Label context menu */
	g_signal_connect (event_box, "button-press-event",
			  G_CALLBACK (button_pressed_callback), NULL);

	/* Drag source */
	gtk_drag_source_set (GTK_WIDGET (event_box),
			     GDK_BUTTON1_MASK | GDK_BUTTON3_MASK,
			     drag_types, G_N_ELEMENTS (drag_types),
			     GDK_ACTION_COPY | GDK_ACTION_LINK);
	g_signal_connect_object (event_box, "drag_data_get",
				 G_CALLBACK (drag_data_get_callback), bar, 0);

	/* Drag dest. */
	gtk_drag_dest_set (GTK_WIDGET (bar),
			   GTK_DEST_DEFAULT_ALL,
			   drop_types, G_N_ELEMENTS (drop_types),
			   GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK);
	g_signal_connect (bar, "drag_data_received",
			  G_CALLBACK (drag_data_received_callback), NULL);

	bar->details->entry = NEMO_ENTRY (entry);

	gtk_widget_show_all (GTK_WIDGET (bar));
}
Beispiel #23
0
static void
gstyle_slidein_init (GstyleSlidein *self)
{
  GtkStyleContext *context;

  g_signal_connect_swapped (self,
                            "key-press-event",
                            G_CALLBACK (gstyle_slidein_event_box_key_pressed_cb),
                            self);

  gtk_widget_set_has_window (GTK_WIDGET (self), FALSE);
  gtk_event_box_set_visible_window (GTK_EVENT_BOX (self), FALSE);
  gtk_event_box_set_above_child (GTK_EVENT_BOX (self), FALSE);

  context = gtk_widget_get_style_context (GTK_WIDGET (self));
  self->default_provider = gstyle_css_provider_init_default (gtk_style_context_get_screen (context));

  self->direction_type = GSTYLE_SLIDEIN_DIRECTION_TYPE_RIGHT;
  self->direction_type_reverse = GSTYLE_SLIDEIN_DIRECTION_TYPE_LEFT;
  self->duration = 0.0;
  self->duration_set = TRUE;
}
Beispiel #24
0
static void wibuti_widget_init(WibutiWidget *self) {
    self->box = GTK_BOX(gtk_hbox_new(FALSE, 0));

#ifdef WIBUTI_WITH_BUTTONS
    self->evbox = g_new(GtkEventBox *, WIBUTI_BUTTON_NUM);
    self->image = g_new(GtkImage *, WIBUTI_BUTTON_NUM);

    int i;
    for (i = WIBUTI_BUTTON_FIRST; i < WIBUTI_BUTTON_NUM; ++i) {
        self->evbox[i] = GTK_EVENT_BOX(gtk_event_box_new());
        self->image[i] = GTK_IMAGE(gtk_image_new());

        gtk_container_add(GTK_CONTAINER(self->evbox[i]), GTK_WIDGET(self->image[i]));

        g_signal_connect(G_OBJECT(self->evbox[i]), "button-release-event", G_CALLBACK(wibuti_widget_release_cb), self);
        g_signal_connect(G_OBJECT(self->evbox[i]), "button-press-event", G_CALLBACK(wibuti_widget_press_cb), self);
        g_signal_connect(G_OBJECT(self->evbox[i]), "enter-notify-event", G_CALLBACK(wibuti_widget_enter_cb), self);
        g_signal_connect(G_OBJECT(self->evbox[i]), "leave-notify-event", G_CALLBACK(wibuti_widget_leave_cb), self);
    }

    self->use_close = self->use_maximize = self->use_minimize = FALSE;
    self->buttons = NULL;
#endif // WIBUTI_WITH_BUTTONS

#ifdef WIBUTI_WITH_TITLE
    self->evbox_icon = GTK_EVENT_BOX(gtk_event_box_new());
    self->evbox_title = GTK_EVENT_BOX(gtk_event_box_new());
    self->image_icon = GTK_IMAGE(gtk_image_new());
    self->label_title = GTK_LABEL(gtk_label_new(NULL));

    gtk_container_add(GTK_CONTAINER(self->evbox_icon), GTK_WIDGET(self->image_icon));
    gtk_container_add(GTK_CONTAINER(self->evbox_title), GTK_WIDGET(self->label_title));

    self->use_title = self->use_icon = FALSE;
#endif // WIBUTI_WITH_TITLE

    gtk_container_add(GTK_CONTAINER(self), GTK_WIDGET(self->box));
    wibuti_widget_repack_with_string(self, ""); // TODO: is it needed?
}
Beispiel #25
0
static GtkWidget *
_gtk_text_handle_ensure_widget (GtkTextHandle         *handle,
                                GtkTextHandlePosition  pos)
{
  GtkTextHandlePrivate *priv;

  priv = handle->priv;

  if (!priv->windows[pos].widget)
    {
      GtkWidget *widget, *window;
      GtkStyleContext *context;

      widget = gtk_event_box_new ();
      gtk_event_box_set_visible_window (GTK_EVENT_BOX (widget), TRUE);
      gtk_widget_set_events (widget,
                             GDK_BUTTON_PRESS_MASK |
                             GDK_BUTTON_RELEASE_MASK |
                             GDK_ENTER_NOTIFY_MASK |
                             GDK_LEAVE_NOTIFY_MASK |
                             GDK_POINTER_MOTION_MASK);

      gtk_widget_set_direction (widget, priv->windows[pos].dir);

      g_signal_connect (widget, "draw",
                        G_CALLBACK (gtk_text_handle_widget_draw), handle);
      g_signal_connect (widget, "event",
                        G_CALLBACK (gtk_text_handle_widget_event), handle);
      g_signal_connect (widget, "style-updated",
                        G_CALLBACK (gtk_text_handle_widget_style_updated),
                        handle);

      priv->windows[pos].widget = g_object_ref_sink (widget);
      window = gtk_widget_get_ancestor (priv->parent, GTK_TYPE_WINDOW);
      _gtk_window_add_popover (GTK_WINDOW (window), widget, priv->parent, FALSE);

      context = gtk_widget_get_style_context (widget);
      gtk_style_context_set_parent (context, gtk_widget_get_style_context (priv->parent));
      gtk_css_node_set_name (gtk_widget_get_css_node (widget), I_("cursor-handle"));
      if (pos == GTK_TEXT_HANDLE_POSITION_SELECTION_END)
        {
          gtk_style_context_add_class (context, GTK_STYLE_CLASS_BOTTOM);
          if (priv->mode == GTK_TEXT_HANDLE_MODE_CURSOR)
            gtk_style_context_add_class (context, GTK_STYLE_CLASS_INSERTION_CURSOR);
        }
      else
        gtk_style_context_add_class (context, GTK_STYLE_CLASS_TOP);
    }

  return priv->windows[pos].widget;
}
Beispiel #26
0
Splash *
oregano_splash_new ()
{
	GtkBuilder *gui;
	GError *perror = NULL;
	Splash *sp;
	GtkEventBox *event;
	gchar *msg;
	
	if ((gui = gtk_builder_new ()) == NULL) {
		oregano_error (_("Could not create splash message."));
		return NULL;
	} 
	else gtk_builder_set_translation_domain (gui, NULL);
	
	if (!g_file_test (OREGANO_UIDIR "/splash.ui", G_FILE_TEST_EXISTS) ||
	     !g_file_test (OREGANO_UIDIR "/splash.xpm", G_FILE_TEST_EXISTS)) {
		msg = g_strdup_printf (
			_("The files %s or %s could not be found. You might need to reinstall Oregano to fix this."),
			OREGANO_UIDIR "/splash.ui",  OREGANO_UIDIR "/splash.xpm");
		oregano_error_with_title (_("Could not create splash message."), msg);
		g_free (msg);
		return NULL;
	}
	
	if (gtk_builder_add_from_file (gui, OREGANO_UIDIR "/splash.ui", 
	    &perror) <= 0) {
		msg = perror->message;
		oregano_error_with_title (_("Could not create splash message."), msg);
		g_error_free (perror);
		return NULL;
	}

	sp = g_new0 (Splash, 1);
	sp->can_destroy = FALSE;

	sp->win = GTK_WINDOW (gtk_builder_get_object (gui, "splash"));
	sp->lbl = GTK_LABEL (gtk_builder_get_object (gui, "label"));
	sp->progress = GTK_WIDGET (gtk_builder_get_object (gui, "pbar"));

	event = GTK_EVENT_BOX (gtk_builder_get_object (gui, "event"));
	sp->event = GTK_WIDGET (event);

	gtk_progress_bar_set_pulse_step (GTK_PROGRESS_BAR (sp->progress), 0.07);
	gtk_widget_show_all (GTK_WIDGET (sp->win));

	while (gtk_events_pending ())
		gtk_main_iteration ();
	return sp;
}
Beispiel #27
0
static void
gimp_handle_bar_init (GimpHandleBar *bar)
{
  gtk_widget_add_events (GTK_WIDGET (bar),
                         GDK_BUTTON_PRESS_MASK   |
                         GDK_BUTTON_RELEASE_MASK |
                         GDK_BUTTON_MOTION_MASK);

  gtk_event_box_set_visible_window (GTK_EVENT_BOX (bar), FALSE);

  bar->orientation = GTK_ORIENTATION_HORIZONTAL;
  bar->lower       = 0.0;
  bar->upper       = 1.0;
}
Beispiel #28
0
void phoneBookEntry_init(PhoneBookEntry *pbe) {
    phoneBookEntryPrivate *priv = PHONE_BOOK_ENTRY_GET_PRIVATE(pbe);
    GtkWidget *event_box = gtk_event_box_new();
    gtk_event_box_set_visible_window(GTK_EVENT_BOX(event_box), TRUE);
    gtk_widget_add_events(event_box, GDK_FOCUS_CHANGE_MASK);
    g_signal_connect(G_OBJECT(event_box), "focus", G_CALLBACK(focus_me), NULL);
    GtkWidget *vbox = gtk_vbox_new(FALSE, 2);
    priv->name = gtk_label_new("");
    priv->number = gtk_label_new("");
    gtk_box_pack_start(GTK_BOX(vbox), priv->name, FALSE, FALSE, 0);
    gtk_box_pack_start(GTK_BOX(vbox), priv->number, FALSE, FALSE, 0);
    gtk_container_add(GTK_CONTAINER(event_box), vbox);
    gtk_container_add(GTK_CONTAINER(pbe), event_box);
}
Beispiel #29
0
static void create_char(int index)
{
  int i;

//  dbg("create_char %d\n", index);

  if (!hbox_edit) {
	dbg("create_char: !hbox_edit\n");
    return;
  }

  GdkColor fg;
  gdk_color_parse(gcin_win_color_fg, &fg);
  GdkColor color_bg;
  gdk_color_parse(tsin_phrase_line_color, &color_bg);


  i = index;
  {
    if (chars[i].vbox)
      return;

    GtkWidget *event_box = gtk_event_box_new();
    gtk_event_box_set_visible_window (GTK_EVENT_BOX(event_box), FALSE);
    chars[i].vbox = event_box;
    g_signal_connect (G_OBJECT (event_box), "button-press-event",  G_CALLBACK (mouse_char_callback), GINT_TO_POINTER(index));

    gtk_box_pack_start (GTK_BOX (hbox_edit), event_box, FALSE, FALSE, 0);
    GtkWidget *vbox = gtk_vbox_new (FALSE, 0);
    gtk_container_add(GTK_CONTAINER(event_box), vbox);

    GtkWidget *label = gtk_label_new(NULL);
    gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);

    set_label_font_size(label, gcin_font_size);
    chars[i].label = label;

    if (gcin_win_color_use) {
#if !GTK_CHECK_VERSION(2,91,6)
      gtk_widget_modify_fg(label, GTK_STATE_NORMAL, &fg);
#else
      GdkRGBA rgbfg;
      gdk_rgba_parse(&rgbfg, gdk_color_to_string(&fg));
      gtk_widget_override_color(label, GTK_STATE_FLAG_NORMAL, &rgbfg);
#endif
    }

    gtk_widget_show_all(event_box);
  }
}
static void create_icon (WindowckPlugin *wckp)
{
    wckp->icon = g_slice_new0 (WindowIcon);
    wckp->icon->eventbox = GTK_EVENT_BOX (gtk_event_box_new());
    wckp->icon->symbol = NULL;

    gtk_widget_set_can_focus (GTK_WIDGET(wckp->icon->eventbox), TRUE);

    gtk_event_box_set_visible_window (wckp->icon->eventbox, FALSE);

    gtk_box_pack_start (GTK_BOX (wckp->hvbox), GTK_WIDGET(wckp->icon->eventbox), FALSE, FALSE, 0);

    create_symbol (wckp);
}