Exemple #1
0
// helper to create a dropdown menu item
void wxToolBarTool::CreateDropDown()
{
    gtk_tool_item_set_homogeneous(m_item, false);
    GtkOrientation orient = GTK_ORIENTATION_HORIZONTAL;
    GtkArrowType arrowType = GTK_ARROW_DOWN;
    if (GetToolBar()->HasFlag(wxTB_LEFT | wxTB_RIGHT))
    {
        orient = GTK_ORIENTATION_VERTICAL;
        arrowType = GTK_ARROW_RIGHT;
    }
    GtkWidget* box = gtk_box_new(orient, 0);
    GtkWidget* arrow = gtk_arrow_new(arrowType, GTK_SHADOW_NONE);
    GtkWidget* tool_button = gtk_bin_get_child(GTK_BIN(m_item));
    g_object_ref(tool_button);
    gtk_container_remove(GTK_CONTAINER(m_item), tool_button);
    gtk_container_add(GTK_CONTAINER(box), tool_button);
    g_object_unref(tool_button);
    GtkWidget* arrow_button = gtk_toggle_button_new();
    gtk_button_set_relief(GTK_BUTTON(arrow_button),
        gtk_tool_item_get_relief_style(GTK_TOOL_ITEM(m_item)));
    gtk_container_add(GTK_CONTAINER(arrow_button), arrow);
    gtk_container_add(GTK_CONTAINER(box), arrow_button);
    gtk_widget_show_all(box);
    gtk_container_add(GTK_CONTAINER(m_item), box);

    g_signal_connect(arrow_button, "toggled", G_CALLBACK(arrow_toggled), this);
    g_signal_connect(arrow_button, "button_press_event",
        G_CALLBACK(arrow_button_press_event), this);
}
Exemple #2
0
// helper to create a dropdown menu item
void wxToolBarTool::CreateDropDown()
{
    gtk_tool_item_set_homogeneous(m_item, false);
    GtkWidget* box;
    GtkWidget* arrow;
    if (GetToolBar()->HasFlag(wxTB_LEFT | wxTB_RIGHT))
    {
        box = gtk_vbox_new(false, 0);
        arrow = gtk_arrow_new(GTK_ARROW_RIGHT, GTK_SHADOW_NONE);
    }
    else
    {
        box = gtk_hbox_new(false, 0);
        arrow = gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_NONE);
    }
    GtkWidget* tool_button = GTK_BIN(m_item)->child;
    gtk_widget_reparent(tool_button, box);
    GtkWidget* arrow_button = gtk_toggle_button_new();
    gtk_button_set_relief(GTK_BUTTON(arrow_button),
        gtk_tool_item_get_relief_style(GTK_TOOL_ITEM(m_item)));
    gtk_container_add(GTK_CONTAINER(arrow_button), arrow);
    gtk_container_add(GTK_CONTAINER(box), arrow_button);
    gtk_widget_show_all(box);
    gtk_container_add(GTK_CONTAINER(m_item), box);

    g_signal_connect(arrow_button, "toggled", G_CALLBACK(arrow_toggled), this);
    g_signal_connect(arrow_button, "button_press_event",
        G_CALLBACK(arrow_button_press_event), this);
}
Exemple #3
0
void ui_common_toolbar_append_separator(GtkWidget * toolbar) {
  GtkToolItem * toolbar_item;
  toolbar_item =  gtk_separator_tool_item_new();
  gtk_tool_item_set_homogeneous(toolbar_item, FALSE);
  gtk_toolbar_insert(GTK_TOOLBAR(toolbar), toolbar_item, -1);
  return;
}
Exemple #4
0
JNIEXPORT void JNICALL
Java_org_gnome_gtk_GtkToolItem_gtk_1tool_1item_1set_1homogeneous
(
    JNIEnv* env,
    jclass cls,
    jlong _self,
    jboolean _homogeneous
)
{
    GtkToolItem* self;
    gboolean homogeneous;

    // convert parameter self
    self = (GtkToolItem*) _self;

    // convert parameter homogeneous
    homogeneous = (gboolean) _homogeneous;

    // call function
    gtk_tool_item_set_homogeneous(self, homogeneous);

    // cleanup parameter self

    // cleanup parameter homogeneous
}
Exemple #5
0
static void
set_homogeneous (GtkWidget *widget, gpointer data)
{
    gboolean *is_hom_p = data;

    gtk_tool_item_set_homogeneous (GTK_TOOL_ITEM (widget), *is_hom_p);
}
Exemple #6
0
GtkWidget *
gtk_utils_append_toolbar_button (GtkToolbar *toolbar,
				 GtkUtilsToolbarEntry *entry,
				 GtkUtilsToolbarButtonFlags flags,
				 gpointer user_data)
{
#if GTK_2_4_OR_LATER

  GtkToolItem *button;

  g_return_val_if_fail (entry, NULL);

  button = gtk_tool_button_new ((gtk_image_new_from_stock
				 (entry->icon_stock_id,
				  gtk_toolbar_get_icon_size (toolbar))),
				(entry->label_text
				 ? _(entry->label_text) : NULL));

  if (entry->tooltip_text) {
    gtk_tool_item_set_tooltip (button, toolbar->tooltips,
			       _(entry->tooltip_text), NULL);
  }

  gtk_tool_item_set_homogeneous (button, ((flags & GTK_UTILS_HOMOGENEOUS)
					  ? TRUE : FALSE));
  gtk_tool_item_set_is_important (button, ((flags & GTK_UTILS_IS_IMPORTANT)
					   ? TRUE : FALSE));

  g_signal_connect (button, "clicked",
		    G_CALLBACK (invoke_toolbar_button_callback), user_data);

  gtk_toolbar_insert (toolbar, button, -1);

#else

  GtkWidget *button;

  g_return_val_if_fail (entry, NULL);

  UNUSED (flags);

  button = (gtk_toolbar_append_item
	    (toolbar, (entry->label_text ? _(entry->label_text) : NULL),
	     _(entry->tooltip_text), NULL,
	     gtk_image_new_from_stock (entry->icon_stock_id,
				       gtk_toolbar_get_icon_size (toolbar)),
	     (GtkSignalFunc) invoke_toolbar_button_callback, user_data));

#endif

  if (!toolbar_button_entry_quark) {
    toolbar_button_entry_quark
      = g_quark_from_static_string ("quarry-toolbar-button-entry");
  }

  g_object_set_qdata (G_OBJECT (button), toolbar_button_entry_quark, entry);

  /* For GTK+ 2.4 and up.  It is certainly a widget. */
  return (GtkWidget *) button;
}
GtkToolItem* AbstractToolItem::createTmpItem(bool horizontal)
{
	GtkToolItem* item = newItem();

	if (GTK_IS_TOOL_ITEM(item))
	{
		gtk_tool_item_set_homogeneous(GTK_TOOL_ITEM(item), false);
	}

	gtk_widget_show_all(GTK_WIDGET(item));
	return item;
}
Exemple #8
0
void ui_common_toolbar_insert_widget(GtkWidget * toolbar, GtkWidget * widget, const gchar * tooltip, gint position) {

  GtkToolItem * toolbar_item;

  toolbar_item = gtk_tool_item_new();
  gtk_container_add(GTK_CONTAINER(toolbar_item), widget);
  if (tooltip != NULL)
    gtk_tool_item_set_tooltip_text(toolbar_item,tooltip);
  gtk_tool_item_set_homogeneous(toolbar_item, FALSE);
  gtk_toolbar_insert(GTK_TOOLBAR(toolbar), toolbar_item, position);

  return;
}
Exemple #9
0
GtkToolItem * FontButton::createTmpItem(bool horizontal) {
	GtkWidget * fontButton = newFontButton();

	GtkToolItem * it = gtk_tool_item_new();

	gtk_container_add(GTK_CONTAINER(it), fontButton);
	gtk_tool_item_set_tooltip_text(it, this->description.c_str());
	gtk_tool_item_set_homogeneous(GTK_TOOL_ITEM(it), false);

	if (!this->font.getName().isEmpty()) {
		setFontFontButton(fontButton, this->font);
	}

	gtk_widget_show_all(GTK_WIDGET(it));
	return it;
}
Exemple #10
0
static void
homogeneous_toggled(GtkCellRendererToggle *cell, const gchar *path_str,
		    GtkTreeModel *model)
{
  GtkTreePath *path;
  GtkTreeIter iter;
  GtkToolItem *tool_item;

  path = gtk_tree_path_new_from_string (path_str);
  gtk_tree_model_get_iter (model, &iter, path);

  gtk_tree_model_get (model, &iter, 0, &tool_item, -1);
  gtk_tool_item_set_homogeneous (tool_item, !gtk_tool_item_get_homogeneous (tool_item));
  g_object_unref (tool_item);

  gtk_tree_model_row_changed (model, path, &iter);
  gtk_tree_path_free (path);
}
Exemple #11
0
GtkToolItem * FontButton::newItem() {
	XOJ_CHECK_TYPE(FontButton);

	if (this->fontButton) {
		g_object_unref(this->fontButton);
	}
	GtkToolItem * it = gtk_tool_item_new();

	this->fontButton = newFontButton();
	gtk_container_add(GTK_CONTAINER(it), this->fontButton);
	gtk_tool_item_set_tooltip_text(it, this->description.c_str());
	gtk_tool_item_set_homogeneous(GTK_TOOL_ITEM(it), false);

	if (!this->font.getName().isEmpty()) {
		setFont(this->font);
	}

	return it;
}
Exemple #12
0
static void
gimp_throbber_init (GimpThrobber *button)
{
  GtkToolItem *toolitem = GTK_TOOL_ITEM (button);

  button->priv = GIMP_THROBBER_GET_PRIVATE (button);

  gtk_tool_item_set_homogeneous (toolitem, TRUE);

  button->priv->button = g_object_new (GTK_TYPE_BUTTON,
                                       "yalign",         0.0,
                                       "focus-on-click", FALSE,
                                       NULL);

  g_signal_connect_object (button->priv->button, "clicked",
                           G_CALLBACK (gimp_throbber_button_clicked),
                           button, 0);

  gtk_container_add (GTK_CONTAINER (button), button->priv->button);
  gtk_widget_show (button->priv->button);
}
Exemple #13
0
static void
gtk_tool_button_init (GtkToolButton      *button,
		      GtkToolButtonClass *klass)
{
  GtkToolItem *toolitem = GTK_TOOL_ITEM (button);
  
  button->priv = GTK_TOOL_BUTTON_GET_PRIVATE (button);

  button->priv->contents_invalid = TRUE;

  gtk_tool_item_set_homogeneous (toolitem, TRUE);

  /* create button */
  button->priv->button = g_object_new (klass->button_type, NULL);
  gtk_button_set_focus_on_click (GTK_BUTTON (button->priv->button), FALSE);
  g_signal_connect_object (button->priv->button, "clicked",
			   G_CALLBACK (button_clicked), button, 0);

  gtk_container_add (GTK_CONTAINER (button), button->priv->button);
  gtk_widget_show (button->priv->button);
}
static VALUE
rg_set_homogeneous(VALUE self, VALUE homogeneous)
{
    gtk_tool_item_set_homogeneous(_SELF(self), RVAL2CBOOL(homogeneous));
    return self;
}