* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
*/
#include "gtksignal.h"
#include "gtkeventbox.h"
static void gtk_event_box_init (GtkEventBox *event_box);
static void gtk_event_box_realize (GtkWidget *widget);
static void gtk_event_box_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
+ GtkRequisition *requisition);
static void gtk_event_box_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static void gtk_event_box_draw (GtkWidget *widget,
- GdkRectangle *area);
-static gint gtk_event_box_expose (GtkWidget *widget,
- GdkEventExpose *event);
+ GtkAllocation *allocation);
+static void gtk_event_box_paint (GtkWidget *widget,
+ GdkRectangle *area);
+static void gtk_event_box_draw (GtkWidget *widget,
+ GdkRectangle *area);
+static gint gtk_event_box_expose (GtkWidget *widget,
+ GdkEventExpose *event);
-guint
-gtk_event_box_get_type ()
+GtkType
+gtk_event_box_get_type (void)
{
- static guint event_box_type = 0;
+ static GtkType event_box_type = 0;
if (!event_box_type)
{
- GtkTypeInfo event_box_info =
+ static const GtkTypeInfo event_box_info =
{
"GtkEventBox",
sizeof (GtkEventBox),
sizeof (GtkEventBoxClass),
(GtkClassInitFunc) gtk_event_box_class_init,
(GtkObjectInitFunc) gtk_event_box_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
+ /* reserved_1 */ NULL,
+ /* reserved_2 */ NULL,
+ (GtkClassInitFunc) NULL,
};
event_box_type = gtk_type_unique (gtk_bin_get_type (), &event_box_info);
gtk_event_box_init (GtkEventBox *event_box)
{
GTK_WIDGET_UNSET_FLAGS (event_box, GTK_NO_WINDOW);
- GTK_WIDGET_SET_FLAGS (event_box, GTK_BASIC);
}
GtkWidget*
-gtk_event_box_new ()
+gtk_event_box_new (void)
{
return GTK_WIDGET ( gtk_type_new (gtk_event_box_get_type ()));
}
child_allocation.x = 0;
child_allocation.y = 0;
- child_allocation.width = allocation->width - GTK_CONTAINER (widget)->border_width * 2;
- child_allocation.height = allocation->height - GTK_CONTAINER (widget)->border_width * 2;
+ child_allocation.width = MAX (allocation->width - GTK_CONTAINER (widget)->border_width * 2, 0);
+ child_allocation.height = MAX (allocation->height - GTK_CONTAINER (widget)->border_width * 2, 0);
if (GTK_WIDGET_REALIZED (widget))
{
child_allocation.height);
}
- if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
+ if (bin->child)
{
gtk_widget_size_allocate (bin->child, &child_allocation);
}
}
+static void
+gtk_event_box_paint (GtkWidget *widget,
+ GdkRectangle *area)
+{
+ gtk_paint_flat_box (widget->style, widget->window,
+ widget->state, GTK_SHADOW_NONE,
+ area, widget, "eventbox",
+ 0, 0, -1, -1);
+}
+
static void
gtk_event_box_draw (GtkWidget *widget,
- GdkRectangle *area)
+ GdkRectangle *area)
{
GtkBin *bin;
GdkRectangle tmp_area;
tmp_area = *area;
tmp_area.x -= GTK_CONTAINER (widget)->border_width;
tmp_area.y -= GTK_CONTAINER (widget)->border_width;
+
+ gtk_event_box_paint (widget, &tmp_area);
if (bin->child)
{
{
bin = GTK_BIN (widget);
+ gtk_event_box_paint (widget, &event->area);
+
child_event = *event;
if (bin->child &&
GTK_WIDGET_NO_WINDOW (bin->child) &&