24
24
#include "themewidget.h"
27
static void meta_area_class_init (MetaAreaClass *klass);
28
static void meta_area_init (MetaArea *area);
27
#include "gtk-compat.h"
29
29
static void meta_area_size_request (GtkWidget *widget,
30
30
GtkRequisition *req);
31
31
static gint meta_area_expose (GtkWidget *widget,
33
33
static void meta_area_finalize (GObject *object);
36
static GtkMiscClass *parent_class;
39
meta_area_get_type (void)
41
static GType area_type = 0;
45
static const GtkTypeInfo area_info =
49
sizeof (MetaAreaClass),
50
(GtkClassInitFunc) meta_area_class_init,
51
(GtkObjectInitFunc) meta_area_init,
52
/* reserved_1 */ NULL,
53
/* reserved_2 */ NULL,
54
(GtkClassInitFunc) NULL,
57
area_type = gtk_type_unique (GTK_TYPE_MISC, &area_info);
36
G_DEFINE_TYPE (MetaArea, meta_area, GTK_TYPE_MISC);
64
39
meta_area_class_init (MetaAreaClass *class)
111
85
GdkEventExpose *event)
88
GtkAllocation allocation;
90
GtkRequisition requisition;
91
gfloat xalign, yalign;
118
95
g_return_val_if_fail (META_IS_AREA (widget), FALSE);
119
96
g_return_val_if_fail (event != NULL, FALSE);
121
if (GTK_WIDGET_DRAWABLE (widget))
98
if (gtk_widget_is_drawable (widget))
123
100
area = META_AREA (widget);
124
101
misc = GTK_MISC (widget);
126
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
127
xalign = misc->xalign;
129
xalign = 1.0 - misc->xalign;
103
gtk_widget_get_allocation (widget, &allocation);
104
gtk_widget_get_requisition (widget, &requisition);
105
gtk_misc_get_alignment (misc, &xalign, &yalign);
106
gtk_misc_get_padding (misc, &xpad, &ypad);
108
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
109
xalign = 1.0 - xalign;
131
x = floor (widget->allocation.x + misc->xpad
132
+ ((widget->allocation.width - widget->requisition.width) * xalign)
111
x = floor (allocation.x + xpad
112
+ ((allocation.width - requisition.width) * xalign)
134
y = floor (widget->allocation.y + misc->ypad
135
+ ((widget->allocation.height - widget->requisition.height) * misc->yalign)
114
y = floor (allocation.y + ypad
115
+ ((allocation.height - requisition.height) * yalign)
138
118
if (area->expose_func)