2
* Inkscape::Widgets::shrink_wrap_button - shrink a button to minimum size
5
* MenTaLguY <mental@rydia.net>
7
* Copyright (C) 2004 MenTaLguY
9
* Released under GNU GPL, read the file 'COPYING' for more information
12
#include <gtkmm/button.h>
13
#include <gtk/gtkbin.h>
20
void minimum_size(GtkWidget *widget, GtkRequisition *requisition, void *) {
21
GtkWidget *child(gtk_bin_get_child(GTK_BIN(widget)));
24
gtk_widget_size_request(child, requisition);
26
requisition->width = 0;
27
requisition->height = 0;
30
requisition->width += 2 + 2 * std::max(2, widget->style->xthickness);
31
requisition->height += 2 + 2 * std::max(2, widget->style->ythickness);
36
void shrink_wrap_button(Gtk::Button &button) {
37
button.set_border_width(0);
38
button.unset_flags(Gtk::CAN_FOCUS | Gtk::CAN_DEFAULT);
39
g_signal_connect_after(G_OBJECT(button.gobj()), "size_request",
40
G_CALLBACK(minimum_size), NULL);
49
c-file-style:"stroustrup"
50
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
55
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :