libeek: draw rotated section with GTK UI

This commit is contained in:
Daiki Ueno
2010-06-22 10:10:24 +09:00
parent bc38ac837b
commit b3903bcc7f

View File

@ -23,6 +23,7 @@
* @short_description: #EekKeyboard that can be converted into a #GtkWidget * @short_description: #EekKeyboard that can be converted into a #GtkWidget
*/ */
#include <string.h> #include <string.h>
#include <math.h>
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
@ -222,12 +223,15 @@ prepare_keyboard_pixmap_section_callback (EekElement *element,
{ {
DrawingContext *context = user_data; DrawingContext *context = user_data;
EekBounds bounds; EekBounds bounds;
gint angle;
eek_element_get_bounds (element, &bounds); eek_element_get_bounds (element, &bounds);
angle = eek_section_get_angle (EEK_SECTION(element));
cairo_save (context->cr); cairo_save (context->cr);
cairo_translate (context->cr, cairo_translate (context->cr,
bounds.x, bounds.x,
bounds.y); bounds.y);
cairo_rotate (context->cr, angle * M_PI / 180);
eek_container_foreach_child (EEK_CONTAINER(element), eek_container_foreach_child (EEK_CONTAINER(element),
prepare_keyboard_pixmap_key_callback, prepare_keyboard_pixmap_key_callback,
context); context);